fix: 名片开发

This commit is contained in:
huxuejian 2026-06-24 10:59:03 +08:00
parent 2f6f0d4abe
commit 7f47745b0e
4 changed files with 147 additions and 56 deletions

View File

@ -34,8 +34,10 @@ export default function useGuard() {
async function useLoad(fn) { async function useLoad(fn) {
await promise; await promise;
if (typeof fn === 'function') {
fn(options.value); fn(options.value);
} }
}
async function triggleShowEvents() { async function triggleShowEvents() {
await promise; await promise;

View File

@ -6,26 +6,26 @@
<view class="service-section"> <view class="service-section">
<view class="service-grid"> <view class="service-grid">
<view class="service-item service-item-1"> <view class="service-item service-item-1" @click="showTeams()">
<image class="service-item-bg" src="/static/card/jzfwBack.png" mode="aspectFit"></image> <image class="service-item-bg" src="/static/card/jzfwBack.png" mode="aspectFit"></image>
<image class="service-icon" src="/static/card/jzfwIcon.png" mode="aspectFit"></image> <image class="service-icon" src="/static/card/jzfwIcon.png" mode="aspectFit"></image>
<text class="service-text">全周期管理</text> <text class="service-text">全周期管理</text>
</view> </view>
<view class="service-item service-item-2" @click="handleWebsiteClick"> <view class="service-item service-item-3" @click="displayPhone()">
<image class="service-item-bg" src="/static/card/gwBack.png" mode="aspectFit"></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="openPhoneModal">
<image class="service-item-bg" src="/static/card/gzhBack.png" mode="aspectFit"></image> <image class="service-item-bg" src="/static/card/gzhBack.png" mode="aspectFit"></image>
<image class="service-icon" src="/static/card/telephone.svg" mode="aspectFit"></image> <image class="service-icon" src="/static/card/telephone.svg" mode="aspectFit"></image>
<text class="service-text">联系电话</text> <text class="service-text">联系电话</text>
</view> </view>
<view class="service-item service-item-4" @click="openVideoAccountModal"> <view class="service-item service-item-4" @click="openEmailModal">
<image class="service-item-bg" src="/static/card/sphBack.png" mode="aspectFit"></image> <image class="service-item-bg" src="/static/card/sphBack.png" mode="aspectFit"></image>
<image class="service-icon" src="/static/card/email.svg" mode="aspectFit"></image> <image class="service-icon" src="/static/card/email.svg" mode="aspectFit"></image>
<text class="service-text">邮箱</text> <text class="service-text">邮箱</text>
</view> </view>
<view class="service-item service-item-2" @click="openAddressModal">
<image class="service-item-bg" src="/static/card/gwBack.png" mode="aspectFit"></image>
<image class="service-icon" src="/static/card/gwIcon.png" mode="aspectFit"></image>
<text class="service-text">地址</text>
</view>
</view> </view>
</view> </view>
</view> </view>
@ -132,10 +132,14 @@
</view> </view>
<view class="service-modal-body"> <view class="service-modal-body">
<view class="service-list"> <view class="service-list">
<view class="service-list-item" v-if="businessCard && businessCard.externalContact" <view class="service-list-item" v-if="businessCard && businessCard.externalContact">
@click="makePhoneCall(businessCard.externalContact)"> <view class="service-list-text">{{ businessCard.externalContact }}</view>
<text class="service-list-text">{{ businessCard.externalContact }}</text> <view class="flex">
<view class="service-list-icon">📞</view> <view class="text-base text-primary mr-10" @click="setClipboardData(businessCard.externalContact)">
复制
</view>
<view class="text-base text-primary" @click="makePhoneCall(businessCard.externalContact)">拨打</view>
</view>
</view> </view>
<view class="service-list-item" v-else> <view class="service-list-item" v-else>
<text class="service-list-text no-data">暂无电话信息</text> <text class="service-list-text no-data">暂无电话信息</text>
@ -155,11 +159,14 @@
</view> </view>
<view class="service-modal-body"> <view class="service-modal-body">
<view class="service-list"> <view class="service-list">
<view class="service-list-item" v-if="accountInfo.email" @click="copyEmail(accountInfo.email)"> <view class="service-list-item" v-if="businessCard.externalEmail"
<text class="service-list-text">{{ accountInfo.email }}</text> @click="copyEmail(businessCard.externalEmail)">
<view class="service-list-icon"></view> <text class="service-list-text">{{ businessCard.externalEmail }}</text>
<view class="text-base text-primary mr-10" @click="setClipboardData(businessCard.externalEmail)">
复制
</view> </view>
<view class="service-list-item" v-if="!accountInfo.email"> </view>
<view class="service-list-item" v-else>
<text class="service-list-text no-data">暂无邮箱信息</text> <text class="service-list-text no-data">暂无邮箱信息</text>
<view class="service-list-icon"></view> <view class="service-list-icon"></view>
</view> </view>
@ -177,11 +184,14 @@
</view> </view>
<view class="service-modal-body"> <view class="service-modal-body">
<view class="service-list"> <view class="service-list">
<view class="service-list-item" v-if="accountInfo.address" @click="openMap(accountInfo.address)"> <view class="service-list-item" v-if="businessCard.externalAddress"
<text class="service-list-text">{{ accountInfo.address }}</text> @click="setClipboardData(businessCard.externalAddress)">
<view class="service-list-icon">📍</view> <text class="service-list-text">{{ businessCard.externalAddress }}</text>
<view class="text-base text-primary" @click="setClipboardData(businessCard.externalAddress)">
复制
</view> </view>
<view class="service-list-item" v-if="!accountInfo.address"> </view>
<view class="service-list-item" v-else>
<text class="service-list-text no-data">暂无地址信息</text> <text class="service-list-text no-data">暂无地址信息</text>
<view class="service-list-icon">📍</view> <view class="service-list-icon">📍</view>
</view> </view>
@ -225,29 +235,68 @@
</view> </view>
</view> </view>
</view> </view>
<teams-popup :visible="showTeamPopup" :teams="teams" @close="showTeamPopup = false" />
</template> </template>
<script setup> <script setup>
import { ref, computed } from 'vue'; import { ref, computed } from 'vue';
import api from '@/utils/api'; import api from '@/utils/api';
import useGuard from '@/hooks/useGuard'; import useGuard from '@/hooks/useGuard';
import { toast } from '@/utils/widget.js';
import BusinessCard from './components/BusinessCard.vue' import BusinessCard from './components/BusinessCard.vue'
import fullPage from '@/components/full-page.vue' import fullPage from '@/components/full-page.vue'
import TeamsPopup from './components/teams-popup.vue'
const { useShow, useLoad } = useGuard(); const { useShow, useLoad } = useGuard();
const corpId = ref(''); const corpId = ref('');
const userid = ref('') const userid = ref('')
const businessCard = ref(null); const businessCard = ref(null);
const teams = ref([])
const showTeamPopup = ref(false)
const hospitalInfo = computed(() => businessCard.value?.hospitalInfo || null); const hospitalInfo = computed(() => businessCard.value?.hospitalInfo || null);
function makePhoneCall(phone) {
closePhoneModal()
uni.makePhoneCall({
phoneNumber: phone,
success: () => {
toast('拨打电话成功')
}
})
}
function setClipboardData(data) {
uni.setClipboardData({
data: data,
success: () => {
toast('复制成功')
}
})
}
async function getCard() { async function getCard() {
const res = await api('getBusinessCard', { userid: userid.value, corpId: corpId.value }) const res = await api('getBusinessCard', { userid: userid.value, corpId: corpId.value })
businessCard.value = res && res.data ? res.data : null; businessCard.value = res && res.data ? res.data : null;
} }
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 : [];
if (teams.value.length === 0) {
toast('暂无加入的团队')
} else {
showTeamPopup.value = true
}
}
useLoad((opt) => { useLoad((opt) => {
corpId.value = opt.corpId corpId.value = opt.corpId
userid.value = opt.userid userid.value = opt.userid
@ -618,32 +667,6 @@ const addFriend = () => {
}) })
} }
//
const makePhoneCall = (phoneNumber) => {
closePhoneModal()
// #ifdef H5
// H5使tel:
uni.showModal({
title: '提示',
content: `即将拨打:${phoneNumber}`,
success: (res) => {
if (res.confirm) {
// tel
const link = document.createElement('a')
link.href = `tel:${phoneNumber}`
link.click()
}
}
})
// #endif
// #ifdef MP-WEIXIN || APP-PLUS
// App使uni.makePhoneCall
uni.makePhoneCall({
phoneNumber: phoneNumber
})
// #endif
}
// //
const copyEmail = (email) => { const copyEmail = (email) => {
@ -1543,16 +1566,9 @@ const updateCardCache = async (cardId) => {
/* 底部操作按钮 */ /* 底部操作按钮 */
.bottom-actions { .bottom-actions {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background: #fff;
padding: 20rpx 40rpx; padding: 20rpx 40rpx;
border-radius: 40rpx 40rpx 0 0;
display: flex; display: flex;
gap: 20rpx; gap: 20rpx;
z-index: 100;
box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.1); box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.1);
} }

View File

@ -0,0 +1,72 @@
<template>
<uni-popup ref="popup" type="bottom" :mask-click="false">
<view class="bg-white rounded overflow-hidden">
<view class="flex items-center justify-between px-15 py-12 border-b">
<view class="text-lg font-semibold text-dark">全周期管理</view>
<uni-icons type="closeempty" :size="24" color="#999" @click="close"></uni-icons>
</view>
<scroll-view scroll-y="true" class="popup-content-scroll">
<view class="px-15 py-12">
<view v-for="team in teams" :key="team.teamId" class="flex items-center p-10 mb-10 rounded-sm bg-gray"
@click="enterTeam(team)">
<view class="flex-grow w-0 mr-5 text-base leading-normal text-dark">
{{ team.name }}
</view>
<view class="flex-shrink-0 text-base text-primary">进入</view>
</view>
</view>
</scroll-view>
</view>
</uni-popup>
</template>
<script setup>
import { computed, ref, watch } from 'vue';
const emits = defineEmits(['close', 'confirm'])
const props = defineProps({
teams: {
type: Array,
default: () => []
},
visible: {
type: Boolean,
default: false
}
})
const popup = ref()
function close() {
emits('close')
}
function enterTeam(team) {
uni.navigateTo({ url: `/pages/team/team-detail?corpId=${team.corpId}&teamId=${team.teamId}` })
close()
}
watch(() => props.visible, n => {
if (n) {
popup.value && popup.value.open();
} else {
popup.value && popup.value.close()
}
})
</script>
<style lang="scss" scoped>
.min-w-60 {
min-width: 120rpx;
}
.check-icon {
width: 48rpx;
height: 48rpx;
}
.popup-content-scroll {
max-height: 50vh;
}
</style>

View File

@ -16,7 +16,8 @@ const urlsConfig = {
getMiniAppHomeStats: "getMiniAppHomeStats", getMiniAppHomeStats: "getMiniAppHomeStats",
getResponsiblePerson: 'getTeamResponsiblePerson', getResponsiblePerson: 'getTeamResponsiblePerson',
relateWxappTeamByExternalUserId: 'relateWxappTeamByExternalUserId', relateWxappTeamByExternalUserId: 'relateWxappTeamByExternalUserId',
getBusinessCard: 'getBusinessCard' getBusinessCard: 'getBusinessCard',
getJoinedTeams: 'getJoinedTeams',
}, },
knowledgeBase: { knowledgeBase: {