fix: 页面调整
This commit is contained in:
parent
f68cd721b6
commit
064bb44ec0
@ -11,6 +11,11 @@
|
||||
<image class="service-icon" src="/static/card/jzfwIcon.png" mode="aspectFit"></image>
|
||||
<text class="service-text">全周期管理</text>
|
||||
</view>
|
||||
<view class="service-item service-item-2" @click="openAddressModal">
|
||||
<image class="service-item-bg" src="/static/card/gwBack.png" mode="scaleToFill"></image>
|
||||
<image class="service-icon" src="/static/card/gwIcon.png" mode="aspectFit"></image>
|
||||
<text class="service-text">门诊预约</text>
|
||||
</view>
|
||||
<view class="service-item service-item-3" @click="displayPhone()">
|
||||
<image class="service-item-bg" src="/static/card/gzhBack.png" mode="scaleToFill"></image>
|
||||
<image class="service-icon" src="/static/card/telephone.svg" mode="aspectFit"></image>
|
||||
@ -21,11 +26,7 @@
|
||||
<image class="service-icon" src="/static/card/email.svg" mode="aspectFit"></image>
|
||||
<text class="service-text">邮箱</text>
|
||||
</view>
|
||||
<view class="service-item service-item-2" @click="openAddressModal">
|
||||
<image class="service-item-bg" src="/static/card/gwBack.png" mode="scaleToFill"></image>
|
||||
<image class="service-icon" src="/static/card/gwIcon.png" mode="aspectFit"></image>
|
||||
<text class="service-text">地址</text>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -42,8 +43,8 @@
|
||||
</view>
|
||||
|
||||
<!-- 医院信息内容 -->
|
||||
<view v-if="hospitalInfo" class="tab-content" :class="{ 'tab-content-left': activeTab === 'hospital' }"
|
||||
v-show="activeTab === 'hospital'">
|
||||
<view v-if="hospitalInfo && activeTab === 'hospital'" class="tab-content"
|
||||
:class="{ 'tab-content-left': activeTab === 'hospital' }">
|
||||
<view class="hospital-info">
|
||||
<view class="hospital-header">
|
||||
<view class="hospital-logo">
|
||||
@ -74,8 +75,7 @@
|
||||
</view>
|
||||
|
||||
<!-- 个人简介内容 -->
|
||||
<view class="tab-content" :class="{ 'tab-content-right': activeTab === 'intro' }"
|
||||
v-show="activeTab === 'intro'">
|
||||
<view v-if="activeTab === 'intro'" class="tab-content" :class="{ 'tab-content-right': activeTab === 'intro' }">
|
||||
<view class="intro-content">
|
||||
<view class="intro-header">
|
||||
<view class="intro-title-bar"></view>
|
||||
@ -101,27 +101,6 @@
|
||||
</view>
|
||||
</template>
|
||||
</full-page>
|
||||
<!-- 便民服务弹窗 -->
|
||||
<view v-if="showServiceModal" class="modal-mask" @click="closeServiceModal">
|
||||
<view class="service-modal-content" @click.stop>
|
||||
<view class="service-modal-header">
|
||||
<text class="service-modal-close" @click="closeServiceModal">×</text>
|
||||
<text class="service-modal-title">便民服务</text>
|
||||
</view>
|
||||
<view class="service-modal-body">
|
||||
<view class="service-list">
|
||||
<view class="service-list-item" v-for="(service, index) in services" :key="index"
|
||||
@click="openServiceLink(service)">
|
||||
<text class="service-list-text">{{ service.label }}</text>
|
||||
<view class="service-list-icon">🔗</view>
|
||||
</view>
|
||||
<view v-if="services.length === 0" class="no-service">
|
||||
<text class="no-service-text">暂无便民服务</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 电话弹窗 -->
|
||||
<view v-if="showPhoneModal" class="modal-mask" @click="closePhoneModal">
|
||||
@ -200,41 +179,6 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 医院介绍弹窗 -->
|
||||
<view v-if="showMoreInfoModal" class="modal-mask" @click="closeMoreInfoModal">
|
||||
<view class="more-info-modal-content" @click.stop @touchmove.stop.prevent>
|
||||
<view class="more-info-modal-header">
|
||||
<text class="more-info-modal-title">医院介绍</text>
|
||||
<text class="more-info-modal-close" @click="closeMoreInfoModal">×</text>
|
||||
</view>
|
||||
<scroll-view class="more-info-modal-body" scroll-y="true" show-scrollbar="true">
|
||||
<view class="more-info-content" v-if="institutionInfo?.introduction">
|
||||
<rich-text :nodes="institutionInfo.introduction"></rich-text>
|
||||
</view>
|
||||
<view class="more-info-text" v-else>
|
||||
<text class="no-data-text">暂无医院介绍信息</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 公众号弹窗 -->
|
||||
<view v-if="showOfficialAccountModal" class="modal-mask" @click="closeOfficialAccountModal">
|
||||
<view class="link-modal-content" @click.stop>
|
||||
<view class="link-modal-header">
|
||||
<text class="link-modal-title">广医一院公众号</text>
|
||||
<text class="link-modal-close" @click="closeOfficialAccountModal">×</text>
|
||||
</view>
|
||||
<view class="link-modal-body">
|
||||
<view class="qr-code-placeholder">
|
||||
<view class="qr-code-image">
|
||||
<image src="/static/card/服务号.jpg" mode="aspectFit"></image>
|
||||
</view>
|
||||
</view>
|
||||
<text class="link-modal-desc">扫描或长按二维码进入</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<teams-popup :visible="showTeamPopup" :teams="teams" @close="showTeamPopup = false" />
|
||||
</template>
|
||||
|
||||
@ -257,12 +201,28 @@ const { account } = storeToRefs(useAccount());
|
||||
const env = __VITE_ENV__;
|
||||
const shareAppVersion = env.MP_SHARE_WX_APP_VERSION;
|
||||
|
||||
const activeTab = ref('hospital') // 'hospital' 或 'intro'
|
||||
const corpId = ref('');
|
||||
const userid = ref('')
|
||||
const businessCard = ref(null);
|
||||
const teams = ref([])
|
||||
const showTeamPopup = ref(false)
|
||||
const hospitalInfo = computed(() => businessCard.value?.hospitalInfo || null);
|
||||
const showPhoneModal = ref(false)
|
||||
const showEmailModal = ref(false)
|
||||
const showTeamPopup = ref(false)
|
||||
|
||||
|
||||
function addFriend() {
|
||||
uni.navigateTo({
|
||||
url: `/pages/team/friend?corpId=${corpId.value}&userid=${userid.value}`
|
||||
})
|
||||
}
|
||||
|
||||
function displayPhone() {
|
||||
if (businessCard.value.externalContact) {
|
||||
showPhoneModal.value = true
|
||||
}
|
||||
}
|
||||
|
||||
function makePhoneCall(phone) {
|
||||
closePhoneModal()
|
||||
@ -283,20 +243,21 @@ function setClipboardData(data) {
|
||||
})
|
||||
}
|
||||
|
||||
function switchTab(tab) {
|
||||
activeTab.value = tab
|
||||
}
|
||||
|
||||
async function getCard() {
|
||||
const res = await api('getBusinessCard', { userid: userid.value, corpId: corpId.value })
|
||||
businessCard.value = res && res.data ? res.data : null;
|
||||
if (!hospitalInfo.value && activeTab.value === 'hospital') {
|
||||
activeTab.value = 'intro'
|
||||
}
|
||||
if (businessCard.value) {
|
||||
recordBusinessCardVisit()
|
||||
}
|
||||
}
|
||||
|
||||
async function displayPhone() {
|
||||
if (businessCard.value.externalContact) {
|
||||
showPhoneModal.value = true
|
||||
}
|
||||
}
|
||||
|
||||
async function showTeams() {
|
||||
const res = await api('getJoinedTeams', { mateId: userid.value, corpId: corpId.value })
|
||||
teams.value = res && Array.isArray(res.data) ? res.data : [];
|
||||
@ -343,6 +304,8 @@ async function getVisitorAccount() {
|
||||
}
|
||||
|
||||
useLoad((opt) => {
|
||||
console.clear()
|
||||
console.log(account.value)
|
||||
if (opt.q) {
|
||||
const href = typeof opt.q === "string" ? decodeURIComponent(opt.q.trim()) : "";
|
||||
const [, url = ""] = href.split("?");
|
||||
@ -371,7 +334,8 @@ onShareAppMessage((res) => {
|
||||
return {
|
||||
title: `【${businessCard.value.externalName || card.anotherName || ''}】电子名片`,
|
||||
type: shareAppVersion || 0, // 0 正式版本 | 1 开发版本 | 2 体验版本
|
||||
path: `/pages/team/business-card?corpId=${corpId.value}&userid=${userid.value}&shareOpenId=${account.value?.openid || ''}`
|
||||
path: `/pages/team/business-card?corpId=${corpId.value}&userid=${userid.value}&shareOpenId=${account.value?.openid || ''}`,
|
||||
imageUrl: 'https://ykt.youcan365.com/uploads/1782455619525-business-card.jpg'
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -379,22 +343,9 @@ onShareAppMessage((res) => {
|
||||
const cardStore = ref({})
|
||||
const accountStore = ref({})
|
||||
|
||||
// 获取账户信息
|
||||
const accountInfo = computed(() => accountStore.getAccountInfo || {})
|
||||
const institutionInfo = computed(() => accountStore.getInstitutionInfo || {})
|
||||
|
||||
// 获取医生名片状态
|
||||
const doctorCardStatus = computed(() => accountStore.getDoctorCardStatus)
|
||||
|
||||
// 判断是否有联系方式
|
||||
const hasContactInfo = computed(() => {
|
||||
return cardStore.phoneVisible || cardStore.emailVisible || cardStore.addressVisible
|
||||
})
|
||||
|
||||
// 弹窗显示状态
|
||||
const showServiceModal = ref(false)
|
||||
const showPhoneModal = ref(false)
|
||||
const showEmailModal = ref(false)
|
||||
|
||||
const showAddressModal = ref(false)
|
||||
const showMoreInfoModal = ref(false)
|
||||
const showOfficialAccountModal = ref(false)
|
||||
@ -404,152 +355,18 @@ const showShareModal = ref(false)
|
||||
// 便民服务列表
|
||||
const services = ref([])
|
||||
|
||||
// Tab 切换状态
|
||||
const activeTab = ref('hospital') // 'hospital' 或 'intro'
|
||||
|
||||
// 切换 tab
|
||||
const switchTab = (tab) => {
|
||||
activeTab.value = tab
|
||||
}
|
||||
|
||||
// 初始化 tab 状态
|
||||
const initTab = () => {
|
||||
// 如果只有个人简介,默认显示个人简介
|
||||
if (!institutionInfo.value?.showHomepage) {
|
||||
activeTab.value = 'intro'
|
||||
}
|
||||
// 如果只有医院信息,默认显示医院信息
|
||||
else if (!accountInfo.value.introduction) {
|
||||
activeTab.value = 'hospital'
|
||||
}
|
||||
// 如果两者都有,默认显示医院信息
|
||||
else {
|
||||
activeTab.value = 'hospital'
|
||||
}
|
||||
}
|
||||
|
||||
// 防止在同一次拉取过程中重复创建名片
|
||||
let isAutoCreatingCard = false
|
||||
|
||||
|
||||
const goToCard = () => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/card/card'
|
||||
})
|
||||
}
|
||||
// 获取标签样式类名
|
||||
const getTagClass = (index) => {
|
||||
const styles = ['grade', 'center', 'specialty']
|
||||
return styles[index % 3]
|
||||
}
|
||||
|
||||
const goToQRCode = () => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/card/code'
|
||||
})
|
||||
}
|
||||
// 跳转到保存名片页
|
||||
const goToSave = () => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/business-card/card-qrcode/card-qrcode'
|
||||
})
|
||||
}
|
||||
// 处理Banner图片点击
|
||||
const handleBannerClick = (item) => {
|
||||
if (!item || !item.link) {
|
||||
return
|
||||
}
|
||||
|
||||
const link = item.link
|
||||
|
||||
// 判断是否为外部链接
|
||||
if (link.startsWith('http://') || link.startsWith('https://')) {
|
||||
// #ifdef H5
|
||||
window.open(link, '_blank')
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
plus.runtime.openURL(link)
|
||||
// #endif
|
||||
// #ifdef MP-WEIXIN
|
||||
// 微信小程序中,需要先复制链接,然后提示用户
|
||||
uni.setClipboardData({
|
||||
data: link,
|
||||
success: () => {
|
||||
uni.showToast({
|
||||
title: '链接已复制',
|
||||
icon: 'success'
|
||||
})
|
||||
}
|
||||
})
|
||||
// #endif
|
||||
} else {
|
||||
// 内部链接,使用导航
|
||||
uni.navigateTo({
|
||||
url: link
|
||||
})
|
||||
}
|
||||
}
|
||||
// 打开便民服务弹窗
|
||||
const openServiceModal = () => {
|
||||
showServiceModal.value = true
|
||||
}
|
||||
|
||||
// 关闭便民服务弹窗
|
||||
const closeServiceModal = () => {
|
||||
showServiceModal.value = false
|
||||
}
|
||||
|
||||
// 打开便民服务链接
|
||||
const openServiceLink = (service) => {
|
||||
if (service.url) {
|
||||
// 关闭弹窗
|
||||
closeServiceModal()
|
||||
|
||||
// 显示确认对话框
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: `即将跳转到:${service.label}`,
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.showToast({
|
||||
title: '正在跳转中...',
|
||||
icon: 'none'
|
||||
})
|
||||
|
||||
// #ifdef H5
|
||||
// H5环境下使用window.open打开外部链接
|
||||
window.open(service.url, '_blank')
|
||||
// #endif
|
||||
|
||||
// #ifdef MP-WEIXIN
|
||||
// 微信小程序环境下使用uni.navigateToMiniProgram或提示用户
|
||||
uni.showToast({
|
||||
title: '请在浏览器中打开链接',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
// #endif
|
||||
|
||||
// #ifdef APP-PLUS
|
||||
// App环境下使用plus.runtime.openURL
|
||||
plus.runtime.openURL(service.url)
|
||||
// #endif
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '该服务暂无链接',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 打开电话弹窗
|
||||
const openPhoneModal = () => {
|
||||
showPhoneModal.value = true
|
||||
}
|
||||
|
||||
// 关闭电话弹窗
|
||||
const closePhoneModal = () => {
|
||||
showPhoneModal.value = false
|
||||
@ -565,9 +382,9 @@ const closeEmailModal = () => {
|
||||
showEmailModal.value = false
|
||||
}
|
||||
|
||||
// 打开地址弹窗
|
||||
const openAddressModal = () => {
|
||||
showAddressModal.value = true
|
||||
toast('门诊预约功能暂未开放')
|
||||
// showAddressModal.value = true
|
||||
}
|
||||
|
||||
// 关闭地址弹窗
|
||||
@ -575,211 +392,10 @@ const closeAddressModal = () => {
|
||||
showAddressModal.value = false
|
||||
}
|
||||
|
||||
// 打开医院介绍弹窗
|
||||
const openMoreInfoModal = () => {
|
||||
showMoreInfoModal.value = true
|
||||
|
||||
}
|
||||
|
||||
// 关闭医院介绍弹窗
|
||||
const closeMoreInfoModal = () => {
|
||||
showMoreInfoModal.value = false
|
||||
}
|
||||
|
||||
// 打开公众号弹窗
|
||||
const openOfficialAccountModal = () => {
|
||||
showOfficialAccountModal.value = true
|
||||
}
|
||||
|
||||
// 关闭公众号弹窗
|
||||
const closeOfficialAccountModal = () => {
|
||||
showOfficialAccountModal.value = false
|
||||
}
|
||||
|
||||
// 打开视频号弹窗
|
||||
const openVideoAccountModal = () => {
|
||||
showVideoAccountModal.value = true
|
||||
}
|
||||
|
||||
// 关闭视频号弹窗
|
||||
const closeVideoAccountModal = () => {
|
||||
showVideoAccountModal.value = false
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 处理人才招聘点击
|
||||
const handleRecruitClick = () => {
|
||||
const recruitUrl = 'https://www.gyfyyy.cn/cn/wap/news/xwsd/'
|
||||
openExternalLink(recruitUrl)
|
||||
}
|
||||
|
||||
// 处理官网点击
|
||||
const handleWebsiteClick = () => {
|
||||
const websiteUrl = 'https://www.gyfyyy.cn/'
|
||||
openExternalLink(websiteUrl)
|
||||
}
|
||||
|
||||
// 打开外部链接的通用方法
|
||||
const openExternalLink = (url) => {
|
||||
if (!url) {
|
||||
uni.showToast({
|
||||
title: '链接地址无效',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// 判断是否为外部链接
|
||||
if (url.startsWith('http://') || url.startsWith('https://')) {
|
||||
// #ifdef H5
|
||||
window.open(url, '_blank')
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
plus.runtime.openURL(url)
|
||||
// #endif
|
||||
// #ifdef MP-WEIXIN
|
||||
// 微信小程序中,需要先复制链接,然后提示用户
|
||||
uni.setClipboardData({
|
||||
data: url,
|
||||
success: () => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '链接已复制到剪贴板,请在浏览器中打开',
|
||||
showCancel: false
|
||||
})
|
||||
}
|
||||
})
|
||||
// #endif
|
||||
} else {
|
||||
// 内部链接,使用导航
|
||||
uni.navigateTo({
|
||||
url: url
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 处理来院导航点击
|
||||
const handleNavigationClick = () => {
|
||||
// 跳转到导航页面
|
||||
uni.navigateTo({
|
||||
url: '/pages/navigation/index'
|
||||
})
|
||||
}
|
||||
// 打开官网
|
||||
const openWebsite = () => {
|
||||
// 在微信小程序中打开外部网址
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '即将打开医院官网,是否继续?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.showToast({
|
||||
title: '正在跳转中...',
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 打开互联网医院
|
||||
const openInternetHospital = () => {
|
||||
// 在微信小程序中打开外部网址
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '即将打开互联网医院平台,是否继续?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.showToast({
|
||||
title: '正在跳转中...',
|
||||
icon: 'none',
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 打开分享弹窗
|
||||
const openShareModal = () => {
|
||||
showShareModal.value = true
|
||||
}
|
||||
|
||||
// 关闭分享弹窗
|
||||
const closeShareModal = () => {
|
||||
showShareModal.value = false
|
||||
}
|
||||
|
||||
// 分享到企业微信
|
||||
const shareToWechatWork = () => {
|
||||
uni.showToast({
|
||||
title: '分享到企业微信...',
|
||||
icon: 'none'
|
||||
})
|
||||
closeShareModal()
|
||||
}
|
||||
|
||||
// 分享到微信
|
||||
const shareToWechat = () => {
|
||||
uni.showToast({
|
||||
title: '分享到微信...',
|
||||
icon: 'none'
|
||||
})
|
||||
closeShareModal()
|
||||
}
|
||||
|
||||
|
||||
// 跳转到编辑名片页
|
||||
const addFriend = () => {
|
||||
uni.navigateTo({
|
||||
url: `/pages/team/friend?corpId=${corpId.value}&userid=${userid.value}`
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 复制邮箱地址
|
||||
const copyEmail = (email) => {
|
||||
closeEmailModal()
|
||||
// #ifdef H5
|
||||
// H5环境下使用navigator.clipboard API
|
||||
if (navigator.clipboard) {
|
||||
navigator.clipboard.writeText(email).then(() => {
|
||||
uni.showToast({
|
||||
title: '邮箱已复制',
|
||||
icon: 'none'
|
||||
})
|
||||
}).catch(() => {
|
||||
// 降级方案:使用传统方法
|
||||
const textArea = document.createElement('textarea')
|
||||
textArea.value = email
|
||||
document.body.appendChild(textArea)
|
||||
textArea.select()
|
||||
document.execCommand('copy')
|
||||
document.body.removeChild(textArea)
|
||||
uni.showToast({
|
||||
title: '邮箱已复制',
|
||||
icon: 'none'
|
||||
})
|
||||
})
|
||||
} else {
|
||||
// 降级方案
|
||||
const textArea = document.createElement('textarea')
|
||||
textArea.value = email
|
||||
document.body.appendChild(textArea)
|
||||
textArea.select()
|
||||
document.execCommand('copy')
|
||||
document.body.removeChild(textArea)
|
||||
uni.showToast({
|
||||
title: '邮箱已复制',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
// #endif
|
||||
|
||||
// #ifdef MP-WEIXIN || APP-PLUS
|
||||
// 微信小程序和App环境下使用uni.setClipboardData
|
||||
uni.setClipboardData({
|
||||
data: email,
|
||||
success: () => {
|
||||
@ -795,280 +411,6 @@ const copyEmail = (email) => {
|
||||
})
|
||||
}
|
||||
})
|
||||
// #endif
|
||||
}
|
||||
|
||||
// 打开地图
|
||||
const openMap = (address) => {
|
||||
// 关闭地址弹窗
|
||||
closeAddressModal()
|
||||
|
||||
// #ifdef H5
|
||||
// H5环境下使用百度地图或高德地图网页版
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '即将在浏览器中打开地图,是否继续?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
// 使用百度地图网页版
|
||||
const mapUrl = `https://api.map.baidu.com/geocoder?address=${encodeURIComponent(address)}&output=html&src=webapp.baidu.openAPIdemo`
|
||||
window.open(mapUrl, '_blank')
|
||||
}
|
||||
}
|
||||
})
|
||||
// #endif
|
||||
|
||||
// #ifdef MP-WEIXIN || APP-PLUS
|
||||
// 微信小程序和App环境下使用uni.openLocation
|
||||
uni.openLocation({
|
||||
latitude: 23.1291, // 广州的纬度
|
||||
longitude: 113.2644, // 广州的经度
|
||||
name: '广州医科大学附属第一医院',
|
||||
address: address,
|
||||
scale: 18,
|
||||
success: () => {
|
||||
console.log('地图打开成功')
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('地图打开失败:', err)
|
||||
// 如果打开地图失败,提供备选方案
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '无法打开地图,是否复制地址到剪贴板?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.setClipboardData({
|
||||
data: address,
|
||||
success: () => {
|
||||
uni.showToast({
|
||||
title: '地址已复制',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
// #endif
|
||||
}
|
||||
|
||||
|
||||
const getDoctorCardListData = async () => {
|
||||
try {
|
||||
const res = await getDoctorCardList({
|
||||
staffId: accountStore.getAccountInfo.staffId
|
||||
})
|
||||
|
||||
// 更新医生名片状态和基本信息
|
||||
if (res.success && res.data) {
|
||||
// 提取基本信息(如果API返回了医生信息)
|
||||
const basicInfo = res.data.staffInfo ? {
|
||||
staffId: res.data.staffInfo.staffId || accountStore.getAccountInfo.staffId,
|
||||
staffName: res.data.staffInfo.staffName || accountStore.getAccountInfo.staffName,
|
||||
hospitalId: res.data.staffInfo.hospitalId || accountStore.getAccountInfo.hospitalId,
|
||||
hospitalName: res.data.staffInfo.hospitalName || accountStore.getAccountInfo.hospitalName,
|
||||
position: res.data.staffInfo.position || accountStore.getAccountInfo.position,
|
||||
jobTitle: res.data.staffInfo.jobTitle || accountStore.getAccountInfo.jobTitle,
|
||||
professionalTitle: res.data.staffInfo.professionalTitle || accountStore.getAccountInfo.professionalTitle,
|
||||
phone: res.data.staffInfo.phone || accountStore.getAccountInfo.phone,
|
||||
enterpriseWechatId: res.data.staffInfo.enterpriseWechatId || accountStore.getAccountInfo.enterpriseWechatId,
|
||||
email: res.data.staffInfo.email || accountStore.getAccountInfo.email,
|
||||
address: res.data.staffInfo.address || accountStore.getAccountInfo.address,
|
||||
photo: res.data.staffInfo.photo || accountStore.getAccountInfo.photo,
|
||||
introduction: res.data.staffInfo.introduction || accountStore.getAccountInfo.introduction,
|
||||
departments: res.data.staffInfo.departments || accountStore.getAccountInfo.departments
|
||||
} : null;
|
||||
|
||||
accountStore.updateDoctorCardStatus(
|
||||
res.data.hasCards || false,
|
||||
res.data.message || '',
|
||||
basicInfo
|
||||
)
|
||||
|
||||
// 当接口返回明确没有名片时:自动创建名片,然后重新拉取列表
|
||||
if (res.data.hasCards === false) {
|
||||
if (!isAutoCreatingCard) {
|
||||
isAutoCreatingCard = true
|
||||
try {
|
||||
const account = accountStore.getAccountInfo
|
||||
const departments = accountStore.getDepartments || []
|
||||
const primaryDept =
|
||||
departments.find((d) => d.isPrimary) || departments[0]
|
||||
|
||||
const externalDisplay = {
|
||||
phone: cardStore.phoneVisible,
|
||||
email: cardStore.emailVisible,
|
||||
address: cardStore.addressVisible,
|
||||
deptName: cardStore.deptNameVisible,
|
||||
position: cardStore.positionVisible
|
||||
}
|
||||
|
||||
const convenienceServices = (cardStore.services || []).map((service) => ({
|
||||
serviceName: service.label || service.serviceName || '',
|
||||
serviceUrl: service.url || service.serviceUrl || ''
|
||||
}))
|
||||
|
||||
const requestData = {
|
||||
staffId: account.staffId,
|
||||
shareMessage: cardStore.shareMessage,
|
||||
phone: account.phone,
|
||||
email: account.email,
|
||||
address: account.address,
|
||||
position: account.position,
|
||||
photo: account.photo,
|
||||
introduction: account.introduction,
|
||||
externalDisplay,
|
||||
convenienceServices
|
||||
}
|
||||
|
||||
// 设置主部门(保持与 edit-card.vue 一致)
|
||||
if (primaryDept?.deptId) {
|
||||
requestData.deptId = primaryDept.deptId
|
||||
await setDeptStaffPrimary({
|
||||
staffId: account.staffId,
|
||||
primaryDeptId: primaryDept.deptId
|
||||
})
|
||||
accountStore.updatePrimaryDepartment(primaryDept.deptId)
|
||||
}
|
||||
|
||||
uni.showLoading({ title: '正在创建名片...' })
|
||||
const createRes = await createDoctorCard(requestData)
|
||||
uni.hideLoading()
|
||||
|
||||
if (!createRes?.success) {
|
||||
throw new Error(createRes?.message || '创建名片失败')
|
||||
}
|
||||
|
||||
// 创建成功后重新拉取列表
|
||||
await getDoctorCardListData()
|
||||
return
|
||||
} catch (error) {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: '名片创建失败,请稍后重试',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
console.error('自动创建名片失败:', error)
|
||||
} finally {
|
||||
isAutoCreatingCard = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 更新名片列表数据
|
||||
if (res.data.hasCards && res.data.cards) {
|
||||
// 使用接口返回的名片数据
|
||||
const newCardList = res.data.cards.map(card => ({
|
||||
name: accountStore.getAccountInfo.staffName || '未知',
|
||||
hospital: accountStore.getAccountInfo.hospitalName || '',
|
||||
title: `${accountStore.getAccountInfo.deptName || ''} ${accountStore.getAccountInfo.position || ''}`,
|
||||
version: card.version || '',
|
||||
cardId: card.cardId
|
||||
}))
|
||||
|
||||
// 更新cardStore中的名片列表
|
||||
cardStore.setCardList(newCardList)
|
||||
console.log('cardList:', newCardList)
|
||||
|
||||
// 如果当前没有选中的名片,或者当前选中的名片不在新列表中,则选择第一张
|
||||
if (!cardStore.currentCardId || !newCardList.some(card => card.cardId === cardStore.currentCardId)) {
|
||||
const firstCardId = newCardList[0].cardId || ''
|
||||
cardStore.setCurrentCardId(firstCardId)
|
||||
console.log('设置第一张名片为当前选中:', firstCardId)
|
||||
|
||||
// 更新名片缓存数据
|
||||
await updateCardCache(firstCardId)
|
||||
} else {
|
||||
// 更新当前选中名片的缓存数据
|
||||
await updateCardCache(cardStore.currentCardId)
|
||||
}
|
||||
} else {
|
||||
// 如果没有名片,使用默认数据
|
||||
const account = accountStore.getAccountInfo
|
||||
const defaultCardList = [{
|
||||
name: account.staffName || '',
|
||||
hospital: account.hospitalName || '',
|
||||
title: `${account.deptName || ''} ${account.position || ''}`,
|
||||
version: '全员通用版',
|
||||
cardId: 'default'
|
||||
}]
|
||||
cardStore.setCardList(defaultCardList)
|
||||
cardStore.setCurrentCardId('default')
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取名片列表失败:', error)
|
||||
// 如果获取失败,默认设置为没有名片
|
||||
accountStore.updateDoctorCardStatus(false, '获取名片信息失败')
|
||||
cardId.value = ''
|
||||
|
||||
// 使用默认名片数据
|
||||
const account = accountStore.getAccountInfo
|
||||
const defaultCardList = [{
|
||||
name: account.staffName || '',
|
||||
hospital: account.hospitalName || '',
|
||||
title: `${account.deptName || ''} ${account.position || ''}`,
|
||||
version: '全员通用版',
|
||||
cardId: 'default'
|
||||
}]
|
||||
cardStore.setCardList(defaultCardList)
|
||||
cardStore.setCurrentCardId('default')
|
||||
}
|
||||
}
|
||||
|
||||
// 更新名片缓存数据
|
||||
const updateCardCache = async (cardId) => {
|
||||
if (!cardId) return
|
||||
|
||||
try {
|
||||
console.log('开始获取名片详情并更新缓存,cardId:', cardId)
|
||||
const detailRes = await getDoctorCardDetail({ cardId })
|
||||
|
||||
if (detailRes.success && detailRes.data) {
|
||||
const cardData = detailRes.data
|
||||
console.log('名片详情数据:', cardData)
|
||||
|
||||
// 更新名片分享语
|
||||
if (cardData.shareMessage) {
|
||||
cardStore.shareMessage = cardData.shareMessage
|
||||
}
|
||||
|
||||
// 更新对外信息展示配置
|
||||
if (cardData.externalDisplay) {
|
||||
cardStore.updateContactVisibility(
|
||||
cardData.externalDisplay.phone || false,
|
||||
cardData.externalDisplay.email || false,
|
||||
cardData.externalDisplay.address || false,
|
||||
cardData.externalDisplay.deptName || false,
|
||||
cardData.externalDisplay.position || false
|
||||
)
|
||||
}
|
||||
|
||||
// 更新便民服务
|
||||
if (cardData.convenienceServices && cardData.convenienceServices.length > 0) {
|
||||
cardStore.services = cardData.convenienceServices.map(service => ({
|
||||
label: service.serviceName,
|
||||
url: service.serviceUrl
|
||||
}))
|
||||
}
|
||||
|
||||
// 更新审核状态到缓存
|
||||
if (cardData.auditStatus) {
|
||||
cardStore.setAuditStatus(cardData.auditStatus)
|
||||
console.log('名片审核状态已缓存:', cardData.auditStatus)
|
||||
}
|
||||
|
||||
// 保存到本地存储
|
||||
cardStore.saveToStorage()
|
||||
|
||||
console.log('名片缓存数据已更新')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('更新名片缓存失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -1181,11 +523,12 @@ const updateCardCache = async (cardId) => {
|
||||
}
|
||||
|
||||
.service-text {
|
||||
font-size: 28rpx;
|
||||
font-size: 32rpx;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
font-weight: 500;
|
||||
position: relative;
|
||||
white-space: nowrap;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
|
||||
@ -23,7 +23,12 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { ref, watch } from 'vue';
|
||||
import { storeToRefs } from "pinia";
|
||||
import useAccount from "@/store/account";
|
||||
import api from "@/utils/api";
|
||||
import { set } from "@/utils/cache";
|
||||
import { toast } from "@/utils/widget";
|
||||
|
||||
const emits = defineEmits(['close', 'confirm'])
|
||||
const props = defineProps({
|
||||
@ -36,15 +41,30 @@ const props = defineProps({
|
||||
default: false
|
||||
}
|
||||
})
|
||||
const env = __VITE_ENV__;
|
||||
const appid = env.MP_WX_APP_ID;
|
||||
const popup = ref()
|
||||
const { account } = storeToRefs(useAccount());
|
||||
|
||||
|
||||
function close() {
|
||||
emits('close')
|
||||
}
|
||||
|
||||
function enterTeam(team) {
|
||||
uni.navigateTo({ url: `/pages/team/team-detail?corpId=${team.corpId}&teamId=${team.teamId}` })
|
||||
close()
|
||||
async function enterTeam(team) {
|
||||
const res = await api('bindWxappWithTeam', { appid, corpId: team.corpId, teamId: team.teamId, openid: account.value.openid });
|
||||
if (!res || !res.success) {
|
||||
return toast("关联团队失败");
|
||||
}
|
||||
set('home-invite-team-info', {
|
||||
teamId: team.teamId,
|
||||
corpId: team.corpId,
|
||||
});
|
||||
uni.switchTab({
|
||||
url: "/pages/home/home",
|
||||
});
|
||||
// uni.navigateTo({ url: `/pages/team/team-detail?corpId=${team.corpId}&teamId=${team.teamId}` })
|
||||
// close()
|
||||
}
|
||||
|
||||
watch(() => props.visible, n => {
|
||||
|
||||
@ -106,8 +106,13 @@ function toFriend(userid) {
|
||||
uni.navigateTo({ url: `/pages/team/friend?corpId=${corpId.value}&userid=${userid}` })
|
||||
}
|
||||
|
||||
function toHomePage(userid) {
|
||||
async function toHomePage(userid) {
|
||||
const res = await api('getCorpBusinessCardStatus', { corpId: corpId.value });
|
||||
if (res && res.data) {
|
||||
uni.navigateTo({ url: `/pages/team/business-card?corpId=${corpId.value}&userid=${userid}` })
|
||||
} else {
|
||||
uni.navigateTo({ url: `/pages/team/homepage?corpId=${corpId.value}&userid=${userid}&showQrcode=${friendlyMember.value[userid] ? 'YES' : ''}` })
|
||||
}
|
||||
}
|
||||
|
||||
async function getTeam() {
|
||||
|
||||
@ -56,6 +56,10 @@ export default [
|
||||
path: 'pages/team/friend',
|
||||
meta: { title: '添加好友', login: true }
|
||||
},
|
||||
{
|
||||
path: 'pages/team/business-card',
|
||||
meta: { title: '电子名片', login: true }
|
||||
},
|
||||
{
|
||||
path: 'pages/web-view/web-view',
|
||||
meta: { title: '' }
|
||||
|
||||
@ -19,6 +19,7 @@ const urlsConfig = {
|
||||
getBusinessCard: 'getBusinessCard',
|
||||
recordBusinessCardBehavior: 'recordBusinessCardBehavior',
|
||||
getJoinedTeams: 'getJoinedTeams',
|
||||
getCorpBusinessCardStatus: 'getCorpBusinessCardStatus',
|
||||
},
|
||||
|
||||
knowledgeBase: {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user