2021-10-18 18:46:11 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<v-container id="user-profile-view" fluid tag="section">
|
|
|
|
|
|
<v-row justify="center">
|
|
|
|
|
|
<v-col cols="12" md="4">
|
|
|
|
|
|
<app-card class="mt-4 text-center">
|
|
|
|
|
|
<v-img
|
|
|
|
|
|
class="rounded-circle elevation-6 mt-n12 d-inline-block"
|
|
|
|
|
|
src="https://demos.creative-tim.com/vue-material-dashboard/img/marc.aba54d65.jpg"
|
|
|
|
|
|
width="128"
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
|
|
<v-card-text class="text-center">
|
2021-10-20 16:38:39 +08:00
|
|
|
|
<h6 class="text-h6 mb-2 text--secondary">
|
|
|
|
|
|
{{ userInfo.username }}
|
|
|
|
|
|
</h6>
|
2021-10-18 18:46:11 +08:00
|
|
|
|
|
2021-10-20 16:38:39 +08:00
|
|
|
|
<h4 class="text-h4 mb-3 text--primary">{{ userInfo.nick }}</h4>
|
2021-10-18 18:46:11 +08:00
|
|
|
|
|
2021-10-20 16:38:39 +08:00
|
|
|
|
<p class="text--secondary">{{ userInfo.introduction }}</p>
|
2021-10-18 18:46:11 +08:00
|
|
|
|
|
|
|
|
|
|
<v-btn class="mr-4" color="primary" min-width="100" rounded>
|
|
|
|
|
|
编辑头像
|
|
|
|
|
|
</v-btn>
|
|
|
|
|
|
<v-btn color="primary" min-width="100" rounded> 绑定QQ </v-btn>
|
|
|
|
|
|
</v-card-text>
|
|
|
|
|
|
</app-card>
|
|
|
|
|
|
</v-col>
|
|
|
|
|
|
|
|
|
|
|
|
<v-col cols="12" md="8">
|
|
|
|
|
|
<material-card color="primary" icon="mdi-account-outline">
|
|
|
|
|
|
<template #title>
|
|
|
|
|
|
用户信息 — <small class="text-body-1">编辑属于你的一切</small>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<v-form>
|
2021-10-20 16:38:39 +08:00
|
|
|
|
<v-tabs class="pl-4" v-model="tab">
|
2021-10-18 18:46:11 +08:00
|
|
|
|
<v-tab href="#tab-1">
|
|
|
|
|
|
账户信息
|
|
|
|
|
|
<v-icon>mdi-phone</v-icon>
|
|
|
|
|
|
</v-tab>
|
|
|
|
|
|
|
|
|
|
|
|
<v-tab href="#tab-2">
|
|
|
|
|
|
额外信息
|
|
|
|
|
|
<v-icon>mdi-account-box</v-icon>
|
|
|
|
|
|
</v-tab>
|
|
|
|
|
|
|
|
|
|
|
|
<v-tab href="#tab-3">
|
|
|
|
|
|
修改密码
|
|
|
|
|
|
<v-icon>mdi-account-box</v-icon>
|
|
|
|
|
|
</v-tab>
|
|
|
|
|
|
</v-tabs>
|
|
|
|
|
|
|
|
|
|
|
|
<v-tabs-items v-model="tab">
|
|
|
|
|
|
<v-tab-item :value="'tab-1'">
|
|
|
|
|
|
<v-card class="py-0">
|
2021-10-20 16:38:39 +08:00
|
|
|
|
<v-card-text>
|
|
|
|
|
|
<div>Account Information</div>
|
|
|
|
|
|
<v-row>
|
|
|
|
|
|
<v-col cols="12" md="4">
|
|
|
|
|
|
<v-text-field color="purple" label="用户名" v-model="editInfo.username" disabled />
|
|
|
|
|
|
</v-col>
|
|
|
|
|
|
<v-col cols="12" md="4">
|
|
|
|
|
|
<v-text-field color="purple" label="昵称" v-model="editInfo.nick" />
|
|
|
|
|
|
</v-col>
|
|
|
|
|
|
<v-col cols="12" md="4">
|
|
|
|
|
|
<v-text-field color="purple" label="邮箱" v-model="editInfo.email"/>
|
|
|
|
|
|
</v-col>
|
|
|
|
|
|
|
|
|
|
|
|
<v-col cols="12" md="6">
|
|
|
|
|
|
<v-text-field color="purple" label="住址" v-model="editInfo.address" />
|
|
|
|
|
|
</v-col>
|
|
|
|
|
|
<v-col cols="12" md="6">
|
|
|
|
|
|
<v-text-field
|
|
|
|
|
|
color="purple"
|
|
|
|
|
|
label="电话"
|
|
|
|
|
|
type="number"
|
|
|
|
|
|
v-model="editInfo.phone"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</v-col>
|
|
|
|
|
|
<v-col cols="12">
|
|
|
|
|
|
<v-textarea
|
|
|
|
|
|
v-model="editInfo.introduction"
|
|
|
|
|
|
color="purple"
|
|
|
|
|
|
label="简介"
|
|
|
|
|
|
value="空空如也,Ta什么也没有留下"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</v-col>
|
|
|
|
|
|
</v-row>
|
|
|
|
|
|
</v-card-text>
|
2021-10-18 18:46:11 +08:00
|
|
|
|
</v-card>
|
|
|
|
|
|
</v-tab-item>
|
|
|
|
|
|
<v-tab-item :value="'tab-2'">
|
2021-10-20 16:38:39 +08:00
|
|
|
|
<v-card class="py-0 mx-auto">
|
|
|
|
|
|
<v-card-text>
|
|
|
|
|
|
<div>Extra Information</div>
|
|
|
|
|
|
<v-row>
|
|
|
|
|
|
<v-col cols="12">
|
|
|
|
|
|
<v-list two-line>
|
|
|
|
|
|
<v-list-item>
|
|
|
|
|
|
<v-list-item-icon>
|
|
|
|
|
|
<v-icon color="secondary"> mdi-phone </v-icon>
|
|
|
|
|
|
</v-list-item-icon>
|
|
|
|
|
|
|
|
|
|
|
|
<v-list-item-content>
|
|
|
|
|
|
<v-list-item-title>等级:</v-list-item-title>
|
|
|
|
|
|
<v-list-item-subtitle>100</v-list-item-subtitle>
|
|
|
|
|
|
</v-list-item-content>
|
|
|
|
|
|
|
|
|
|
|
|
<v-list-item-icon>
|
|
|
|
|
|
<v-icon>mdi-message-text</v-icon>
|
|
|
|
|
|
</v-list-item-icon>
|
|
|
|
|
|
</v-list-item>
|
|
|
|
|
|
|
|
|
|
|
|
<v-list-item>
|
|
|
|
|
|
<v-list-item-action></v-list-item-action>
|
|
|
|
|
|
|
|
|
|
|
|
<v-list-item-content>
|
|
|
|
|
|
<v-list-item-title>经验:</v-list-item-title>
|
|
|
|
|
|
<v-list-item-subtitle>1000</v-list-item-subtitle>
|
|
|
|
|
|
</v-list-item-content>
|
|
|
|
|
|
|
|
|
|
|
|
<v-list-item-icon>
|
|
|
|
|
|
<v-icon>mdi-message-text</v-icon>
|
|
|
|
|
|
</v-list-item-icon>
|
|
|
|
|
|
</v-list-item>
|
|
|
|
|
|
|
|
|
|
|
|
<v-divider inset></v-divider>
|
|
|
|
|
|
|
|
|
|
|
|
<v-list-item>
|
|
|
|
|
|
<v-list-item-icon>
|
|
|
|
|
|
<v-icon color="secondary"> mdi-lock </v-icon>
|
|
|
|
|
|
</v-list-item-icon>
|
|
|
|
|
|
|
|
|
|
|
|
<v-list-item-content>
|
|
|
|
|
|
<v-list-item-title>拥有角色:</v-list-item-title>
|
|
|
|
|
|
<v-list-item-subtitle>
|
|
|
|
|
|
<v-row>
|
|
|
|
|
|
<v-col
|
|
|
|
|
|
v-for="item in editInfo.roles"
|
|
|
|
|
|
:key="item.id"
|
|
|
|
|
|
cols="6" sm="3" md="1">{{item.role_name}}</v-col>
|
|
|
|
|
|
</v-row>
|
|
|
|
|
|
</v-list-item-subtitle>
|
|
|
|
|
|
</v-list-item-content>
|
|
|
|
|
|
</v-list-item>
|
|
|
|
|
|
<v-list-item>
|
|
|
|
|
|
<v-list-item-action></v-list-item-action>
|
|
|
|
|
|
|
|
|
|
|
|
<v-list-item-content>
|
|
|
|
|
|
<v-list-item-title>拥有菜单:</v-list-item-title>
|
|
|
|
|
|
<v-list-item-subtitle>
|
|
|
|
|
|
<v-row>
|
|
|
|
|
|
<v-col
|
|
|
|
|
|
v-for="item in menuInfo"
|
|
|
|
|
|
:key="item.id"
|
2021-10-20 20:19:04 +08:00
|
|
|
|
cols="6" sm="3" md="1">{{item.menu_name}}</v-col>
|
2021-10-20 16:38:39 +08:00
|
|
|
|
</v-row>
|
|
|
|
|
|
</v-list-item-subtitle>
|
|
|
|
|
|
</v-list-item-content>
|
|
|
|
|
|
</v-list-item>
|
|
|
|
|
|
|
|
|
|
|
|
<v-divider inset></v-divider>
|
|
|
|
|
|
|
|
|
|
|
|
<v-list-item>
|
|
|
|
|
|
<v-list-item-icon>
|
|
|
|
|
|
<v-icon color="secondary"> mdi-email </v-icon>
|
|
|
|
|
|
</v-list-item-icon>
|
|
|
|
|
|
|
|
|
|
|
|
<v-list-item-content>
|
|
|
|
|
|
<v-list-item-title>等待更新:</v-list-item-title>
|
|
|
|
|
|
<v-list-item-subtitle>1000</v-list-item-subtitle>
|
|
|
|
|
|
</v-list-item-content>
|
|
|
|
|
|
</v-list-item>
|
|
|
|
|
|
|
|
|
|
|
|
<v-list-item>
|
|
|
|
|
|
<v-list-item-action></v-list-item-action>
|
|
|
|
|
|
|
|
|
|
|
|
<v-list-item-content>
|
|
|
|
|
|
<v-list-item-title>等待更新:</v-list-item-title>
|
|
|
|
|
|
<v-list-item-subtitle>500</v-list-item-subtitle>
|
|
|
|
|
|
</v-list-item-content>
|
|
|
|
|
|
</v-list-item>
|
|
|
|
|
|
|
|
|
|
|
|
<v-list-item>
|
|
|
|
|
|
<v-list-item-action></v-list-item-action>
|
|
|
|
|
|
<v-list-item-content>
|
|
|
|
|
|
<v-btn dark color="primary" class="ml-0" dense>
|
|
|
|
|
|
等待更新
|
|
|
|
|
|
</v-btn>
|
|
|
|
|
|
</v-list-item-content>
|
|
|
|
|
|
</v-list-item>
|
|
|
|
|
|
<v-divider inset></v-divider>
|
|
|
|
|
|
</v-list>
|
|
|
|
|
|
</v-col>
|
|
|
|
|
|
</v-row>
|
|
|
|
|
|
</v-card-text>
|
|
|
|
|
|
</v-card>
|
2021-10-18 18:46:11 +08:00
|
|
|
|
</v-tab-item>
|
|
|
|
|
|
<v-tab-item :value="'tab-3'">
|
|
|
|
|
|
<v-card>
|
|
|
|
|
|
<v-card-text>
|
2021-10-20 16:38:39 +08:00
|
|
|
|
<div>Password Information</div>
|
|
|
|
|
|
<v-col cols="12">
|
|
|
|
|
|
<v-text-field
|
|
|
|
|
|
style="width: 80%"
|
|
|
|
|
|
label="原密码"
|
|
|
|
|
|
v-model="editInfo.password"
|
|
|
|
|
|
outlined
|
|
|
|
|
|
clearable
|
|
|
|
|
|
></v-text-field>
|
|
|
|
|
|
<v-text-field
|
|
|
|
|
|
required
|
|
|
|
|
|
style="width: 80%"
|
|
|
|
|
|
:counter="120"
|
|
|
|
|
|
v-model="newPassword"
|
|
|
|
|
|
:disabled="dis_newPassword"
|
|
|
|
|
|
label="新密码"
|
|
|
|
|
|
></v-text-field>
|
|
|
|
|
|
</v-col>
|
|
|
|
|
|
</v-card-text>
|
2021-10-18 18:46:11 +08:00
|
|
|
|
</v-card>
|
2021-10-20 16:38:39 +08:00
|
|
|
|
</v-tab-item>
|
2021-10-18 18:46:11 +08:00
|
|
|
|
</v-tabs-items>
|
|
|
|
|
|
|
2021-10-20 16:38:39 +08:00
|
|
|
|
<v-col cols="12" class="text-right">
|
|
|
|
|
|
<v-btn color="primary" class="ma-4" min-width="100"> 清空 </v-btn>
|
2021-10-20 20:19:04 +08:00
|
|
|
|
<v-btn color="secondary" @click="save()" min-width="100"> 保存 </v-btn>
|
2021-10-20 16:38:39 +08:00
|
|
|
|
</v-col>
|
2021-10-18 18:46:11 +08:00
|
|
|
|
</v-form>
|
|
|
|
|
|
</material-card>
|
|
|
|
|
|
</v-col>
|
|
|
|
|
|
</v-row>
|
|
|
|
|
|
</v-container>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2021-10-20 16:38:39 +08:00
|
|
|
|
import userApi from "../api/userApi";
|
2021-10-20 20:19:04 +08:00
|
|
|
|
import menuApi from "../api/menuApi";
|
|
|
|
|
|
import accountApi from "../api/accountApi"
|
2021-10-18 18:46:11 +08:00
|
|
|
|
export default {
|
|
|
|
|
|
name: "UserProfileView",
|
|
|
|
|
|
data: () => ({
|
|
|
|
|
|
tab: "tab-1",
|
2021-10-20 16:38:39 +08:00
|
|
|
|
userInfo: {},
|
|
|
|
|
|
editInfo: {},
|
|
|
|
|
|
newPassword:"",
|
|
|
|
|
|
dis_newPassword:true,
|
2021-10-20 20:19:04 +08:00
|
|
|
|
menuInfo:[]
|
2021-10-18 18:46:11 +08:00
|
|
|
|
}),
|
2021-10-20 16:38:39 +08:00
|
|
|
|
created() {
|
2021-10-20 20:19:04 +08:00
|
|
|
|
this.init();
|
2021-10-20 16:38:39 +08:00
|
|
|
|
},
|
|
|
|
|
|
watch:{
|
|
|
|
|
|
editInfo:{
|
|
|
|
|
|
handler(val, oldVal){
|
|
|
|
|
|
if(val.password.length>0 )
|
|
|
|
|
|
{
|
|
|
|
|
|
this.dis_newPassword=false;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
this.dis_newPassword=true;
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
deep:true //true 深度监听
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
methods: {
|
2021-10-20 20:19:04 +08:00
|
|
|
|
save()
|
|
|
|
|
|
{
|
|
|
|
|
|
accountApi.changePassword(this.editInfo,this.newPassword).then(resp=>{
|
|
|
|
|
|
if(resp.status)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.$dialog.notify.error(resp.msg, {
|
|
|
|
|
|
position: "top-right",
|
|
|
|
|
|
timeout: 5000,
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
this.$dialog.notify.success(resp.msg, {
|
|
|
|
|
|
position: "top-right",
|
|
|
|
|
|
timeout: 5000,
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
this.init();
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2021-10-20 16:38:39 +08:00
|
|
|
|
init() {
|
|
|
|
|
|
userApi.GetUserInfoById().then((resp) => {
|
|
|
|
|
|
this.userInfo = resp.data;
|
2021-10-20 20:19:04 +08:00
|
|
|
|
this.userInfo.password="";
|
2021-10-20 16:38:39 +08:00
|
|
|
|
this.editInfo= Object.assign({}, this.userInfo);
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
menuApi.geTopMenuByUser().then(resp=>{
|
|
|
|
|
|
this.menuInfo=resp.data;
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
2021-10-18 18:46:11 +08:00
|
|
|
|
};
|
|
|
|
|
|
</script>
|