Bladeren bron

首页无网络,签到展示更新

pansl 2 jaren geleden
bovenliggende
commit
43317e341e
8 gewijzigde bestanden met toevoegingen van 402 en 294 verwijderingen
  1. 2 2
      src/api/config.js
  2. 21 11
      src/api/index.js
  3. BIN
      src/assets/imgs/no_network.png
  4. 110 97
      src/assets/less/index.less
  5. 4 4
      src/manifest.json
  6. 110 83
      src/views/Activity/index.ux
  7. 40 13
      src/views/Index/index.ux
  8. 115 84
      src/views/Pay/index.ux

+ 2 - 2
src/api/config.js

@@ -6,8 +6,8 @@
  * @Description: api配置文件
  */
 const apiConfig = {
-  // baseURL: 'https://quickapp.leyuee.com/api',
-   baseURL: "https://quickapponlinetest2.leyuee.com/api", //online地址
+  baseURL: 'https://quickapp.leyuee.com/api',
+  //  baseURL: "https://quickapponlinetest2.leyuee.com/api", //online地址
   // baseURL:"https://quickapptestnew.leyuee.com/api",
   //baseURL: "https://quickapptest.leyuee.com/api",
   package: 'com.beidao.kuaiying.quanwang'

+ 21 - 11
src/api/index.js

@@ -232,45 +232,55 @@ export const logOff = () => {
 
 //腾讯广告书籍替换
 export const noAdvBookInfo = (send_order_id) => {
-  return fly.get(`/txAdqNew/noAdvBookInfo`,{send_order_id:send_order_id})
+  return fly.get(`/txAdqNew/noAdvBookInfo`, { send_order_id: send_order_id })
 }
 
 //阅读返回书籍推荐
 export const recommendBooks = (bid) => {
-  return fly.get(`/books/recommend_books`,{bid:bid})
+  return fly.get(`/books/recommend_books`, { bid: bid })
 }
 
 //推荐书籍点击次数
 export const clickRecommendBooks = (bid) => {
-  return fly.get(`/books/clickRecommendBooks`,{bid:bid})
+  return fly.get(`/books/clickRecommendBooks`, { bid: bid })
 }
 
 //轮播图和弹窗点击统计
 export const clickBanner = (id) => {
-  return fly.get(`/books/clickRecommendBooks`,{bid:bid})
+  return fly.get(`/books/clickRecommendBooks`, { bid: bid })
 }
 
 // 获取可用促销活动
 export const getPopp = () => {
-  return fly.get(`/books/clickRecommendBooks`,{bid:bid})
+  return fly.get(`/books/clickRecommendBooks`, { bid: bid })
 }
 
 // 充值成功回调参数
 export const advertOrders = (order) => {
-  return fly.get(`/books/advertOrders`,{order_id:order})
+  return fly.get(`/books/advertOrders`, { order_id: order })
 }
 
 // 获取轮播图弹窗参数 1为男频,2为女频,3为书架,4为弹窗,5为充值页返回广告
 export const getBannerData = (release_type) => {
-  return fly.get(`/books/recommendBanners`,{release_type:release_type})
+  return fly.get(`/books/recommendBanners`, { release_type: release_type })
 }
 
 // banner弹窗等广告点击统计
-export const checkAdvertisement = (type,id) => {
-  return fly.get(`/books/checkAdvertisement`,{type:type,ids:id})
+export const checkAdvertisement = (type, id) => {
+  return fly.get(`/books/checkAdvertisement`, { type: type, ids: id })
 }
 
 // 广告替换书籍
 export const advReplaceBookInfo = (send_order_id) => {
-  return fly.get("advReplaceBookInfo", { send_order_id: send_order_id});
-}
+  return fly.get("advReplaceBookInfo", { send_order_id: send_order_id });
+}
+
+// 是否有可领取任务(包括未签到)
+/**
+ * 
+ * @param {*} params:{type:home(包含去完成状态) recharge(不包含去完成状态)} 
+ * @returns 
+ */
+export const hasPendingTask = (params) => {
+  return fly.get("/user/hasPendingTask", { ...params });
+}

BIN
src/assets/imgs/no_network.png


+ 110 - 97
src/assets/less/index.less

@@ -1,115 +1,128 @@
 .index-wrap {
-  flex-direction: column;
-
-  .fixed-tabbar {
     flex-direction: column;
-
-    .tabbar-item__wrap {
-      height: 120px;
-      flex-shrink: 0;
-      background-color: #fff;
+    .fixed-tabbar {
+        flex-direction: column;
+        .tabbar-item__wrap {
+            height: 120px;
+            flex-shrink: 0;
+            background-color: #fff;
+        }
+        .tabbar-item {
+            flex: 1;
+            flex-direction: column;
+            justify-content: center;
+            align-items: center;
+            image {
+                width: 46px;
+            }
+            text {
+                color: #333333;
+                font-size: 24px;
+            }
+        }
     }
-
-    .tabbar-item {
-      flex: 1;
-      flex-direction: column;
-      justify-content: center;
-      align-items: center;
-
-      image {
-        width: 46px;
-      }
-
-      text {
-        color: #333333;
-        font-size: 24px;
-      }
+    .tab-content {
+        flex: 1;
     }
-  }
-
-  .tab-content {
-    flex: 1;
-  }
 }
 
 .stack-popup {
-  background-color: rgba(0, 0, 0, 0.6);
-  width: 100%;
-  height: 100%;
-  justify-content: center;
-  align-items: center;
-
-  .customer-popup {
-    width: 600px;
-    border-radius: 6px;
-    background-color: #fff;
-    flex-direction: column;
+    background-color: rgba(0, 0, 0, 0.6);
+    width: 100%;
+    height: 100%;
+    justify-content: center;
     align-items: center;
-
-    .title {
-      width: 100%;
-      font-size: 30px;
-      text-align: center;
-      color: #333;
-      line-height: 104px;
-      border-bottom: 2px solid #f7f7f7;
-    }
-    .desc {
-      margin: 40px 80px;
-      font-size: 28px;
-      color: #666;
-      text-align: center;
-    }
-    image {
-      margin: 0 auto 10px;
-      width: 280px;
-      height: 280px;
-    }
-    .duplication {
-      margin-bottom: 40px;
-    }
-    .duplication-text {
-      font-size: 24px;
-    }
-    .duplication-button {
-      color: #ef5952;
-      border: 2px solid #ef5952;
-      padding: 2px 8px;
-      border-radius: 20px;
-      font-size: 20px;
-      margin-left: 10px;
+    .customer-popup {
+        width: 600px;
+        border-radius: 6px;
+        background-color: #fff;
+        flex-direction: column;
+        align-items: center;
+        .title {
+            width: 100%;
+            font-size: 30px;
+            text-align: center;
+            color: #333;
+            line-height: 104px;
+            border-bottom: 2px solid #f7f7f7;
+        }
+        .desc {
+            margin: 40px 80px;
+            font-size: 28px;
+            color: #666;
+            text-align: center;
+        }
+        image {
+            margin: 0 auto 10px;
+            width: 280px;
+            height: 280px;
+        }
+        .duplication {
+            margin-bottom: 40px;
+        }
+        .duplication-text {
+            font-size: 24px;
+        }
+        .duplication-button {
+            color: #ef5952;
+            border: 2px solid #ef5952;
+            padding: 2px 8px;
+            border-radius: 20px;
+            font-size: 20px;
+            margin-left: 10px;
+        }
     }
-  }
 }
+
 .sign-icon {
-  position: fixed;
-  width: 150px;
-  height: 150px;
-  right: 20px;
-  bottom: 340px;
+    position: fixed;
+    width: 150px;
+    height: 150px;
+    right: 20px;
+    bottom: 340px;
 }
+
 .mask {
-  position: fixed;
-  width: 100%;
-  height: 100%;
-  flex-direction: column;
-  z-index: 9999;
-  justify-content: center;
-  align-items: center;
-  background-color: rgba(0, 0, 0, 0.6);
-  .banner {
-    margin-top: -200px;
-    width: 600px;
-  }
-  .close-pop {
-    width: 70px;
-    height: 70px;
-    margin-top: 24px;
-  }
+    position: fixed;
+    width: 100%;
+    height: 100%;
+    flex-direction: column;
+    z-index: 9999;
+    justify-content: center;
+    align-items: center;
+    background-color: rgba(0, 0, 0, 0.6);
+    .banner {
+        margin-top: -200px;
+        width: 600px;
+    }
+    .close-pop {
+        width: 70px;
+        height: 70px;
+        margin-top: 24px;
+    }
 }
+
 .mode-text {
-  margin-left: 10px;
+    margin-left: 10px;
 }
+
 .modeimage {
-  padding: 10px;
+    padding: 10px;
 }
+
+.network-wrapper {
+    width: 100%;
+    height: 100%;
+    align-items: center;
+    justify-content: center;
+    flex-direction: column;
+    .network-img {
+        width: 200px;
+        object-fit: contain;
+    }
+    text {
+        margin-top: 15px;
+        margin-right: 50px;
+        text-align: center;
+    }
+}

+ 4 - 4
src/manifest.json

@@ -57,7 +57,7 @@
   "config": {
     "logLevel": "debug",
     "data": {
-      "yinsi_addr":"https://zhuishuyun.oss-cn-hangzhou.aliyuncs.com/qapp/privacy/shouyue-privacy.htm"
+      "yinsi_addr": "https://zhuishuyun.oss-cn-hangzhou.aliyuncs.com/qapp/privacy/shouyue-privacy.htm"
     }
   },
   "router": {
@@ -151,10 +151,10 @@
     "themeMode": 0,
     "pages": {
       "views/Index": {
-        "titleBarBackgroundColor":"#79BA70",
+        "titleBarBackgroundColor": "#79BA70",
         "titleBarText": "全网看书",
         "menuBarData": {
-          "menuBar": false
+          "menuBar": true
         },
         "titleBar": false
       },
@@ -311,4 +311,4 @@
       }
     }
   }
-}
+}

+ 110 - 83
src/views/Activity/index.ux

@@ -7,7 +7,9 @@
       ></image>
       <div class="contain">
         <text class="promotion-title" if="{{activity.isForever!='1'}}"
-          >活动时间:{{ activity.startTime.substring(0, 10) }} 至 {{ activity.endTime.substring(0, 10)}}</text>
+          >活动时间:{{ activity.startTime.substring(0, 10) }} 至
+          {{ activity.endTime.substring(0, 10) }}</text
+        >
         <div
           class="charge-item {{currentIdx==$idx?'charge-on':''}}"
           for="{{activity.products}}"
@@ -46,10 +48,14 @@
       </div>
       <div class="rule">
         <text class="rule-bd">活动说明</text>
-        <text>1.充值后书币到账可能有延迟,1小时内未到账请到个人中心联系客服</text>
+        <text
+          >1.充值后书币到账可能有延迟,1小时内未到账请到个人中心联系客服</text
+        >
         <text>2.未满18周岁的未成年人应在法定监护人同意后进行充值</text>
         <text>3.此充值为书币充值,1元=100书币</text>
-        <text>4.充值书币,鉴于网络服务性质特殊属于不宜退货商品,不适用无理由退换规定</text>
+        <text
+          >4.充值书币,鉴于网络服务性质特殊属于不宜退货商品,不适用无理由退换规定</text
+        >
       </div>
     </div>
     <!--  <div class="loading-wrap" if="showLoading">
@@ -111,7 +117,13 @@
 </template>
 <script>
 import { configWxPay, configAliPay } from '../../helper'
-import { getAcitivity, getUserInfo, checkWxOrder ,advertOrders} from '../../api'
+import {
+  getAcitivity,
+  getUserInfo,
+  checkWxOrder,
+  advertOrders,
+  hasPendingTask
+} from '../../api'
 import { getAppConfig, getToken } from '../../api/utils'
 import router from '@system.router'
 import prompt from '@system.prompt'
@@ -120,7 +132,8 @@ import storage from '@system.storage'
 export default {
   public: {
     token: '',
-     pay_back: 0,
+    pay_back: 0,
+    isPendingTask: false
   },
   private: {
     showPay: false,
@@ -129,20 +142,20 @@ export default {
     currentProduct: null,
     currentIdx: 0,
     showLoading: false,
-    pay_order_id:"",
-    trade_no:"",
+    pay_order_id: '',
+    trade_no: '',
     haslogin: '',
     loginPhone: '',
-    pay_success:false,
-    need_check_order:false,
+    pay_success: false,
+    need_check_order: false
   },
-    async onInit() {
+  async onInit() {
     // getAppConfig(this);
     this.getUserInfo()
     setTimeout(() => {
       this.getAcitvy()
     }, 1000)
- 
+
     getConfig = getAppConfig(this)
     let { pay_back_alert_show } = await getConfig('task_center')
     this.pay_back = pay_back_alert_show
@@ -176,58 +189,55 @@ export default {
             uri: '/views/Phone'
           })
         },
-        cancel: function() {
-        }
+        cancel: function() {}
       })
-    }else{
-       this.showPay = true 
+    } else {
+      this.showPay = true
     }
   },
   async getUserInfo() {
-   try{
+    try {
       this.loginPhone = (await storage.get({ key: 'loginPhone' })).data
-    this.haslogin = (await storage.get({ key: 'hasLogin' })).data
-    let userinfo = await getUserInfo()
-    if(userinfo){
-      this.send_order_id = userinfo.send_order_id;
-    }
-   }catch(e){
-   }
+      this.haslogin = (await storage.get({ key: 'hasLogin' })).data
+      let userinfo = await getUserInfo()
+      if (userinfo) {
+        this.send_order_id = userinfo.send_order_id
+      }
+    } catch (e) {}
   },
   chooseItem(product, idx) {
     this.currentProduct = product
     this.currentIdx = idx
   },
   async goPay(evt) {
-    
     evt.stopPropagation()
-    
+
     let cur_pay_type = this.payType
     let product_id = this.currentProduct.product_id
     let ret = null
-    this.need_check_order = false;
-    this.pay_order_id = "";
-    this.trade_no = "";
+    this.need_check_order = false
+    this.pay_order_id = ''
+    this.trade_no = ''
     if (cur_pay_type == 1) {
       ret = await configAliPay({
         product_id: product_id,
         send_order_id: this.send_order_id,
         activity_token: this.token
       })
-      this.trade_no = ret.order;
-      this.showToastByCode(ret.code);
+      this.trade_no = ret.order
+      this.showToastByCode(ret.code)
     } else {
       ret = await configWxPay({
         product_id: product_id,
         send_order_id: this.send_order_id,
         activity_token: this.token
       })
-      this.trade_no = ret.order;
-      this.pay_order_id =ret.order;
-      this.need_check_order = true;
+      this.trade_no = ret.order
+      this.pay_order_id = ret.order
+      this.need_check_order = true
     }
 
-    return false;
+    return false
     // 成功支付后的回调操作
     if (ret.code === '9000') this.showWaitingWrap(ret)
     else this.showToastByCode(ret.code)
@@ -254,34 +264,41 @@ export default {
         router.back()
       }
     }, 2000)
