许成详 6 years ago
parent
commit
72eeb2ffef
4 changed files with 37 additions and 5 deletions
  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 View File

@@ -1,15 +1,40 @@
1 1
 <template>
2
-  <div id="app">
2
+  <div id="app" v-if="showPage">
3 3
     <router-view></router-view>
4 4
   </div>
5 5
 </template>
6 6
 
7 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 12
   export default {
11 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 39
 </script>
15 40
 

+ 6
- 0
src/pages/sales/login/index.vue View File

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

+ 1
- 0
src/store/index.js View File

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

+ 2
- 2
src/store/login/login.js View File

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