|
@@ -50,7 +50,7 @@
|
|
|
</div>
|
|
|
<div class="line-wrap">
|
|
|
<img class="icon icon1" src="../static/img/anniversaryCelebrate/icon1.png" />
|
|
|
- <img class="icon icon2" src="../static/img/anniversaryCelebrate/icon3.png" />
|
|
|
+ <img class="icon icon2" src="../static/img/anniversaryCelebrate/icon2.png" />
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -66,30 +66,44 @@
|
|
|
<div class="get-award-wrap">
|
|
|
<img class="award-img" src="../static/img/anniversaryCelebrate/left-bg.png" />
|
|
|
<img class="get-award-img" src="../static/img/anniversaryCelebrate/get-award-show.png" />
|
|
|
- <div class="get-award-text">领取</div>
|
|
|
+ <div class="get-award-text">充值奖励</div>
|
|
|
</div>
|
|
|
- <div class="get-award-wrap">
|
|
|
+ <div class="get-award-wrap get-award-right-wrap">
|
|
|
<img class="award-img right-bg" src="../static/img/anniversaryCelebrate/right-bg.png" />
|
|
|
<img class="get-award-img" src="../static/img/anniversaryCelebrate/get-award-success-hidden.png" />
|
|
|
- <div class="get-award-text used-text">已使用</div>
|
|
|
+ <div class="get-award-text used-text">分配奖励</div>
|
|
|
+ <div class="no-distribution-award">999+</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="light-title-wrap">
|
|
|
- <div class="light-title-text award-text">奖品</div>
|
|
|
- <div class="light-title-text light-title-time">时间</div>
|
|
|
- <div class="light-title-text active-text">操作</div>
|
|
|
- </div>
|
|
|
<div class="light-content-container">
|
|
|
- <div class="light-content-list"></div>
|
|
|
+ <div class="light-content-list">
|
|
|
+ <div class="light-content-text">点亮一颗星获得星曜7天时长奖励</div>
|
|
|
+ </div>
|
|
|
<div class="all-light">已全部点亮<text class="light-number"></text>次</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="activity-intrduction-wrap">
|
|
|
- <div>活动时间:2022年6月10日-2022年6月19日</div>
|
|
|
+ <div>活动时间:2022年6月18日-2022年6月27日</div>
|
|
|
<div>活动参与套餐:星曜套餐月卡年卡(自动续费除外)</div>
|
|
|
</div>
|
|
|
<div class="law-statement">请阅读相关《法律声明》文件</div>
|
|
|
</div>
|
|
|
+ <div class="reward-list">
|
|
|
+ <img class="left-ear" src="../static/img/doubleChristmasActivity/left-ear.png" />
|
|
|
+ <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 class="page-row">
|
|
|
+ <div class="schedule-line">
|
|
|
+ <div class="schedule-child-line"></div>
|
|
|
+ </div>
|
|
|
+ <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" />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
<div class="award-result-mask">
|
|
|
<div class="award-result-dialog-sure">
|
|
|
<div class="have-times-wrap">
|
|
@@ -192,7 +206,7 @@
|
|
|
</script>
|
|
|
<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
|
|
|
<script type="text/javascript">
|
|
|
- // var baseUrl = 'http://192.168.31.198'
|
|
|
+ var baseUrl = 'http://14.18.190.141:1280'
|
|
|
let timer,flag = true;
|
|
|
var url = window.location.href;
|
|
|
url = url.split('/')
|
|
@@ -214,6 +228,15 @@
|
|
|
lighten = [],
|
|
|
notReceive = true,
|
|
|
phoneRemainQuantity = 0,
|
|
|
+ totalTime = 0,
|
|
|
+ currTotalTime = 0,
|
|
|
+ distributionList = [],
|
|
|
+ totalRecords = [],
|
|
|
+ pageNums = 0,
|
|
|
+ distributionFlag = true,
|
|
|
+ distributionPageNum = 0,
|
|
|
+ distributionPages = 0,
|
|
|
+ sliderNumber = 0,//滑块是数量,控制溢出不能滑动
|
|
|
isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
|
|
|
// 初始化数据
|
|
|
window.onload = function(){
|
|
@@ -242,9 +265,22 @@
|
|
|
residueDegree = res.data.residueDegree;
|
|
|
anniversarySwitch = res.data.anniversarySwitch;
|
|
|
result = res.data.lighten;
|
|
|
- lighten = result.split(','), str = '';
|
|
|
+ lighten = result && result.split(',') || [], str = '';
|
|
|
$('.rest-number').eq(0).text(residueDegree);
|
|
|
$('.light-number').eq(0).text(res.data.allTotal);
|
|
|
+ if(residueDegree == 0){
|
|
|
+ $('.line-wrap')[0].className = 'line-wrap';
|
|
|
+ $('.icon1')[0].src = '../static/img/anniversaryCelebrate/icon1.png';
|
|
|
+ $('.icon2')[0].src = '../static/img/anniversaryCelebrate/icon2.png';
|
|
|
+ }else if(residueDegree >=1 && residueDegree < 5){
|
|
|
+ $('.line-wrap')[0].className = 'line-wrap line-wrap-one';
|
|
|
+ $('.icon1')[0].src = '../static/img/anniversaryCelebrate/icon4.png';
|
|
|
+ $('.icon2')[0].src = '../static/img/anniversaryCelebrate/icon2.png';
|
|
|
+ } else if(residueDegree >= 5){
|
|
|
+ $('.line-wrap')[0].className = 'line-wrap line-wrap-two';
|
|
|
+ $('.icon1')[0].src = '../static/img/anniversaryCelebrate/icon4.png';
|
|
|
+ $('.icon2')[0].src = '../static/img/anniversaryCelebrate/icon3.png';
|
|
|
+ }
|
|
|
if(anniversarySwitch !== 0){
|
|
|
let awardText = anniversarySwitch == 1 ? '<div>活动暂未开启</div>请稍安勿躁' : '<div>活动已结束</div>期待下次的见面'
|
|
|
$('.no-start-dialog').eq(0).append(awardText);
|
|
@@ -252,7 +288,7 @@
|
|
|
$('.no-start-mask').show();
|
|
|
document.documentElement.style.overflow='hidden';
|
|
|
}
|
|
|
- if(result == ''){
|
|
|
+ if(result == '' || !lighten){
|
|
|
return
|
|
|
}
|
|
|
//更新点亮星星
|
|
@@ -274,7 +310,7 @@
|
|
|
},
|
|
|
})
|
|
|
};
|
|
|
- getAward();
|
|
|
+ // getAward();
|
|
|
//点击抽奖
|
|
|
$('.once-btn')[0].addEventListener('click',() => {
|
|
|
if(!animationFlag) return;
|
|
@@ -345,6 +381,7 @@
|
|
|
}
|
|
|
let currData = list.filter(item => item.awardType == 0);
|
|
|
list = [...currData, ...otherData];
|
|
|
+ getAward();
|
|
|
if(type !== 'report'){
|
|
|
$('.award-result-dialog-sure').animate({top: '1.86rem'},"fast");
|
|
|
$('.award-result-mask').show();
|
|
@@ -414,7 +451,7 @@
|
|
|
imgNumber++;
|
|
|
},400)
|
|
|
}
|
|
|
- $('.times-text-number').eq(0).text(residueDegree - 1);
|
|
|
+ $('.times-text-number').eq(0).text(residueDegree - times);
|
|
|
$('.award-result-wrap').eq(0).append(str);
|
|
|
init();
|
|
|
}else{
|
|
@@ -425,6 +462,13 @@
|
|
|
},
|
|
|
})
|
|
|
}
|
|
|
+ //点击确定
|
|
|
+ $('.distribution-award')[0].addEventListener('click',() => {
|
|
|
+ animationFlag = true;
|
|
|
+ $('.award-result-dialog').animate({top: '-10.96rem'},"fast");
|
|
|
+ $('.award-result-mask').hide();
|
|
|
+ document.documentElement.style.overflow='auto';
|
|
|
+ },false);
|
|
|
//点击抽奖关闭按钮
|
|
|
$('.award-result-close')[0].addEventListener('click',() => {
|
|
|
animationFlag = true;
|
|
@@ -592,6 +636,186 @@
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
+ // 活动获取用户云机列表,分页
|
|
|
+ getLists();
|
|
|
+ function getLists(){
|
|
|
+ const sliderLen = Array.from($('.slider-item')).length;
|
|
|
+ // if(sliderLen != 0 && sliderLen >= sliderNumber){
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // $.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 res = {
|
|
|
+ data: {
|
|
|
+ userCardPage: {
|
|
|
+ records: [{id: 1, exceptTime: '2022-11-11 12:21:22',diskName: 'fdf',}]
|
|
|
+ },
|
|
|
+ pages: 1
|
|
|
+ },
|
|
|
+ now: '2022-11-11 12:21:22'
|
|
|
+ }
|
|
|
+ let records = res.data.userCardPage.records;
|
|
|
+ totalRecords = [...totalRecords, ...records];
|
|
|
+ if(records.length === 0){
|
|
|
+ $('.page-row').eq(0).css('display','none');
|
|
|
+ let sliderItemDom = `<div class="slider-item no-slider">暂无可分配的云手机</div>`;
|
|
|
+ $('#slider-list').append(sliderItemDom);
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if(res.data && records.length > 0){
|
|
|
+ sliderNumber = res.data.userCardPage.pages;
|
|
|
+ let sliderItemText = $('.slider-item').eq(pageNums).text();
|
|
|
+ var str = '',
|
|
|
+ len = records.length;
|
|
|
+ for (var i = 0; i < len; i++) {
|
|
|
+ // 解决ios时间显示为NaN
|
|
|
+ // var now = res.data.now.replace(/T/g, ' ');
|
|
|
+ // now = now.replace(/\-/g, '/');
|
|
|
+ var exceptTime = records[i].exceptTime.replace(/T/g, ' ');
|
|
|
+ exceptTime = exceptTime.replace(/\-/g, '/');
|
|
|
+ var diskName = records[i].diskName,
|
|
|
+ // 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 = 1 + "天" + 1 + "时",
|
|
|
+ recordsId = records[i].id;
|
|
|
+ // if(day == 0 && hour <= 0){
|
|
|
+ // time = '已过期';
|
|
|
+ // }
|
|
|
+ if(sliderItemText){
|
|
|
+ $('.reward-diskName').eq(pageNums*4 + i).text(diskName);
|
|
|
+ $('.reward-time-content').eq(pageNums*4 + i).text(time);
|
|
|
+ }
|
|
|
+ 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 reward-diskName">${diskName}</div>
|
|
|
+ <div class="total-day time-row">
|
|
|
+ <img class="time-icon" src="../static/img/doubleChristmasActivity/time-icon.png" />
|
|
|
+ <span class="reward-time-content ${time === '已过期'?'time-overdue':''}">${time}</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="compute-block">
|
|
|
+ <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=${(pageNums)*4 + i} type="number" onkeyup="this.value=this.value.replace(/-/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 = `<div class="slider-item">${str}</div>`;
|
|
|
+ $('#slider-list').append(sliderItemDom);
|
|
|
+ // if(!sliderItemText){
|
|
|
+ // $('#slider-list').append(sliderItemDom);
|
|
|
+ // }else{
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ $('.left-ear').eq(0).css('display','block');
|
|
|
+ $('.right-ear').eq(0).css('display','block');
|
|
|
+ $('.distribution-reward-btn').eq(0).css('display','block');
|
|
|
+ $('.schedule-child-line').eq(0).css('width',`${36/sliderNumber}px`);
|
|
|
+ $('.page').eq(0).text(`${pageNums + 1}/${sliderNumber}页`);
|
|
|
+ if(sliderNumber === 1){
|
|
|
+ $('.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('margin-top','20px');
|
|
|
+ }
|
|
|
+ for (var i = 0; i < len; i++) {
|
|
|
+ iptIndex = (pageNums) * 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();
|
|
|
+ // if(value.length >= 5){
|
|
|
+ // value = value.substr(0, 5);
|
|
|
+ // }
|
|
|
+ // console.log('value',value)
|
|
|
+ // var position = String(value).indexOf(".");//获取小数点的位置
|
|
|
+ // if(position != -1){
|
|
|
+ // value = value.substr(0, position);
|
|
|
+ // }
|
|
|
+ // distributionList.map(item => { // 上一次的总数据
|
|
|
+ // preTotalTime += parseInt(item.duration);
|
|
|
+ // })
|
|
|
+ // //这一次操作
|
|
|
+ // if(value == 0){
|
|
|
+ // if(!distributionList.find((item) => item.cardId == id)){
|
|
|
+ // distributionList.push({
|
|
|
+ // cardId: id,
|
|
|
+ // duration: +value
|
|
|
+ // });
|
|
|
+ // }else{
|
|
|
+ // distributionList = distributionList.filter(item => item.cardId != id);
|
|
|
+ // }
|
|
|
+ // distributionList = distributionList.filter(item => item.duration != 0);
|
|
|
+ // }else{
|
|
|
+ // if(!distributionList.find((item) => item.cardId == id)){
|
|
|
+ // distributionList.push({
|
|
|
+ // cardId: id,
|
|
|
+ // duration: Math.abs(value)
|
|
|
+ // });
|
|
|
+ // }else{
|
|
|
+ // distributionList.map(item => {
|
|
|
+ // if (item.cardId == id) {
|
|
|
+ // oldDuration = item.duration;
|
|
|
+ // item.duration = +value;
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // currTotalTime = 0;
|
|
|
+ // distributionList.map(item => { // 这一次的总数据
|
|
|
+ // currTotalTime += parseInt(item.duration);
|
|
|
+ // })
|
|
|
+ // if(currTotalTime > totalTime){ // 当前已分配大于总分配时长
|
|
|
+ // let val = totalTime - preTotalTime + oldDuration;
|
|
|
+ // distributionList.map(item => {
|
|
|
+ // if (item.cardId == id) {
|
|
|
+ // item.duration = val;
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // $('.ipt').eq(index).val(val);
|
|
|
+ // stopManyClick(() => {
|
|
|
+ // toastr.error('分配时长不能大于未分配总时长');
|
|
|
+ // })
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // console.log(distributionList)
|
|
|
+ // if(value.length > 5) value=value.slice(0, 5);
|
|
|
+ // $('.ipt').eq(index).val(value);
|
|
|
+ // }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // } else {
|
|
|
+ // stopManyClick(() => {
|
|
|
+ // toastr.error(res.msg);
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ }
|
|
|
//获取云机数量
|
|
|
getPhoneNumber();
|
|
|
function getPhoneNumber(){
|