Commit a22ff4fc by 姜鹏凯

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

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