许成详 6 vuotta sitten
vanhempi
commit
72eeb2ffef
4 muutettua tiedostoa jossa 37 lisäystä ja 5 poistoa
  1. 28
    3
      src/pages/sales/App.vue
  2. 6
    0
      src/pages/sales/login/index.vue
  3. 1
    0
      src/store/index.js
  4. 2
    2
      src/store/login/login.js

+ 28
- 3
src/pages/sales/App.vue Näytä tiedosto

1
 <template>
1
 <template>
2
-  <div id="app">
2
+  <div id="app" v-if="showPage">
3
     <router-view></router-view>
3
     <router-view></router-view>
4
   </div>
4
   </div>
5
 </template>
5
 </template>
6
 
6
 
7
 <script>
7
 <script>
8
-  import '../../common/css/reset.css'
8
+import '../../common/css/reset.css'
9
+import { mapState, createNamespacedHelpers } from 'vuex'
10
+const { mapActions: actions } = createNamespacedHelpers('userCenter')
9
 
11
 
10
   export default {
12
   export default {
11
     name: 'app',
13
     name: 'app',
12
-    components: {}
14
+    data () {
15
+      return {
16
+        showPage: false
17
+      }
18
+    },
19
+    computed: {
20
+      ...mapState({
21
+        userInfo: x => x.userCenter.userInfo,
22
+        org: x => x.app.orgId
23
+      })
24
+    },
25
+    created () {
26
+      if (location.search && this.toolClass.UrlSearch(location.search).code) {
27
+        this.code = this.toolClass.UrlSearch(location.search).code
28
+      } else {
29
+        this.code = null
30
+      }
31
+      this.getUserInfo({ org: this.org, code: this.code }).then(() => {
32
+        this.showPage = true
33
+      })
34
+    },
35
+    methods: {
36
+      ...actions(['getUserInfo'])
37
+    }
13
   }
38
   }
14
 </script>
39
 </script>
15
 
40
 

+ 6
- 0
src/pages/sales/login/index.vue Näytä tiedosto

90
         }
90
         }
91
       }, 1000)
91
       }, 1000)
92
     },
92
     },
93
+    getUrl (val) {
94
+      var url = window.location.pathname
95
+      return url.replace('sales.html', 'user.html') + '#/' + val
96
+    },
93
     submit () {
97
     submit () {
94
       if (!this.postData.captcha) {
98
       if (!this.postData.captcha) {
95
         this.$toast('请先获取验证码')
99
         this.$toast('请先获取验证码')
96
         return
100
         return
97
       }
101
       }
102
+      // console.log(this.postData)
98
       this.submitData(this.postData).then((res) => {
103
       this.submitData(this.postData).then((res) => {
99
         this.$toast(res)
104
         this.$toast(res)
105
+        window.location.href = this.getUrl('mainPage/coffeeIndex')
100
       })
106
       })
101
     }
107
     }
102
   }
108
   }

+ 1
- 0
src/store/index.js Näytä tiedosto

18
   placeOrderForCoffee: () => require('./placeOrderForCoffee/index').default,
18
   placeOrderForCoffee: () => require('./placeOrderForCoffee/index').default,
19
   case: () => require('./case/case').default,
19
   case: () => require('./case/case').default,
20
   goodsOrder: () => require('./goods/order').default,
20
   goodsOrder: () => require('./goods/order').default,
21
+  login: () => require('./login/login').default,
21
 }
22
 }
22
 
23
 
23
 Object.keys(modules).forEach((modKey) => {
24
 Object.keys(modules).forEach((modKey) => {

+ 2
- 2
src/store/login/login.js Näytä tiedosto

37
   state: {},
37
   state: {},
38
   mutations: {},
38
   mutations: {},
39
   actions: {
39
   actions: {
40
-    getCaptcha (data) {
40
+    getCaptcha ({ commit }, data) {
41
       return new Promise((resolve) => {
41
       return new Promise((resolve) => {
42
         http.getCaptcha(data).then((res) => {
42
         http.getCaptcha(data).then((res) => {
43
           resolve(res)
43
           resolve(res)
44
         })
44
         })
45
       })
45
       })
46
     },
46
     },
47
-    submitData(data) {
47
+    submitData({ commit }, data) {
48
       return new Promise((resolve) => {
48
       return new Promise((resolve) => {
49
         http.submitData(data).then((res) => {
49
         http.submitData(data).then((res) => {
50
           resolve(res)
50
           resolve(res)