Browse Source

debug postage.js

stanley-king 4 years ago
parent
commit
f77373e469
2 changed files with 16 additions and 8 deletions
  1. 12 3
      config.js
  2. 4 5
      pages/postage/postage.js

+ 12 - 3
config.js

@@ -3,6 +3,7 @@
 // let api = "http://192.168.1.200/mobile/index.php";
 // let api = "http://192.168.1.200/mobile/index.php";
 let api = "https://www.xyzshops.cn/mobile/index.php";
 let api = "https://www.xyzshops.cn/mobile/index.php";
 let app = getApp();
 let app = getApp();
+
 function getReq(data, callback, method)
 function getReq(data, callback, method)
 {
 {
   let options = { 
   let options = { 
@@ -28,15 +29,23 @@ function getReq(data, callback, method)
       'Cookie': 'MPHPSESSID=' + session_id
       'Cookie': 'MPHPSESSID=' + session_id
     }
     }
   }
   }
+  //const ErrUnLogin = 10014;
   return wx.request({
   return wx.request({
     url: api,
     url: api,
     data,
     data,
     method: method || 'GET',
     method: method || 'GET',
     header,
     header,
-    success(res) {
-      callback(res.data)
+    success(res) 
+    {
+      if(res.data.code == 10014) {
+        
+      }
+      else {
+        callback(res.data)
+      }
     },
     },
-    fail() {
+    fail() 
+    {
       wx.showModal({
       wx.showModal({
         confirmText: '重试',
         confirmText: '重试',
         content: '网络错误',
         content: '网络错误',

+ 4 - 5
pages/postage/postage.js

@@ -57,7 +57,7 @@ Page({
       url: `/pages/postageManage/postageManage?card_type=${cardtype}`,
       url: `/pages/postageManage/postageManage?card_type=${cardtype}`,
     })
     })
   },
   },
-  
+
   /**
   /**
    * 生命周期函数--监听页面加载
    * 生命周期函数--监听页面加载
    */
    */
@@ -81,10 +81,8 @@ Page({
         if(res.datas && res.datas.goods){
         if(res.datas && res.datas.goods){
           const datas = res.datas
           const datas = res.datas
           const { tips = '', goods = [], cards = [], } = datas
           const { tips = '', goods = [], cards = [], } = datas
-
           const sinopec = this.getValueBykey('sinopec', cards)
           const sinopec = this.getValueBykey('sinopec', cards)
-          const petrochina = this.getValueBykey('petrochina', cards)
-          
+          const petrochina = this.getValueBykey('petrochina', cards)          
           this.setData({ tips, goods, cards, sinopec, petrochina, card_no: sinopec.card_no, goods_id: datas.goods[0].goods_id });
           this.setData({ tips, goods, cards, sinopec, petrochina, card_no: sinopec.card_no, goods_id: datas.goods[0].goods_id });
         }
         }
       } else {
       } else {
@@ -93,7 +91,8 @@ Page({
     })
     })
   },
   },
   // 通过键取值
   // 通过键取值
-  getValueBykey(key = '', data = []){
+  getValueBykey(key = '', data = [])
+  {
     if(!data.length) {
     if(!data.length) {
       return {};
       return {};
     }
     }