|
@@ -265,7 +265,7 @@
|
|
|
<img class="countdown-img" src="img/countdown.png" />
|
|
|
<div class="countdown-title">计费规则</div>
|
|
|
<div class="countdown-tip">进入云机开始计时,下线停止计时</div>
|
|
|
- <div class="countdown-tip2">云机时长剩余:<span class="countdown-time">00:00:00</span></div>
|
|
|
+ <div class="countdown-tip2">云机时长剩余:<span class="countdown-time"></span></div>
|
|
|
<div class="countdown-btn">我知道了</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -304,7 +304,8 @@
|
|
|
<script>
|
|
|
var url = window.location.href;
|
|
|
url = url.split('/');
|
|
|
- var baseUrl = url[0] + '//' + url[2];
|
|
|
+ //var baseUrl = url[0] + '//' + url[2];
|
|
|
+ var baseUrl = 'https://prese.phone.androidscloud.com'
|
|
|
|
|
|
var parameters = GetRequest();
|
|
|
var token = parameters['token'];
|
|
@@ -1411,33 +1412,66 @@
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ var residueTimer = null;
|
|
|
// 获取云机剩余时长
|
|
|
function getResidueTime() {
|
|
|
+ let value = localStorage.getItem('isShowRecommend');
|
|
|
+ if(value) {
|
|
|
+ return
|
|
|
+ }
|
|
|
return $.ajax({
|
|
|
url: baseUrl + `/api/resources/yearMember/getResidueTime?userCardId=${userCardId}`,
|
|
|
headers: {
|
|
|
- Authorization: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyYW5kb20iOiIyNzg0NyIsImNsaWVudCI6IjUiLCJleHAiOjE2NjQzMTgwMjEsInVzZXJuYW1lX2FwcGxldCI6InFIZkFmMTYzMTg0NzM3OCJ9.KsMHvyiNOyvkx8vk1h3T2-ZU38-GaCxlLPDwZv0xTqQ',
|
|
|
+ Authorization: token,
|
|
|
},
|
|
|
-
|
|
|
type: 'get',
|
|
|
dataType: 'json',
|
|
|
contentType: 'application/json;charset=UTF-8',
|
|
|
}).then(function (res) {
|
|
|
if (res.status === 0) {
|
|
|
- console.log(res);
|
|
|
+ let time = res.data;
|
|
|
$('.countdown-wrap').eq(0).show();
|
|
|
+ residueTimer = setInterval(() => {
|
|
|
+ time--;
|
|
|
+ showTime = getResultTime(time);
|
|
|
+ $('.countdown-time').eq(0).text(showTime);
|
|
|
+ }, 1000)
|
|
|
} else {
|
|
|
return Promise.reject(new Error(res.msg));
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ // 秒转化为时分秒
|
|
|
+ function getResultTime(time) {
|
|
|
+ let theTime = parseInt(time);// 秒
|
|
|
+ let theTime1 = 0;// 分
|
|
|
+ let theTime2 = 0;// 小时
|
|
|
+
|
|
|
+ if(theTime > 60) {
|
|
|
+ theTime1 = parseInt(theTime/60);
|
|
|
+ theTime = parseInt(theTime%60);
|
|
|
+
|
|
|
+ if(theTime1 > 60) {
|
|
|
+ theTime2 = parseInt(theTime1/60);
|
|
|
+ theTime1 = parseInt(theTime1%60);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let result = '' + parseInt(theTime);
|
|
|
+ if(theTime1 > 0) {
|
|
|
+ result = '' + parseInt(theTime1) + ':' + result;
|
|
|
+ }
|
|
|
+ if(theTime2 > 0) {
|
|
|
+ result = '' + parseInt(theTime2) + ':' + result;
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
// 推荐列表
|
|
|
function getRecommend() {
|
|
|
return $.ajax({
|
|
|
url: baseUrl + `/api/public/v1/market/get/recommend?userCardId=${userCardId}`,
|
|
|
headers: {
|
|
|
- Authorization: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyYW5kb20iOiIyNzg0NyIsImNsaWVudCI6IjUiLCJleHAiOjE2NjQzMTgwMjEsInVzZXJuYW1lX2FwcGxldCI6InFIZkFmMTYzMTg0NzM3OCJ9.KsMHvyiNOyvkx8vk1h3T2-ZU38-GaCxlLPDwZv0xTqQ',
|
|
|
+ Authorization: token,
|
|
|
},
|
|
|
|
|
|
type: 'get',
|
|
@@ -1469,6 +1503,7 @@
|
|
|
|
|
|
//点击了关闭按钮
|
|
|
$('.apply-close')[0].addEventListener('click',() => {
|
|
|
+ localStorage.setItem('isShowRecommend', false);
|
|
|
$('.apply-wrap').eq(0).hide();
|
|
|
})
|
|
|
|
|
@@ -1484,6 +1519,7 @@
|
|
|
// 点击了我知道了
|
|
|
$('.countdown-btn')[0].addEventListener('click',() => {
|
|
|
$('.countdown-wrap').eq(0).hide();
|
|
|
+ clearInterval(residueTimer);
|
|
|
getRecommend();
|
|
|
})
|
|
|
|