Explorar el Código

修复 退出登录失效问题

魏熙美 hace 6 años
padre
commit
3e37c34a64
Se han modificado 3 ficheros con 7 adiciones y 6 borrados
  1. 0
    2
      src/layout/default/index.vue
  2. 5
    4
      src/store/system.js
  3. 2
    0
      src/views/Login.vue

+ 0
- 2
src/layout/default/index.vue Ver fichero

95
     }
95
     }
96
   },
96
   },
97
   created () {
97
   created () {
98
-    // 默认进入欢迎语页面
99
-    this.$router.push({ name: 'indexWelcome' })
100
     // if (this.$route.path.indexOf('exception') === -1) {
98
     // if (this.$route.path.indexOf('exception') === -1) {
101
     //   this.$store.dispatch('getUser').then(() => {
99
     //   this.$store.dispatch('getUser').then(() => {
102
     //     this.menuArray = pageArray
100
     //     this.menuArray = pageArray

+ 5
- 4
src/store/system.js Ver fichero

15
   },
15
   },
16
   mutations: {
16
   mutations: {
17
     updateUser(state, user) {
17
     updateUser(state, user) {
18
-      state.user = {
19
-        ...state.user,
20
-        ...user,
21
-      }
18
+      // state.user = {
19
+      //   ...state.user,
20
+      //   ...user,
21
+      // }
22
+      state.user = user
22
     },
23
     },
23
     syncState(state, payload = {}) {
24
     syncState(state, payload = {}) {
24
       Object.keys(payload).forEach(k => state[k] = payload[k])
25
       Object.keys(payload).forEach(k => state[k] = payload[k])

+ 2
- 0
src/views/Login.vue Ver fichero

66
     submit() {
66
     submit() {
67
       this.login({ username: this.formdata.username, password: md5(this.formdata.password) }).then(() => {
67
       this.login({ username: this.formdata.username, password: md5(this.formdata.password) }).then(() => {
68
         this.$router.push({ name: this.fromRoute })
68
         this.$router.push({ name: this.fromRoute })
69
+        // 默认进入欢迎语页面
70
+        this.$router.push({ name: 'indexWelcome' })
69
       }).catch((err) => {
71
       }).catch((err) => {
70
         this.$message({
72
         this.$message({
71
           showClose: true,
73
           showClose: true,