Browse Source

应用推荐迁移到ios

heyang 2 years ago
parent
commit
148bb9f05d

+ 2 - 2
static/screenAndroid/WXtrialInterface.html

@@ -1507,7 +1507,7 @@
 
       //点击了关闭按钮
       $('.apply-close')[0].addEventListener('click',() => {
-        localStorage.setItem('isShowRecommend', false);
+        localStorage.setItem('isShowRecommend', true);
         $('.apply-wrap').eq(0).hide();
       })
 
@@ -1529,6 +1529,7 @@
 
       // 点击了续时长
       $('.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
@@ -1538,7 +1539,6 @@
             url: '/pages/order/renew?record=' + userCardId
           })
         }
-        
       })
 
       //广告信息

+ 170 - 0
static/screenIos/WXtrialInterface.html

@@ -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()方法不能异步调用。

+ 157 - 1
static/screenIos/css/WXtrialInterface.css

@@ -517,7 +517,10 @@ textarea {
 
 .try-use-wrap,
 .buy-phone-wrap,
-.look-wrap {
+.look-wrap,
+.apply-wrap,
+.time-lang-wrap,
+.countdown-wrap {
   width: 100%;
   height: 100%;
   position: fixed;
@@ -528,6 +531,65 @@ textarea {
   display: none;
 }
 
+.time-lang-container, .countdown-container{
+  width: 80%;
+  height: 326px;
+  position: absolute;
+  top: 50%;
+  left: 50%;
+  transform: translate(-50%, -50%);
+  background-color: #ffffff;
+  border-radius: 0.66em;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+}
+
+.time-lang-img, .countdown-img{
+  width: 104px;
+  height: 140px;
+}
+
+.time-lang-title, .countdown-title{
+  margin-top: 0.34rem;
+  font-size: 18px;
+  font-weight: 600;
+  color: #363636;
+}
+
+.time-lang-tip, .countdown-tip{
+  margin-top: 0.28rem;
+  font-size: 14px;
+  color: #757580;
+}
+
+.countdown-tip2{
+  margin-top: 0.16rem;
+  font-size: 14px;
+  color: #757580;
+}
+
+.countdown-time{
+  color: #00DB88;
+}
+
+.time-lang-btn, .countdown-btn{
+  width: 244px;
+  height: 50px;
+  line-height: 50px;
+  text-align: center;
+  margin: auto;
+  margin-top: 44px;
+  background: linear-gradient(90deg, #00A3FF 0%, #04F79A 100%);
+  border-radius: 8px;
+  font-size: 12px;
+  color: #FFFFFF;
+}
+
+.countdown-btn{
+  margin-top: 24px;
+}
+
 .try-use-container {
   width: 80%;
   height: 409px;
@@ -539,6 +601,100 @@ textarea {
   border-radius: 0.66em;
 }
 
+.apply-container{
+  width: 80%;
+  height: 419px;
+  position: absolute;
+  top: 50%;
+  left: 50%;
+  transform: translate(-50%, -50%);
+  background-color: #ffffff;
+  border-radius: 0.66em;
+}
+
+.apply-title{
+  text-align: center;
+  margin-top: 0.34rem;
+  font-size: 16px;
+  font-weight: 500;
+  color: #363636;
+}
+
+.apply-list{
+  height: 290px;
+  margin-top: 16px;
+}
+
+.apply-item{
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  padding: 0 18px;
+  margin-top: 16px;
+}
+
+.apply-item:first-child {
+  margin: 0;
+}
+
+.apply-img {
+  width: 36px;
+  height: 36px;
+  border-radius: 10px;
+}
+
+.apply-row{
+  flex: 1;
+  margin-left: 10px;
+}
+
+.apply-row-title{
+  width: 140px;
+  overflow:hidden; 
+  text-overflow:ellipsis;
+  white-space:nowrap;
+  font-size: 16px;
+  color: #363636;
+}
+
+.apply-row-down{
+  font-size: 12px;
+  color: #757580;
+}
+
+.apply-down-btn{
+  width: 68px;
+  height: 30px;
+  line-height: 30px;
+  text-align: center;
+  background: linear-gradient(90deg, #00A3FF 0%, #04F79A 100%);
+  border-radius: 8px;
+  font-size: 12px;
+  color: #FFFFFF;
+}
+
+.apply-list-change{
+  width: 244px;
+  height: 50px;
+  line-height: 50px;
+  text-align: center;
+  margin: auto;
+  margin-top: 14px;
+  background: linear-gradient(225deg, #FF62F8 0%, #FF9D5C 100%);
+  border-radius: 8px;
+  font-size: 12px;
+  color: #FFFFFF;
+}
+
+.apply-close {
+  width: 1.875rem;
+  height: 1.875rem;
+  position: absolute;
+  bottom: -3.2em;
+  left: 50%;
+  transform: translateX(-50%);
+}
+
 .time-close-wrap {
   width: 5.46em;
   height: 2em;

BIN
static/screenIos/img/close.png


BIN
static/screenIos/img/countdown.png


BIN
static/screenIos/img/smallBell.png