You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

155 lines
5.6 KiB
HTML

<extend name="Public/bases" />
<block name="css">
<link href="__CSS__/{:C('DEFAULT_THEME')}/gift.css" rel="stylesheet" >
</block>
<block name="body">
<div class="trunk-box">
<div class="wrap">
<div class="condition">
<ul class="table">
<li class="table-row">
<span class="table-cell condition-name">游戏类型:</span>
<span class="table-cell condition-value">
<a href="{:U('Gift/index',array('account'=>I('account'),'rs'=>I('rs')))}" class="condition-item <empty name='Think.get.gt'>active</empty>">不限</a>
<game:gametype name="vo" >
<a href="{:U('Gift/index',array('account'=>I('account'),'gt'=>$vo['id'],'rs'=>I('rs')))}" class="condition-item <eq name='Think.get.gt' value='$vo.id'>active</eq>">{$vo.type_name}</a>
</game:gametype>
</span>
</li>
<li class="table-row">
<span class="table-cell condition-name">推荐状态:</span>
<span class="table-cell condition-value">
<a href="{:U('Gift/index',array('account'=>I('account'),'gt'=>I('gt')))}" class="condition-item <empty name='Think.get.rs'>active</empty>">不限</a>
<a href="{:U('Gift/index',array('account'=>I('account'),'rs'=>1,'gt'=>I('gt')))}" class="condition-item <eq name='Think.get.rs' value='1'>active</eq>">推荐</a>
<a href="{:U('Gift/index',array('account'=>I('account'),'rs'=>2,'gt'=>I('gt')))}" class="condition-item <eq name='Think.get.rs' value='2'>active</eq>">热门</a>
<a href="{:U('Gift/index',array('account'=>I('account'),'rs'=>3,'gt'=>I('gt')))}" class="condition-item <eq name='Think.get.rs' value='3'>active</eq>">最新</a>
</span>
</li>
</ul>
</div>
<div class="list">
<notempty name="lists">
<ul class="clearfix">
<volist name="lists" id="vo" mod="4">
<li class="<eq name='mod' value='0'>first</eq>">
<div class="item clearfix">
<div class="pic">
<span class="font table"><span class="table-cell">----游戏</span></span>
<notempty name="vo.game_icon"><img src="{:get_cover($vo['game_icon'],'path')}" class="icon"></notempty>
</div>
<div class="txt">
<a href="{:U('Gift/detail',array('id'=>$vo['id'],'account'=>I('account')))}" class="name">[{:str_replace(array('(安卓版)','(苹果版)'),'',$vo['game_name'])}]{$vo.gift_name}</a>
<p class="info">
<eq name="vo.giftbag_version" value="1"><img src="__IMG__/icon_package_android.png" class="and"></eq>
<eq name="vo.giftbag_version" value="2"><img src="__IMG__/icon_package_ios.png" class="ios"></eq>
<span>{$vo.server_name|default='全区服'}</span>
<span class="surplus">剩余:<i><notempty name="vo.novice">{:count(explode(',',$vo['novice']))}<else />0</notempty></i></span></p>
<gt name='vo.recordid' value='0'>
<a href="javascript:;" class="butn jsgetgift disabled">已领取</a>
<else />
<a href="javascript:;" data-id="{$vo.id}" class="butn jsgetgift">领取</a>
</gt>
</div>
</div>
</li>
</volist>
</ul>
<else />
<div class="empty">
<span class="table">
<span class="table-cell">
<img src="__IMG__/empty_icon_list.png" class="empty-icon">
<p class="empty-text">找不到相关礼包</p>
</span>
</span>
</div>
</notempty>
</div>
<div class="pagenation">{$_page}</div>
</div>
</div>
</block>
<block name="script">
<script src="__STATIC__/layer/layer.js"></script>
<script>
function Copy(str,that,index){
var save = function(e){
e.clipboardData.setData('text/plain', str);
e.preventDefault();
}
document.addEventListener('copy', save);
document.execCommand('copy');
document.removeEventListener('copy',save);
that.text('复制成功');
setTimeout(function(){layer.close(index);layer.msg('复制成功');},1500);
}
$(function() {
var height = $('.pagenation').height() || 126;
$('.list').css({'height':($(window).height()-345-height)+'px'});
$('.jsgetgift').on('click',function() {
var that=$(this),id=$.trim(that.attr('data-id')),text = $.trim(that.text());
if (id>0) {
if (that.hasClass('disabled')) {return false;}
that.addClass('disabled').text('领取中');
$.ajax({
type:'post',
dataType:'json',
url:'{:U("Gift/getgift")}',
data:{id:id},
success:function(data) {
switch(parseInt(data.status)) {
case 1:
case 2:
case 3:{
that.text('已领取');
var title = parseInt(data.status)==2?'你已成功领取过':'领取成功!';
layer.open({
type: 1,
closeBtn: '1',
title: false,
skin: 'layer-lwx-style', //加上边框
area: ['262px', '133px'], //宽高
content: '<div class="layer-lwx-notice"><h4 class="layer-lwx-title">'+title+'</h4><p class="layer-lwx-novice"><span>激活码:</span><span class="novice-txt">'+data.info+'</span></p><div class="layer-lwx-butn"><a href="javascript:;" class="butn copy">复制激活码</a></div></div>',
success:function(layero, index){
$('.copy').click(function() {
// //移动端复制
$(".copy").text('复制');
Copy($('.novice-txt').text(),$(this),index);
return false;
});
}
});
};break;
case 4:{
that.text('已领完');
layer.msg(data.info);
};break;
default:{layer.msg(data.info);
that.removeClass('disabled').text(text);}
}
},error:function() {
layer.msg('服务器故障,请稍候再试...');
that.removeClass('disabled').text(text);
}
});
}
return false;
});
});
</script>
</block>