feat: 登录默认密码提示改密并可取消,版本升至1.1.19

This commit is contained in:
2026-11-03 16:01:56 +08:00
parent fdacdfbda0
commit 59e699b4f6
3 changed files with 65 additions and 16 deletions
+2 -2
View File
@@ -2,8 +2,8 @@
"name" : "浩拓织厂", "name" : "浩拓织厂",
"appid" : "__UNI__F79F300", "appid" : "__UNI__F79F300",
"description" : "周尚-浩拓织厂", "description" : "周尚-浩拓织厂",
"versionName" : "1.1.18", "versionName" : "1.1.19",
"versionCode" : 118, "versionCode" : 119,
"transformPx" : false, "transformPx" : false,
"app-plus" : { "app-plus" : {
"optimization" : { "optimization" : {
+30 -10
View File
@@ -364,12 +364,6 @@ export default {
console.log('自动匹配扫码设置失败', scanError); console.log('自动匹配扫码设置失败', scanError);
} }
setTimeout(() => {
uni.reLaunch({
url: '/pages/sys/workbench/index'
});
}, 500);
var that = this var that = this
if (that.remember == true) { if (that.remember == true) {
if ((this.login.username.length > 0) && (this.login.password.length > 0)) { 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'); this.$store.dispatch('initNotification');
setTimeout(function () { setTimeout(function () {
uni.hideLoading(); uni.hideLoading();
}, 1000); }, 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) => { }).catch((error) => {
console.log('login error', error) console.log('login error', error)
uni.showToast({ uni.showToast({
+33 -4
View File
@@ -30,10 +30,11 @@ import base64 from '@/common/base64.js';
export default { export default {
data() { data() {
return { return {
fromLogin: false,
model: { model: {
oldPassword: '', oldPassword: '',
newPassword: '', newPassword: '',
confirmNewPassword: '' confirmPassword: ''
}, },
rules: { rules: {
oldPassword: [ oldPassword: [
@@ -72,10 +73,31 @@ export default {
} }
}; };
}, },
onLoad(options) {
this.fromLogin = options && options.from === 'login';
},
onReady() { onReady() {
this.$refs.uForm.setRules(this.rules); this.$refs.uForm.setRules(this.rules);
}, },
onBackPress() {
if (this.fromLogin) {
uni.reLaunch({
url: '/pages/sys/workbench/index'
});
return true;
}
return false;
},
methods: { methods: {
goAfterSuccess() {
if (this.fromLogin) {
uni.reLaunch({
url: '/pages/sys/workbench/index'
});
return;
}
uni.navigateBack();
},
submit() { submit() {
this.$refs.uForm.validate(valid => { this.$refs.uForm.validate(valid => {
if (valid) { if (valid) {
@@ -84,12 +106,19 @@ export default {
newPassword: this.model.newPassword newPassword: this.model.newPassword
}).then(res => { }).then(res => {
if(res.code == '200'){ if(res.code == '200'){
const userInfo = uni.getStorageSync('UserInfo');
if (userInfo && typeof userInfo === 'object') {
uni.setStorageSync('UserInfo', {
...userInfo,
password: this.model.newPassword
});
}
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: res.msg, content: res.msg,
showCancel: false, showCancel: false,
success: function () { success: () => {
uni.navigateBack(); this.goAfterSuccess();
} }
}); });
}else{ }else{
@@ -106,7 +135,7 @@ export default {
}); });
}, },
cancel() { cancel() {
uni.navigateBack(); this.goAfterSuccess();
} }
} }
}; };