用户界面

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] [HttpPost]
public async Task<Result> AddChildrenMenu(ChildrenDto<menu> childrenDto) public async Task<Result> AddChildrenMenu(ChildrenDto<menu> childrenDto)
{ {
await _menuService.AddChildrenMenu(childrenDto.parentId, childrenDto.data);
var _children= await _menuService.AddChildrenMenu(childrenDto.parentId, childrenDto.data);
return Result.Success(); return Result.Success();
} }
/// <summary> /// <summary>

View File

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

View File

@@ -32,6 +32,13 @@
<param name="emailAddress"></param> <param name="emailAddress"></param>
<returns></returns> <returns></returns>
</member> </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)"> <member name="M:Yi.Framework.ApiMicroservice.Controllers.MenuController.UpdateMenu(Yi.Framework.Model.Models.menu)">
<summary> <summary>

View File

@@ -28,6 +28,13 @@ export default {
url: `/Account/email?emailAddress=${emailAddress}`, url: `/Account/email?emailAddress=${emailAddress}`,
method: 'post', 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', method: 'post',
data: { id1: menuId, id2: mouldId } 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}`, url: `/User/GetRolesByUserId?userId=${userId}`,
method: 'get' 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"); store.dispatch("closeLoad");
return resp; return resp;
}, function(error) { }, async function(error) {
const resp = error.response.data const resp = error.response.data
if (resp.code == undefined && resp.msg == undefined) { if (resp.code == undefined && resp.msg == undefined) {
vm.$dialog.notify.error("错误代码:无,原因:与服务器失去连接", { vm.$dialog.notify.error("错误代码:无,原因:与服务器失去连接", {
position: "top-right", position: "top-right",
timeout: 5000, 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"); store.dispatch("closeLoad");

View File

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

View File

@@ -10,11 +10,13 @@
/> />
<v-card-text class="text-center"> <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> <v-btn class="mr-4" color="primary" min-width="100" rounded>
编辑头像 编辑头像
@@ -31,7 +33,7 @@
</template> </template>
<v-form> <v-form>
<v-tabs class="pl-4" v-model="tab"> <v-tabs class="pl-4" v-model="tab">
<v-tab href="#tab-1"> <v-tab href="#tab-1">
账户信息 账户信息
<v-icon>mdi-phone</v-icon> <v-icon>mdi-phone</v-icon>
@@ -51,192 +53,179 @@
<v-tabs-items v-model="tab"> <v-tabs-items v-model="tab">
<v-tab-item :value="'tab-1'"> <v-tab-item :value="'tab-1'">
<v-card class="py-0"> <v-card class="py-0">
<v-card-text> <v-card-text>
<div>Account Information</div> <div>Account Information</div>
<v-row> <v-row>
<v-col cols="12" md="4"> <v-col cols="12" md="4">
<v-text-field color="purple" label="用户名" /> <v-text-field color="purple" label="用户名" v-model="editInfo.username" disabled />
</v-col> </v-col>
<v-col cols="12" md="4"> <v-col cols="12" md="4">
<v-text-field color="purple" label="昵称" /> <v-text-field color="purple" label="昵称" v-model="editInfo.nick" />
</v-col> </v-col>
<v-col cols="12" md="4"> <v-col cols="12" md="4">
<v-text-field color="purple" label="邮箱" /> <v-text-field color="purple" label="邮箱" v-model="editInfo.email"/>
</v-col> </v-col>
<v-col cols="12" md="6"> <v-col cols="12" md="6">
<v-text-field color="purple" label="住址" /> <v-text-field color="purple" label="住址" v-model="editInfo.address" />
</v-col> </v-col>
<v-col cols="12" md="6"> <v-col cols="12" md="6">
<v-text-field color="purple" label="电话" type="number" /> <v-text-field
</v-col> color="purple"
<v-col cols="12"> label="电话"
<v-textarea type="number"
color="purple" v-model="editInfo.phone"
label="简介" />
value="空空如也Ta什么也没有留下" </v-col>
/> <v-col cols="12">
</v-col> <v-textarea
v-model="editInfo.introduction"
color="purple"
</v-row> label="简介"
</v-card-text> value="空空如也Ta什么也没有留下"
/>
</v-col>
</v-row>
</v-card-text>
</v-card> </v-card>
</v-tab-item> </v-tab-item>
<v-tab-item :value="'tab-2'"> <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-list-item-content>
<v-card-text> <v-list-item-title>等级</v-list-item-title>
<div>Extra Information</div> <v-list-item-subtitle>100</v-list-item-subtitle>
<v-row> </v-list-item-content>
<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-icon>
<v-list-item-title>等级</v-list-item-title> <v-icon>mdi-message-text</v-icon>
<v-list-item-subtitle>100</v-list-item-subtitle> </v-list-item-icon>
</v-list-item-content> </v-list-item>
<v-list-item-icon> <v-list-item>
<v-icon>mdi-message-text</v-icon> <v-list-item-action></v-list-item-action>
</v-list-item-icon>
</v-list-item>
<v-list-item> <v-list-item-content>
<v-list-item-action></v-list-item-action> <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-icon>
<v-list-item-title>经验</v-list-item-title> <v-icon>mdi-message-text</v-icon>
<v-list-item-subtitle>1000</v-list-item-subtitle> </v-list-item-icon>
</v-list-item-content> </v-list-item>
<v-list-item-icon> <v-divider inset></v-divider>
<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> <v-list-item-content>
<v-list-item-icon> <v-list-item-title>拥有角色</v-list-item-title>
<v-icon color="secondary"> mdi-lock </v-icon> <v-list-item-subtitle>
</v-list-item-icon> <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-content>
<v-list-item-title>拥有角色</v-list-item-title> <v-list-item-title>拥有菜单</v-list-item-title>
<v-list-item-subtitle> <v-list-item-subtitle>
<v-row> <v-row>
<v-col <v-col
cols="6" v-for="item in menuInfo"
sm="3" :key="item.id"
md="1" cols="6" sm="3" md="1">{{menuInfo.menu_name}}</v-col>
>管理员</v-col </v-row>
> </v-list-item-subtitle>
</v-row> </v-list-item-content>
</v-list-item-subtitle> </v-list-item>
</v-list-item-content>
</v-list-item>
<v-list-item>
<v-list-item-action></v-list-item-action>
<v-list-item-content> <v-divider inset></v-divider>
<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-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-content>
<v-list-item-icon> <v-list-item-title>等待更新</v-list-item-title>
<v-icon color="secondary"> mdi-email </v-icon> <v-list-item-subtitle>1000</v-list-item-subtitle>
</v-list-item-icon> </v-list-item-content>
</v-list-item>
<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>
<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>
<v-tab-item :value="'tab-3'"> <v-tab-item :value="'tab-3'">
<v-card> <v-card>
<v-card-text> <v-card-text>
<div>Password Information</div> <div>Password Information</div>
<v-col cols="12"> <v-col cols="12">
<v-text-field <v-text-field
style="width: 80%" style="width: 80%"
label="原密码" label="原密码"
outlined v-model="editInfo.password"
clearable outlined
></v-text-field> clearable
<v-text-field ></v-text-field>
required <v-text-field
style="width: 80%" required
:counter="120" style="width: 80%"
label="新密码" :counter="120"
></v-text-field> v-model="newPassword"
</v-col> :disabled="dis_newPassword"
</v-card-text> label="新密码"
></v-text-field>
</v-col>
</v-card-text>
</v-card> </v-card>
</v-tab-item> </v-tab-item>
</v-tabs-items> </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 cols="12" class="text-right"> </v-col>
<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> </v-form>
</material-card> </material-card>
</v-col> </v-col>
@@ -245,10 +234,48 @@
</template> </template>
<script> <script>
import userApi from "../api/userApi";
import menuApi from "../api/menuApi"
export default { export default {
name: "UserProfileView", name: "UserProfileView",
data: () => ({ data: () => ({
tab: "tab-1", 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> </script>