mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-25 00:15:06 +08:00
vuex统一命名风格
This commit is contained in:
@ -142,20 +142,12 @@ export default {
|
||||
},
|
||||
handleSubmit() {
|
||||
this.$refs.form.validate().then(res => {
|
||||
if (this.currentModeIndex === 0) {
|
||||
this.handleLoginPromise(passwordLogin({ mobile: this.formData.mobile, password: this.formData.password }))
|
||||
} else if (this.currentModeIndex === 1) {
|
||||
this.handleLoginPromise(smsLogin({ mobile: this.formData.mobile, code: this.formData.code }))
|
||||
}
|
||||
})
|
||||
},
|
||||
handleLoginPromise(promise) {
|
||||
promise.then(res => {
|
||||
this.$store.commit('setToken', res.data)
|
||||
uni.$u.toast('登录成功')
|
||||
setTimeout(() => {
|
||||
this.navigateBack()
|
||||
}, 1000)
|
||||
this.$store.dispatch('Login', { type: this.currentModeIndex, data: this.formData }).then(res => {
|
||||
uni.$u.toast('登录成功')
|
||||
setTimeout(() => {
|
||||
this.navigateBack()
|
||||
}, 1000)
|
||||
})
|
||||
})
|
||||
},
|
||||
navigateBack() {
|
||||
|
@ -81,7 +81,7 @@ export default {
|
||||
const tempFilePaths = chooseImageRes.tempFilePaths
|
||||
updateAvatar(tempFilePaths[0]).then(res => {
|
||||
this.userInfo.avatar = res.data
|
||||
this.$store.commit('setUserInfo', this.userInfo)
|
||||
this.$store.commit('SET_USER_INFO', this.userInfo)
|
||||
})
|
||||
}
|
||||
})
|
||||
@ -90,7 +90,7 @@ export default {
|
||||
updateNickname({ nickname: this.tempName }).then(res => {
|
||||
this.nameEditOn = false;
|
||||
this.userInfo.nickname = this.tempName
|
||||
this.$store.commit('setUserInfo', this.userInfo)
|
||||
this.$store.commit('SET_USER_INFO', this.userInfo)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ export default {
|
||||
},
|
||||
onLoad() {
|
||||
if (this.hasLogin){
|
||||
this.$store.dispatch('obtainUserInfo')
|
||||
this.$store.dispatch('ObtainUserInfo')
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@ -90,7 +90,7 @@ export default {
|
||||
content: '您确定要退出登录吗',
|
||||
success: res => {
|
||||
if (res.confirm) {
|
||||
this.$store.dispatch('logout')
|
||||
this.$store.dispatch('Logout')
|
||||
} else if (res.cancel) {
|
||||
//console.log('用户点击取消')
|
||||
}
|
||||
@ -100,7 +100,7 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
userInfo() {
|
||||
return this.$store.state.userInfo
|
||||
return this.$store.getters.userInfo
|
||||
},
|
||||
hasLogin() {
|
||||
return this.$store.getters.hasLogin
|
||||
|
Reference in New Issue
Block a user