Skip to content

Commit

Permalink
添加个人中心页面
Browse files Browse the repository at this point in the history
  • Loading branch information
lenve committed Mar 1, 2020
1 parent dc1ebdd commit 4eb1e1b
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package org.javaboy.vhr.controller;

import org.javaboy.vhr.model.Hr;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
* @作者 江南一点雨
* @公众号 江南一点雨
* @微信号 a_java_boy
* @GitHub https://github.com/lenve
* @博客 http://wangsong.blog.csdn.net
* @网站 http://www.javaboy.org
* @时间 2020-03-01 13:07
*/
@RestController
public class HrInfoController {

@GetMapping("/hr/info")
public Hr getCurrentHr(Authentication authentication) {
return ((Hr) authentication.getPrincipal());
}
}
6 changes: 6 additions & 0 deletions vuehr/src/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Router from 'vue-router'
import Login from './views/Login.vue'
import Home from './views/Home.vue'
import FriendChat from './views/chat/FriendChat.vue'
import HrInfo from './views/HrInfo.vue'

Vue.use(Router)

Expand All @@ -27,6 +28,11 @@ export default new Router({
name: '在线聊天',
component: FriendChat,
hidden:true
},{
path: '/hrinfo',
name: '个人中心',
component: HrInfo,
hidden:true
}
]
}
Expand Down
2 changes: 2 additions & 0 deletions vuehr/src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@
message: '已取消操作'
});
});
}else if (cmd == 'userinfo') {
this.$router.push('/hrinfo');
}
}
}
Expand Down
62 changes: 62 additions & 0 deletions vuehr/src/views/HrInfo.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<template>
<div>
<el-card class="box-card" style="width: 400px">
<div slot="header" class="clearfix">
<span>{{hr.name}}</span>
</div>
<div>
<div style="display: flex;justify-content: center">
<img title="点击修改用户图像" :src="hr.userface" style="width: 100px;height: 100px;border-radius: 50px"
alt="">
</div>
<div>电话号码
<el-tag>{{hr.telephone}}</el-tag>
</div>
<div>手机号码
<el-tag>{{hr.phone}}</el-tag>
</div>
<div>居住地址
<el-tag>{{hr.address}}</el-tag>
</div>
<div>用户标签
<el-tag type="success" style="margin-right: 5px" v-for="(r,index) in hr.roles" :key="index">
{{r.nameZh}}
</el-tag>
</div>
<div style="display: flex;justify-content: space-around;margin-top: 10px">
<el-button type="primary">修改信息</el-button>
<el-button type="danger">修改密码</el-button>
</div>
</div>
</el-card>
</div>
</template>

<script>
export default {
name: "HrInfo",
data() {
return {
hr: null,
dialogVisible: false
}
},
mounted() {
this.initHr();
},
methods: {
initHr() {
this.getRequest('/hr/info').then(resp => {
if (resp) {
this.hr = resp;
this.hr2 = Object.assign({}, this.hr);
}
})
}
}
}
</script>

<style scoped>

</style>

0 comments on commit 4eb1e1b

Please sign in to comment.