-  },async onShow() {
-     await this.getUserInfo();
-    if(this.need_check_order && this.pay_order_id){
-        this.checkOrderNew(this.pay_order_id);
+  },
+  async onShow() {
+    try {
+      let { has_pend_task } = await hasPendingTask({ type: 'recharge' })
+      this.isPendingTask = has_pend_task
+      await this.getUserInfo()
+      console.log(this.isPendingTask, 'this.isPendingTask')
+    } catch (err) {
+      console.lg(err)
+    }
+    if (this.need_check_order && this.pay_order_id) {
+      this.checkOrderNew(this.pay_order_id)
+    }
+  },
+  async checkOrderNew(order) {
+    // this.showLoading = true;
+    let fb = await checkWxOrder(order)
+    //  this.showToastByCode('9000')
+    if (fb && typeof fb === 'object') {
+      this.showToastByCode('9000')
+    } else {
+      this.showToastByCode('6001')
     }
-  },async checkOrderNew(order){
-      // this.showLoading = true;
-      let fb = await checkWxOrder(order);
-      //  this.showToastByCode('9000')
-      if (fb && typeof fb === 'object'){
-        this.showToastByCode('9000')
-      }else{
-        this.showToastByCode('6001')
-      }
   },
   showToastByCode(code) {
     this.showLoading = false
-    this.pay_success = false;
+    this.pay_success = false
     let msg = '支付成功!'
     switch (code) {
       case '9000':
-         this.pay_success = true;
-         try{
-            advertOrders(this.trade_no);
-          }catch(e){
-
-          }
-         msg = '支付成功!'
+        this.pay_success = true
+        try {
+          advertOrders(this.trade_no)
+        } catch (e) {}
+        msg = '支付成功!'
         break
       case '8000':
         msg = '订单已提交,请等待结果'
@@ -324,12 +341,13 @@ export default {
       success: data => {
         if (data.index === 0) this.checkOrder(order)
       },
-      cancel: () => {
-      }
+      cancel: () => {}
     })
-  },onBackPress(){
+  },
+  onBackPress() {
     if (!this.pay_success) {
-        let taht = this;
+      let taht = this
+      if (this.isPendingTask) {
         prompt.showDialog({
           title: '温馨提示',
           message: '每日完成任务,可以免费获取书币~',
@@ -345,7 +363,7 @@ export default {
           ],
           success: function(data) {
             if (data.index === 1) {
-              taht.getLastpage();
+              taht.getLastpage()
             } else {
               router.push({
                 uri: '/views/Task'
@@ -353,34 +371,43 @@ export default {
             }
           },
           cancel: function() {
+            console.log('取消前往')
           }
         })
-        return true;
-    }else{
-      this.getLastpage();  
+      } else {
+        this.getLastpage()
+      }
+      return true
+    } else {
+      this.getLastpage()
     }
-    return true;
-  },getLastpage(){
-    let backPage = {};
-      try{
-        let page = router.getState();
-        let allPage = router.getPages();
-        for(var k = allPage.length -1; k >=  0;k--){
-          if(allPage[k].name != page.name && allPage[k].name != "views/Phone" && allPage[k].name != "views/Pay"){
-            backPage = allPage[k];
-            break;
-          }
+    return true
+  },
+  getLastpage() {
+    let backPage = {}
+    try {
+      let page = router.getState()
+      let allPage = router.getPages()
+      for (var k = allPage.length - 1; k >= 0; k--) {
+        if (
+          allPage[k].name != page.name &&
+          allPage[k].name != 'views/Phone' &&
+          allPage[k].name != 'views/Pay'
+        ) {
+          backPage = allPage[k]
+          break
         }
-      } catch(e){
-        backPage = {};
-      }
-      if(JSON.stringify(backPage) === '{}'){
-         router.replace({ uri: "/views/Index" });
-      }else{
-        router.back(backPage);
       }
-    return true;
-  },
+    } catch (e) {
+      backPage = {}
+    }
+    if (JSON.stringify(backPage) === '{}') {
+      router.replace({ uri: '/views/Index' })
+    } else {
+      router.back(backPage)
+    }
+    return true
+  }
 }
 </script>
 

+ 40 - 13
src/views/Index/index.ux

@@ -40,7 +40,7 @@
         src="../../assets/imgs/rukou.png"
         class="sign-icon"
         @click="goTask"
-        if="{{home_show}}"
+        if="{{home_show && isPendingTask}}"
       >
       </image>
 
@@ -82,6 +82,13 @@
     <block if="display">
       <policy-page @change="dispatchEvent"></policy-page>
     </block>
+
+    <div if="{{networkStatus=='none'}}" class="network-wrapper">
+      <image src="../../assets/imgs/no_network.png" class="network-img"></image>
+      <text>
+        暂无网络
+      </text>
+    </div>
   </stack>
 </template>
 
@@ -91,7 +98,12 @@ import prompt from '@system.prompt'
 import device from '@system.device'
 import storage from '@system.storage'
 import it from '../../helper/interface.js'
-import { getCustomQrcode, userAddDsktop, getUserInfo } from '../../api/index.js'
+import {
+  getCustomQrcode,
+  userAddDsktop,
+  getUserInfo,
+  hasPendingTask
+} from '../../api/index.js'
 import { downImg, getStore, getAppConfig } from '../../api/utils.js'
 import router from '@system.router'
 let getConfig
@@ -102,6 +114,8 @@ export default {
     bid: '',
     chapter_id: '',
     send_order_id: '',
+    networkStatus: '',
+    isPendingTask: false,
     link_url: ''
   },
   protected: {
@@ -149,7 +163,7 @@ export default {
     home_alert: null,
     back_alert: 0,
     isInit: false,
-    display: false,
+    display: false
   },
   async onInit() {
     let isFromPush = false
@@ -159,14 +173,14 @@ export default {
       await storage.set({ key: 'push_id', value: this.push_id })
     }
     if (this.send_order_id) {
-      await storage.set({ key: "send_order_id", value: this.send_order_id });
+      await storage.set({ key: 'send_order_id', value: this.send_order_id })
     } else {
-      let send_order_id = (await storage.get({ key: "send_order_id" })).data;
-      if (send_order_id) this.send_order_id = send_order_id;
+      let send_order_id = (await storage.get({ key: 'send_order_id' })).data
+      if (send_order_id) this.send_order_id = send_order_id
     }
     //获取当前是否隐私弹窗
-    let showPolicy = (await storage.get({ key: "agreeFlag" })).data;
-    if (!this.send_order_id && !showPolicy) this.display = true;
+    let showPolicy = (await storage.get({ key: 'agreeFlag' })).data
+    if (!this.send_order_id && !showPolicy) this.display = true
 
     //今日已签到过不在弹框签到
 
@@ -185,7 +199,7 @@ export default {
     this.back_alert = sign_out_app_show
     this.getCoustom()
     this.getUser()
-    this.current = 1;
+    this.current = 1
   },
   goActicity() {
     router.push({
@@ -206,16 +220,29 @@ export default {
   save() {
     storage.set({
       key: 'agreeFlag',
-      value: 'agree',
+      value: 'agree'
     })
   },
-  toMyRead(evt) {
-  },
+  toMyRead(evt) {},
   async onShow() {
     const hasInit = this.$app.getAppData('hasInit')
+    try {
+      let { has_pend_task } = await hasPendingTask({ type: 'recharge' })
+      this.isPendingTask = has_pend_task
+      console.log(this.isPendingTask, 'this.isPendingTask')
+    } catch (err) {
+      console.lg(err)
+    }
     if (hasInit) {
       this.$broadcast('refreshData', { current: this.current })
     }
+    network.getType({
+      success: data => {
+        // console.log(`handling success: ${data.type}`)
+        this.networkStatus = data.type
+        // prompt.showToast({ message: `handling success: ${data.type}` })
+      }
+    })
     it.getShortCut(value => {
       this.showShortPop = !value
 
@@ -306,7 +333,7 @@ export default {
   duplication() {
     clipboard.set({
       text: this.cutomerName,
-      success: function (data) {
+      success: function(data) {
         prompt.showToast({
           message: '复制成功!'
         })

+ 115 - 84
src/views/Pay/index.ux

@@ -72,7 +72,9 @@
           </div>
           <div class="notice-wrap">
             <text class="title">提示:</text>
-            <text class="notice-item">1.充值后书币到账可能有延迟,1小时内未到账请到个人中心联系客服</text>
+            <text class="notice-item"
+              >1.充值后书币到账可能有延迟,1小时内未到账请到个人中心联系客服</text
+            >
             <text class="notice-item"
               >2.未满18周岁的未成年人应在法定监护人同意后进行充值。</text
             >
@@ -103,14 +105,22 @@ import router from '@system.router'
 import prompt from '@system.prompt'
 import storage from '@system.storage'
 
-import { getChargeList, getUserInfo, checkWxOrder,advertOrders,getBannerData } from '../../api'
+import {
+  getChargeList,
+  getUserInfo,
+  checkWxOrder,
+  advertOrders,
+  getBannerData,
+  hasPendingTask
+} from '../../api'
 import { configWxPay, configAliPay } from '../../helper'
 import { getAppConfig } from '../../api/utils.js'
 let getConfig
 
 export default {
   public: {
-    push_id: ''
+    push_id: '',
+    isPendingTask:false
   },
   protected: {
     bid: '',
@@ -129,12 +139,12 @@ export default {
     showLoading: false,
     checked: false,
     loginPhone: '',
-    need_check_order:false,
+    need_check_order: false,
     haslogin: '',
     isVip: '',
-    pay_order_id:"",
-    trade_no:"",
-    pay_success:false,
+    pay_order_id: '',
+    trade_no: '',
+    pay_success: false,
     last: null,
     payType: [
       {
@@ -232,9 +242,9 @@ export default {
     let cur_pay_type = this.curPayType
     let product_id = this.rechargeList[this.curSelect].product_id
     let ret = null
-    this.need_check_order = false;
-    this.pay_order_id = "";
-    this.trade_no = "";
+    this.need_check_order = false
+    this.pay_order_id = ''
+    this.trade_no = ''
     if (cur_pay_type === 1) {
       ret = await configAliPay({
         product_id: product_id,
@@ -242,25 +252,25 @@ export default {
         send_order_id: this.send_order_id
       })
       // console.log('al111111111111111111111111',res);
-      this.trade_no = ret.order;
-      this.showToastByCode(ret.code);
+      this.trade_no = ret.order
+      this.showToastByCode(ret.code)
     } else {
       ret = await configWxPay({
         product_id: product_id,
         bid: this.bid,
         send_order_id: this.send_order_id
       })
-      this.trade_no = ret.order;
-      this.pay_order_id =ret.order;
-      this.need_check_order = true;
+      this.trade_no = ret.order
+      this.pay_order_id = ret.order
+      this.need_check_order = true
       // this.back_click = 0;
       //  console.log('wx111111111111111111111',res);
       // if (fb && typeof fb === 'object')
     }
-    
+
     // this.pay_order_id =ret.order;
     // console.log('00000000000000000',ret,"paytype d",cur_pay_type);
-    return false;
+    return false
     // 成功支付后的回调操作
     if (ret.code === '9000') this.showWaitingWrap(ret)
     else this.showToastByCode(ret.code)
@@ -299,26 +309,25 @@ export default {
         if (data.index === 0) this.checkOrder(order)
       },
       cancel: () => {
-       
         console.log('cancel')
       }
     })
-  
-    return false;
+
+    return false
   },
   showToastByCode(code) {
     this.showLoading = false
-    this.pay_success = false;
+    this.pay_success = false
     let msg = '支付成功!'
-  
+
     switch (code) {
       case '9000':
-        this.pay_success = true;
-          try{
-            advertOrders(this.trade_no);
-          }catch(e){
-            console.log(e);
-          }
+        this.pay_success = true
+        try {
+          advertOrders(this.trade_no)
+        } catch (e) {
+          console.log(e)
+        }
         ;(msg = '支付成功!'), router.back()
         break
       case '8000':
@@ -344,39 +353,50 @@ export default {
     }
     prompt.showToast({ message: msg })
   },
-  onShow() {
-    this.getUserInfo();
-    if(this.need_check_order && this.pay_order_id){
-        this.checkOrderNew(this.pay_order_id);
+  async onShow() {
+    try {
+      let { has_pend_task } = await hasPendingTask({ type: 'recharge' })
+      this.isPendingTask = has_pend_task
+      console.log(this.isPendingTask, 'this.isPendingTask')
+    } catch (err) {
+      console.lg(err)
+    }
+    this.getUserInfo()
+    if (this.need_check_order && this.pay_order_id) {
+      this.checkOrderNew(this.pay_order_id)
+    }
+  },
+  async checkOrderNew(order) {
+    console.log('需要查询订单', order)
+    // this.showLoading = true;
+    let fb = await checkWxOrder(order)
+    console.log('查询结果:', fb)
+    if (fb && typeof fb === 'object') {
+      this.showToastByCode('9000')
+    } else {
+      this.showToastByCode('6001')
     }
-  },async checkOrderNew(order){
-      console.log("需要查询订单",order);
-      // this.showLoading = true;
-      let fb = await checkWxOrder(order);
-      console.log('查询结果:',fb);
-      if (fb && typeof fb === 'object'){
-        this.showToastByCode('9000')
-      }else{
-        this.showToastByCode('6001')
-      }
   },
   onHide() {
     //this.$app.$def.createShortcut(true);
-  },onBackPress(){
+  },
+  onBackPress() {
     if (this.pay_back && !this.pay_success) {
-        this.getActivity();
-        return true;
-    }else{
-      this.getLastpage();  
+      this.getActivity()
+      return true
+    } else {
+      this.getLastpage()
     }
-    return true;
-  },async getActivity(){
-      // let back = await getBannerData(5);
-      // console.log(back,JSON.stringify(back) === "{}",JSON.stringify(back));
-      let back = [];
-      if(JSON.stringify(back) === "{}" || JSON.stringify(back) === "[]"){
-        console.log('000000000000000000000');
-        let taht = this;
+    return true
+  },
+  async getActivity() {
+    // let back = await getBannerData(5);
+    // console.log(back,JSON.stringify(back) === "{}",JSON.stringify(back));
+    let back = []
+    if (JSON.stringify(back) === '{}' || JSON.stringify(back) === '[]') {
+      console.log('000000000000000000000')
+      let taht = this
+      if (this.isPendingTask) {
         prompt.showDialog({
           title: '温馨提示',
           message: '每日完成任务,可以免费获取书币~',
@@ -392,7 +412,7 @@ export default {
           ],
           success: function(data) {
             if (data.index === 1) {
-              taht.getLastpage();
+              taht.getLastpage()
             } else {
               router.push({
                 uri: '/views/Task'
@@ -403,37 +423,48 @@ export default {
             console.log('取消前往')
           }
         })
-      }else{
-        router.push({
-          uri: back.redirect_url,
-          params:back.param
-        })
+      } else {
+        this.getLastpage()
       }
-      return true;
-  },getLastpage(){
-    let backPage = {};
-      try{
-        let page = router.getState();
-        let allPage = router.getPages();
-     
-        console.log('page = ',page,'all pages',allPage,'length',allPage.length);
-        for(var k = allPage.length -1; k >=  0;k--){
-          if(allPage[k].name != page.name && allPage[k].name != "views/Phone"){
-            backPage = allPage[k];
-            break;
-          }
+    } else {
+      router.push({
+        uri: back.redirect_url,
+        params: back.param
+      })
+    }
+    return true
+  },
+  getLastpage() {
+    let backPage = {}
+    try {
+      let page = router.getState()
+      let allPage = router.getPages()
+
+      console.log(
+        'page = ',
+        page,
+        'all pages',
+        allPage,
+        'length',
+        allPage.length
+      )
+      for (var k = allPage.length - 1; k >= 0; k--) {
+        if (allPage[k].name != page.name && allPage[k].name != 'views/Phone') {
+          backPage = allPage[k]
+          break
         }
-      } catch(e){
-        backPage = {};
-        // console.log('back err',e);
-      }
-      console.log(backPage,backPage.length,typeof backPage);
-      if(JSON.stringify(backPage) === '{}'){
-         router.replace({ uri: "/views/Index" });
-      }else{
-        router.back(backPage);
       }
-    return true;
+    } catch (e) {
+      backPage = {}
+      // console.log('back err',e);
+    }
+    console.log(backPage, backPage.length, typeof backPage)
+    if (JSON.stringify(backPage) === '{}') {
+      router.replace({ uri: '/views/Index' })
+    } else {
+      router.back(backPage)
+    }
+    return true
   },
   onBackPressOld() {
     if (this.pay_back) {