用户界面

This commit is contained in:
橙子
2021-10-20 16:38:39 +08:00
parent 7f5cba11b7
commit 1bf37a2590
11 changed files with 244 additions and 168 deletions

View File

@@ -104,8 +104,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
[HttpPost]
public async Task<Result> AddChildrenMenu(ChildrenDto<menu> childrenDto)
{
var _children= await _menuService.AddChildrenMenu(childrenDto.parentId, childrenDto.data);
await _menuService.AddChildrenMenu(childrenDto.parentId, childrenDto.data);
return Result.Success();
}
/// <summary>

View File

@@ -122,6 +122,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// 根据http上下文的用户得到该用户信息关联角色
/// </summary>
/// <returns></returns>
[Authorize]
[HttpGet]
public async Task<Result> GetUserInfoById()
{

View File

@@ -32,6 +32,13 @@
<param name="emailAddress"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.AccountController.ChangePassword(Yi.Framework.DTOModel.ChangePwdDto)">
<summary>
修改密码
</summary>
<param name="pwdDto"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.MenuController.UpdateMenu(Yi.Framework.Model.Models.menu)">
<summary>

View File

@@ -28,6 +28,13 @@ export default {
url: `/Account/email?emailAddress=${emailAddress}`,
method: 'post',
})
},
changePassword(user, newPassword) {
return myaxios({
url: `/Account/changePassword`,
method: 'put',
data: { user, newPassword }
})
}
}

View File

@@ -40,5 +40,11 @@ export default {
method: 'post',
data: { id1: menuId, id2: mouldId }
})
},
geTopMenuByUser() {
return myaxios({
url: '/Menu/geTopMenuByUser',
method: 'get'
})
}
}

View File

@@ -19,5 +19,11 @@ export default {
url: `/User/GetRolesByUserId?userId=${userId}`,
method: 'get'
})
},
GetUserInfoById() {
return myaxios({
url: `/User/GetUserInfoById`,
method: 'get'
})
}
}

View File

@@ -49,14 +49,33 @@ myaxios.interceptors.response.use(async function(response) {
store.dispatch("closeLoad");
return resp;
}, function(error) {
}, async function(error) {
const resp = error.response.data
if (resp.code == undefined && resp.msg == undefined) {
vm.$dialog.notify.error("错误代码:无,原因:与服务器失去连接", {
position: "top-right",
timeout: 5000,
});
} else if (resp.code == 401) {
const res = await vm.$dialog.error({
text: `错误代码:${resp.code},原因:${resp.msg}<br>是否重新进行登录?`,
title: '错误',
actions: {
'false': '取消',
'true': '跳转'
}
});
if (res) {
vm.$store.dispatch("Logout").then((resp) => {
vm.$router.push({ path: "/login" });
});
}
} else if (resp.code !== 200) {
vm.$dialog.notify.error(`错误代码:${resp.code},原因:${resp.msg}`, {
position: "top-right",
timeout: 5000,
});
}
store.dispatch("closeLoad");

View File

@@ -108,6 +108,8 @@ strInfo+="<hr>"
{ text: "邮箱", value: "email", sortable: true },
{ text: "IP", value: "ip", sortable: false },
{ text: "年龄", value: "age", sortable: false },
{ text: "地址", value: "address", sortable: false },
{ text: "电话", value: "phone", sortable: false },
{ text: "操作", value: "actions", sortable: false },
],
defaultItem: {
@@ -116,6 +118,8 @@ strInfo+="<hr>"
icon: "mdi-lock",
nick: "橙子",
age: 18,
address:"中国",
phone:""
},
}),
};

View File

