Commit a22ff4fc by 姜鹏凯

首页头像、个人中心问题修复

1 parent a17bccc7
......@@ -79,7 +79,20 @@ export const constantRoutes = [
},
],
},
{
path: '/user',
component: Layout,
hidden: true,
redirect: 'noredirect',
children: [
{
path: 'profile',
component: (resolve) => require(['@/views/system/user/profile/index'], resolve),
name: 'Profile',
meta: { title: '个人中心', icon: 'user' },
},
],
},
{
path: '',
component: visitor,
......
......@@ -441,6 +441,7 @@
.userinfo {
display: flex;
.portrait {
flex-shrink: 0;
width: 120px;
height: 120px;
border-radius: 120px;
......@@ -465,6 +466,12 @@
flex-direction: column;
justify-content: space-between;
padding: 10px 0;
max-width: 200px;
span {
white-space: nowrap; /*强制单行显示*/
text-overflow: ellipsis; /*超出部分省略号表示*/
overflow: hidden; /*超出部分隐藏*/
}
span:nth-child(1) {
font-size: 16px;
}
......
......@@ -17,58 +17,54 @@
</template>
<script>
import { updateUserPwd } from "@/api/system/user";
import { updateUserPwd } from '@/api/system/user'
export default {
data() {
const equalToPassword = (rule, value, callback) => {
if (this.user.newPassword !== value) {
callback(new Error("两次输入的密码不一致"));
} else {
callback();
export default {
data() {
const equalToPassword = (rule, value, callback) => {
if (this.user.newPassword !== value) {
callback(new Error('两次输入的密码不一致'))
} else {
callback()
}
}
};
return {
test: "1test",
user: {
oldPassword: undefined,
newPassword: undefined,
confirmPassword: undefined
},
// 表单校验
rules: {
oldPassword: [
{ required: true, message: "旧密码不能为空", trigger: "blur" }
],
newPassword: [
{ required: true, message: "新密码不能为空", trigger: "blur" },
{ min: 6, max: 20, message: "长度在 6 到 20 个字符", trigger: "blur" }
],
confirmPassword: [
{ required: true, message: "确认密码不能为空", trigger: "blur" },
{ required: true, validator: equalToPassword, trigger: "blur" }
]
return {
test: '1test',
user: {
oldPassword: undefined,
newPassword: undefined,
confirmPassword: undefined
},
// 表单校验
rules: {
oldPassword: [{ required: true, message: '旧密码不能为空', trigger: 'blur' }],
newPassword: [
{ required: true, message: '新密码不能为空', trigger: 'blur' },
{ min: 6, max: 20, message: '长度在 6 到 20 个字符', trigger: 'blur' }
],
confirmPassword: [
{ required: true, message: '确认密码不能为空', trigger: 'blur' },
{ required: true, validator: equalToPassword, trigger: 'blur' }
]
}
}
};
},
methods: {
submit() {
this.$refs["form"].validate(valid => {
if (valid) {
updateUserPwd(this.user.oldPassword, this.user.newPassword).then(
response => {
},
methods: {
submit() {
this.$refs['form'].validate((valid) => {
if (valid) {
updateUserPwd(this.user.oldPassword, this.user.newPassword).then((response) => {
if (response.code === 200) {
this.msgSuccess("修改成功");
this.msgSuccess('修改成功')
}
}
);
}
});
},
close() {
this.$store.dispatch("tagsView/delView", this.$route);
this.$router.push({ path: "/index" });
})
}
})
},
close() {
this.$store.dispatch('tagsView/delView', this.$route)
this.$router.back()
}
}
}
};
</script>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!