ykt-team-wxapp/pages/team/homepage.vue

186 lines
5.9 KiB
Vue
Raw Permalink Normal View History

2026-01-20 19:36:49 +08:00
<template>
<view v-if="member" class="flex p-15 bg-whtie shadow-lg">
<view class="flex-grow w-0 mr-10 leading-normal">
2026-01-21 10:35:08 +08:00
<view class="flex items-center">
<view class="mr-5 flex-shrink-0 text-xl text-dark font-semibold">{{ member.anotherName }}</view>
<view class="w-0 flex-grow truncate text-base text-gray">{{ memberJob[member.userid] }}</view>
2026-01-20 19:36:49 +08:00
</view>
<view class="flex">
<view class="flex-shrink-0 text-base text-gray">机构部门</view>
<view class="flex-shrink-0 text-base text-dark">{{ deptNames }}</view>
</view>
<view class="flex">
<view class="flex-shrink-0 text-base text-gray">执业机构</view>
<view class="flex-shrink-0 text-base text-dark">{{ corpNames }}</view>
</view>
</view>
<image class="avatar" :src="member.avatar"></image>
</view>
<view v-if="member" class="p-15 mt-12 leading-normal bg-white shadow-lg">
<view class="flex items-center" @click="expand = !expand">
2026-01-21 10:59:55 +08:00
<image class="flex-shrink-0 mr-10 section-icon" src="/static/homepage/book.svg"></image>
2026-01-20 19:36:49 +08:00
<view class="w-0 flex-grow text-lg font-semibold">个人简介</view>
<uni-icons v-if="member.memberTroduce" :type="expand ? 'up' : 'down'" size="16"></uni-icons>
</view>
<view class="mt-10 text-dark text-base" :class="expand ? '' : 'line-clamp-4'">
{{ member.memberTroduce || '暂无简介' }}
</view>
<view class="mt-20 flex items-center">
2026-01-21 10:59:55 +08:00
<image class="flex-shrink-0 mr-10 section-icon" src="/static/homepage/calendar.svg"></image>
2026-01-20 19:36:49 +08:00
<view class="w-0 flex-grow text-lg font-semibold">门诊时间</view>
</view>
<view class="mt-10 text-dark text-base">
{{ member.outpatientTime || '暂无门诊时间' }}
</view>
<view class="mt-20 flex items-center">
2026-01-21 10:59:55 +08:00
<image class="flex-shrink-0 mr-10 section-icon" src="/static/homepage/out-phone.svg"></image>
2026-01-20 19:36:49 +08:00
<view class="w-0 flex-grow text-lg font-semibold">对外联系电话</view>
</view>
<view class="mt-10 text-dark" :class="member.callNumber ? 'text-primary' : 'text-gray'" @click="callNumber()">
{{ member.callNumber || '暂无联系电话' }}
</view>
<view class="mt-20 flex items-center">
2026-01-21 10:59:55 +08:00
<image class="flex-shrink-0 mr-10 section-icon" src="/static/homepage/sunshine-home.svg"></image>
2026-01-20 19:36:49 +08:00
<view class="w-0 flex-grow text-lg font-semibold">便民服务</view>
</view>
<view class="mt-10 flex">
2026-01-21 10:59:55 +08:00
<view v-if="services.length === 0" class="text-gray text-base">暂无服务</view>
<view v-for="(i, idx) in services" :key="idx" class="px-15 py-5 text-base text-white bg-primary rounded-sm"
:class="idx > 0 ? 'ml-15' : ''" @click="openService(i)">
{{ i.name }}
</view>
2026-01-20 19:36:49 +08:00
</view>
</view>
<view v-if="qrcode" class="p-15 mt-12 leading-normal bg-white shadow-lg">
<view class="text-lg font-semibold text-center text-dark">
点击下方二维码加我为好友
</view>
<view class="mt-12 border-primary qrcode p-15 mx-auto rounded" @click="previewImage()">
<image :src="qrcode" class="h-full w-full"></image>
</view>
</view>
<view class="safe-bottom-padding"></view>
</template>
<script setup>
import { computed, ref, watch } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
2026-01-21 10:35:08 +08:00
import useJob from '@/hooks/useJob';
2026-01-20 19:36:49 +08:00
import api from '@/utils/api';
import { toast } from '@/utils/widget';
const corpId = ref('');
const userid = ref('');
const showQrcode = ref(false);
const qrcode = ref('')
const member = ref(null);
const expand = ref(false);
2026-01-21 10:35:08 +08:00
const { memberJob, memberList } = useJob();
2026-01-20 19:36:49 +08:00
const corpNames = computed(() => {
const corpNames = member.value && Array.isArray(member.value.corpNames) ? member.value.corpNames : [];
return corpNames.join('、');
})
const deptNames = computed(() => {
const deptNames = member.value && Array.isArray(member.value.deptNames) ? member.value.deptNames : [];
return deptNames.join('、');
})
2026-01-21 10:59:55 +08:00
const services = computed(() => {
if (member.value && Array.isArray(member.value.convenienceService)) {
return member.value.convenienceService.filter(item => {
const nameExist = item && typeof item.name === 'string' && item.name.trim() !== '';
const hrefExist = item && typeof item.href === 'string' && item.href.trim().startsWith('http');
return nameExist && hrefExist
}).map((i, idx) => ({ ...i, key: `${Date.now}_${idx}` }))
}
return []
})
2026-01-20 19:36:49 +08:00
function callNumber() {
if (member.value && member.value.callNumber) {
uni.makePhoneCall({
phoneNumber: member.value.callNumber
})
}
}
2026-01-21 10:59:55 +08:00
function openService(service) {
uni.navigateTo({
url: `/pages/web-view/web-view?title=${encodeURIComponent(service.name)}&src=${encodeURIComponent(service.href)}`
})
}
2026-01-20 19:36:49 +08:00
function previewImage() {
uni.previewImage({
urls: [qrcode.value]
})
}
async function getMember() {
const res = await api('getCorpMemberHomepageInfo', { userid: userid.value, corpId: corpId.value });
if (res && res.success) {
member.value = res.data;
2026-01-21 10:35:08 +08:00
if (showQrcode.value && !qrcode.value) {
2026-01-20 19:36:49 +08:00
getQrcode();
}
} else {
toast(res.message || '获取医生信息失败')
}
}
async function getQrcode() {
const res = await api('addContactWay', { corpUserId: userid.value, corpId: corpId.value });
2026-01-21 10:35:08 +08:00
if (res && res.data) {
2026-01-20 19:36:49 +08:00
qrcode.value = res.data;
}
}
onLoad((options) => {
corpId.value = options.corpId;
userid.value = options.userid;
2026-01-21 10:35:08 +08:00
showQrcode.value = options.showQrcode === 'YES';
2026-01-20 19:36:49 +08:00
});
onShow(() => {
if (corpId.value && userid.value) {
getMember()
}
})
2026-01-21 10:35:08 +08:00
watch(member, n => {
if (n) {
memberList.value = [n];
}
}, { immediate: true })
2026-01-20 19:36:49 +08:00
</script>
<style>
page {
overflow: auto;
}
.avatar {
width: 120rpx;
height: 128rpx;
}
.section-icon {
width: 48rpx;
height: 48rpx;
}
.mt-20 {
margin-top: 40rpx;
}
.line-clamp-4 {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 4;
overflow: hidden;
}
.qrcode {
width: 560rpx;
height: 560rpx;
}
</style>