Browse Source

bug修改

wangfei 6 years ago
parent
commit
a66320f1a5
2 changed files with 8 additions and 10 deletions
  1. 8
    6
      src/App.vue
  2. 0
    4
      src/store/vote.js

+ 8
- 6
src/App.vue View File

@@ -32,7 +32,6 @@ export default {
32 32
     ...mapactivityState({
33 33
       activity: s => s.activity || {},
34 34
       theme: s => `${s.theme}`,
35
-      code: s => s.code,
36 35
     })
37 36
   },
38 37
   created() {
@@ -40,12 +39,15 @@ export default {
40 39
     console.log("process.env.NODE_ENV =>", env)
41 40
     if (env === 'production' || env === 'test') {
42 41
       if (location.search && this.toolClass.UrlSearch(location.search).code) {
43
-        const code = this.toolClass.UrlSearch(location.search).code
44
-        if (this.code === code) {
42
+        this.code = this.toolClass.UrlSearch(location.search).code
43
+        let oldCode = localStorage.getItem('code')
44
+        if (this.code === oldCode) {
45
+          localStorage.setItem('code', this.code)
45 46
           this.toolClass.getCode(this.appid[env])
46 47
         } else {
47
-          this.setCode(code)
48
-          this.getUser({ code }).then(() => {
48
+          localStorage.setItem('code', this.code)
49
+          // this.showPage = true
50
+          this.getUser({code: this.code }).then(() => {
49 51
             this.showPage = true
50 52
           })
51 53
         }
@@ -57,7 +59,7 @@ export default {
57 59
     }
58 60
   },
59 61
   methods: {
60
-    ...mapIndexActions(["getUser","setCode"])
62
+    ...mapIndexActions(["getUser"])
61 63
   }
62 64
 };
63 65
 </script>

+ 0
- 4
src/store/vote.js View File

@@ -11,7 +11,6 @@ export default {
11 11
     toplist: [],
12 12
     list: [],
13 13
     theme: 1,
14
-    code: '',
15 14
   },
16 15
   mutations: {
17 16
     updateActivity(state, data) {
@@ -50,9 +49,6 @@ export default {
50 49
         return x.MemberId === data.MemberId ? data : x
51 50
       })
52 51
     },
53
-    setCode(state, code) {
54
-      state.code = code
55
-    }
56 52
   },
57 53
   actions: {
58 54
     getActivity ({ commit, state }, {actid}) {