'+v.gamename+'('+v.gift_name+')
\n' + '礼包码:\n' + '
使用方法:'+v.func+'
\n' + 'require(['config'], function () { require(['jquery', 'utils', 'pagination', 'clipboard'], function ($, utils, pagination, Clipboard) { $(function () { var phoneReg = /^[1][345789][0-9]{9}$/; var code_time = 60; function bindmobileEvent() { $('#BindDialog .js-getcode').on('click', function () { var phone = $('#BindDialog .js-newphone').val(); var that = this; console.log(phone); if (! phone || ! phoneReg.test(phone)) { layer.msg('请检查手机号格式是否正确!'); return; } $.ajax({ url: $('#sendCodeUrl').val(), data: { mobile: phone, smstype : 4 }, type: 'post', success: function (res) { if (res.error == 0) { layer.msg(res.msg, {icon: 6, time: 1000}); $(that).attr('disabled',true) var code_Interval = setInterval(function () { if (code_time <= 0) { $(that).attr('disabled',false) $(that).html('获取') code_time = 60; clearInterval(code_Interval) return; } code_time--; $(that).html(code_time) },1000) } else { layer.msg(res.msg, {icon: 5, time: 1000}); } } }) }) $('#BindDialog .close').on('click', function () { $('#BindDialog').fadeOut(250) utils.unlockY() }) $('#BindDialog .js-save').on('click', function () { var dt = { mobile: $('#BindDialog .js-newphone').val(), code: $('#BindDialog .js-code').val() } if (!dt.mobile && !dt.code) { layer.msg('手机/验证码为必填项') return false; } $.ajax({ url: $('#editmobileUrl').val(), data: dt, type: 'post', success: function (res) { if (res.error == 0){ $('#BindDialog').fadeOut(250); $('#BindSuccessDialog').fadeIn(250); setTimeout(function () { window.location.reload() },250); } else { layer.msg(res.msg) } } }) }) } function resetmobileEvent() { $('#resetBindDialog .js-getcode').on('click', function () { // var phone = $('#resetBindDialog .js-oldphone').text(); var phone = $('#resetBindDialog .js-oldphone').text(); var that = this; $.ajax({ url: $('#sendCodeUrl').val(), data: { mobile: phone, smstype : 4 }, type: 'post', success: function (res) { if (res.error == 0) { layer.msg(res.msg, {icon: 6, time: 1000}); $(that).attr('disabled',true) var code_Interval = setInterval(function () { if (code_time <= 0) { $(that).attr('disabled',false) $(that).html('获取') code_time = 60; clearInterval(code_Interval) return; } code_time--; $(that).html(code_time) },1000) } else { layer.msg(res.msg, {icon: 5, time: 1000}); } } }) }) $('#resetBindDialog .close').on('click', function () { $('#resetBindDialog').fadeOut(250) utils.unlockY() }) $('#resetBindDialog .js-save').on('click', function () { var dt = { mobile: $('#resetBindDialog .js-oldphone').text(), code: $('#resetBindDialog .js-code').val() } if (!dt.code) { layer.msg('验证码为必填项'); return false; } $.ajax({ url: $('#checkmobileUrl').val(), data: dt, type: 'post', success: function (res) { if (res.error == 0){ layer.msg(res.msg, {time: 700}); $('#resetBindDialog').hide(); $('#BindDialog').fadeIn(250); } else { layer.msg(res.msg); } } }) }) } bindmobileEvent(); resetmobileEvent(); $('#exChange').on('click', function () { $("#exchangeDialog").fadeIn(250) utils.lockY() }) $('#exchangeDialog .close').on('click', function () { $('#exchangeDialog').fadeOut(250) utils.unlockY() }) $('#PayDialog .close').on('click', function () { $('#PayDialog').fadeOut(250) utils.unlockY() }) $(".js-resetUserData").on('click', function () { $('.UserTop_Toggle > div').eq(1).addClass('active').siblings().removeClass('active') }) $(".js-resetUserPass").on('click', function () { $('.UserTop_Toggle > div').eq(2).addClass('active').siblings().removeClass('active') }) $('.UserTop_Toggle .back').on('click', function () { $('.UserTop_Toggle > div').eq(0).addClass('active').siblings().removeClass('active') }) $('.resetUserData .resetmobile').on('click',function () { $('#resetBindDialog').fadeIn(250) }) $('.resetUserData .bindmobile').on('click',function () { $('#BindDialog').fadeIn(250) }) $('.UserMneus_right .myNews li').on('click', function () { var index = $(this).index(); $('#newsDialog').fadeIn(250); $('#newsDialog .u-Dialog__news .mainText').html(msg_list.list[index].content) $('#newsDialog .u-Dialog__news .auth').html(msg_list.list[index].type_value) $('#newsDialog .u-Dialog__news .time').html(msg_list.list[index].create_time) $(this).find('.readStatus').text('已读'); $.ajax({ url: $('#readUrl').val(), type: 'get', data: {msg_id: msg_list.list[index].id}, success: function () {} }) utils.lockY() }) $('#newsDialog .close').on('click', function () { $('#newsDialog').fadeOut(250) utils.unlockY() }) var UserTabIndex = 0; // 0: 礼包 1:消息 2:游戏币充值记录 3:平台币充值记录 4: 消费记录 var gift_index = 1; var new_index = 1; var yxb_index = 1; var ptb_index = 1; var xf_index = 1; //导航切换 $('.UserMneus_left li').on('click',function(){ UserTabIndex = $(this).index(); $(this).addClass('active').siblings().removeClass('active'); $('.UserMneus_right > div').eq(UserTabIndex).show().siblings().hide(); var total = 0; var number = 1; if (UserTabIndex == 0) { total = gift_list.count; //礼包 number = gift_index; } else if (UserTabIndex == 1) { total = msg_list.count; //消息 number = new_index; } else if (UserTabIndex == 2) { total = gm_recharge_log.count; //游戏币充值记录 number = yxb_index; } else if (UserTabIndex == 3) { total = ptb_recharge_log.count; number = ptb_index; //平台币充值记录 } else if (UserTabIndex == 4) { total = consumption_log.count; //消费记录 number = xf_index; } // xf_index pagination({ elem : '#pagination', total : total, size : 4, number : number, callback: renderGamelist }); }); // 页码 renderPagination(); function renderGamelist(page) { page = page || 1; var ajaxData; if (UserTabIndex == 0) { gift_index = page; ajaxData = {'gift_page': gift_index}; } else if (UserTabIndex == 1) { new_index = page; ajaxData = {'msg_page': new_index}; } else if (UserTabIndex == 2) { yxb_index = page; ajaxData = {'gm_page': yxb_index}; }else if (UserTabIndex == 3) { ptb_index = page; ajaxData = {'ptb_page': ptb_index}; }else if (UserTabIndex == 4) { xf_index = page; ajaxData = {'consum_page': xf_index}; } $.ajax({ url:'', data: ajaxData, type: 'get', success: function (res) { var resData = ''; console.log(UserTabIndex); if (UserTabIndex == 0) { resData = res.gift_list.list; // 礼包 $('.js-gift_tpl').html(giftDatatoHtml(resData)) var clipboard = new Clipboard('.copyBtn'); clipboard.on('success', function(e) { layer.msg('复制成功!', {tiem: 700}) e.clearSelection(); }); clipboard.on('error', function(e) { layer.msg('请选择“拷贝”进行复制!', {tiem: 700}) }); } else if (UserTabIndex == 1) { resData = res.msg_list.list; // 消息 $('.js-news_tpl').html(newsDatatoHtml(resData)) $('.UserMneus_right .myNews li').on('click', function () { var index = $(this).index(); $.ajax({ url: $('#readUrl').val(), type: 'get', data: {msg_id: res.msg_list.list[index].id}, success: function () {} }) $(this).find('.readStatus').text('已读'); $('#newsDialog').fadeIn(250); $('#newsDialog .u-Dialog__news .mainText').html(res.msg_list.list[index].content) $('#newsDialog .u-Dialog__news .auth').html(res.msg_list.list[index].type_value) $('#newsDialog .u-Dialog__news .time').html(res.msg_list.list[index].create_time) utils.lockY() }) } else if (UserTabIndex == 2) { resData = res.gm_recharge_log.list; // 游戏币充值记录 $('.js-gm_tpl').html(yxbDatatoHtml(resData)) }else if (UserTabIndex == 3) { resData = res.ptb_recharge_log.list; // 平台币充值记录 $('.js-tpb_tpl').html(ptbDatatoHtml(resData)) }else if (UserTabIndex == 4) { resData = res.consumption_log.list; // 充值记录 $('.js-xf_tpl').html(xfDatatoHtml(resData)) } } }) } function giftDatatoHtml(data) { var h = ''; $.each(data, function (i, v) { var date = new Date(v.end_time * 1000) h += '
'+v.title+'
\n' + '