|
|
@@ -108,6 +108,20 @@ export default {
|
|
|
try {
|
|
|
await this.$refs.ruleForm.validate()
|
|
|
const res = await userSave(this.ruleForm)
|
|
|
+ // 如果是编辑用户--并且编辑的是自己
|
|
|
+ if (this.ruleForm.id) {
|
|
|
+ const temp = localStorage.getItem('SWKK_userInfo')
|
|
|
+ const userInfo = JSON.parse(temp)
|
|
|
+ if (userInfo.id === this.ruleForm.id) {
|
|
|
+ const userRes = await getUserDetailById(this.ruleForm.id)
|
|
|
+ localStorage.setItem('SWKK_userInfo', JSON.stringify(userRes.data))
|
|
|
+ this.$nextTick(() => {
|
|
|
+ setTimeout(() => {
|
|
|
+ location.reload(true)
|
|
|
+ }, 200)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
if (res.code === 0) {
|
|
|
this.$message.success('操作成功')
|
|
|
// 通知父组件更新
|
|
|
@@ -122,7 +136,7 @@ export default {
|
|
|
async getUserDetailById (id) {
|
|
|
const res = await getUserDetailById(id)
|
|
|
this.ruleForm = res.data
|
|
|
- // console.log(999, res)
|
|
|
+ // localStorage.setItem('SWKK_userInfo', JSON.stringify(res.data))
|
|
|
}
|
|
|
},
|
|
|
// 生命周期 - 创建完成(可以访问当前this实例)
|