yuantianjiao 6 anni fa
parent
commit
9f35b0ea04

+ 7
- 0
src/config/index.js Vedi File

1
+export default {
2
+  appid: 'wx7320287e057bbeee',
3
+  redirect_uri: encodeURIComponent(window.location.href),
4
+  response_type: 'code',
5
+  scope: 'snsapi_userinfo',
6
+  state: '12313'
7
+}

+ 1
- 9
src/pages/user/App.vue Vedi File

23
     } else {
23
     } else {
24
       this.code = null
24
       this.code = null
25
     }
25
     }
26
-    this.getUserInfo({ org: this.org, code: this.code }).then((res) => {
27
-      if (typeof (res) === 'string') {
28
-        if (res.indexOf('401-') > -1) {
29
-          this.toolClass.getCode(res.substring(4, res.length))
30
-        }
31
-      }
32
-    }).catch((err) => {
33
-      console.log(err)
34
-    })
26
+    this.getUserInfo({ org: this.org, code: this.code })
35
   },
27
   },
36
   methods: {
28
   methods: {
37
     ...actions(['getUserInfo'])
29
     ...actions(['getUserInfo'])

+ 3
- 8
src/pages/user/mainPage/userCenter/index.vue Vedi File

1
 <template>
1
 <template>
2
   <div class="mainPage">
2
   <div class="mainPage">
3
     <div class="loading" v-if="isLoading">
3
     <div class="loading" v-if="isLoading">
4
-      <!-- <img :src='loading' alt=""> -->
5
       <div @click="bindMobile">请绑定手机号</div>
4
       <div @click="bindMobile">请绑定手机号</div>
6
     </div>
5
     </div>
7
     <div v-else>
6
     <div v-else>
61
 </template>
60
 </template>
62
 
61
 
63
 <script>
62
 <script>
64
-import loading from '../../../../common/icon/loading.gif'
65
 import { mapState, createNamespacedHelpers } from 'vuex'
63
 import { mapState, createNamespacedHelpers } from 'vuex'
66
 const { mapActions: actions } = createNamespacedHelpers('userCenter')
64
 const { mapActions: actions } = createNamespacedHelpers('userCenter')
67
 export default {
65
 export default {
69
   data () {
67
   data () {
70
     return {
68
     return {
71
       user: {},
69
       user: {},
72
-      loading,
73
       isLoading: true
70
       isLoading: true
74
     }
71
     }
75
   },
72
   },
83
 
80
 
84
   },
81
   },
85
   created () {
82
   created () {
86
-    this.getUserInfo({ org: this.org }).then((res) => {
83
+    if (this.userInfo != 406) {
87
       this.user = this.userInfo.customer
84
       this.user = this.userInfo.customer
88
       this.AccountInfo = JSON.parse(this.user.AccountInfo)
85
       this.AccountInfo = JSON.parse(this.user.AccountInfo)
89
       this.headimgurl = this.AccountInfo.headimgurl
86
       this.headimgurl = this.AccountInfo.headimgurl
90
       this.isLoading = false
87
       this.isLoading = false
91
-    }).catch((err) => {
92
-      console.log(err)
93
-    })
88
+    }
94
   },
89
   },
95
   methods: {
90
   methods: {
96
     ...actions(['getUserInfo']),
91
     ...actions(['getUserInfo']),
115
 
110
 
116
 <!-- Add "scoped" attribute to limit CSS to this component only -->
111
 <!-- Add "scoped" attribute to limit CSS to this component only -->
117
 <style lang="scss" scoped>
112
 <style lang="scss" scoped>
118
-@import "page.scss";
113
+@import 'page.scss';
119
 </style>
114
 </style>

+ 1
- 0
src/store/userCenter/userCenter.js Vedi File

17
       method: api.user.info.method,
17
       method: api.user.info.method,
18
       queryData: queryData
18
       queryData: queryData
19
     }).then(res => {
19
     }).then(res => {
20
+      console.log(res)
20
       resolve(res)
21
       resolve(res)
21
     }).catch((err) => {
22
     }).catch((err) => {
22
       reject(err)
23
       reject(err)

+ 10
- 2
src/util/ajax.js Vedi File

1
 import axios from 'axios'
1
 import axios from 'axios'
2
 import qs from 'qs'
2
 import qs from 'qs'
3
 import toolClass from './util'
3
 import toolClass from './util'
4
+import router from '../pages/user/router'
4
 import { Toast } from '../../node_modules/vant';
5
 import { Toast } from '../../node_modules/vant';
5
 
6
 
6
 const Axios = axios.create({
7
 const Axios = axios.create({
48
 const ajax = (...args) => {
49
 const ajax = (...args) => {
49
   return new Promise((resolve, reject) => {
50
   return new Promise((resolve, reject) => {
50
     Axios(...args).then(({ data }) => {
51
     Axios(...args).then(({ data }) => {
51
-      // console.log(111)
52
+      console.log(111)
52
       const { code, message, result } = data
53
       const { code, message, result } = data
53
       if (code === 200) {
54
       if (code === 200) {
54
         resolve(result)
55
         resolve(result)
55
       } else if (code === 401) {
56
       } else if (code === 401) {
57
+        console.log(result)
56
         // reject(code)
58
         // reject(code)
57
-        toolClass.getCode()
59
+        toolClass.getCode(result.appid)
60
+      } else if (code === 406) {
61
+        console.log(message)
62
+        // if (router.history.current.name == 'bindMobile'){
63
+        //   router.push({ name:'bindMobile' })
64
+        // }
65
+        resolve(code)
58
       } else {
66
       } else {
59
         Toast({
67
         Toast({
60
           message: message,
68
           message: message,

+ 1
- 0
src/util/util.js Vedi File

1
+import wechatConfig from '../config/index'
1
 const toolClass = {
2
 const toolClass = {
2
   dateFormat: (timestamp, fmt) => {
3
   dateFormat: (timestamp, fmt) => {
3
     if (!fmt) {
4
     if (!fmt) {

+ 4
- 1
vue.config.js Vedi File

20
   productionSourceMap: true,
20
   productionSourceMap: true,
21
   chainWebpack: config => config.plugins.delete('named-chunks'),
21
   chainWebpack: config => config.plugins.delete('named-chunks'),
22
   devServer: {
22
   devServer: {
23
+    publicPath: '/c-v2/',
23
     proxy: {
24
     proxy: {
24
       '/api-v2': {
25
       '/api-v2': {
25
         // target: 'https://dp.huiju360.com.cn/hj_operations',
26
         // target: 'https://dp.huiju360.com.cn/hj_operations',
31
         //   '^/api': '/api-v2/api'
32
         //   '^/api': '/api-v2/api'
32
         // },
33
         // },
33
       },
34
       },
34
-    }
35
+    },
36
+    // compress: true,
37
+    disableHostCheck: true,   // That solved it
35
   }
38
   }
36
 }
39
 }