李志伟 3 years ago
parent
commit
5666dfe402
4 changed files with 4 additions and 5 deletions
  1. 1
    1
      src/api/user.js
  2. 1
    1
      src/store/modules/settings.js
  3. 1
    1
      src/store/modules/user.js
  4. 1
    2
      src/utils/auth.js

+ 1
- 1
src/api/user.js View File

6
     method: 'post',
6
     method: 'post',
7
     data
7
     data
8
   })
8
   })
9
-}
9
+}

+ 1
- 1
src/store/modules/settings.js View File

18
 }
18
 }
19
 
19
 
20
 const actions = {
20
 const actions = {
21
-  changeSetting ({ commit }, data) {
21
+  changeSetting({ commit }, data) {
22
     commit('CHANGE_SETTING', data)
22
     commit('CHANGE_SETTING', data)
23
   }
23
   }
24
 }
24
 }

+ 1
- 1
src/store/modules/user.js View File

27
   login({ commit }, userInfo) {
27
   login({ commit }, userInfo) {
28
     const { userName, password } = userInfo
28
     const { userName, password } = userInfo
29
     return new Promise((resolve, reject) => {
29
     return new Promise((resolve, reject) => {
30
-      login({ userName: userName.trim(), password:md5(password) }).then(response => {
30
+      login({ userName: userName.trim(), password: md5(password) }).then(response => {
31
         const { data } = response
31
         const { data } = response
32
         commit('SET_TOKEN', data.token)
32
         commit('SET_TOKEN', data.token)
33
         setToken(data.token)
33
         setToken(data.token)

+ 1
- 2
src/utils/auth.js View File

10
   return Cookies.set(TokenKey, token)
10
   return Cookies.set(TokenKey, token)
11
 }
11
 }
12
 
12
 
13
-
14
 export function removeToken() {
13
 export function removeToken() {
15
   return Cookies.remove(TokenKey)
14
   return Cookies.remove(TokenKey)
16
 }
15
 }
22
 }
21
 }
23
 export function getUserId() {
22
 export function getUserId() {
24
   return Cookies.get(UserIdKey)
23
   return Cookies.get(UserIdKey)
25
-}
24
+}