|
@@ -18,7 +18,7 @@ const user = {
|
|
|
// 用户ID
|
|
|
userId: getUid(),
|
|
|
// 用户名
|
|
|
- userName:null,
|
|
|
+ userName: null,
|
|
|
// 验证码
|
|
|
codeUrl: null,
|
|
|
// 验证码登录参数
|
|
@@ -77,8 +77,8 @@ const user = {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
uni.$http.get('/user/getPublicKey').then(res => {
|
|
|
if (res.data.code === 200) {
|
|
|
- const key=res.data.data.replace('\r\n','')
|
|
|
- commit('SET_PUBKEY',key)
|
|
|
+ const key = res.data.data.replace('\r\n', '')
|
|
|
+ commit('SET_PUBKEY', key)
|
|
|
setPubKey(key)
|
|
|
resolve(res)
|
|
|
}
|
|
@@ -91,7 +91,7 @@ const user = {
|
|
|
commit,
|
|
|
state
|
|
|
}, data) {
|
|
|
- const pwd = encrypt(data.password)
|
|
|
+ const pwd = encrypt(data.password, data.publicKey)
|
|
|
const obj = {
|
|
|
userName: data.userName,
|
|
|
password: pwd,
|
|
@@ -102,7 +102,10 @@ const user = {
|
|
|
uni.$http.post('/user/phoneUserLogin', obj).then(res => {
|
|
|
if (res.data.code === 200) {
|
|
|
const token = res.data.data.token
|
|
|
- const {userId,userName} = res.data.data.user
|
|
|
+ const {
|
|
|
+ userId,
|
|
|
+ userName
|
|
|
+ } = res.data.data.user
|
|
|
commit('SET_TOKEN', token)
|
|
|
setToken(token)
|
|
|
commit('SET_USER_ID', userId)
|
|
@@ -147,4 +150,4 @@ export default {
|
|
|
state,
|
|
|
mutations,
|
|
|
actions
|
|
|
-}
|
|
|
+}
|