fix: 页面调整

This commit is contained in:
huxuejian 2026-06-26 15:12:09 +08:00
parent f68cd721b6
commit 064bb44ec0
5 changed files with 78 additions and 705 deletions

View File

@ -11,6 +11,11 @@
<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="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()"> <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-item-bg" src="/static/card/gzhBack.png" mode="scaleToFill"></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>
@ -21,11 +26,7 @@
<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="scaleToFill"></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>
@ -42,8 +43,8 @@
</view> </view>
<!-- 医院信息内容 --> <!-- 医院信息内容 -->
<view v-if="hospitalInfo" class="tab-content" :class="{ 'tab-content-left': activeTab === 'hospital' }" <view v-if="hospitalInfo && activeTab === 'hospital'" class="tab-content"
v-show="activeTab === 'hospital'"> :class="{ 'tab-content-left': activeTab === 'hospital' }">
<view class="hospital-info"> <view class="hospital-info">
<view class="hospital-header"> <view class="hospital-header">
<view class="hospital-logo"> <view class="hospital-logo">
@ -74,8 +75,7 @@
</view> </view>
<!-- 个人简介内容 --> <!-- 个人简介内容 -->
<view class="tab-content" :class="{ 'tab-content-right': activeTab === 'intro' }" <view v-if="activeTab === 'intro'" class="tab-content" :class="{ 'tab-content-right': activeTab === 'intro' }">
v-show="activeTab === 'intro'">
<view class="intro-content"> <view class="intro-content">
<view class="intro-header"> <view class="intro-header">
<view class="intro-title-bar"></view> <view class="intro-title-bar"></view>
@ -101,27 +101,6 @@
</view> </view>
</template> </template>
</full-page> </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"> <view v-if="showPhoneModal" class="modal-mask" @click="closePhoneModal">
@ -200,41 +179,6 @@
</view> </view>
</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" /> <teams-popup :visible="showTeamPopup" :teams="teams" @close="showTeamPopup = false" />
</template> </template>
@ -257,12 +201,28 @@ const { account } = storeToRefs(useAccount());
const env = __VITE_ENV__; const env = __VITE_ENV__;
const shareAppVersion = env.MP_SHARE_WX_APP_VERSION; const shareAppVersion = env.MP_SHARE_WX_APP_VERSION;
const activeTab = ref('hospital') // 'hospital' 'intro'
const corpId = ref(''); const corpId = ref('');
const userid = ref('') const userid = ref('')
const businessCard = ref(null); const businessCard = ref(null);
const teams = ref([]) const teams = ref([])
const showTeamPopup = ref(false)
const hospitalInfo = computed(() => businessCard.value?.hospitalInfo || null); 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) { function makePhoneCall(phone) {
closePhoneModal() closePhoneModal()
@ -283,20 +243,21 @@ function setClipboardData(data) {
}) })
} }
function switchTab(tab) {
activeTab.value = tab
}
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;
if (!hospitalInfo.value && activeTab.value === 'hospital') {
activeTab.value = 'intro'
}
if (businessCard.value) { if (businessCard.value) {
recordBusinessCardVisit() recordBusinessCardVisit()
} }
} }
async function displayPhone() {
if (businessCard.value.externalContact) {
showPhoneModal.value = true
}
}
async function showTeams() { async function showTeams() {
const res = await api('getJoinedTeams', { mateId: userid.value, corpId: corpId.value }) const res = await api('getJoinedTeams', { mateId: userid.value, corpId: corpId.value })
teams.value = res && Array.isArray(res.data) ? res.data : []; teams.value = res && Array.isArray(res.data) ? res.data : [];
@ -343,6 +304,8 @@ async function getVisitorAccount() {
} }
useLoad((opt) => { useLoad((opt) => {
console.clear()
console.log(account.value)
if (opt.q) { if (opt.q) {
const href = typeof opt.q === "string" ? decodeURIComponent(opt.q.trim()) : ""; const href = typeof opt.q === "string" ? decodeURIComponent(opt.q.trim()) : "";
const [, url = ""] = href.split("?"); const [, url = ""] = href.split("?");
@ -371,7 +334,8 @@ onShareAppMessage((res) => {
return { return {
title: `${businessCard.value.externalName || card.anotherName || ''}】电子名片`, title: `${businessCard.value.externalName || card.anotherName || ''}】电子名片`,
type: shareAppVersion || 0, // 0 | 1 | 2 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 cardStore = ref({})
const accountStore = 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 showAddressModal = ref(false)
const showMoreInfoModal = ref(false) const showMoreInfoModal = ref(false)
const showOfficialAccountModal = ref(false) const showOfficialAccountModal = ref(false)
@ -404,152 +355,18 @@ const showShareModal = ref(false)
// 便 // 便
const services = ref([]) 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 getTagClass = (index) => {
const styles = ['grade', 'center', 'specialty'] const styles = ['grade', 'center', 'specialty']
return styles[index % 3] 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 = () => { const closeServiceModal = () => {
showServiceModal.value = false 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 = () => { const closePhoneModal = () => {
showPhoneModal.value = false showPhoneModal.value = false
@ -565,9 +382,9 @@ const closeEmailModal = () => {
showEmailModal.value = false showEmailModal.value = false
} }
//
const openAddressModal = () => { const openAddressModal = () => {
showAddressModal.value = true toast('门诊预约功能暂未开放')
// showAddressModal.value = true
} }
// //
@ -575,211 +392,10 @@ const closeAddressModal = () => {
showAddressModal.value = false 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) => { const copyEmail = (email) => {
closeEmailModal() 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({ uni.setClipboardData({
data: email, data: email,
success: () => { 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> </script>
@ -1181,11 +523,12 @@ const updateCardCache = async (cardId) => {
} }
.service-text { .service-text {
font-size: 28rpx; font-size: 32rpx;
color: #fff; color: #fff;
text-align: center; text-align: center;
font-weight: 500; font-weight: 500;
position: relative; position: relative;
white-space: nowrap;
z-index: 1; z-index: 1;
} }

View File

@ -23,7 +23,12 @@
</template> </template>
<script setup> <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 emits = defineEmits(['close', 'confirm'])
const props = defineProps({ const props = defineProps({
@ -36,15 +41,30 @@ const props = defineProps({
default: false default: false
} }
}) })
const env = __VITE_ENV__;
const appid = env.MP_WX_APP_ID;
const popup = ref() const popup = ref()
const { account } = storeToRefs(useAccount());
function close() { function close() {
emits('close') emits('close')
} }
function enterTeam(team) { async function enterTeam(team) {
uni.navigateTo({ url: `/pages/team/team-detail?corpId=${team.corpId}&teamId=${team.teamId}` }) const res = await api('bindWxappWithTeam', { appid, corpId: team.corpId, teamId: team.teamId, openid: account.value.openid });
close() 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 => { watch(() => props.visible, n => {

View File

@ -106,8 +106,13 @@ function toFriend(userid) {
uni.navigateTo({ url: `/pages/team/friend?corpId=${corpId.value}&userid=${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' : ''}` }) uni.navigateTo({ url: `/pages/team/homepage?corpId=${corpId.value}&userid=${userid}&showQrcode=${friendlyMember.value[userid] ? 'YES' : ''}` })
}
} }
async function getTeam() { async function getTeam() {

View File

@ -56,6 +56,10 @@ export default [
path: 'pages/team/friend', path: 'pages/team/friend',
meta: { title: '添加好友', login: true } meta: { title: '添加好友', login: true }
}, },
{
path: 'pages/team/business-card',
meta: { title: '电子名片', login: true }
},
{ {
path: 'pages/web-view/web-view', path: 'pages/web-view/web-view',
meta: { title: '' } meta: { title: '' }

View File

@ -19,6 +19,7 @@ const urlsConfig = {
getBusinessCard: 'getBusinessCard', getBusinessCard: 'getBusinessCard',
recordBusinessCardBehavior: 'recordBusinessCardBehavior', recordBusinessCardBehavior: 'recordBusinessCardBehavior',
getJoinedTeams: 'getJoinedTeams', getJoinedTeams: 'getJoinedTeams',
getCorpBusinessCardStatus: 'getCorpBusinessCardStatus',
}, },
knowledgeBase: { knowledgeBase: {