配置
This commit is contained in:
@@ -24,11 +24,7 @@
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
user: this.$store.getters.loginName ? this.$store.getters.loginName : '',
|
||||
password: '',
|
||||
showPassword: false,
|
||||
saveUser: this.$store.getters.loginName ? true : false,
|
||||
disabled: false,
|
||||
addrip: this.$store.getters.baseUrl,
|
||||
version: '',
|
||||
versionCode: '',
|
||||
grade: false,
|
||||
@@ -49,54 +45,18 @@
|
||||
isUpdate () {
|
||||
this._pdaUpdate()
|
||||
},
|
||||
toSaveUser() {
|
||||
this.saveUser = !this.saveUser
|
||||
},
|
||||
changePassword() {
|
||||
this.showPassword = !this.showPassword
|
||||
},
|
||||
setup () {
|
||||
uni.redirectTo({
|
||||
url: '/pages/login/setup'
|
||||
})
|
||||
},
|
||||
async toLogin() {
|
||||
// uni.redirectTo({
|
||||
// url: '/pages/home/home'
|
||||
// })
|
||||
this.disabled = true
|
||||
if (this.user === '') {
|
||||
if (this.addrip === '') {
|
||||
uni.showToast({
|
||||
title: '用户名不能为空',
|
||||
title: '服务器地址',
|
||||
icon: 'none'
|
||||
})
|
||||
this.disabled = false
|
||||
return
|
||||
}
|
||||
if (this.password === '') {
|
||||
uni.showToast({
|
||||
title: '密码不能为空',
|
||||
icon: 'none'
|
||||
})
|
||||
this.disabled = false
|
||||
return
|
||||
}
|
||||
try {
|
||||
let res = await handLogin(this.user, RSAencrypt(this.password))
|
||||
if (this.saveUser) {
|
||||
this.$store.dispatch('saveLoginName', this.user)
|
||||
} else {
|
||||
this.$store.dispatch('delLoginName', '')
|
||||
}
|
||||
this.$store.dispatch('saveUserInfo', JSON.stringify(res.result))
|
||||
// this.$store.dispatch('saveToken', res.token)
|
||||
uni.redirectTo({
|
||||
url: '/pages/home/home'
|
||||
})
|
||||
this.disabled = false
|
||||
} catch (e) {
|
||||
this.disabled = false
|
||||
}
|
||||
this.$store.dispatch('setConfig',{baseUrl: this.addrip})
|
||||
uni.redirectTo({
|
||||
url: '/pages/home/home'
|
||||
})
|
||||
},
|
||||
async _pdaUpdate () {
|
||||
let res = await pdaUpdate()
|
||||
|
||||
Reference in New Issue
Block a user