提交 4eb1e1be 编写于 作者: 江南一点雨

添加个人中心页面

上级 dc1ebdd4
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());
}
}
......@@ -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)
......@@ -27,6 +28,11 @@ export default new Router({
name: '在线聊天',
component: FriendChat,
hidden:true
},{
path: '/hrinfo',
name: '个人中心',
component: HrInfo,
hidden:true
}
]
}
......
......@@ -80,6 +80,8 @@
message: '已取消操作'
});
});
}else if (cmd == 'userinfo') {
this.$router.push('/hrinfo');
}
}
}
......
<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>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册