|
|
@@ -12,7 +12,7 @@
|
|
|
<script src="../static/js/vender/toastr/toastr.min.js"></script>
|
|
|
<script src="../static/js/vender/config.js"></script>
|
|
|
<style>
|
|
|
-
|
|
|
+
|
|
|
</style>
|
|
|
</head>
|
|
|
|
|
|
@@ -26,10 +26,10 @@
|
|
|
<div class="limit">PC端用户不参与本次活动</div>
|
|
|
</div>
|
|
|
<div class="middle-container">
|
|
|
- <img class="footer-cloud" src="../static/img/doubleChristmasActivity/footer-cloud.png" />
|
|
|
+ <img class="footer-cloud" src="../static/img/doubleChristmasActivity/footer-cloud.png" />
|
|
|
<div class="step-container">
|
|
|
- <img class="tips" src="../static/img/doubleChristmasActivity/tip.png" />
|
|
|
- <div class="main-step-content">
|
|
|
+ <img class="tips" src="../static/img/doubleChristmasActivity/tip.png" />
|
|
|
+ <div class="main-step-content">
|
|
|
<div class="top-step">
|
|
|
<div class="step-item">
|
|
|
<img class="buyphone" src="../static/img/doubleElevenActivity/buyphone.png" />
|
|
|
@@ -51,7 +51,7 @@
|
|
|
<img class="join-activity" src="../static/img/doubleElevenActivity/button-join-activity.png" />
|
|
|
<div class="activity-btn-content">
|
|
|
<span class="activity-btn-text">立即参与</span>
|
|
|
- <img class="icon-left" src="../static/img/doubleElevenActivity/icon-left.png" />
|
|
|
+ <img class="icon-left" src="../static/img/doubleElevenActivity/icon-left.png" />
|
|
|
</div>
|
|
|
</div>
|
|
|
<img class="middle-cloud" src="../static/img/doubleChristmasActivity/middle-cloud.png" />
|
|
|
@@ -76,8 +76,8 @@
|
|
|
<span class="reward-text">天</span>
|
|
|
</div>
|
|
|
<div class="reward-tip-row">
|
|
|
- <img class="reward-tip-img" src="../static/img/doubleChristmasActivity/reward-tip-img.png" />
|
|
|
- <div class="reward-tip">精彩不停的充值福利专场已经来临充值越多折扣越大</div>
|
|
|
+ <img class="reward-tip-img" src="../static/img/doubleChristmasActivity/reward-tip-img.png" />
|
|
|
+ <div class="reward-tip">精彩不停的充值福利专场已经来临充值越多折扣越大</div>
|
|
|
</div>
|
|
|
<div class="reward-list"></div>
|
|
|
</div>
|
|
|
@@ -100,7 +100,7 @@
|
|
|
<img class="right-ear" src="../static/img/doubleChristmasActivity/right-ear.png" />
|
|
|
<div class="slider" id="slider">
|
|
|
<div class="slider-list flex" id="slider-list"></div>
|
|
|
- </div>
|
|
|
+ </div>
|
|
|
<div class="page-row">
|
|
|
<div class="schedule-line">
|
|
|
<div class="schedule-child-line"></div>
|
|
|
@@ -108,14 +108,14 @@
|
|
|
<div class="page">1/4页</div>
|
|
|
</div>
|
|
|
<div class="distribution-reward-btn">
|
|
|
- <img class="reward-btn-img" src="../static/img/doubleChristmasActivity/distribution-reward-btn.png" />
|
|
|
+ <img class="reward-btn-img" src="../static/img/doubleChristmasActivity/distribution-reward-btn.png" />
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="distribution-container time-container">
|
|
|
<div class="time-title-row">
|
|
|
<img class="time-title-bg" src="../static/img/doubleChristmasActivity/time-title-bg.png" />
|
|
|
- <div class="time-title">分配时长记录(已分配时长999天)</div>
|
|
|
+ <div class="time-title">分配时长记录(已分配时长<span class="time-title-usedDuration"></span>天)</div>
|
|
|
</div>
|
|
|
<div class="time-list">
|
|
|
<div class="title-row">
|
|
|
@@ -127,7 +127,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="rule-container">
|
|
|
- <img class="rule-tips" src="../static/img/doubleChristmasActivity/rule.png" />
|
|
|
+ <img class="rule-tips" src="../static/img/doubleChristmasActivity/rule.png" />
|
|
|
<div class="rule-content">
|
|
|
<div class="rule-point">一、活动时间:2021年12月18日-2022年1月3日。</div>
|
|
|
<div class="rule-point">二、任务奖励与获取说明</div>
|
|
|
@@ -160,8 +160,9 @@
|
|
|
toastr.options.positionClass = 'toast-center-center';
|
|
|
toastr.options.timeOut = '1500';
|
|
|
</script>
|
|
|
+ <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
|
|
|
<script type="text/javascript">
|
|
|
- let timer,flag = true;
|
|
|
+ let timer, flag = true;
|
|
|
var url = window.location.href;
|
|
|
url = url.split('/');
|
|
|
var topVal = -0.5;
|
|
|
@@ -169,98 +170,112 @@
|
|
|
// 上线分享环境改为0,图片路径改为正式站路径
|
|
|
// var baseUrl = 'https://test.androidscloud.com'
|
|
|
var loc = window.location.search,
|
|
|
- n1 = loc.length,//地址的总长度
|
|
|
- n2 = loc.indexOf("="),//取得=号的位置
|
|
|
- id = loc.substr(n2 + 1, n1 - n2),//从=号后面的内容
|
|
|
+ n1 = loc.length,//地址的总长度
|
|
|
+ n2 = loc.indexOf("="),//取得=号的位置
|
|
|
+ id = loc.substr(n2 + 1, n1 - n2),//从=号后面的内容
|
|
|
u = navigator.userAgent,
|
|
|
ua = navigator.userAgent.toLowerCase(),
|
|
|
isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),
|
|
|
- isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
|
|
|
- let s = loc.substr(1,loc.length-1);//取得=号的位置
|
|
|
+ isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1, //android终端
|
|
|
+ isMiniprogram = false;
|
|
|
+ if (ua.match(/MicroMessenger/i) == "micromessenger") {
|
|
|
+ //ios的ua中无miniProgram,但都有MicroMessenger(表示是微信浏览器)
|
|
|
+ wx.miniProgram.getEnv((res) => {
|
|
|
+ if (res.miniprogram) {
|
|
|
+ isMiniprogram = true;
|
|
|
+ } else {
|
|
|
+ isMiniprogram = false;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ isMiniprogram = false;
|
|
|
+ }
|
|
|
+ let s = loc.substr(1, loc.length - 1);//取得=号的位置
|
|
|
let userName = '';
|
|
|
let totalTime = 0;
|
|
|
let christmasDoubleReward = 0;
|
|
|
let currTotalTime = 0;
|
|
|
let distributionList = [];
|
|
|
var pageNum = 0;
|
|
|
+ var distributionFlag = true;
|
|
|
+ var distributionPageNum = 0;
|
|
|
+ var distributionPages = 0;
|
|
|
var sliderNumber = 0;//滑块是数量,控制溢出不能滑动
|
|
|
- // let parms = s.split('&');
|
|
|
- // parms.map((item) =>{
|
|
|
- // let arr = item.split('=');
|
|
|
- // let key = arr[0];
|
|
|
- // obj[key] = arr[1];
|
|
|
- // })
|
|
|
getBaseData();
|
|
|
//点击立即参与按钮
|
|
|
- $('.join-activity-btn')[0].addEventListener('click',() => {
|
|
|
- operate('dt_双旦_h5_立即参与');
|
|
|
- if(isAndroid){ // 安卓
|
|
|
- window.native.startPurchase(1,365);
|
|
|
- }else if(isiOS){
|
|
|
- window.webkit.messageHandlers.startPurchase.postMessage({type:2,day:365});
|
|
|
- }else {
|
|
|
-
|
|
|
+ $('.join-activity-btn')[0].addEventListener('click', () => {
|
|
|
+ operate('dt_双旦_h5_立即参与');
|
|
|
+ if (isMiniprogram) { // 小程序
|
|
|
+ wx.miniProgram.navigateTo({
|
|
|
+ url: '/packageA/order/buy/index'
|
|
|
+ })
|
|
|
+ } else if (isAndroid) { // 安卓
|
|
|
+ window.native.startPurchase(1, 365);
|
|
|
+ } else if (isiOS) {
|
|
|
+ window.webkit.messageHandlers.startPurchase.postMessage({ type: 2, day: 365 });
|
|
|
}
|
|
|
})
|
|
|
//点击去完成
|
|
|
- $('.reward-list')[0].addEventListener('click',(e) => {
|
|
|
- if(e.target.className === 'reward-btn'){
|
|
|
+ $('.reward-list')[0].addEventListener('click', (e) => {
|
|
|
+ if (e.target.className === 'reward-btn') {
|
|
|
let receive = e.target.dataset.receive;
|
|
|
- if(receive !== 'null'){
|
|
|
+ if (receive !== 'null') {
|
|
|
return
|
|
|
}
|
|
|
- if(isAndroid){ // 安卓
|
|
|
- window.native.startPurchase(1,365);
|
|
|
- }else if(isiOS){
|
|
|
- window.webkit.messageHandlers.startPurchase.postMessage({type:2,day:365});
|
|
|
- }else{
|
|
|
-
|
|
|
+ if (isMiniprogram) { // 小程序
|
|
|
+ wx.miniProgram.navigateTo({
|
|
|
+ url: '/packageA/order/buy/index'
|
|
|
+ })
|
|
|
+ } else if (isAndroid) { // 安卓
|
|
|
+ window.native.startPurchase(1, 365);
|
|
|
+ } else if (isiOS) {
|
|
|
+ window.webkit.messageHandlers.startPurchase.postMessage({ type: 2, day: 365 });
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
//点击tab选项卡
|
|
|
- $('.tab-row')[0].addEventListener('click',(e) => {
|
|
|
+ $('.tab-row')[0].addEventListener('click', (e) => {
|
|
|
const index = e.target.dataset.index;
|
|
|
- if(!index){
|
|
|
+ if (!index) {
|
|
|
return
|
|
|
}
|
|
|
- if(index == 0){
|
|
|
+ if (index == 0) {
|
|
|
operate('dt_双旦_h5_tab_充值奖励');
|
|
|
- $('.tab-item')[1].className = 'tab-item';
|
|
|
+ $('.tab-item')[1].className = 'tab-item';
|
|
|
$('.tab-bg')[0].className = 'tab-bg tab-left';
|
|
|
- $('.reward-container').eq(0).css('display','block');
|
|
|
- $('.distribution-container').eq(0).css('display','none');
|
|
|
- $('.distribution-container').eq(1).css('display','none');
|
|
|
- }else{
|
|
|
+ $('.reward-container').eq(0).css('display', 'block');
|
|
|
+ $('.distribution-container').eq(0).css('display', 'none');
|
|
|
+ $('.distribution-container').eq(1).css('display', 'none');
|
|
|
+ } else {
|
|
|
operate('dt_双旦_h5_tab_分配奖励');
|
|
|
- getLists();
|
|
|
+ getLists();
|
|
|
distributionRecord();
|
|
|
- $('.tab-item')[0].className = 'tab-item';
|
|
|
+ $('.tab-item')[0].className = 'tab-item';
|
|
|
$('.tab-bg')[0].className = 'tab-bg tab-right';
|
|
|
- $('.reward-container').eq(0).css('display','none');
|
|
|
- $('.distribution-container').eq(0).css('display','block');
|
|
|
- $('.distribution-container').eq(1).css('display','block');
|
|
|
+ $('.reward-container').eq(0).css('display', 'none');
|
|
|
+ $('.distribution-container').eq(0).css('display', 'block');
|
|
|
+ $('.distribution-container').eq(1).css('display', 'block');
|
|
|
}
|
|
|
$('.tab-item')[index].className = 'tab-item tab-active';
|
|
|
})
|
|
|
//获取倒计时
|
|
|
- function getBaseData(){
|
|
|
+ function getBaseData() {
|
|
|
$.ajax({
|
|
|
url: baseUrl + '/api/user/v1/activity/getChristmasActivityConf',
|
|
|
type: 'get',
|
|
|
headers: {
|
|
|
'Authorization': id //id
|
|
|
},
|
|
|
- contentType:"application/json",
|
|
|
+ contentType: "application/json",
|
|
|
dataType: 'json',
|
|
|
cache: false,
|
|
|
success: function (res) {
|
|
|
- getList();
|
|
|
+ getList();
|
|
|
const objData = res.data;
|
|
|
userName = objData.userName;
|
|
|
christmasDoubleReward = objData.christmasDoubleReward;
|
|
|
$('.meal-price-num').eq(0).text(objData.price);
|
|
|
- let currTime = parseInt(Date.parse(objData.now)),
|
|
|
+ let currTime = parseInt(Date.parse(objData.now)),
|
|
|
closeTime = parseInt(Date.parse(objData.endTime)),
|
|
|
result = closeTime - currTime,
|
|
|
day = parseInt(result / 1000 / 60 / 60 / 24),
|
|
|
@@ -268,36 +283,36 @@
|
|
|
minute = parseInt(result / 1000 / 60 % 60),
|
|
|
seconds = parseInt(result / 1000 % 60),
|
|
|
time = day + "天" + hour + "时" + minute + "分" + seconds + "秒";
|
|
|
- const timeInterval = setInterval(() =>{
|
|
|
- if(seconds > 0){
|
|
|
- seconds--;
|
|
|
- } else if(minute > 0) {
|
|
|
- seconds = 59;
|
|
|
- minute--;
|
|
|
- } else if(hour > 0) {
|
|
|
- minute = 59;
|
|
|
- hour--;
|
|
|
- } else if(day > 0) {
|
|
|
- hour = 59;
|
|
|
- day--;
|
|
|
- } else {
|
|
|
- clearInterval(timeInterval);
|
|
|
- }
|
|
|
- time = day + "天" + hour + "时" + minute + "分" + seconds + "秒";
|
|
|
- let str =`距离活动结束:${time}`
|
|
|
- $('.rest-time').eq(0).text(str);
|
|
|
- },1000)
|
|
|
- let str =`距离活动结束:${time}`
|
|
|
- if(day == 0 && hour == 0 && minute == 0 && seconds == 0 || objData.activityEnd){
|
|
|
- str = '已结束'
|
|
|
- getList()
|
|
|
+ const timeInterval = setInterval(() => {
|
|
|
+ if (seconds > 0) {
|
|
|
+ seconds--;
|
|
|
+ } else if (minute > 0) {
|
|
|
+ seconds = 59;
|
|
|
+ minute--;
|
|
|
+ } else if (hour > 0) {
|
|
|
+ minute = 59;
|
|
|
+ hour--;
|
|
|
+ } else if (day > 0) {
|
|
|
+ hour = 59;
|
|
|
+ day--;
|
|
|
+ } else {
|
|
|
+ clearInterval(timeInterval);
|
|
|
}
|
|
|
+ time = day + "天" + hour + "时" + minute + "分" + seconds + "秒";
|
|
|
+ let str = `距离活动结束:${time}`
|
|
|
$('.rest-time').eq(0).text(str);
|
|
|
- },
|
|
|
+ }, 1000)
|
|
|
+ let str = `距离活动结束:${time}`
|
|
|
+ if (day == 0 && hour == 0 && minute == 0 && seconds == 0 || objData.activityEnd) {
|
|
|
+ str = '已结束'
|
|
|
+ getList()
|
|
|
+ }
|
|
|
+ $('.rest-time').eq(0).text(str);
|
|
|
+ },
|
|
|
})
|
|
|
}
|
|
|
//调用获取数据列表接口
|
|
|
- function getList(){
|
|
|
+ function getList() {
|
|
|
$.ajax({
|
|
|
url: baseUrl + '/api/user/v1/activity/getReceivingList',
|
|
|
type: 'get',
|
|
|
@@ -308,23 +323,23 @@
|
|
|
dataType: 'json',
|
|
|
cache: false,
|
|
|
success: function (res) {
|
|
|
- if(res.status === 0){
|
|
|
- if(res.data.open == 2){
|
|
|
- $('.activity-finish').eq(0).css('display','block');
|
|
|
+ if (res.status === 0) {
|
|
|
+ if (res.data.open == 2) {
|
|
|
+ $('.activity-finish').eq(0).css('display', 'block');
|
|
|
}
|
|
|
- if(res.data && res.data.operateActivityGoodsInfos.length > 0){
|
|
|
+ if (res.data && res.data.operateActivityGoodsInfos.length > 0) {
|
|
|
var str = '',
|
|
|
- flag = true,
|
|
|
- nextDuration = 0,
|
|
|
- usedDuration = res.data.usedDuration,
|
|
|
- rewardDuration = res.data.rewardDuration,
|
|
|
- totalDuration = res.data.totalDuration,
|
|
|
- len = res.data.operateActivityGoodsInfos.length;
|
|
|
+ flag = true,
|
|
|
+ nextDuration = 0,
|
|
|
+ usedDuration = res.data.usedDuration,
|
|
|
+ rewardDuration = res.data.rewardDuration,
|
|
|
+ totalDuration = res.data.totalDuration,
|
|
|
+ len = res.data.operateActivityGoodsInfos.length;
|
|
|
for (var i = 0; i < len; i++) {
|
|
|
let rewardDuration = res.data.operateActivityGoodsInfos[i].rewardDuration,
|
|
|
- receiveDuration = res.data.operateActivityGoodsInfos[i].receiveDuration,
|
|
|
- cumulativeDuration = res.data.operateActivityGoodsInfos[i].cumulativeDuration;
|
|
|
- str += `<div class="reward-row">
|
|
|
+ receiveDuration = res.data.operateActivityGoodsInfos[i].receiveDuration,
|
|
|
+ cumulativeDuration = res.data.operateActivityGoodsInfos[i].cumulativeDuration;
|
|
|
+ str += `<div class="reward-row">
|
|
|
<img class="reward-row-bg" src="../static/img/doubleChristmasActivity/reward-row-bg.png" />
|
|
|
<div class="reward-row-content">
|
|
|
<img class="reward-img" src="../static/img/doubleChristmasActivity/reward.png" />
|
|
|
@@ -335,7 +350,7 @@
|
|
|
<img class="reward-btn" data-receive=${receiveDuration} src="../static/img/doubleChristmasActivity/${receiveDuration ? 'get-btn' : 'finish-btn'}.png" />
|
|
|
</div>
|
|
|
</div>`
|
|
|
- if(totalDuration - cumulativeDuration < 0 && flag){
|
|
|
+ if (totalDuration - cumulativeDuration < 0 && flag) {
|
|
|
flag = false;
|
|
|
nextDuration = cumulativeDuration - totalDuration;
|
|
|
}
|
|
|
@@ -343,25 +358,26 @@
|
|
|
str += `<div class="reward-row">
|
|
|
<img class="reward-row-bg" src="../static/img/doubleChristmasActivity/reward-row-bg.png" />
|
|
|
<div class="reward-row-content">
|
|
|
- <img class="reward-img" src="../static/img/doubleChristmasActivity/reward.png" />
|
|
|
+ <img class="reward-img" src="../static/img/doubleChristmasActivity/three-reward.png" />
|
|
|
<div class="reward-day-text">
|
|
|
<div class="reward-day">星曜套餐买一送二</div>
|
|
|
<div class="total-day">购买套餐累计时长达高于${christmasDoubleReward}天</div>
|
|
|
</div>
|
|
|
- <img class="reward-btn" data-receive=33 src="../static/img/doubleChristmasActivity/finish-btn.png" />
|
|
|
+ <img class="reward-btn" data-receive='null' src="../static/img/doubleChristmasActivity/finish-btn.png" />
|
|
|
</div>
|
|
|
</div>`
|
|
|
- str +=`<div class="reward-last-tip">已获得奖励请在分配奖励栏中进行时长分配</div>`
|
|
|
+ str += `<div class="reward-last-tip">已获得奖励请在分配奖励栏中进行时长分配</div>`
|
|
|
$('.reward-list').eq(0).append(str);
|
|
|
- $('.time-number').eq(0).text(rewardDuration);
|
|
|
- $('.total-time-num').eq(0).text(totalDuration);
|
|
|
- $('.next-time-num').eq(0).text(nextDuration);
|
|
|
- $('.distribution-total-num').eq(0).text(rewardDuration);
|
|
|
+ $('.time-number').eq(0).text(rewardDuration);
|
|
|
+ $('.total-time-num').eq(0).text(totalDuration);
|
|
|
+ $('.next-time-num').eq(0).text(nextDuration);
|
|
|
+ $('.distribution-total-num').eq(0).text(rewardDuration);
|
|
|
const noDistributionDuration = rewardDuration - usedDuration;
|
|
|
+ $('.time-title-usedDuration').eq(0).text(usedDuration);
|
|
|
totalTime = noDistributionDuration;
|
|
|
- $('.no-distribution-num').eq(0).text(noDistributionDuration);
|
|
|
+ $('.no-distribution-num').eq(0).text(noDistributionDuration);
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
stopManyClick(() => {
|
|
|
toastr.error(res.msg);
|
|
|
})
|
|
|
@@ -370,12 +386,12 @@
|
|
|
})
|
|
|
}
|
|
|
// 获取分配列表数据
|
|
|
- function distributionRecord(){
|
|
|
+ function distributionRecord() {
|
|
|
$.ajax({
|
|
|
url: baseUrl + '/api/user/v1/activity/queryUserDistribution',
|
|
|
type: 'get',
|
|
|
data:{
|
|
|
- pageNum: pageNum + 1,
|
|
|
+ pageNum: distributionPageNum + 1,
|
|
|
pageSize: 10,
|
|
|
userName: userName
|
|
|
},
|
|
|
@@ -386,29 +402,29 @@
|
|
|
dataType: 'json',
|
|
|
cache: false,
|
|
|
success: function (res) {
|
|
|
- console.log(res)
|
|
|
if(res.status === 0){
|
|
|
+ distributionFlag = true;
|
|
|
let records = res.data.records;
|
|
|
+ let distributionPages = res.data.pages;
|
|
|
if(res.data && records.length > 0){
|
|
|
var str = '',
|
|
|
- len = records.length;
|
|
|
+ len = records.length;
|
|
|
for (var i = 0; i < len; i++) {
|
|
|
var diskName = records[i].diskName,
|
|
|
createTime = records[i].createTime,
|
|
|
- increaseDuration = records[i].increaseDuration,
|
|
|
- id = records[i].id;
|
|
|
+ increaseDuration = records[i].increaseDuration;
|
|
|
str += `<div class="time-content-row">
|
|
|
- <div>${diskName}</div>
|
|
|
- <div>${createTime.substring(0,4)}年${createTime.substring(5,7)}月${createTime.substring(8,10)}日 ${createTime.substring(11,19)}</div>
|
|
|
- <div>${increaseDuration}天</div>
|
|
|
+ <div class="time-content-diskName">${diskName}</div>
|
|
|
+ <div class="time-content-time">${createTime.substring(0,4)}年${createTime.substring(5,7)}月${createTime.substring(8,10)}日 ${createTime.substring(11,19)}</div>
|
|
|
+ <div class="time-content-day">${increaseDuration}天</div>
|
|
|
</div>`
|
|
|
}
|
|
|
$('.time-list').eq(0).append(str);
|
|
|
- if(len !== 0){
|
|
|
- $('.no-time-data').eq(0).css('display','none');
|
|
|
+ if (len !== 0) {
|
|
|
+ $('.no-time-data').eq(0).css('display', 'none');
|
|
|
}
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
stopManyClick(() => {
|
|
|
toastr.error(res.msg);
|
|
|
})
|
|
|
@@ -416,20 +432,31 @@
|
|
|
},
|
|
|
})
|
|
|
}
|
|
|
+ $('.time-container')[0].addEventListener('scroll',function () {
|
|
|
+ let scrollTop = $('.time-container')[0].scrollTop;
|
|
|
+ let clientHeight = $('.time-container')[0].clientHeight;
|
|
|
+ let scrollHeight = $('.time-container')[0].scrollHeight;
|
|
|
+ if(scrollTop + clientHeight + 100 > scrollHeight){
|
|
|
+ if(distributionFlag && distributionPageNum <= distributionPages + 1){
|
|
|
+ distributionFlag = false;
|
|
|
+ distributionPageNum++;
|
|
|
+ distributionRecord();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
// 活动获取用户云机列表,分页
|
|
|
function getLists(){
|
|
|
- console.log(id)
|
|
|
const sliderLen = Array.from($('.slider-item')).length;
|
|
|
- if(sliderLen > sliderNumber){
|
|
|
+ if (sliderLen > sliderNumber) {
|
|
|
return
|
|
|
}
|
|
|
$.ajax({
|
|
|
url: baseUrl + '/api/user/v1/activity/getUserCardPage',
|
|
|
type: 'get',
|
|
|
- data:{
|
|
|
+ data: {
|
|
|
pageNum: pageNum + 1,
|
|
|
pageSize: 4,
|
|
|
- phoneType : 'SVIP'
|
|
|
+ phoneType: 'SVIP'
|
|
|
},
|
|
|
headers: {
|
|
|
'Authorization': id //id
|
|
|
@@ -438,15 +465,15 @@
|
|
|
dataType: 'json',
|
|
|
cache: false,
|
|
|
success: function (res) {
|
|
|
- if(res.status === 0){
|
|
|
+ if (res.status === 0) {
|
|
|
let records = res.data.userCardPage.records;
|
|
|
- if(res.data && records.length > 0){
|
|
|
+ if (res.data && records.length > 0) {
|
|
|
sliderNumber = res.data.userCardPage.pages;
|
|
|
var str = '',
|
|
|
- len = records.length;
|
|
|
+ len = records.length;
|
|
|
for (var i = 0; i < len; i++) {
|
|
|
var diskName = records[i].diskName,
|
|
|
- exceptTime = records[i].exceptTime,
|
|
|
+ exceptTime = records[i].exceptTime,
|
|
|
now = res.data.now,
|
|
|
currTime = parseInt(Date.parse(now)),
|
|
|
closeTime = parseInt(Date.parse(exceptTime)),
|
|
|
@@ -454,8 +481,8 @@
|
|
|
day = parseInt(resultTime / 1000 / 60 / 60 / 24),
|
|
|
hour = parseInt(resultTime / 1000 / 60 / 60 % 24),
|
|
|
time = day + "天" + hour + "时";
|
|
|
- recordsId = records[i].id;
|
|
|
- str += `<div class="reward-row">
|
|
|
+ recordsId = records[i].id;
|
|
|
+ str += `<div class="reward-row">
|
|
|
<img class="reward-row-bg" src="../static/img/doubleChristmasActivity/reward-row-bg.png" />
|
|
|
<div class="reward-row-content">
|
|
|
<img class="icon_xingyao" src="../static/img/doubleChristmasActivity/home_list_icon_xingyao.png" />
|
|
|
@@ -467,30 +494,30 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="compute-block">
|
|
|
- <img class="compute-icon cut" src="../static/img/doubleChristmasActivity/cut.png" />
|
|
|
+ <img class="compute-icon cut" data-id=${recordsId} data-index=${i} src="../static/img/doubleChristmasActivity/cut.png" />
|
|
|
<input class="ipt" data-id=${recordsId} data-index=${i} type="number" onkeyup="this.value=this.value.replace(/[^0-9]/g,'')" value="0" />
|
|
|
<img class="compute-icon add" data-id=${recordsId} data-index=${i} src="../static/img/doubleChristmasActivity/add.png" />
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>`
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
let sliderItemDom = res.data.length === 0 ? `<div class="slider-item no-slider">暂无可分配的云手机</div>` : `<div class="slider-item">${str}</div>`;
|
|
|
$('#slider-list').append(sliderItemDom);
|
|
|
- if(records.length === 0){
|
|
|
- $('.left-ear').eq(0).css('display','none');
|
|
|
- $('.right-ear').eq(0).css('display','none');
|
|
|
- $('.page-row').eq(0).css('display','none');
|
|
|
- $('.distribution-reward-btn').eq(0).css('display','none');
|
|
|
+ if (records.length === 0) {
|
|
|
+ $('.left-ear').eq(0).css('display', 'none');
|
|
|
+ $('.right-ear').eq(0).css('display', 'none');
|
|
|
+ $('.page-row').eq(0).css('display', 'none');
|
|
|
+ $('.distribution-reward-btn').eq(0).css('display', 'none');
|
|
|
}
|
|
|
- $('.page').eq(0).text(`${pageNum + 1}/${sliderNumber}页`);
|
|
|
- if(sliderNumber === 1){
|
|
|
- $('.page-row').eq(0).css('display','none');
|
|
|
- $('.distribution-reward-btn').eq(0).css('margin-top','20px');
|
|
|
+ $('.page').eq(0).text(`${pageNum + 1}/${sliderNumber}页`);
|
|
|
+ if (sliderNumber === 1) {
|
|
|
+ $('.page-row').eq(0).css('display', 'none');
|
|
|
+ $('.distribution-reward-btn').eq(0).css('margin-top', '20px');
|
|
|
}
|
|
|
- for(var i = 0; i < len; i++){
|
|
|
- iptIndex = (pageNum)*4 + parseInt(i);
|
|
|
- $('.ipt')[iptIndex].oninput = function(e){
|
|
|
+ for (var i = 0; i < len; i++) {
|
|
|
+ iptIndex = (pageNum) * 4 + parseInt(i);
|
|
|
+ $('.ipt')[iptIndex].oninput = function (e) {
|
|
|
const id = e.target.dataset.id;
|
|
|
let oldDuration = 0;
|
|
|
let preTotalTime = 0;
|
|
|
@@ -501,13 +528,15 @@
|
|
|
})
|
|
|
//这一次操作
|
|
|
if(value == 0){
|
|
|
- distributionList.push({
|
|
|
- cardId: id,
|
|
|
- duration: +value
|
|
|
- });
|
|
|
+ if(!distributionList.find((item) => item.cardId == id)){
|
|
|
+ distributionList.push({
|
|
|
+ cardId: id,
|
|
|
+ duration: +value
|
|
|
+ });
|
|
|
+ }
|
|
|
}else{
|
|
|
distributionList.map(item => {
|
|
|
- if(item.cardId == id){
|
|
|
+ if (item.cardId == id) {
|
|
|
oldDuration = item.duration;
|
|
|
item.duration = +value;
|
|
|
}
|
|
|
@@ -517,28 +546,25 @@
|
|
|
distributionList.map(item => { // 这一次的总数据
|
|
|
currTotalTime += parseInt(item.duration);
|
|
|
})
|
|
|
- console.log(currTotalTime);
|
|
|
- if(currTotalTime < totalTime){ // 当前已分配小于总分配时长
|
|
|
-
|
|
|
- }else{// 当前已分配大于总分配时长
|
|
|
- let val = totalTime - preTotalTime;
|
|
|
+ if(currTotalTime > totalTime){ // 当前已分配大于总分配时长
|
|
|
+ let val = totalTime - preTotalTime + oldDuration;
|
|
|
distributionList.map(item => {
|
|
|
- if(item.cardId == id){
|
|
|
+ if (item.cardId == id) {
|
|
|
item.duration = val;
|
|
|
}
|
|
|
})
|
|
|
$('.ipt').eq(index).val(val);
|
|
|
stopManyClick(() => {
|
|
|
- toastr.error('分配时常不能大于未分配时常');
|
|
|
+ toastr.error('分配时常不能大于未分配总时常');
|
|
|
})
|
|
|
return
|
|
|
- };
|
|
|
+ }
|
|
|
if(value.length > 5) value=value.slice(0, 5);
|
|
|
$('.ipt').eq(index).val(value);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
stopManyClick(() => {
|
|
|
toastr.error(res.msg);
|
|
|
})
|
|
|
@@ -547,26 +573,26 @@
|
|
|
})
|
|
|
}
|
|
|
//点击分配时常按钮
|
|
|
- $('.distribution-reward-btn')[0].addEventListener('click',(e) => {
|
|
|
- if(distributionList.length === 0){
|
|
|
+ $('.distribution-reward-btn')[0].addEventListener('click', (e) => {
|
|
|
+ if (distributionList.length === 0) {
|
|
|
stopManyClick(() => {
|
|
|
toastr.error('未选中任何云手机');
|
|
|
})
|
|
|
- }else{
|
|
|
- $('.sure-distribution-wrap').eq(0).css('display','block');
|
|
|
+ } else {
|
|
|
+ $('.sure-distribution-wrap').eq(0).css('display', 'block');
|
|
|
}
|
|
|
});
|
|
|
//点击分配时常取消按钮
|
|
|
- $('.sure-distribution-cannel')[0].addEventListener('click',(e) => {
|
|
|
- operate('dt_双旦_h5_分配奖励_取消');
|
|
|
- $('.sure-distribution-wrap').eq(0).css('display','none');
|
|
|
+ $('.sure-distribution-cannel')[0].addEventListener('click', (e) => {
|
|
|
+ operate('dt_双旦_h5_分配奖励_取消');
|
|
|
+ $('.sure-distribution-wrap').eq(0).css('display', 'none');
|
|
|
});
|
|
|
//点击分配时常确定按钮
|
|
|
- $('.sure-distribution-sure')[0].addEventListener('click',(e) => {
|
|
|
+ $('.sure-distribution-sure')[0].addEventListener('click', (e) => {
|
|
|
$.ajax({
|
|
|
url: baseUrl + '/api/user/v1/activity/distributeRewardDuration',
|
|
|
type: 'post',
|
|
|
- data:JSON.stringify(distributionList),
|
|
|
+ data: JSON.stringify(distributionList),
|
|
|
headers: {
|
|
|
'Authorization': id //id
|
|
|
},
|
|
|
@@ -575,16 +601,16 @@
|
|
|
cache: false,
|
|
|
success: function (res) {
|
|
|
console.log(res)
|
|
|
- if(res.status === 0){
|
|
|
+ if (res.status === 0) {
|
|
|
operate('dt_双旦_h5_分配奖励_确定');
|
|
|
- $('.sure-distribution-wrap').eq(0).css('display','none');
|
|
|
- $('.reward-list').eq(0).text('');
|
|
|
+ $('.sure-distribution-wrap').eq(0).css('display', 'none');
|
|
|
+ $('.reward-list').eq(0).text('');
|
|
|
getList();
|
|
|
getLists();
|
|
|
stopManyClick(() => {
|
|
|
toastr.error('分配时长成功,请前往云机列表查看');
|
|
|
})
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
stopManyClick(() => {
|
|
|
toastr.error(res.msg);
|
|
|
})
|
|
|
@@ -594,55 +620,63 @@
|
|
|
});
|
|
|
//点击加号
|
|
|
$('.slider-list')[0].addEventListener('click',(e) => {
|
|
|
- console.log(sliderNumber)
|
|
|
if(e.target.className === 'compute-icon add'){
|
|
|
const id = e.target.dataset.id;
|
|
|
+ let currTotalTime = 0;
|
|
|
let index = e.target.dataset.index;
|
|
|
index = (pageNum)*4 + parseInt(index);
|
|
|
let number = $('.ipt').eq(index).val();
|
|
|
- if(number < totalTime - 1){
|
|
|
- if(number == 0){
|
|
|
+ // 这一次操作
|
|
|
+ if(number == 0){
|
|
|
+ if(!distributionList.find((item) => item.cardId == id)){
|
|
|
distributionList.push({
|
|
|
cardId: id,
|
|
|
duration: +number + 1
|
|
|
});
|
|
|
- }else{
|
|
|
- distributionList.map(item => {
|
|
|
- if(item.cardId == id){
|
|
|
- item.duration++;
|
|
|
- }
|
|
|
- })
|
|
|
}
|
|
|
+ }else{
|
|
|
+ distributionList.map(item => {
|
|
|
+ if(item.cardId == id){
|
|
|
+ item.duration++;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ distributionList.map(item => { // 这一次的总数据
|
|
|
+ currTotalTime += parseInt(item.duration);
|
|
|
+ })
|
|
|
+
|
|
|
+ if(currTotalTime <= totalTime){
|
|
|
number++;
|
|
|
- currTotalTime++;
|
|
|
$('.ipt').eq(index).val(number);
|
|
|
}else{
|
|
|
+ distributionList.map(item => {
|
|
|
+ if(item.cardId == id){
|
|
|
+ item.duration = +number;
|
|
|
+ }
|
|
|
+ })
|
|
|
stopManyClick(() => {
|
|
|
- toastr.error('分配时常不能大于未分配时常');
|
|
|
+ toastr.error('分配时常不能大于未分配总时常');
|
|
|
})
|
|
|
}
|
|
|
+ console.log(distributionList)
|
|
|
}
|
|
|
});
|
|
|
//点击减号
|
|
|
$('.slider-list')[0].addEventListener('click',(e) => {
|
|
|
if(e.target.className === 'compute-icon cut'){
|
|
|
- let number = $('.ipt').eq(0).val();
|
|
|
+ const id = e.target.dataset.id;
|
|
|
+ let index = e.target.dataset.index;
|
|
|
+ index = (pageNum)*4 + parseInt(index);
|
|
|
+ let number = $('.ipt').eq(index).val();
|
|
|
if(number > 0){
|
|
|
- if(number == 0){
|
|
|
- distributionList.push({
|
|
|
- cardId: id,
|
|
|
- duration: +number - 1
|
|
|
- });
|
|
|
- }else{
|
|
|
- distributionList.map(item => {
|
|
|
- if(item.cardId == id){
|
|
|
- item.duration--;
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
+ distributionList.map(item => {
|
|
|
+ if(item.cardId == id){
|
|
|
+ item.duration--;
|
|
|
+ }
|
|
|
+ })
|
|
|
number--;
|
|
|
currTotalTime--;
|
|
|
- $('.ipt').eq(0).val(number);
|
|
|
+ $('.ipt').eq(index).val(number);
|
|
|
}else{
|
|
|
stopManyClick(() => {
|
|
|
toastr.error('分配的时常不能小于0');
|
|
|
@@ -650,33 +684,33 @@
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
//埋点
|
|
|
operate('dt_双旦_h5_活动首页');
|
|
|
- function operate(pointName,type){
|
|
|
+ function operate(pointName, type) {
|
|
|
$.ajax({
|
|
|
url: baseUrl + '/api/public/v1/systemBuriedPoint/stat',
|
|
|
type: 'post',
|
|
|
- data:JSON.stringify({
|
|
|
+ data: JSON.stringify({
|
|
|
pointName: pointName
|
|
|
}),
|
|
|
- contentType:"application/json",
|
|
|
+ contentType: "application/json",
|
|
|
dataType: 'json',
|
|
|
cache: false,
|
|
|
success: function (res) {
|
|
|
-
|
|
|
+
|
|
|
},
|
|
|
})
|
|
|
}
|
|
|
//防止提示一秒内重复显示
|
|
|
function stopManyClick(fn) {
|
|
|
- if (flag) {
|
|
|
+ if (flag) {
|
|
|
fn();
|
|
|
}
|
|
|
flag = false;
|
|
|
- if(timer){clearTimeout(timer);}
|
|
|
- timer = setTimeout(() => {flag = true}, 1500);
|
|
|
- }
|
|
|
+ if (timer) { clearTimeout(timer); }
|
|
|
+ timer = setTimeout(() => { flag = true }, 1500);
|
|
|
+ }
|
|
|
</script>
|
|
|
<script src="../static/js/vender/move.js"></script>
|
|
|
</body>
|