|
@@ -58,6 +58,7 @@
|
|
|
export default {
|
|
export default {
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
|
|
+ requestStatus:false,
|
|
|
savePassword:false,
|
|
savePassword:false,
|
|
|
form: {
|
|
form: {
|
|
|
username: '',
|
|
username: '',
|
|
@@ -109,6 +110,11 @@
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
login() {
|
|
login() {
|
|
|
|
|
+
|
|
|
|
|
+ if (this.requestStatus){
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ this.requestStatus=true
|
|
|
this.$refs.uForm.validate().then(res => {
|
|
this.$refs.uForm.validate().then(res => {
|
|
|
if (this.savePassword){
|
|
if (this.savePassword){
|
|
|
uni.setStorageSync('savePassword', this.savePassword)
|
|
uni.setStorageSync('savePassword', this.savePassword)
|
|
@@ -120,9 +126,16 @@
|
|
|
uni.removeStorageSync('password');
|
|
uni.removeStorageSync('password');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ uni.showLoading({
|
|
|
|
|
+ title: '登录中...'
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
this.$api.login.expandLogin(this.form).then(res => {
|
|
this.$api.login.expandLogin(this.form).then(res => {
|
|
|
|
|
+ uni.hideLoading();
|
|
|
|
|
+ this.requestStatus=false
|
|
|
uni.setStorageSync('accessToken', res.data.data.access_token)
|
|
uni.setStorageSync('accessToken', res.data.data.access_token)
|
|
|
this.$api.user.getUserInfo().then(res=>{
|
|
this.$api.user.getUserInfo().then(res=>{
|
|
|
|
|
+
|
|
|
this.userInfo = res.data.data
|
|
this.userInfo = res.data.data
|
|
|
uni.setStorageSync('spreadUserInfo', this.userInfo)
|
|
uni.setStorageSync('spreadUserInfo', this.userInfo)
|
|
|
uni.showToast({
|
|
uni.showToast({
|
|
@@ -136,8 +149,11 @@
|
|
|
})
|
|
})
|
|
|
},1000)
|
|
},1000)
|
|
|
})
|
|
})
|
|
|
-
|
|
|
|
|
|
|
+ }).catch(err=>{
|
|
|
|
|
+ this.requestStatus=false
|
|
|
})
|
|
})
|
|
|
|
|
+ }).catch(err=>{
|
|
|
|
|
+ this.requestStatus=false
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|