我的礼包界面功能完善

master
zyx 5 years ago
parent 0d090ded9b
commit 2b012aad08

@ -1694,6 +1694,8 @@ class UserController extends BaseController
$page = intval($p);
$page = $page ? $page : 1; //默认显示第一页数据
$data = D("Giftbag")->getMyGiftRecord($this->suser->login_info('account'), $page);
// echo D("Giftbag")->_sql();
// dump($data);die();
foreach ($data as $key => $value) {
$data[$key]['end_time'] = empty($value['end_time']) ? "永久" : date('Y-m-d H:i:s', $value['end_time']);
}

@ -199,8 +199,9 @@ class GiftbagModel extends Model{
//$map['status'] = 0;
$data = $this
->table("tab_gift_record as r")
->field("r.gift_id,r.novice,r.gift_name,r.game_name,g.icon,r.start_time,r.end_time")
->field("r.gift_id,r.novice,r.gift_name,r.game_name,g.icon,r.start_time,r.end_time,b.desribe")
->join("left join tab_game g on g.id = r.game_id and g.game_status = 1 ")
->join("left join tab_giftbag b on b.id = r.gift_id ")
->where($map)
->page($page,$row)
->select();

@ -3,6 +3,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link href="__CSS__/user.css" rel="stylesheet" >
<script src="__JS__/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="__JS__/getRem.js"></script>
<link rel="stylesheet" type="text/css" href="__CSS__/reset.css">
@ -14,7 +15,7 @@
<div class="myBag">
<!-- 子页公共头部 -->
<div class="subpage-heard" style="width: 100%;position: fixed;top:0;margin-bottom: 1rem;z-index: 999">我的礼包
<a href="#" class="arrows"></a>
<a href="{:U('User/index')}" class="arrows"></a>
</div>
<div style="height: 1.4rem"></div>
<!-- 没有内容时显示 -->
@ -25,30 +26,120 @@
<span>您还没有相关内容哦</span>
</div>
<else/>
<volist name="data" id="data">
<div id="ajaxContainer" currentpage="{$page}">
<volist name="data" id="data">
<div class="myBag-box">
<div class="myBag-info">
<div class="infoBox">
<div class="title">特权礼包</div>
<div class="gift-bag">
<img src="__IMG__/libao.png" alt="">
<span>《天宫计》至尊礼包</span>
<span>{$data.gift_name}</span>
</div>
<div class="describe">[高级宝图*2、财神银匙*1]</div>
<div class="describe">[{$data.desribe}]</div>
<div class="redeem">
<div>兑换码:<span>GNHNW6WJS</span></div>
<a>复制兑换码</a>
<div >兑换码:<span >{$data.novice}</span></div>
<a class="jsgetgiftcopy" data-clipboard-text="{$data.novice}">复制兑换码</a>
</div>
</div>
</div>
</div>
</volist>
</div>
</empty>
</div>
<div class="loading ms-none hidden" id="moreBtn"><a href="javascript:" class="link"></a></div>
<div class="pop pop-dialog"></div>
<style>
.pop-dialog span {
padding: .1rem 1rem;
}
</style>
<div class="popmsg pop-dialog" style="font-size: 15px!important;"></div>
<div class="space"></div>
<script src="__JS__/ajaxload.js"></script>
<script src="__JS__/pop.lwx.min.js"></script>
<script src="__JS__/clipboard.min.js"></script>
<script src="__JS__/slider.lwx.min.js"></script>
<script>
$(function() {
var pmsg = $('.popmsg').pop();
var clipboard = new Clipboard('.jsgetgiftcopy');
clipboard.on('success', function(e) {
pmsg.msg('复制成功');
e.clearSelection();
});
clipboard.on('error', function(e) {
pmsg.msg('此浏览器不支持此操作,请长按礼包码复制');
});
$('.jscopy').click(function(event) {
var elem = $(this).siblings('input');
if (window.clipboarData) {
window.clipboarData.clearData();
window.clipboarData.setData('text',elem.val());
alert('已经成功复制');
} else {
elem.select();
alert('请长按礼包号码上选择');
}
return false;
});
slider.init('.jsbutton');
var pop = $('.pop').pop();
$('.jsdel').click(function() {
pop.msg('dddd');
});
var popmsg = $('.loading').pop();
<?php if(!$data){?>
pmsg.msg('暂无数据');
<?php }?>
var ac = $('#ajaxContainer');
ajaxload('{:U("ajaxUserGift")}',{},function(data) {
if (data.status == 1) {
ac.attr('currentpage',data.page);
var html = '',d = data.lists;
for (var i in d) {
var item = d[i];
html += '<div class="myBag-box">'+
'<div class="myBag-info">'+
'<div class="infoBox"> ' +
'<div class="title">特权礼包</div>' +
'<div class="gift-bag">' +
'<img src="__IMG__/libao.png" alt="">' +
'<span>{$data.gift_name}</span></div>' +
'<div class="describe">[' + item.desribe+ ']</div>'+
'<div class="redeem">'+
'<div >兑换码:<span >'+item.novice+'</span></div>' +
'<a class="jsgetgiftcopy" data-clipboard-text="'+item.novice+'">复制兑换码</a>'+
'</div> </div> </div> </div>';
}
ac.append(html);
$('.loading').addClass('ms-none');
$('#moreBtn').removeClass('ms-none');loads = false;
} else {
$('.loading').removeClass('hidden').addClass('ms-none');
pmsg.msg('已经到底了~');
}
})
});
</script>
</body>
<script type="text/javascript" src="http://www.jq22.com/demo/clipboard.js-master201703170013/dist/clipboard.min.js"></script>
<script type="text/javascript" src="__JS__/myBag.js"></script>

Loading…
Cancel
Save