huangxiaojing %!s(int64=2) %!d(string=hai) anos
pai
achega
9f35adedf5
Modificáronse 3 ficheiros con 19 adicións e 18 borrados
  1. 5 14
      pages/activity/lottery/index.vue
  2. 2 2
      pages/activity/lottery/pc.vue
  3. 12 2
      plugins/axios.js

+ 5 - 14
pages/activity/lottery/index.vue

@@ -280,17 +280,17 @@ export default {
   },
   async fetch() {
     if (this.$route.query.type === 'pc') {
-      this.$router.push({ path: '/activity/lottery/pc', query: { token: this.$route.query.token } })
+      this.$router.push({ path: '/activity/lottery/pc', query: { token: this.$route.query.token, type: 'pc' } })
     }
     if (this.$userAgent.isSzx && this.$userAgent.isAndroid) {
       this.token = await window.native.getToken();
     } else {
       this.token = this.$route.query.token;
     }
-    
-    if (this.$userAgent.isAndroid) {
+
+    if (this.$userAgent.isSzx && this.$userAgent.isAndroid) {
       this.client = 1;
-    } else if (this.$userAgent.isIos) {
+    } else if (this.$userAgent.isSzx && this.$userAgent.isIos) {
       this.client = 2;
     } else if (this.$userAgent.isMiniProgram) {
       this.client = 5;
@@ -344,17 +344,8 @@ export default {
         };
         taocan = this.sort_ASCII(taocan);
         const sign = this.jiaqian(JSON.stringify(taocan));
-        if (this.$userAgent.isSzx && this.$userAgent.isAndroid) {
-          this.client = 1;
-        } else if (this.$userAgent.isSzx && this.$userAgent.isIos) {
-          this.client = 2;
-        } else if (this.$userAgent.isMiniProgram) {
-          this.client = 5;
-        } else {
-          this.client = 7;
-        }
         const res = await this.$axios.$post('/pay/v1/order/create', taocan, {
-          headers: { Authorization: this.token, sign, client: this.client }
+          headers: { Authorization: this.token, sign }
         });
         Toast.clear();
         if (this.$userAgent.isSzx && this.$userAgent.isAndroid) {

+ 2 - 2
pages/activity/lottery/pc.vue

@@ -328,7 +328,7 @@ export default {
         taocan = this.sort_ASCII(taocan);
         const sign = this.jiaqian(JSON.stringify(taocan));
         const res = await this.$axios.$post('/pay/v1/order/create', taocan, {
-          headers: { Authorization: this.token, sign }, client: this.client
+          headers: { Authorization: this.token, sign }
         });
         Toast.clear();
         await window.vgeminipc.startPay(
@@ -544,7 +544,7 @@ export default {
       line-height: 1.5;
       word-break: break-all;
     }
-    & .van-grid-item__icon+.van-grid-item__text {
+    & .van-grid-item__icon + .van-grid-item__text {
       margin-top: 8px;
     }
   }

+ 12 - 2
plugins/axios.js

@@ -1,10 +1,20 @@
 import AxiosError from 'axios/lib/core/AxiosError';
 
-export default function ({ $axios, $auth, redirect }) {
+export default function ({ $axios, $auth, $userAgent, query, redirect }) {
   // $axios.defaults.dataKey = 'data';
 
   $axios.onRequest((config) => {
-    config.headers.client = 7;
+    if ($userAgent.isSzx && $userAgent.isAndroid) {
+      config.headers.client = 1;
+    } else if ($userAgent.isSzx && $userAgent.isIos) {
+      config.headers.client = 2;
+    } else if ($userAgent.isMiniProgram) {
+      config.headers.client = 5;
+    } else if (query.type === 'pc') {
+      config.headers.client = 3;
+    } else {
+      config.headers.client = 7;
+    }
     return config;
   });
   $axios.onResponse(async (response) => {