288 lines
7.6 KiB
Vue
288 lines
7.6 KiB
Vue
<template>
|
||
<div class="outer-layer user-detail-page">
|
||
<div class="root">
|
||
<ZPaging ref="zPaging" :show-scrollbar="false">
|
||
<template #top>
|
||
<tm-navbar
|
||
class="tmNavBar"
|
||
:hideBack="false"
|
||
hideHome
|
||
title=""
|
||
:leftWidth="220"
|
||
></tm-navbar>
|
||
</template>
|
||
<div class="user-detail-info">
|
||
<div class="user-info-head user-info-card">
|
||
<div class="user-info-avatar">
|
||
<img
|
||
:src="state?.userInfo?.avatar"
|
||
v-if="state?.userInfo?.avatar"
|
||
/>
|
||
<span
|
||
v-if="!state?.userInfo?.avatar"
|
||
class="text-[46rpx] font-bold"
|
||
>
|
||
{{
|
||
state?.userInfo?.nickname.length >= 2
|
||
? state?.userInfo?.nickname.slice(-2)
|
||
: state?.userInfo?.nickname
|
||
}}
|
||
</span>
|
||
</div>
|
||
<div class="user-info">
|
||
<span class="text-[40rpx] font-medium user-info-name">
|
||
{{ state?.userInfo?.nickname }}
|
||
</span>
|
||
<span class="text-[28rpx] font-medium user-info-job-num">
|
||
{{ $t('user.info.jobNum') + ':' + state?.userInfo?.job_num }}
|
||
</span>
|
||
</div>
|
||
</div>
|
||
<div class="user-info-main user-info-card">
|
||
<div class="user-info-main-title">
|
||
<img src="/src/static/image/mine/ming001@3x.png" />
|
||
<span class="text-[28rpx] font-medium">
|
||
{{ $t('index.mine.basic') }}
|
||
</span>
|
||
</div>
|
||
<div class="user-info-main-list">
|
||
<div
|
||
class="user-info-main-each"
|
||
v-for="(item, index) in state.userBasicInfos"
|
||
:key="index"
|
||
>
|
||
<span class="text-[28rpx] font-medium user-info-main-each-hint">
|
||
{{ item.name }}
|
||
</span>
|
||
<span class="text-[28rpx] font-medium user-info-main-each-text">
|
||
{{ item.value }}
|
||
</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<template #bottom>
|
||
<customBtn
|
||
:isBottom="true"
|
||
:btnText="$t('user.detail.sendMsg')"
|
||
:subBtnText="$t('user.detail.ringBell')"
|
||
></customBtn>
|
||
</template>
|
||
</ZPaging>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
<script setup>
|
||
import customBtn from '@/components/custom-btn/custom-btn.vue'
|
||
import ZPaging from '@/uni_modules/z-paging/components/z-paging/z-paging.vue'
|
||
import { onLoad } from '@dcloudio/uni-app'
|
||
import { reactive } from 'vue'
|
||
|
||
import { getUserInfoByClickAvatar } from '@/api/user/index'
|
||
|
||
import { useI18n } from 'vue-i18n'
|
||
const { t } = useI18n()
|
||
|
||
const state = reactive({
|
||
erpUserId: '', //erp用户id
|
||
userInfo: null, //用户详情
|
||
userBasicInfos: [], //用户基本信息
|
||
})
|
||
|
||
onLoad((options) => {
|
||
console.log(options)
|
||
if (options.erpUserId) {
|
||
state.erpUserId = options.erpUserId
|
||
getUserInfo()
|
||
}
|
||
})
|
||
|
||
//获取用户信息
|
||
const getUserInfo = () => {
|
||
let params = {
|
||
erp_user_id: Number(state.erpUserId),
|
||
}
|
||
console.log(params)
|
||
const resp = getUserInfoByClickAvatar(params)
|
||
console.log(resp)
|
||
resp.then(({ code, data }) => {
|
||
console.log(data)
|
||
if (code == 200) {
|
||
state.userInfo = data
|
||
let department = ''
|
||
let post = ''
|
||
if (data?.erp_dept_position?.length > 0) {
|
||
data.erp_dept_position.forEach((item) => {
|
||
if (!department) {
|
||
department = item.department_name
|
||
} else {
|
||
department = department + '、' + item.department_name
|
||
}
|
||
if (!post) {
|
||
post = item.position_name
|
||
} else {
|
||
post = post + '、' + item.position_name
|
||
}
|
||
})
|
||
}
|
||
|
||
let hasAddDepartment = department.split('、')
|
||
let uniqueArr = [...new Set(hasAddDepartment)]
|
||
department = uniqueArr.join('、')
|
||
|
||
let manager = ''
|
||
if (data?.leaders?.length > 0) {
|
||
data.leaders.forEach((item) => {
|
||
if (!manager) {
|
||
manager = item.user_name
|
||
} else {
|
||
manager = manager + '、' + item.user_name
|
||
}
|
||
})
|
||
}
|
||
state.userBasicInfos = [
|
||
{
|
||
name: t('index.mine.company'),
|
||
value: data.company_name,
|
||
},
|
||
{
|
||
name: t('index.mine.department'),
|
||
value: department,
|
||
},
|
||
{
|
||
name: t('index.mine.post'),
|
||
value: post,
|
||
},
|
||
{
|
||
name: t('index.mine.manager'),
|
||
value: manager,
|
||
},
|
||
{
|
||
name: t('index.mine.phone'),
|
||
value: data.tel_num,
|
||
},
|
||
{
|
||
name: t('index.mine.entry'),
|
||
value: data.enter_date,
|
||
},
|
||
]
|
||
} else {
|
||
}
|
||
})
|
||
|
||
resp.catch(() => {})
|
||
}
|
||
</script>
|
||
<style scoped lang="scss">
|
||
.outer-layer {
|
||
flex: 1;
|
||
background-image: url('@/static/image/mine/1111.png');
|
||
background-size: cover;
|
||
background-repeat: no-repeat;
|
||
}
|
||
|
||
.tmNavBar {
|
||
::v-deep .noNvueBorder {
|
||
border-bottom: 0 !important;
|
||
background-color: unset !important;
|
||
box-shadow: unset !important;
|
||
}
|
||
}
|
||
|
||
.user-detail-page {
|
||
.user-detail-info {
|
||
padding: 86rpx 32rpx 0;
|
||
.user-info-card {
|
||
background-color: #fff;
|
||
box-shadow: 0 6px 12px 2px rgba(188, 188, 188, 0.08);
|
||
border-radius: 8rpx;
|
||
}
|
||
.user-info-head {
|
||
display: flex;
|
||
flex-direction: row;
|
||
align-items: center;
|
||
justify-content: flex-start;
|
||
padding: 20rpx 32rpx;
|
||
.user-info-avatar {
|
||
width: 154rpx;
|
||
height: 154rpx;
|
||
border-radius: 16rpx;
|
||
overflow: hidden;
|
||
background: linear-gradient(to right, #674bbc, #46299d);
|
||
box-shadow: 0 6px 12px 2px rgba(70, 41, 157, 0.16);
|
||
display: flex;
|
||
flex-direction: row;
|
||
align-items: center;
|
||
justify-content: center;
|
||
img {
|
||
width: 100%;
|
||
height: 100%;
|
||
}
|
||
span {
|
||
line-height: 64rpx;
|
||
color: #fff;
|
||
}
|
||
}
|
||
.user-info {
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: flex-start;
|
||
justify-content: center;
|
||
margin: 0 0 0 32rpx;
|
||
.user-info-name {
|
||
line-height: 56rpx;
|
||
color: $theme-text;
|
||
}
|
||
.user-info-job-num {
|
||
margin: 12rpx 0 0;
|
||
line-height: 40rpx;
|
||
color: #b4b4b4;
|
||
}
|
||
}
|
||
}
|
||
.user-info-main {
|
||
margin: 20rpx 0 0;
|
||
padding: 0 18rpx;
|
||
.user-info-main-title {
|
||
display: flex;
|
||
flex-direction: row;
|
||
align-items: center;
|
||
justify-content: flex-start;
|
||
padding: 38rpx 12rpx 32rpx;
|
||
img {
|
||
width: 36rpx;
|
||
height: 40rpx;
|
||
}
|
||
span {
|
||
line-height: 40rpx;
|
||
color: $theme-text;
|
||
margin: 0 0 0 20rpx;
|
||
}
|
||
}
|
||
.user-info-main-list {
|
||
.user-info-main-each {
|
||
padding: 14rpx;
|
||
border-top: 1px solid $theme-border-color;
|
||
display: flex;
|
||
flex-direction: row;
|
||
align-items: center;
|
||
justify-content: flex-start;
|
||
.user-info-main-each-hint {
|
||
line-height: 40rpx;
|
||
color: $theme-text;
|
||
width: 112rpx;
|
||
white-space: nowrap;
|
||
flex-shrink: 0;
|
||
}
|
||
.user-info-main-each-text {
|
||
margin: 0 0 0 56rpx;
|
||
line-height: 40rpx;
|
||
color: #747474;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
</style>
|