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