|
@@ -8,9 +8,62 @@
|
|
|
<link rel="icon" href="../static/img/favicon2.ico" type="img/x-ico">
|
|
|
<link rel="stylesheet" href="../static/js/vender/toastr/toastr.min.css">
|
|
|
<link rel="stylesheet" href="../static/css/anniversaryCelebrate.css">
|
|
|
+ <link rel="stylesheet" href="../static/css/doubleChristmasActivity.css">
|
|
|
<script src="../static/js/vender/jquery-3.4.1.min.js"></script>
|
|
|
<script src="../static/js/vender/toastr/toastr.min.js"></script>
|
|
|
<script src="../static/js/vender/config.js"></script>
|
|
|
+ <style>
|
|
|
+ .reward-list{
|
|
|
+ display: none;
|
|
|
+ }
|
|
|
+ .slider{
|
|
|
+ height: 5.92rem;
|
|
|
+ overflow: hidden;
|
|
|
+ }
|
|
|
+ .slider-item {
|
|
|
+ padding-left: 0.3rem;
|
|
|
+ }
|
|
|
+ .page{
|
|
|
+ color: #FFFFFF;
|
|
|
+ }
|
|
|
+ .icon_xingyao{
|
|
|
+ width: 0.8rem;
|
|
|
+ height: 0.4rem;
|
|
|
+ }
|
|
|
+ .reward-btn-img{
|
|
|
+ width: 4rem;
|
|
|
+ height: 0.6rem;
|
|
|
+ margin: auto;
|
|
|
+ }
|
|
|
+ .distribution-reward-btn{
|
|
|
+ width: 100%;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+ .distribution-time-Record{
|
|
|
+ width: 1.6rem;
|
|
|
+ margin: 0.25rem auto;
|
|
|
+ padding-bottom: 0.05rem;
|
|
|
+ border-bottom: 0.01rem solid #F5F5F5;
|
|
|
+ font-size: 0.26rem;
|
|
|
+ color: #FFFFFF;
|
|
|
+ }
|
|
|
+ .reward-row{
|
|
|
+ height: 0.8rem;
|
|
|
+ margin-top: 0.1rem;
|
|
|
+ }
|
|
|
+ .page-row{
|
|
|
+ margin-top: 0.4rem;
|
|
|
+ }
|
|
|
+ .time-color{
|
|
|
+ color: #FDFF41;
|
|
|
+ }
|
|
|
+ .btn-wrap{
|
|
|
+ position: absolute;
|
|
|
+ bottom: -0.36rem;
|
|
|
+ left: 50%;
|
|
|
+ transform: translateX(-50%);
|
|
|
+ }
|
|
|
+ </style>
|
|
|
</head>
|
|
|
|
|
|
<body>
|
|
@@ -62,6 +115,7 @@
|
|
|
<img class="record-title" src="../static/img/anniversaryCelebrate/record-title.png" />
|
|
|
</div>
|
|
|
<div class="record-main-wrap">
|
|
|
+ <img class="selected-bg" src="../static/img/anniversaryCelebrate/right-selected.png" />
|
|
|
<div class="change-wrap">
|
|
|
<div class="get-award-wrap">
|
|
|
<img class="award-img" src="../static/img/anniversaryCelebrate/left-bg.png" />
|
|
@@ -72,15 +126,34 @@
|
|
|
<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="no-distribution-award">999+</div>
|
|
|
+ <div class="no-distribution-award"></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="light-content-container">
|
|
|
- <div class="light-content-list">
|
|
|
- <div class="light-content-text">点亮一颗星获得星曜7天时长奖励</div>
|
|
|
- </div>
|
|
|
+ <div class="light-content-list"></div>
|
|
|
<div class="all-light">已全部点亮<text class="light-number"></text>次</div>
|
|
|
</div>
|
|
|
+ <div class="reward-list">
|
|
|
+ <div class="light-title-wrap">
|
|
|
+ <div class="light-title-text">总时长<text class="time-color all-time">0</text>天</div>
|
|
|
+ <div class="light-title-text">已分配<text class="time-color get-time">0</text>天</div>
|
|
|
+ <div class="light-title-text">未分配<text class="time-color no-distribution">0</text>天</div>
|
|
|
+ </div>
|
|
|
+ <div class="slider" id="slider">
|
|
|
+ <div class="slider-list flex" id="slider-list"></div>
|
|
|
+ </div>
|
|
|
+ <div class="btn-wrap">
|
|
|
+ <div class="page-row-wrap">
|
|
|
+ <img class="left-head" src="../static/img/anniversaryCelebrate/left-head.png" />
|
|
|
+ <div class="page-number"></div>
|
|
|
+ <img class="right-head" src="../static/img/anniversaryCelebrate/right-head.png" />
|
|
|
+ </div>
|
|
|
+ <div class="distribution-reward-btn">
|
|
|
+ <img class="reward-btn-img" src="../static/img/anniversaryCelebrate/distribution-reward-btn.png" />
|
|
|
+ </div>
|
|
|
+ <div class="distribution-time-Record">分配时长记录</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div class="activity-intrduction-wrap">
|
|
|
<div>活动时间:2022年6月18日-2022年6月27日</div>
|
|
@@ -88,22 +161,6 @@
|
|
|
</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">
|
|
@@ -122,6 +179,7 @@
|
|
|
<div class="rule-mask">
|
|
|
<div class="rule-result-dialog">
|
|
|
<div class="rule-content">
|
|
|
+ <div class="rule-title">活动规则</div>
|
|
|
<div class="rule-point">1、本次活动参与活动的套餐是星曜月卡、年卡套餐,其他套餐不参与活动,现金购买及续费皆可参与活动</div>
|
|
|
<div class="rule-point">2、激活码、优惠券、星币购买的订单不参与本次活动</div>
|
|
|
<div class="rule-point">3、本次活动购买限时折扣次数不限,获得赠送天数,可分配在购买套餐的云机账户上,单账号购买新增云机总数上限为200台</div>
|
|
@@ -199,6 +257,39 @@
|
|
|
<div class="no-start-mask">
|
|
|
<div class="no-start-dialog"></div>
|
|
|
</div>
|
|
|
+ <div class="sure-distribution-wrap">
|
|
|
+ <div class="sure-distribution-box">
|
|
|
+ <div class="sure-distribution-title">确定分配奖励时长</div>
|
|
|
+ <div class="sure-distribution-btn-list">
|
|
|
+ <div class="sure-distribution-btn sure-distribution-cannel">取消</div>
|
|
|
+ <div class="sure-distribution-btn sure-distribution-sure">确定</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="distribution-time-mask">
|
|
|
+ <div class="distribution-time-dialog">
|
|
|
+ <div class="distribution-time-container">
|
|
|
+ <div class="distribution-time-title">分配时长记录</div>
|
|
|
+ <div class="distribution-time-wrap">
|
|
|
+ <div class="distribution-time-name">云机名称</div>
|
|
|
+ <div class="distribution-time-name">时间</div>
|
|
|
+ <div class="distribution-time-name">时长</div>
|
|
|
+ </div>
|
|
|
+ <div class="distribution-list"></div>
|
|
|
+ <div class="page-row-wrap page-row-record-wrap">
|
|
|
+ <img class="left-head" src="../static/img/anniversaryCelebrate/left-head.png" />
|
|
|
+ <div class="page-number">
|
|
|
+ <div class="page-number-text">1</div>
|
|
|
+ <div class="page-number-text">2</div>
|
|
|
+ <div class="page-number-text">3</div>
|
|
|
+ <div class="page-number-text">4</div>
|
|
|
+ </div>
|
|
|
+ <img class="right-head" src="../static/img/anniversaryCelebrate/right-head.png" />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <img class="distribution-close" src="../static/img/anniversaryCelebrate/close.png" />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<script>
|
|
|
toastr.options.positionClass = 'toast-center-center';
|
|
@@ -206,7 +297,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://14.18.190.141:1280'
|
|
|
+ var baseUrl = 'http://192.168.31.198'
|
|
|
let timer,flag = true;
|
|
|
var url = window.location.href;
|
|
|
url = url.split('/')
|
|
@@ -229,12 +320,14 @@
|
|
|
notReceive = true,
|
|
|
phoneRemainQuantity = 0,
|
|
|
totalTime = 0,
|
|
|
+ receivedDuration = 0,
|
|
|
+ totalRewardDuration = 0,
|
|
|
currTotalTime = 0,
|
|
|
distributionList = [],
|
|
|
totalRecords = [],
|
|
|
pageNums = 0,
|
|
|
distributionFlag = true,
|
|
|
- distributionPageNum = 0,
|
|
|
+ distributionPageNum = 1,
|
|
|
distributionPages = 0,
|
|
|
sliderNumber = 0,//滑块是数量,控制溢出不能滑动
|
|
|
isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
|
|
@@ -265,6 +358,17 @@
|
|
|
residueDegree = res.data.residueDegree;
|
|
|
anniversarySwitch = res.data.anniversarySwitch;
|
|
|
result = res.data.lighten;
|
|
|
+ totalTime = res.data.notReceivedDuration;
|
|
|
+ receivedDuration = res.data.receivedDuration;
|
|
|
+ totalRewardDuration = res.data.totalRewardDuration;
|
|
|
+ $('.all-time').eq(0).text(totalRewardDuration);
|
|
|
+ $('.get-time').eq(0).text(receivedDuration);
|
|
|
+ $('.no-distribution').eq(0).text(totalTime);
|
|
|
+ if(totalTime > 999){
|
|
|
+ $('.no-distribution-award').eq(0).text('999+');
|
|
|
+ } else {
|
|
|
+ $('.no-distribution-award').eq(0).text(totalTime);
|
|
|
+ }
|
|
|
lighten = result && result.split(',') || [], str = '';
|
|
|
$('.rest-number').eq(0).text(residueDegree);
|
|
|
$('.light-number').eq(0).text(res.data.allTotal);
|
|
@@ -310,7 +414,7 @@
|
|
|
},
|
|
|
})
|
|
|
};
|
|
|
- // getAward();
|
|
|
+ getAward();
|
|
|
//点击抽奖
|
|
|
$('.once-btn')[0].addEventListener('click',() => {
|
|
|
if(!animationFlag) return;
|
|
@@ -455,6 +559,7 @@
|
|
|
$('.award-result-wrap').eq(0).append(str);
|
|
|
init();
|
|
|
}else{
|
|
|
+ animationFlag = true;
|
|
|
stopManyClick(() =>{
|
|
|
toastr.error(res.msg)
|
|
|
})
|
|
@@ -486,24 +591,25 @@
|
|
|
getAward();
|
|
|
$('.get-award-img')[0].src = '../static/img/anniversaryCelebrate/get-award-show.png';
|
|
|
$('.get-award-img')[1].src = '../static/img/anniversaryCelebrate/get-award-success-hidden.png';
|
|
|
+ $('.reward-list').eq(0).css('display', 'none');
|
|
|
$('.award-img').eq(1).css('display', 'none');
|
|
|
$('.award-img').eq(0).css('display', 'block');
|
|
|
- $('.record-main-wrap')[0].className = 'record-main-wrap';
|
|
|
+ $('.light-content-container').eq(0).css('display', 'block');
|
|
|
+ $('.selected-bg')[0].src = '../static/img/anniversaryCelebrate/right-selected.png';
|
|
|
$('.get-award-text')[1].className = 'get-award-text used-text';
|
|
|
$('.get-award-text')[0].className = 'get-award-text';
|
|
|
},false);
|
|
|
$('.get-award-wrap')[1].addEventListener('click',(e) => {
|
|
|
- $('.light-content-list').eq(0).empty();
|
|
|
- pageNum = 1;
|
|
|
+ $('.reward-list').eq(0).css('display', 'block');
|
|
|
+ $('.light-content-container').eq(0).css('display', 'none');
|
|
|
+ pageNums = 1;
|
|
|
pages = 0;
|
|
|
- receive = 1;
|
|
|
- recordFlag = true;
|
|
|
- getAward();
|
|
|
+ getLists();
|
|
|
$('.get-award-img')[0].src = '../static/img/anniversaryCelebrate/get-award-hidden.png';
|
|
|
$('.get-award-img')[1].src = '../static/img/anniversaryCelebrate/get-award-success-show.png';
|
|
|
$('.award-img').eq(0).css('display', 'none');
|
|
|
$('.award-img').eq(1).css('display', 'block');
|
|
|
- $('.record-main-wrap')[0].className = 'record-main-wrap record-main-active-wrap';
|
|
|
+ $('.selected-bg')[0].src = '../static/img/anniversaryCelebrate/left-selected.png';
|
|
|
$('.get-award-text')[0].className = 'get-award-text used-text';
|
|
|
$('.get-award-text')[1].className = 'get-award-text';
|
|
|
},false);
|
|
@@ -538,11 +644,7 @@
|
|
|
$('.title-row').eq(0).css('display', 'flex');
|
|
|
}
|
|
|
for (var i = 0; i < records.length; i++) {
|
|
|
- str += `<div class="light-content-wrap">
|
|
|
- <div class="light-content-text">获得星曜${records[i].awardDurations}天时长</div>
|
|
|
- <div class="light-content-time" >${records[i].createTime.substr(6)}</div>
|
|
|
- <div class="get-btn ${records[i].receive === 1 ? 'btn-active' : ''}" data-awardid=${records[i].id} data-day=${records[i].day}>领取</div>
|
|
|
- </div>`
|
|
|
+ str += `<div class="light-content-text">点亮一颗星获得星曜${records[i].awardDurations}天时长奖励</div>`
|
|
|
}
|
|
|
$('.light-content-list').eq(0).append(str)
|
|
|
}else{
|
|
@@ -637,38 +739,28 @@
|
|
|
}
|
|
|
});
|
|
|
// 活动获取用户云机列表,分页
|
|
|
- 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;
|
|
|
+ if(sliderLen != 0 && sliderLen >= sliderNumber){
|
|
|
+ return
|
|
|
+ }
|
|
|
+ $.ajax({
|
|
|
+ url: baseUrl + '/api/resources/v5/client/disk/info/anniversary/usercard',
|
|
|
+ type: 'get',
|
|
|
+ data: {
|
|
|
+ pageNum: pageNums,
|
|
|
+ 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.list;
|
|
|
totalRecords = [...totalRecords, ...records];
|
|
|
if(records.length === 0){
|
|
|
$('.page-row').eq(0).css('display','none');
|
|
@@ -677,145 +769,323 @@
|
|
|
return
|
|
|
}
|
|
|
if(res.data && records.length > 0){
|
|
|
- sliderNumber = res.data.userCardPage.pages;
|
|
|
+ sliderNumber = res.data.pages;
|
|
|
let sliderItemText = $('.slider-item').eq(pageNums).text();
|
|
|
- var str = '',
|
|
|
+ let str = '',
|
|
|
+ strs = '',
|
|
|
len = records.length;
|
|
|
for (var i = 0; i < len; i++) {
|
|
|
// 解决ios时间显示为NaN
|
|
|
+ now = '2021-11-11 12:22:22'
|
|
|
// var now = res.data.now.replace(/T/g, ' ');
|
|
|
- // now = now.replace(/\-/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)),
|
|
|
+ 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 + "时",
|
|
|
+ resultTime = closeTime - currTime,
|
|
|
+ day = parseInt(resultTime / 1000 / 60 / 60 / 24),
|
|
|
+ hour = parseInt(resultTime / 1000 / 60 / 60 % 24),
|
|
|
+ time = day + "天" + hour + "时",
|
|
|
recordsId = records[i].id;
|
|
|
- // if(day == 0 && hour <= 0){
|
|
|
- // time = '已过期';
|
|
|
- // }
|
|
|
+ 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" />
|
|
|
+ <img class="icon_xingyao" src="../static/img/anniversaryCelebrate/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" />
|
|
|
+ <img class="time-icon" src="../static/img/anniversaryCelebrate/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" />
|
|
|
+ <img class="compute-icon cut" data-id=${recordsId} data-index=${i} src="../static/img/anniversaryCelebrate/cut.png" />
|
|
|
+ <input class="ipt" data-id=${recordsId} data-index=${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/anniversaryCelebrate/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');
|
|
|
+ if(!sliderItemText){
|
|
|
+ $('#slider-list').append(sliderItemDom);
|
|
|
+ }else{
|
|
|
+ return
|
|
|
+ }
|
|
|
$('.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 < sliderNumber; i++) {
|
|
|
+ strs += `<div class="page-number-text">${i + 1}</div>`
|
|
|
}
|
|
|
+ $('.page-number').eq(0).append(strs)
|
|
|
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);
|
|
|
- // }
|
|
|
+ console.log(i)
|
|
|
+ $('.ipt')[i].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();
|
|
|
+ console
|
|
|
+ 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.userCardId == id)){
|
|
|
+ distributionList.push({
|
|
|
+ userCardId: id,
|
|
|
+ duration: +value
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ distributionList = distributionList.filter(item => item.userCardId != id);
|
|
|
+ }
|
|
|
+ distributionList = distributionList.filter(item => item.duration != 0);
|
|
|
+ }else{
|
|
|
+ if(!distributionList.find((item) => item.userCardId == id)){
|
|
|
+ distributionList.push({
|
|
|
+ userCardId: id,
|
|
|
+ duration: Math.abs(value)
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ distributionList.map(item => {
|
|
|
+ if (item.userCardId == 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.userCardId == 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);
|
|
|
- // })
|
|
|
- // }
|
|
|
- // }
|
|
|
- // })
|
|
|
+ } else {
|
|
|
+ stopManyClick(() => {
|
|
|
+ toastr.error(res.msg);
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
+ //点击加号
|
|
|
+ $('.slider-list')[0].addEventListener('click',(e) => {
|
|
|
+ if(e.target.className === 'compute-icon add'){
|
|
|
+ const id = e.target.dataset.id;
|
|
|
+ let currTotalTime = 0;
|
|
|
+ let index = e.target.dataset.index;
|
|
|
+ let number = $('.ipt').eq(index).val();
|
|
|
+ // 这一次操作
|
|
|
+ if(number == 0){
|
|
|
+ if(!distributionList.find((item) => item.userCardId == id)){
|
|
|
+ distributionList.push({
|
|
|
+ userCardId: id,
|
|
|
+ duration: +number + 1
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ distributionList.map(item => {
|
|
|
+ if(item.userCardId == id){
|
|
|
+ item.duration++;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ distributionList.map(item => {
|
|
|
+ if(item.userCardId == id){
|
|
|
+ item.duration++;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ distributionList.map(item => { // 这一次的总数据
|
|
|
+ currTotalTime += parseInt(item.duration);
|
|
|
+ })
|
|
|
+ console.log(currTotalTime)
|
|
|
+ console.log(totalTime)
|
|
|
+ if(currTotalTime <= totalTime){
|
|
|
+ number++;
|
|
|
+ $('.ipt').eq(index).val(number);
|
|
|
+ }else{
|
|
|
+ distributionList.map(item => {
|
|
|
+ if(item.userCardId == id){
|
|
|
+ item.duration = +number;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ stopManyClick(() => {
|
|
|
+ toastr.error('分配时长不能大于未分配总时长');
|
|
|
+ })
|
|
|
+ }
|
|
|
+ console.log(distributionList)
|
|
|
+ }
|
|
|
+ });
|
|
|
+ //点击减号
|
|
|
+ $('.slider-list')[0].addEventListener('click',(e) => {
|
|
|
+ if(e.target.className === 'compute-icon cut'){
|
|
|
+ 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){
|
|
|
+ distributionList.map(item => {
|
|
|
+ if(item.userCardId == id){
|
|
|
+ item.duration--;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ number--;
|
|
|
+ if(number == 0){
|
|
|
+ distributionList = distributionList.filter(item => item.userCardId != id);
|
|
|
+ }
|
|
|
+ currTotalTime--;
|
|
|
+ $('.ipt').eq(index).val(number);
|
|
|
+ }else{
|
|
|
+ stopManyClick(() => {
|
|
|
+ toastr.error('分配的时长不能小于0');
|
|
|
+ })
|
|
|
+ }
|
|
|
+ console.log(distributionList)
|
|
|
+ }
|
|
|
+ });
|
|
|
+ //点击分配时长按钮
|
|
|
+ $('.distribution-reward-btn')[0].addEventListener('click', (e) => {
|
|
|
+ distributionList = distributionList.filter(item => item.duration != 0);
|
|
|
+ if (distributionList.length === 0) {
|
|
|
+ stopManyClick(() => {
|
|
|
+ toastr.error('未选中任何云手机');
|
|
|
+ })
|
|
|
+ } 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-sure')[0].addEventListener('click', (e) => {
|
|
|
+ $.ajax({
|
|
|
+ url: baseUrl + '/api/activity/v1/anniversary/receive',
|
|
|
+ type: 'post',
|
|
|
+ data: JSON.stringify({
|
|
|
+ userCards: distributionList
|
|
|
+ }),
|
|
|
+ headers: {
|
|
|
+ 'Authorization': id //id
|
|
|
+ },
|
|
|
+ contentType: "application/json",
|
|
|
+ dataType: 'json',
|
|
|
+ cache: false,
|
|
|
+ success: function (res) {
|
|
|
+ if(res.status === 0){
|
|
|
+ operate('dt_双旦_h5_分配奖励_确定');
|
|
|
+ $('.sure-distribution-wrap').eq(0).css('display', 'none');
|
|
|
+ getLists();
|
|
|
+ distributionPageNum = 1;
|
|
|
+ $('.time-row-data').eq(0).text('');
|
|
|
+ distributionList.map((val) => {
|
|
|
+ totalRecords.map((item, indexs) => {
|
|
|
+ if(val.userCardId == item.id){
|
|
|
+ $('.ipt').eq(indexs).val(0);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ distributionList = [];
|
|
|
+ stopManyClick(() => {
|
|
|
+ toastr.error('分配成功,请前往云机列表查看');
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ stopManyClick(() => {
|
|
|
+ toastr.error(res.msg);
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ })
|
|
|
+ });
|
|
|
+ //点击分配时长记录
|
|
|
+ $('.distribution-time-Record')[0].addEventListener('click', (e) => {
|
|
|
+ $('.distribution-time-dialog').animate({top: '4.86rem'},"fast");
|
|
|
+ $('.distribution-time-mask').show();
|
|
|
+ document.documentElement.style.overflow='hidden';
|
|
|
+ $('.distribution-list').eq(0).empty();
|
|
|
+ $.ajax({
|
|
|
+ url: baseUrl + '/api/activity/v1/anniversary/receiveData',
|
|
|
+ type: 'get',
|
|
|
+ headers: {
|
|
|
+ 'Authorization': id //id
|
|
|
+ },
|
|
|
+ data: {
|
|
|
+ pageNum: distributionPageNum,
|
|
|
+ pageSize: 10,
|
|
|
+ phoneType: 'SVIP'
|
|
|
+ },
|
|
|
+ contentType: "application/json",
|
|
|
+ dataType: 'json',
|
|
|
+ cache: false,
|
|
|
+ success: function (res) {
|
|
|
+ if(res.status === 0){
|
|
|
+ let records = res.data.records, str = '', strs = '';
|
|
|
+ for (var i = 0; i < records.length; i++) {
|
|
|
+ str += `<div class="distribution-content-wrap">
|
|
|
+ <div class="distribution-content-name">${records[i].diskName}</div>
|
|
|
+ <div class="distribution-content-name distribution-time-text">${records[i].createTime}</div>
|
|
|
+ <div class="distribution-content-name">${records[i].receiveDurations}天</div>
|
|
|
+ </div>`
|
|
|
+ }
|
|
|
+ $('.distribution-list').eq(0).append(str)
|
|
|
+ for (var i = 0; i < 4; i++) {
|
|
|
+ strs += `<div class="page-number-text">${i}</div>`
|
|
|
+ }
|
|
|
+ console.log(strs)
|
|
|
+ $('.page-number').eq(1).append(strs)
|
|
|
+ }else{
|
|
|
+ stopManyClick(() =>{
|
|
|
+ toastr.error(res.msg)
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ })
|
|
|
+ });
|
|
|
+ //点击分配时长关闭按钮
|
|
|
+ $('.distribution-close')[0].addEventListener('click',() => {
|
|
|
+ $('.distribution-time-dialog').animate({top: '-10.96rem'},"fast");
|
|
|
+ $('.distribution-time-mask').hide();
|
|
|
+ document.documentElement.style.overflow='auto';
|
|
|
+ },false);
|
|
|
//获取云机数量
|
|
|
getPhoneNumber();
|
|
|
function getPhoneNumber(){
|