@@ -10,11 +10,13 @@
/>
<v-card-text class="text-center">
<h6 class="text-h6 mb-2 text--secondary">橙子</h6>
<h6 class="text-h6 mb-2 text--secondary">
{{ userInfo.username }}
</h6>
<h4 class="text-h4 mb-3 text--primary">橙子大大</h4>
<h4 class="text-h4 mb-3 text--primary">{{ userInfo.nick }}</h4>
<p class="text--secondary">我认为世界有我而更精彩难道不是吗</p>
<p class="text--secondary">{{ userInfo.introduction }}</p>
<v-btn class="mr-4" color="primary" min-width="100" rounded>
编辑头像
@@ -31,7 +33,7 @@
</template>
<v-form>
<v-tabs class="pl-4" v-model="tab">
<v-tabs class="pl-4" v-model="tab">
<v-tab href="#tab-1">
账户信息
<v-icon>mdi-phone</v-icon>
@@ -51,192 +53,179 @@
<v-tabs-items v-model="tab">
<v-tab-item :value="'tab-1'">
<v-card class="py-0">
<v-card-text>
<div>Account Information</div>
<v-row>
<v-col cols="12" md="4">
<v-text-field color="purple" label="用户名" />
</v-col>
<v-col cols="12" md="4">
<v-text-field color="purple" label="昵称" />
</v-col>
<v-col cols="12" md="4">
<v-text-field color="purple" label="邮箱" />
</v-col>
<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-col>
<v-col cols="12" md="6">
<v-text-field color="purple" label="电话" type="number" />
</v-col>
<v-col cols="12">
<v-textarea
color="purple"
label="简介"
value="空空如也Ta什么也没有留下"
/>
</v-col>
</v-row>
</v-card-text>
<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>
</v-card>
</v-tab-item>
<v-tab-item :value="'tab-2'">
<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-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-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-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>
<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-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-list-item-icon>
<v-icon>mdi-message-text</v-icon>
</v-list-item-icon>
</v-list-item>
<v-divider inset></v-divider>
<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>
<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
cols="6"
sm="3"
md="1"
>管理员</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 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
cols="6"
sm="3"
md="1"
>增删改查</v-col
>
</v-row>
</v-list-item-subtitle>
</v-list-item-content>
</v-list-item>
<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"
cols="6" sm="3" md="1">{{menuInfo.menu_name}}</v-col>
</v-row>
</v-list-item-subtitle>
</v-list-item-content>
</v-list-item>
<v-divider inset></v-divider>
<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>
<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>
<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>
</v-tab-item>
<v-tab-item :value="'tab-3'">
<v-card>
<v-card-text>
<div>Password Information</div>
<v-col cols="12">
<v-text-field
style="width: 80%"
label="原密码"
outlined
clearable
></v-text-field>
<v-text-field
required
style="width: 80%"
:counter="120"
label="新密码"
></v-text-field>
</v-col>
</v-card-text>
<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>
</v-card>
</v-tab-item>
</v-tab-item>
</v-tabs-items>
<v-col cols="12" class="text-right">
<v-btn color="primary" class="ma-4" min-width="100">
清空
</v-btn>
<v-btn color="secondary" min-width="100"> 保存 </v-btn>
</v-col>
<v-col cols="12" class="text-right">
<v-btn color="primary" class="ma-4" min-width="100"> 清空 </v-btn>
<v-btn color="secondary" min-width="100"> 保存 </v-btn>
</v-col>
</v-form>
</material-card>
</v-col>
@@ -245,10 +234,48 @@
</template>
<script>
import userApi from "../api/userApi";
import menuApi from "../api/menuApi"
export default {
name: "UserProfileView",
data: () => ({
tab: "tab-1",
userInfo: {},
editInfo: {},
newPassword:"",
dis_newPassword:true,
menuInfo:{}
}),
created() {
// this.init();
},
watch:{
editInfo:{
handler(val, oldVal){
if(val.password.length>0 )
{
this.dis_newPassword=false;
}
else
{
this.dis_newPassword=true;
}
},
deep:true //true 深度监听
}
},
methods: {
init() {
userApi.GetUserInfoById().then((resp) => {
this.userInfo = resp.data;
this.editInfo= Object.assign({}, this.userInfo);
});
menuApi.geTopMenuByUser().then(resp=>{
this.menuInfo=resp.data;
})
},
},
};
</script>