mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-mobile.git
synced 2025-12-06 17:36:45 +08:00
Merge branch 'cloud'
This commit is contained in:
@@ -17,8 +17,12 @@ const modifyPassword = function(data) {
|
|||||||
return ajax.postJson('/b1/system/user/update-password',data);
|
return ajax.postJson('/b1/system/user/update-password',data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getRsaPublicKey=function(){
|
||||||
|
return ajax.get('/b1/common/secret/rsa-public-key');
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
logout,
|
logout,
|
||||||
modifyPassword
|
modifyPassword,
|
||||||
|
getRsaPublicKey
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
import accountApi from '@/api/account';
|
import accountApi from '@/api/account';
|
||||||
import apiLogin from '@/api/boe/login.js';
|
import apiLogin from '@/api/boe/login.js';
|
||||||
import apiUserBasic from '@/api/boe/userbasic.js'
|
import apiUserBasic from '@/api/boe/userbasic.js'
|
||||||
|
import JSEncrypt from '@/utils/jsencrypt.js';
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
var testPassword = /^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\W_!@#$%^&*`~()-+=]+$)(?![a-z0-9]+$)(?![a-z\W_!@#$%^&*`~()-+=]+$)(?![0-9\W_!@#$%^&*`~()-+=]+$)[a-zA-Z0-9\W_!@#$%^&*`~()-+=]{8,16}$/;
|
var testPassword = /^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\W_!@#$%^&*`~()-+=]+$)(?![a-z0-9]+$)(?![a-z\W_!@#$%^&*`~()-+=]+$)(?![0-9\W_!@#$%^&*`~()-+=]+$)[a-zA-Z0-9\W_!@#$%^&*`~()-+=]{8,16}$/;
|
||||||
@@ -96,33 +97,57 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
submit() {
|
submit() {
|
||||||
|
let $this=this;
|
||||||
this.$refs.ruleForm.validate().then(res => {
|
this.$refs.ruleForm.validate().then(res => {
|
||||||
let params = {
|
// let params = {
|
||||||
oldPassword: this.model.oldPass,
|
// oldPassword: this.model.oldPass,
|
||||||
newPassword: this.model.newPass,
|
// newPassword: this.model.newPass,
|
||||||
confirmPassword: this.model.confirmPass
|
// confirmPassword: this.model.confirmPass
|
||||||
};
|
// };
|
||||||
|
apiLogin.getRsaPublicKey().then(krs=>{
|
||||||
|
if(krs.code=='0'){
|
||||||
|
let publicKey=krs.data.list.publickey;
|
||||||
|
let encryptor = new JSEncrypt();
|
||||||
|
let rsa ='-----BEGIN PUBLIC KEY-----'+publicKey+'-----END PUBLIC KEY-----';
|
||||||
|
encryptor.setPublicKey(rsa);
|
||||||
|
let mpdata={
|
||||||
|
oldPassword:$this.model.oldPass,
|
||||||
|
newPassword:encryptor.encrypt($this.model.newPass),
|
||||||
|
confirmPassword:encryptor.encrypt($this.model.confirmPass)
|
||||||
|
}
|
||||||
|
apiUserBasic.modifyPassword(mpdata).then(res=>{
|
||||||
|
if(res.status==200){
|
||||||
|
let loginPath = this.$config.loginPath;
|
||||||
|
uni.showToast({ title: '修改成功,请重新登录', duration: 2000 });
|
||||||
|
setTimeout(() => { location.href = loginPath; }, 2000);
|
||||||
|
}else{
|
||||||
|
uni.showToast({ title: res.message, icon: 'none' });
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
uni.showToast({ title: '获取公钥错误', icon: 'none' });
|
||||||
|
}
|
||||||
|
})
|
||||||
//apiLogin 修改为 apiUserBasic
|
//apiLogin 修改为 apiUserBasic
|
||||||
apiUserBasic.modifyPassword(params).then(res => {
|
// apiUserBasic.modifyPassword(params).then(res => {
|
||||||
if (res.status == 200) {
|
// if (res.status == 200) {
|
||||||
let loginPath = this.$config.loginPath;
|
// let loginPath = this.$config.loginPath;
|
||||||
|
|
||||||
uni.showToast({
|
// uni.showToast({
|
||||||
title: '修改成功,请重新登录',
|
// title: '修改成功,请重新登录',
|
||||||
duration: 2000
|
// duration: 2000
|
||||||
});
|
// });
|
||||||
setTimeout(() => {
|
// setTimeout(() => {
|
||||||
location.href = loginPath;
|
// location.href = loginPath;
|
||||||
}, 2000);
|
// }, 2000);
|
||||||
} else {
|
// } else {
|
||||||
uni.showToast({
|
// uni.showToast({
|
||||||
title: res.message,
|
// title: res.message,
|
||||||
icon: 'none'
|
// icon: 'none'
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
})
|
}).catch(errors => {
|
||||||
.catch(errors => {
|
|
||||||
uni.$u.toast('校验失败:' + errors);
|
uni.$u.toast('校验失败:' + errors);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
2
utils/jsencrypt.js
Normal file
2
utils/jsencrypt.js
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user