fix: 名片开发
This commit is contained in:
parent
2f6f0d4abe
commit
7f47745b0e
@ -34,8 +34,10 @@ export default function useGuard() {
|
||||
|
||||
async function useLoad(fn) {
|
||||
await promise;
|
||||
if (typeof fn === 'function') {
|
||||
fn(options.value);
|
||||
}
|
||||
}
|
||||
|
||||
async function triggleShowEvents() {
|
||||
await promise;
|
||||
|
||||
@ -6,26 +6,26 @@
|
||||
|
||||
<view class="service-section">
|
||||
<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-icon" src="/static/card/jzfwIcon.png" mode="aspectFit"></image>
|
||||
<text class="service-text">全周期管理</text>
|
||||
</view>
|
||||
<view class="service-item service-item-2" @click="handleWebsiteClick">
|
||||
<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">
|
||||
<view class="service-item service-item-3" @click="displayPhone()">
|
||||
<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>
|
||||
<text class="service-text">联系电话</text>
|
||||
</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-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="aspectFit"></image>
|
||||
<image class="service-icon" src="/static/card/gwIcon.png" mode="aspectFit"></image>
|
||||
<text class="service-text">地址</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -132,10 +132,14 @@
|
||||
</view>
|
||||
<view class="service-modal-body">
|
||||
<view class="service-list">
|
||||
<view class="service-list-item" v-if="businessCard && businessCard.externalContact"
|
||||
@click="makePhoneCall(businessCard.externalContact)">
|
||||
<text class="service-list-text">{{ businessCard.externalContact }}</text>
|
||||
<view class="service-list-icon">📞</view>
|
||||
<view class="service-list-item" v-if="businessCard && businessCard.externalContact">
|
||||
<view class="service-list-text">{{ businessCard.externalContact }}</view>
|
||||
<view class="flex">
|
||||
<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 class="service-list-item" v-else>
|
||||
<text class="service-list-text no-data">暂无电话信息</text>
|
||||
@ -155,11 +159,14 @@
|
||||
</view>
|
||||
<view class="service-modal-body">
|
||||
<view class="service-list">
|
||||
<view class="service-list-item" v-if="accountInfo.email" @click="copyEmail(accountInfo.email)">
|
||||
<text class="service-list-text">{{ accountInfo.email }}</text>
|
||||
<view class="service-list-icon">✉️</view>
|
||||
<view class="service-list-item" v-if="businessCard.externalEmail"
|
||||
@click="copyEmail(businessCard.externalEmail)">
|
||||
<text class="service-list-text">{{ businessCard.externalEmail }}</text>
|
||||
<view class="text-base text-primary mr-10" @click="setClipboardData(businessCard.externalEmail)">
|
||||
复制
|
||||
</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>
|
||||
<view class="service-list-icon">✉️</view>
|
||||
</view>
|
||||
@ -177,11 +184,14 @@
|
||||
</view>
|
||||
<view class="service-modal-body">
|
||||
<view class="service-list">
|
||||
<view class="service-list-item" v-if="accountInfo.address" @click="openMap(accountInfo.address)">
|
||||
<text class="service-list-text">{{ accountInfo.address }}</text>
|
||||
<view class="service-list-icon">📍</view>
|
||||
<view class="service-list-item" v-if="businessCard.externalAddress"
|
||||
@click="setClipboardData(businessCard.externalAddress)">
|
||||
<text class="service-list-text">{{ businessCard.externalAddress }}</text>
|
||||
<view class="text-base text-primary" @click="setClipboardData(businessCard.externalAddress)">
|
||||
复制
|
||||
</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>
|
||||
<view class="service-list-icon">📍</view>
|
||||
</view>
|
||||
@ -225,29 +235,68 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<teams-popup :visible="showTeamPopup" :teams="teams" @close="showTeamPopup = false" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import api from '@/utils/api';
|
||||
import useGuard from '@/hooks/useGuard';
|
||||
import { toast } from '@/utils/widget.js';
|
||||
|
||||
import BusinessCard from './components/BusinessCard.vue'
|
||||
import fullPage from '@/components/full-page.vue'
|
||||
import TeamsPopup from './components/teams-popup.vue'
|
||||
|
||||
const { useShow, useLoad } = useGuard();
|
||||
|
||||
const corpId = ref('');
|
||||
const userid = ref('')
|
||||
const businessCard = ref(null);
|
||||
const teams = ref([])
|
||||
const showTeamPopup = ref(false)
|
||||
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() {
|
||||
const res = await api('getBusinessCard', { userid: userid.value, corpId: corpId.value })
|
||||
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) => {
|
||||
corpId.value = opt.corpId
|
||||
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) => {
|
||||
@ -1543,16 +1566,9 @@ const updateCardCache = async (cardId) => {
|
||||
|
||||
/* 底部操作按钮 */
|
||||
.bottom-actions {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background: #fff;
|
||||
padding: 20rpx 40rpx;
|
||||
border-radius: 40rpx 40rpx 0 0;
|
||||
display: flex;
|
||||
gap: 20rpx;
|
||||
z-index: 100;
|
||||
box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
|
||||
72
pages/team/components/teams-popup.vue
Normal file
72
pages/team/components/teams-popup.vue
Normal 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>
|
||||
@ -16,7 +16,8 @@ const urlsConfig = {
|
||||
getMiniAppHomeStats: "getMiniAppHomeStats",
|
||||
getResponsiblePerson: 'getTeamResponsiblePerson',
|
||||
relateWxappTeamByExternalUserId: 'relateWxappTeamByExternalUserId',
|
||||
getBusinessCard: 'getBusinessCard'
|
||||
getBusinessCard: 'getBusinessCard',
|
||||
getJoinedTeams: 'getJoinedTeams',
|
||||
},
|
||||
|
||||
knowledgeBase: {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user