|
@@ -21,8 +21,8 @@
|
|
|
<div class="header-container">
|
|
|
<img class="top-banner" src="../static/img/doubleChristmasActivity/top-banner.png" />
|
|
|
<div class="activity-meal">活动参与套餐:星耀套餐</div>
|
|
|
- <div class="meal-price">云机低至0.24元/天</div>
|
|
|
- <div class="rest-time">距离活动结束:20天3时4分30秒</div>
|
|
|
+ <div class="meal-price">云机低至<span class="meal-price-num"></span>元/天</div>
|
|
|
+ <div class="rest-time"></div>
|
|
|
<div class="limit">PC端用户不参与本次活动</div>
|
|
|
</div>
|
|
|
<div class="middle-container">
|
|
@@ -59,38 +59,39 @@
|
|
|
<div class="rest-tip">使用激活码,优惠券和星币支付不参与活动</div>
|
|
|
<div class="tab-row">
|
|
|
<div class="tab-item tab-active" data-index="0">充值奖励</div>
|
|
|
- <div class="tab-item" data-index="1">分配奖励(0000)</div>
|
|
|
+ <div class="tab-item" data-index="1">分配奖励(<span class="time-number"></span>)</div>
|
|
|
<img class="tab-bg" src="../static/img/doubleChristmasActivity/tab-bg.png" />
|
|
|
</div>
|
|
|
<div class="reward-container">
|
|
|
+ <div class="activity-finish">
|
|
|
+ <div class="finish-text">活动已结束</div>
|
|
|
+ </div>
|
|
|
<div class="reward-time">
|
|
|
<span class="reward-text">购买套餐累计时长</span>
|
|
|
- <span class="time-num">2222</span>
|
|
|
+ <span class="total-time-num"></span>
|
|
|
<span class="reward-text">天</span>
|
|
|
<span class="time-line">|</span>
|
|
|
<span class="reward-text">距离下一个奖励还差</span>
|
|
|
- <span class="time-num">2222</span>
|
|
|
+ <span class="next-time-num"></span>
|
|
|
<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>
|
|
|
</div>
|
|
|
- <div class="reward-list">
|
|
|
- <div class="reward-last-tip">已获得奖励请在分配奖励栏中进行时长分配</div>
|
|
|
- </div>
|
|
|
+ <div class="reward-list"></div>
|
|
|
</div>
|
|
|
<div class="distribution-container">
|
|
|
<div class="distribution-time">
|
|
|
<div>
|
|
|
<span class="distribution-text">奖励总时长</span>
|
|
|
- <span class="distribution-num">2222</span>
|
|
|
+ <span class="distribution-total-num"></span>
|
|
|
<span class="distribution-text">天</span>
|
|
|
</div>
|
|
|
<span class="distribution-line">|</span>
|
|
|
<div>
|
|
|
<span class="distribution-text">未分配时长</span>
|
|
|
- <span class="distribution-num">2222</span>
|
|
|
+ <span class="no-distribution-num"></span>
|
|
|
<span class="distribution-text">天</span>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -122,26 +123,7 @@
|
|
|
<div>时间</div>
|
|
|
<div>时长</div>
|
|
|
</div>
|
|
|
- <div class="time-content-row">
|
|
|
- <div>lo试玩撒了</div>
|
|
|
- <div>2021年11月24日15:48:44</div>
|
|
|
- <div>1000天</div>
|
|
|
- </div>
|
|
|
- <div class="time-content-row">
|
|
|
- <div>lo试玩撒了</div>
|
|
|
- <div>2021年11月24日15:48:44</div>
|
|
|
- <div>1000天</div>
|
|
|
- </div>
|
|
|
- <div class="time-content-row">
|
|
|
- <div>lo试玩撒了</div>
|
|
|
- <div>2021年11月24日15:48:44</div>
|
|
|
- <div>1000天</div>
|
|
|
- </div>
|
|
|
- <div class="time-content-row">
|
|
|
- <div>lo试玩撒了</div>
|
|
|
- <div>2021年11月24日15:48:44</div>
|
|
|
- <div>1000天</div>
|
|
|
- </div>
|
|
|
+ <div class="no-time-data">暂无分配时长</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="rule-container">
|
|
@@ -156,7 +138,7 @@
|
|
|
<div class="rule-point">2.使用星币支付、激活码兑换、优惠劵购买和购买非星耀套餐不计入任务进度。</div>
|
|
|
<div class="rule-point">3.奖励获取的云机时长仅可用于续费账号中现有的星曜云机设备。</div>
|
|
|
<div class="rule-point blue">4.奖励领取日期为:2021年12月18日-2022年1月6日,超过领取时间未领取奖励则视为放弃任务奖励。</div>
|
|
|
- <div class="rule-point">5.授权的云手机不能获取累计奖励时长。</div>
|
|
|
+ <div class="rule-point">5.从他人获取授权的云手机不能分配累计奖励时长。</div>
|
|
|
<div class="rule-point">三、其他说明</div>
|
|
|
<div class="rule-point">1.本次活动不与其他活动优惠叠加。</div>
|
|
|
<div class="rule-point">2.本次活动期间购买的云手机套餐不支持退款。</div>
|
|
@@ -179,34 +161,51 @@
|
|
|
// 上线分享环境改为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),//从=号后面的内容
|
|
|
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);//取得=号的位置
|
|
|
- let parms = s.split('&');
|
|
|
- parms.map((item) =>{
|
|
|
- let arr = item.split('=');
|
|
|
- let key = arr[0];
|
|
|
- obj[key] = arr[1];
|
|
|
- })
|
|
|
+ let userName = '';
|
|
|
+ let totalTime = 300;
|
|
|
+ let currTotalTime = 0;
|
|
|
+ let distributionList = [];
|
|
|
+ var pageNum = 0;
|
|
|
+ var sliderNumber = 0;//滑块是数量,控制溢出不能滑动
|
|
|
+ // let parms = s.split('&');
|
|
|
+ // parms.map((item) =>{
|
|
|
+ // let arr = item.split('=');
|
|
|
+ // let key = arr[0];
|
|
|
+ // obj[key] = arr[1];
|
|
|
+ // })
|
|
|
+ getBaseData();
|
|
|
getList();
|
|
|
- getLists();
|
|
|
//点击立即参与按钮
|
|
|
$('.join-activity-btn')[0].addEventListener('click',() => {
|
|
|
if(isAndroid){ // 安卓
|
|
|
window.native.startPurchase(1,365);
|
|
|
- }else{
|
|
|
+ }else if(isiOS){
|
|
|
window.webkit.messageHandlers.startPurchase.postMessage({type:2,day:365});
|
|
|
+ }else {
|
|
|
+
|
|
|
}
|
|
|
})
|
|
|
//点击去完成
|
|
|
$('.reward-list')[0].addEventListener('click',(e) => {
|
|
|
if(e.target.className === 'reward-btn'){
|
|
|
+ let receive = e.target.dataset.receive;
|
|
|
+ if(!receive){
|
|
|
+ return
|
|
|
+ }
|
|
|
if(isAndroid){ // 安卓
|
|
|
window.native.startPurchase(1,365);
|
|
|
- }else{
|
|
|
+ }else if(isiOS){
|
|
|
window.webkit.messageHandlers.startPurchase.postMessage({type:2,day:365});
|
|
|
+ }else{
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
});
|
|
@@ -223,6 +222,8 @@
|
|
|
$('.distribution-container').eq(0).css('display','none');
|
|
|
$('.distribution-container').eq(1).css('display','none');
|
|
|
}else{
|
|
|
+ getLists();
|
|
|
+ distributionRecord();
|
|
|
$('.tab-item')[0].className = 'tab-item';
|
|
|
$('.tab-bg')[0].className = 'tab-bg tab-right';
|
|
|
$('.reward-container').eq(0).css('display','none');
|
|
@@ -231,149 +232,342 @@
|
|
|
}
|
|
|
$('.tab-item')[index].className = 'tab-item tab-active';
|
|
|
})
|
|
|
+ //获取倒计时
|
|
|
+ function getBaseData(){
|
|
|
+ $.ajax({
|
|
|
+ url: baseUrl + '/api/user/v1/activity/getChristmasActivityConf',
|
|
|
+ type: 'get',
|
|
|
+ headers: {
|
|
|
+ 'Authorization': id //id
|
|
|
+ },
|
|
|
+ contentType:"application/json",
|
|
|
+ dataType: 'json',
|
|
|
+ cache: false,
|
|
|
+ success: function (res) {
|
|
|
+ const objData = res.data;
|
|
|
+ userName = objData.userName;
|
|
|
+ $('.meal-price-num').eq(0).text(objData.price);
|
|
|
+ let currTime = parseInt(Date.parse(objData.now)),
|
|
|
+ closeTime = parseInt(Date.parse(objData.endTime)),
|
|
|
+ result = closeTime - currTime,
|
|
|
+ day = parseInt(result / 1000 / 60 / 60 / 24),
|
|
|
+ hour = parseInt(result / 1000 / 60 / 60 % 24),
|
|
|
+ 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()
|
|
|
+ }
|
|
|
+ $('.rest-time').eq(0).text(str);
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
//调用获取数据列表接口
|
|
|
function getList(){
|
|
|
- // $.ajax({
|
|
|
- // url: baseUrl + '/api/user/v1/activity/orderRedEnvelopeSharing',
|
|
|
- // type: 'post',
|
|
|
- // headers: {
|
|
|
- // 'Authorization': obj.token //id
|
|
|
- // },
|
|
|
- // contentType: "application/json",
|
|
|
- // dataType: 'json',
|
|
|
- // cache: false,
|
|
|
- // success: function (res) {
|
|
|
- // if(res.status === 0){
|
|
|
- // if(res.data && res.data.length > 0){
|
|
|
- let res = {
|
|
|
- data:[{
|
|
|
- shareCount: 10,
|
|
|
- totalMoney: 30
|
|
|
- },{
|
|
|
- shareCount: 40,
|
|
|
- totalMoney: 90
|
|
|
- },{
|
|
|
- shareCount: 80,
|
|
|
- totalMoney: 180
|
|
|
- },{
|
|
|
- shareCount: 240,
|
|
|
- totalMoney: 365
|
|
|
- },{
|
|
|
- shareCount: 800,
|
|
|
- totalMoney: 730
|
|
|
- },{
|
|
|
- shareCount: 3022,
|
|
|
- totalMoney: 2022
|
|
|
- },{
|
|
|
- shareCount: 3022,
|
|
|
- totalMoney: 2022
|
|
|
- }]
|
|
|
- }
|
|
|
+ $.ajax({
|
|
|
+ url: baseUrl + '/api/user/v1/activity/getReceivingList',
|
|
|
+ type: 'get',
|
|
|
+ headers: {
|
|
|
+ 'Authorization': id //id
|
|
|
+ },
|
|
|
+ contentType: "application/json",
|
|
|
+ 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.data && res.data.operateActivityGoodsInfos.length > 0){
|
|
|
var str = '',
|
|
|
- len = res.data.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++) {
|
|
|
- var totalMoney = res.data[i].totalMoney,
|
|
|
- shareCount = res.data[i].shareCount;
|
|
|
+ let rewardDuration = res.data.operateActivityGoodsInfos[i].rewardDuration,
|
|
|
+ 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" />
|
|
|
<div class="reward-day-text">
|
|
|
- <div class="reward-day">奖励天数${shareCount}天</div>
|
|
|
- <div class="total-day">购买套餐累计时长达${totalMoney}天</div>
|
|
|
+ <div class="reward-day">奖励天数${rewardDuration}天</div>
|
|
|
+ <div class="total-day">购买套餐累计时长达${cumulativeDuration}天</div>
|
|
|
</div>
|
|
|
- <img class="reward-btn" src="../static/img/doubleChristmasActivity/finish-btn.png" />
|
|
|
+ <img class="reward-btn" data-receive=${receiveDuration} src="../static/img/doubleChristmasActivity/${receiveDuration ? 'get-btn' : 'finish-btn'}.png" />
|
|
|
</div>
|
|
|
</div>`
|
|
|
+ if(totalDuration - cumulativeDuration < 0 && flag){
|
|
|
+ flag = false;
|
|
|
+ nextDuration = cumulativeDuration - totalDuration;
|
|
|
+ }
|
|
|
}
|
|
|
str +=`<div class="reward-last-tip">已获得奖励请在分配奖励栏中进行时长分配</div>`
|
|
|
$('.reward-list').eq(0).append(str);
|
|
|
- // }
|
|
|
- // }else{
|
|
|
- // stopManyClick(() => {
|
|
|
- // toastr.error(res.msg);
|
|
|
- // })
|
|
|
- // }
|
|
|
- // }
|
|
|
- // })
|
|
|
+ $('.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;
|
|
|
+ $('.no-distribution-num').eq(0).text(noDistributionDuration);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ stopManyClick(() => {
|
|
|
+ toastr.error(res.msg);
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
- //获取分配列表数据
|
|
|
+ // 获取分配列表数据
|
|
|
+ function distributionRecord(){
|
|
|
+ $.ajax({
|
|
|
+ url: baseUrl + '/api/user/v1/activity/queryUserDistribution',
|
|
|
+ type: 'get',
|
|
|
+ data:{
|
|
|
+ pageNum: pageNum + 1,
|
|
|
+ pageSize: 10,
|
|
|
+ userName: userName
|
|
|
+ },
|
|
|
+ headers: {
|
|
|
+ 'Authorization': id //id
|
|
|
+ },
|
|
|
+ contentType: "application/json",
|
|
|
+ dataType: 'json',
|
|
|
+ cache: false,
|
|
|
+ success: function (res) {
|
|
|
+ console.log(res)
|
|
|
+ if(res.status === 0){
|
|
|
+ let records = res.data.records;
|
|
|
+ if(res.data && records.length > 0){
|
|
|
+ sliderNumber = res.data.pages;
|
|
|
+ var str = '',
|
|
|
+ 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.substring(0,3)}年${increaseDuration.substring(5,7)}月${increaseDuration.substring(8,10)}
|
|
|
+ str += `<div class="time-content-row">
|
|
|
+ <div>${diskName}</div>
|
|
|
+ <div>${createTime}</div>
|
|
|
+ <div>${increaseDuration}</div>
|
|
|
+ </div>`
|
|
|
+ }
|
|
|
+ $('.time-list').eq(0).append(str);
|
|
|
+ if(len !== 0){
|
|
|
+ $('.no-time-data').eq(0).css('display','none');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ stopManyClick(() => {
|
|
|
+ toastr.error(res.msg);
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
+ // 活动获取用户云机列表,分页
|
|
|
function getLists(){
|
|
|
const sliderLen = Array.from($('.slider-item')).length;
|
|
|
- if(sliderLen > 4){
|
|
|
+ if(sliderLen > sliderNumber){
|
|
|
return
|
|
|
}
|
|
|
- // $.ajax({
|
|
|
- // url: baseUrl + '/api/user/v1/activity/orderRedEnvelopeSharing',
|
|
|
- // type: 'post',
|
|
|
- // headers: {
|
|
|
- // 'Authorization': obj.token //id
|
|
|
- // },
|
|
|
- // contentType: "application/json",
|
|
|
- // dataType: 'json',
|
|
|
- // cache: false,
|
|
|
- // success: function (res) {
|
|
|
- // if(res.status === 0){
|
|
|
- // if(res.data && res.data.length > 0){
|
|
|
- let res = {
|
|
|
- data:[{
|
|
|
- shareCount: 10,
|
|
|
- totalMoney: 30
|
|
|
- },{
|
|
|
- shareCount: 40,
|
|
|
- totalMoney: 90
|
|
|
- },{
|
|
|
- shareCount: 80,
|
|
|
- totalMoney: 180
|
|
|
- }]
|
|
|
- }
|
|
|
+ $.ajax({
|
|
|
+ url: baseUrl + '/api/user/v1/activity/getUserCardPage',
|
|
|
+ type: 'get',
|
|
|
+ data:{
|
|
|
+ pageNum: pageNum + 1,
|
|
|
+ pageSize: 4,
|
|
|
+ phoneType : 'SVIP'
|
|
|
+ },
|
|
|
+ headers: {
|
|
|
+ 'Authorization': id //id
|
|
|
+ },
|
|
|
+ contentType: "application/json",
|
|
|
+ dataType: 'json',
|
|
|
+ cache: false,
|
|
|
+ success: function (res) {
|
|
|
+ if(res.status === 0){
|
|
|
+ let records = res.data.userCardPage.records;
|
|
|
+ if(res.data && records.length > 0){
|
|
|
+ sliderNumber = res.data.userCardPage.pages;
|
|
|
var str = '',
|
|
|
- len = res.data.length;
|
|
|
+ len = records.length;
|
|
|
for (var i = 0; i < len; i++) {
|
|
|
- var totalMoney = res.data[i].totalMoney,
|
|
|
- shareCount = res.data[i].shareCount;
|
|
|
+ var diskName = records[i].diskName,
|
|
|
+ exceptTime = records[i].exceptTime,
|
|
|
+ now = res.data.now,
|
|
|
+ currTime = parseInt(Date.parse(now)),
|
|
|
+ closeTime = parseInt(Date.parse(exceptTime)),
|
|
|
+ resultTime = closeTime - currTime,
|
|
|
+ day = parseInt(resultTime / 1000 / 60 / 60 / 24),
|
|
|
+ hour = parseInt(resultTime / 1000 / 60 / 60 % 24),
|
|
|
+ time = day + "天" + hour + "时";
|
|
|
+ id = 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" />
|
|
|
<div class="reward-day-text">
|
|
|
- <div class="reward-day">Y2-12567</div>
|
|
|
+ <div class="reward-day">${diskName}</div>
|
|
|
<div class="total-day time-row">
|
|
|
<img class="time-icon" src="../static/img/doubleChristmasActivity/time-icon.png" />
|
|
|
- <span>剩99999天24小时</span>
|
|
|
+ <span>${time}</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="compute-block">
|
|
|
<img class="compute-icon cut" src="../static/img/doubleChristmasActivity/cut.png" />
|
|
|
- <input class="ipt" type="number" onkeyup="this.value=this.value.replace(/[^0-9]/g,'')" value="0" maxlength="5" />
|
|
|
- <img class="compute-icon add" src="../static/img/doubleChristmasActivity/add.png" />
|
|
|
+ <input class="ipt" data-id=${id} data-index=${i} type="number" onkeyup="this.value=this.value.replace(/[^0-9]/g,'')" value="0" />
|
|
|
+ <img class="compute-icon add" data-id=${id} 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(res.data.length === 0){
|
|
|
+ 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(sliderNumber === 1){
|
|
|
+ $('.page-row').eq(0).css('display','none');
|
|
|
+ $('.distribution-reward-btn').eq(0).css('margin-top','20px');
|
|
|
}
|
|
|
- // }
|
|
|
- // }else{
|
|
|
- // stopManyClick(() => {
|
|
|
- // toastr.error(res.msg);
|
|
|
- // })
|
|
|
- // }
|
|
|
- // }
|
|
|
- // })
|
|
|
+ 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;
|
|
|
+ let index = e.target.dataset.index;
|
|
|
+ let value = $('.ipt').eq(index).val();
|
|
|
+ distributionList.map(item => { // 上一次的总数据
|
|
|
+ preTotalTime += parseInt(item.duration);
|
|
|
+ })
|
|
|
+ //这一次操作
|
|
|
+ if(value == 0){
|
|
|
+ distributionList.push({
|
|
|
+ cardId: id,
|
|
|
+ duration: +value
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ distributionList.map(item => {
|
|
|
+ if(item.cardId == id){
|
|
|
+ oldDuration = item.duration;
|
|
|
+ item.duration = +value;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ currTotalTime = 0;
|
|
|
+ distributionList.map(item => { // 这一次的总数据
|
|
|
+ currTotalTime += parseInt(item.duration);
|
|
|
+ })
|
|
|
+ console.log(currTotalTime);
|
|
|
+ if(currTotalTime < totalTime){ // 当前已分配小于总分配时长
|
|
|
+
|
|
|
+ }else{// 当前已分配大于总分配时长
|
|
|
+ let val = totalTime - preTotalTime;
|
|
|
+ distributionList.map(item => {
|
|
|
+ if(item.cardId == id){
|
|
|
+ item.duration = val;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ $('.ipt').eq(index).val(val);
|
|
|
+ stopManyClick(() => {
|
|
|
+ toastr.error('分配时常不能大于未分配时常');
|
|
|
+ })
|
|
|
+ return
|
|
|
+ };
|
|
|
+ if(value.length > 5) value=value.slice(0, 5);
|
|
|
+ $('.ipt').eq(index).val(value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ stopManyClick(() => {
|
|
|
+ toastr.error(res.msg);
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
+ //点击分配时常按钮
|
|
|
+ $('.distribution-reward-btn')[0].addEventListener('click',(e) => {
|
|
|
+ $.ajax({
|
|
|
+ url: baseUrl + '/api/user/v1/activity/distributeRewardDuration',
|
|
|
+ type: 'post',
|
|
|
+ data:JSON.stringify(distributionList),
|
|
|
+ headers: {
|
|
|
+ 'Authorization': id //id
|
|
|
+ },
|
|
|
+ contentType: "application/json",
|
|
|
+ dataType: 'json',
|
|
|
+ cache: false,
|
|
|
+ success: function (res) {
|
|
|
+ console.log(res)
|
|
|
+ if(res.status === 0){
|
|
|
+
|
|
|
+ }else{
|
|
|
+ stopManyClick(() => {
|
|
|
+ toastr.error(res.msg);
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ })
|
|
|
+ });
|
|
|
//点击加号
|
|
|
$('.slider-list')[0].addEventListener('click',(e) => {
|
|
|
if(e.target.className === 'compute-icon add'){
|
|
|
- let number = $('.ipt').eq(0).val();
|
|
|
- number++;
|
|
|
- if(number < 30){
|
|
|
- $('.ipt').eq(0).val(number);
|
|
|
+ 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 < totalTime - 1){
|
|
|
+ if(number == 0){
|
|
|
+ distributionList.push({
|
|
|
+ cardId: id,
|
|
|
+ duration: +number + 1
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ distributionList.map(item => {
|
|
|
+ if(item.cardId == id){
|
|
|
+ item.duration++;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ number++;
|
|
|
+ currTotalTime++;
|
|
|
+ $('.ipt').eq(index).val(number);
|
|
|
}else{
|
|
|
stopManyClick(() => {
|
|
|
toastr.error('分配时常不能大于未分配时常');
|
|
@@ -386,7 +580,20 @@
|
|
|
if(e.target.className === 'compute-icon cut'){
|
|
|
let number = $('.ipt').eq(0).val();
|
|
|
if(number > 0){
|
|
|
+ if(number == 0){
|
|
|
+ distributionList.push({
|
|
|
+ cardId: id,
|
|
|
+ duration: +number - 1
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ distributionList.map(item => {
|
|
|
+ if(item.cardId == id){
|
|
|
+ item.duration--;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
number--;
|
|
|
+ currTotalTime--;
|
|
|
$('.ipt').eq(0).val(number);
|
|
|
}else{
|
|
|
stopManyClick(() => {
|
|
@@ -395,6 +602,7 @@
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
//埋点
|
|
|
operate('dt_双11_h5_活动页面');
|
|
|
function operate(pointName,type){
|