|
- <template>
- <view class="page">
- <l-list border>
- <l-list-item title="头像"><l-avatar :src="avatarSrc" slot="action" /></l-list-item>
- <l-list-item :action="currentUser.account" title="账号" />
- <l-list-item :action="currentUser.enCode" title="工号" />
- <l-list-item :action="currentUser.realName" title="姓名" />
- <l-list-item :action="Number(currentUser.gender) === 1 ? '男' : '女'" title="性别" />
- <l-list-item :action="info.company" title="公司" />
- <l-list-item :action="info.dep" title="部门" />
- <l-list-item :action="info.job" title="岗位" />
- <l-list-item :action="info.role" title="角色" />
- </l-list>
- </view>
- </template>
-
- <script>
- export default {
- computed: {
- // 当前用户对象
- currentUser() {
- return this.GET_GLOBAL('loginUser')
- },
-
- // 计算出用户公司、岗位等信息
- info() {
- const company = this.currentUser.companyId ? this.GET_GLOBAL('company')[this.currentUser.companyId]?.name : ''
- const dep = this.currentUser.departmentId ? this.GET_GLOBAL('department')[this.currentUser.departmentId]?.name : ''
- const role = (this.currentUser.role || []).map(t => t.F_FullName).join(' · ')
- const job = (this.currentUser.post || []).map(t => t.F_Name).join(' · ')
-
- return { company, dep, role, job }
- },
-
- // 头像图片 url
- avatarSrc() {
- return this.API + `/user/img?data=${this.currentUser.userId}`
- }
- }
- }
- </script>
|