|
|
|
@ -73,19 +73,18 @@ |
|
|
|
|
import {ref,reactive} from "vue" |
|
|
|
|
import { getUserProfile } from "@/api/system/user"; |
|
|
|
|
import { getUpdatePwd } from "@/api/system/userInfo"; |
|
|
|
|
import {ElMessage} from "element-plus"; |
|
|
|
|
import router from "@/router"; |
|
|
|
|
import { removeToken } from '@/utils/auth' |
|
|
|
|
|
|
|
|
|
// const activeTab = ref("userinfo"); |
|
|
|
|
const state = reactive({ |
|
|
|
|
user: {}, |
|
|
|
|
roleGroup: {}, |
|
|
|
|
postGroup: {}, |
|
|
|
|
userResetPwd:{ |
|
|
|
|
oldPassword: undefined, |
|
|
|
|
newPassword: undefined, |
|
|
|
|
confirmPassword: undefined |
|
|
|
|
}, |
|
|
|
|
postGroup: {} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
//个人信息 |
|
|
|
|
function getUser() { |
|
|
|
|
getUserProfile().then(response => { |
|
|
|
|
state.user = response.data; |
|
|
|
@ -101,6 +100,15 @@ const userResetPwd = reactive({ |
|
|
|
|
confirmPassword: undefined |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
//确认密码 |
|
|
|
|
const equalToPassword = (rule, value, callback) => { |
|
|
|
|
if (userResetPwd.newPassword !== value) { |
|
|
|
|
callback(new Error("两次输入的密码不一致")); |
|
|
|
|
} else { |
|
|
|
|
callback(); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
//规则 |
|
|
|
|
const rules = reactive({ |
|
|
|
|
oldPassword: [ |
|
|
|
@ -112,29 +120,25 @@ const rules = reactive({ |
|
|
|
|
], |
|
|
|
|
confirmPassword: [ |
|
|
|
|
{required: true, message: "确认密码不能为空", trigger: "blur"}, |
|
|
|
|
// {required: true, validator: equalToPassword, trigger: "blur"} |
|
|
|
|
{required: true, validator: equalToPassword, trigger: "blur"} |
|
|
|
|
] |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
//保存按钮 |
|
|
|
|
function submitResetPwd() { |
|
|
|
|
// this.$refs["formResetPwd"].validate(valid => { |
|
|
|
|
// if (valid) { |
|
|
|
|
// userResetPwd().then(response => { |
|
|
|
|
// if (response.data.code === 200){ |
|
|
|
|
// this.$message.success(response.data.msg) |
|
|
|
|
// this.$router.push({ path: "/Logout" }); |
|
|
|
|
// }else { |
|
|
|
|
// this.$message.error(response.data.msg) |
|
|
|
|
// } |
|
|
|
|
// }); |
|
|
|
|
getUpdatePwd({ |
|
|
|
|
oldPassword: '123456', |
|
|
|
|
newPassword: '16341526' |
|
|
|
|
}).then((res)=>{ |
|
|
|
|
getUpdatePwd(userResetPwd.oldPassword, userResetPwd.newPassword).then((res)=>{ |
|
|
|
|
console.log(res) |
|
|
|
|
// }) |
|
|
|
|
// } |
|
|
|
|
if(res.code === 200){ |
|
|
|
|
ElMessage({ |
|
|
|
|
type:'success', |
|
|
|
|
message:'修改密码成功!', |
|
|
|
|
}) |
|
|
|
|
// 清除token |
|
|
|
|
removeToken() |
|
|
|
|
// 跳转到登录页 |
|
|
|
|
location.href = '/login'; |
|
|
|
|
// `/login?redirect=${to.fullPath}` |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|