feat: 登录默认密码提示改密并可取消,版本升至1.1.19
This commit is contained in:
@@ -364,12 +364,6 @@ export default {
|
||||
console.log('自动匹配扫码设置失败', scanError);
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
uni.reLaunch({
|
||||
url: '/pages/sys/workbench/index'
|
||||
});
|
||||
}, 500);
|
||||
|
||||
var that = this
|
||||
if (that.remember == true) {
|
||||
if ((this.login.username.length > 0) && (this.login.password.length > 0)) {
|
||||
@@ -381,14 +375,40 @@ export default {
|
||||
|
||||
}
|
||||
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '登录成功!'
|
||||
});
|
||||
this.$store.dispatch('initNotification');
|
||||
setTimeout(function () {
|
||||
uni.hideLoading();
|
||||
}, 1000);
|
||||
|
||||
const goWorkbench = () => {
|
||||
uni.reLaunch({
|
||||
url: '/pages/sys/workbench/index'
|
||||
});
|
||||
};
|
||||
|
||||
if (aLoginUserData.is_default_password) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '检测到当前为默认密码,建议修改后再使用',
|
||||
confirmText: '去修改',
|
||||
cancelText: '取消',
|
||||
success: (modalRes) => {
|
||||
if (modalRes.confirm) {
|
||||
uni.reLaunch({
|
||||
url: '/pages/sys/user/pwd?from=login'
|
||||
});
|
||||
} else {
|
||||
goWorkbench();
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '登录成功!'
|
||||
});
|
||||
setTimeout(goWorkbench, 500);
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.log('login error', error)
|
||||
uni.showToast({
|
||||
|
||||
@@ -30,10 +30,11 @@ import base64 from '@/common/base64.js';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
fromLogin: false,
|
||||
model: {
|
||||
oldPassword: '',
|
||||
newPassword: '',
|
||||
confirmNewPassword: ''
|
||||
confirmPassword: ''
|
||||
},
|
||||
rules: {
|
||||
oldPassword: [
|
||||
@@ -72,10 +73,31 @@ export default {
|
||||
}
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
this.fromLogin = options && options.from === 'login';
|
||||
},
|
||||
onReady() {
|
||||
this.$refs.uForm.setRules(this.rules);
|
||||
},
|
||||
onBackPress() {
|
||||
if (this.fromLogin) {
|
||||
uni.reLaunch({
|
||||
url: '/pages/sys/workbench/index'
|
||||
});
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
methods: {
|
||||
goAfterSuccess() {
|
||||
if (this.fromLogin) {
|
||||
uni.reLaunch({
|
||||
url: '/pages/sys/workbench/index'
|
||||
});
|
||||
return;
|
||||
}
|
||||
uni.navigateBack();
|
||||
},
|
||||
submit() {
|
||||
this.$refs.uForm.validate(valid => {
|
||||
if (valid) {
|
||||
@@ -84,12 +106,19 @@ export default {
|
||||
newPassword: this.model.newPassword
|
||||
}).then(res => {
|
||||
if(res.code == '200'){
|
||||
const userInfo = uni.getStorageSync('UserInfo');
|
||||
if (userInfo && typeof userInfo === 'object') {
|
||||
uni.setStorageSync('UserInfo', {
|
||||
...userInfo,
|
||||
password: this.model.newPassword
|
||||
});
|
||||
}
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: res.msg,
|
||||
showCancel: false,
|
||||
success: function () {
|
||||
uni.navigateBack();
|
||||
success: () => {
|
||||
this.goAfterSuccess();
|
||||
}
|
||||
});
|
||||
}else{
|
||||
@@ -106,7 +135,7 @@ export default {
|
||||
});
|
||||
},
|
||||
cancel() {
|
||||
uni.navigateBack();
|
||||
this.goAfterSuccess();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user