Przeglądaj źródła

debug vip login fix bug

lushuncheng 6 lat temu
rodzic
commit
0762fbc729
3 zmienionych plików z 21 dodań i 20 usunięć
  1. 1 0
      components/type/vip/mobile.vue
  2. 19 19
      plugins/http.js
  3. 1 1
      plugins/nuxtAxios.js

+ 1 - 0
components/type/vip/mobile.vue

@@ -198,6 +198,7 @@ export default {
           number: number,
           product_id: item.id,
           channel: "apple",
+          needLogin: true,
           ...cookie
         });
         alert('ios vip pay server return:' + qs.stringify(res))

+ 19 - 19
plugins/http.js

@@ -77,18 +77,18 @@ const request = async (method, path, data, payload = {}) => {
   const res = await axios.request(body)
   let rData = res.data
   if(typeof rData !== 'object') rData = JSON.parse(rData)
-  // consoleFormat({ rData })
+  consoleFormat({ rData })
   if(rData.status === 1) return rData
   else if((rData.status === -99 || rData.status === '-99') && !payload.neverLogout) {
-    alert('not login ..');
-    const deviceType = getDeviceType();
-    alert('deviceType ..' + deviceType);
-    if (deviceType === 'ios' || deviceType === 'android') {
-      alert('redirect to login:' + 'proginn://login')
-      location.href = 'proginn://login'
-    } else {
-      location.href = 'https://www.proginn.com/?loginbox=show'
-    }
+    // alert('not login ..');
+    // const deviceType = getDeviceType();
+    // alert('deviceType ..' + deviceType);
+    // if (deviceType === 'ios' || deviceType === 'android') {
+      // alert('redirect to login:' + 'proginn://login')
+      // location.href = 'proginn://login'
+    // } else {
+    //   location.href = 'https://www.proginn.com/?loginbox=show'
+    // }
     return
   } else {
     if(!payload.neverLogout) Vue.prototype.$message.error(rData.info)
@@ -99,15 +99,15 @@ const request = async (method, path, data, payload = {}) => {
 /**
  * 设备判断
  */
-const getDeviceType = function() {
-  if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) { //判断iPhone|iPad|iPod|iOS
-    return 'ios';
-  } else if (/(Android)/i.test(navigator.userAgent)) { //判断Android
-    return 'android';
-  } else { //pc
-    return 'pc';
-  }
-}
+// const getDeviceType = function() {
+//   if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) { //判断iPhone|iPad|iPod|iOS
+//     return 'ios';
+//   } else if (/(Android)/i.test(navigator.userAgent)) { //判断Android
+//     return 'android';
+//   } else { //pc
+//     return 'pc';
+//   }
+// }
 
 const consoleFormat = obj => {
   const key = Object.keys(obj)[0]

+ 1 - 1
plugins/nuxtAxios.js

@@ -87,7 +87,7 @@ export default function({ $axios, redirect, req, ...args }) {
     console.log(res);
 		// req && req.url && needLogin(req.url)
 		if (data.status === 1 || data.filename) {
-		} else if (data.status === -99) {
+		} else if (res.config.data.needLogin && data.status === -99) {
       // alert('not login ..');
       const deviceType = getDeviceType();
       // alert('deviceType ..' + deviceType);