|
@@ -220,6 +220,45 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <div class="apply-wrap">
|
|
|
+ <div class="apply-container">
|
|
|
+ <div class="apply-title">应用推荐</div>
|
|
|
+ <div class="apply-list"></div>
|
|
|
+ <div class="apply-list-change">换一批</div>
|
|
|
+ <img
|
|
|
+ class="apply-close"
|
|
|
+ src="img/close.png"
|
|
|
+ alt=""
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="time-lang-wrap">
|
|
|
+ <div class="time-lang-container">
|
|
|
+ <img class="time-lang-img" src="img/smallBell.png" />
|
|
|
+ <div class="time-lang-title">本月时长已用完</div>
|
|
|
+ <div class="time-lang-tip">您可以去购买时长页面进行购买</div>
|
|
|
+ <div class="time-lang-btn">续时长</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="countdown-wrap">
|
|
|
+ <div class="countdown-container">
|
|
|
+ <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"></span></div>
|
|
|
+ <div class="countdown-btn">我知道了</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <script type="text/html" id="apply">
|
|
|
+ <div class="apply-item">
|
|
|
+ <img class="apply-img" src="{{imageUrl}}" />
|
|
|
+ <div class="apply-row">
|
|
|
+ <div class="apply-row-title">{{filename}}</div>
|
|
|
+ <div class="apply-row-down">{{installNum}}</div>
|
|
|
+ </div>
|
|
|
+ <div class="apply-down-btn" data-url="{{downloadUrl}}">下载</div>
|
|
|
+ </div>
|
|
|
+ </script>
|
|
|
<script
|
|
|
type="text/javascript"
|
|
|
src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"
|
|
@@ -585,6 +624,7 @@
|
|
|
}
|
|
|
|
|
|
initAD();
|
|
|
+ getResidueTime();
|
|
|
$.alert({
|
|
|
title: '提示',
|
|
|
text: '开始使用云手机',
|
|
@@ -1333,6 +1373,136 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ 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: token,
|
|
|
+ },
|
|
|
+ type: 'get',
|
|
|
+ dataType: 'json',
|
|
|
+ contentType: 'application/json;charset=UTF-8',
|
|
|
+ }).then(function (res) {
|
|
|
+ if (res.status === 0) {
|
|
|
+ let time = res.data;
|
|
|
+ $('.countdown-wrap').eq(0).show();
|
|
|
+ residueTimer = setInterval(() => {
|
|
|
+ time--;
|
|
|
+ if(time < 0) {
|
|
|
+ $('.apply-wrap').eq(0).hide();
|
|
|
+ $('.countdown-wrap').eq(0).hide();
|
|
|
+ $('.time-lang-wrap').eq(0).show();
|
|
|
+ }
|
|
|
+ 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: token,
|
|
|
+ },
|
|
|
+
|
|
|
+ type: 'get',
|
|
|
+ dataType: 'json',
|
|
|
+ contentType: 'application/json;charset=UTF-8',
|
|
|
+ }).then(function (res) {
|
|
|
+ if (res.status === 0) {
|
|
|
+ $('.apply-wrap').eq(0).show();
|
|
|
+ let list = res.data;
|
|
|
+ let result = '';
|
|
|
+ list.map(item => {
|
|
|
+ item.installNum = `有${item.installNum}人下载`
|
|
|
+ result += $('#apply').text().replace(/{{(.*?)}}/g, function(node, key) {
|
|
|
+ return item[key];
|
|
|
+ })
|
|
|
+ })
|
|
|
+ $('.apply-list').eq(0).append(result)
|
|
|
+ } else {
|
|
|
+ return Promise.reject(new Error(res.msg));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //点击了换一批
|
|
|
+ $('.apply-list-change')[0].addEventListener('click',() => {
|
|
|
+ $('.apply-list').eq(0).empty();
|
|
|
+ getRecommend();
|
|
|
+ })
|
|
|
+
|
|
|
+ //点击了关闭按钮
|
|
|
+ $('.apply-close')[0].addEventListener('click',() => {
|
|
|
+ localStorage.setItem('isShowRecommend', true);
|
|
|
+ $('.apply-wrap').eq(0).hide();
|
|
|
+ })
|
|
|
+
|
|
|
+ // 点击下载按钮
|
|
|
+ $('.apply-wrap')[0].addEventListener('click',(e)=>{
|
|
|
+ let downloadUrl = e.target.dataset.url;
|
|
|
+ let className = e.target.className;
|
|
|
+ if(className === 'apply-down-btn'){
|
|
|
+ window.location.href = downloadUrl;
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ // 点击了我知道了
|
|
|
+ $('.countdown-btn')[0].addEventListener('click',() => {
|
|
|
+ $('.countdown-wrap').eq(0).hide();
|
|
|
+ clearInterval(residueTimer);
|
|
|
+ getRecommend();
|
|
|
+ })
|
|
|
+
|
|
|
+ // 点击了续时长
|
|
|
+ $('.time-lang-btn')[0].addEventListener('click',() => {
|
|
|
+ $('.time-lang-wrap').eq(0).hide();
|
|
|
+ if (window.__wxjs_environment === 'miniprogram') {
|
|
|
+ wx.miniProgram.navigateTo({
|
|
|
+ url:`/packageA/order/renew/index?record=` + userCardId
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ uni.webView.navigateTo({
|
|
|
+ url: '/pages/order/renew?record=' + userCardId
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
/**
|
|
|
* 初始化广告
|
|
|
* 因移动端video无法自动播放,play()方法不能异步调用。
|