<template>

	<view class="container">
		<!-- v-if="isLogin" -->
		<view class="">
			<view class="cardHeader">
				<view class="introduct">
					<!-- 名片标题 -->
					<view class="introductTitle"></view>
					<view class="introductHeader">
						<view class="left">
							<view class="shield-bg"></view>
							<!-- :style="{backgroundImage: `url(${cardInfo.avatarUrl?cardInfo.avatarUrl:companyLogo})`}" -->
							<view class="avatar">
								<image :src="cardInfo.avatarUrl?cardInfo.avatarUrl:companyLogo" mode="widthFix"
									style="width: 120rpx;"></image>
							</view>
						</view>

						<view class="right">
							<view class="top">
								{{cardInfo.userName || '--'}}
							</view>
							<view class="bottom" v-if="cardInfo.companyInfoList&&cardInfo.companyInfoList.length>0">
								<view class="bottomCon" v-for="(item,index) in cardInfo.companyInfoList" :key="index">
									<view class="bottomL">
										{{item.companyName}}
									</view>
									<view class="bottomR">
										{{item.position}}
									</view>
								</view>

							</view>
						</view>
					</view>
					<view class="introductContent">
						<view v-for="item in infoList" :key="item.id" class="infoCon" @click="handleInfo(item)">
							<template v-if="item.value">
								<view class="iconfont infoIcon" :class="`${item.icon}`"></view>
								<view class="infoTxt">
									{{item.value}}
								</view>
							</template>

						</view>
					</view>
				</view>
				<view class="optionBtn">
					<view class="btnCon" v-for="item in btnList" :key="item.id" @click="handleBtnClick(item)">
						<view style="width: 50rpx;height: 50rpx;">
							<image v-if="item.type=='shareCard'" src="/myPackageA/assets/images/share.png"
								mode="widthFix" class="optionIcon"></image>
							<image v-if="item.type=='phone'" src="/myPackageA/assets/images/phone.png" mode="widthFix"
								class="optionIcon"></image>
							<image v-if="item.type=='focus'" src="/myPackageA/assets/images/guanzhu.png" mode="widthFix"
								class="optionIcon"></image>
							<image v-if="item.type=='shareData'" src="/myPackageA/assets/images/shareData.png"
								mode="widthFix" class="optionIcon"></image>
						</view>
						<view class="btnTxt">
							{{item.name}}
						</view>
					</view>
				</view>
			</view>
			<view class="tabs">
				<customSegmentedControl :values="items" :current="current" :fontSize="16" activeTextColor="#CE0E2D"
					inactiveTextColor="#000" @clickItem="onClickItem" :underlineHeight="'4rpx'"
					:underlineColor="'#CE0E2D'" :underlineWidth="'30%'" :tabBg="false" />
				<view class="content">
					<view v-show="current === 0" class="tabcontent">
						<view class="gapBox">
							<view class="tabTitle">
								品牌简介
							</view>
							<view class="insTxt" style="letter-spacing: 3rpx;">银盾家办（Supguard Family Office）由BHL（Budget
								Holdings
								Limited)全资控股，来自英国拥有半个世纪的历史。依托BHL亚太区核心平台—Auto&General（A&G）集团专业能力，打造中国首个AI普惠型新家办。它带着国际先进的家庭财事治理经验来到中国，致力于成为中国领先的家事治理与风险管理解决方案供应商，为家庭提供全生命周期的风险管理、财产保值增值以及财富传承规划方案。
							</view>
							<view class="insTxt" style="margin-top: 20rpx;letter-spacing: 1.5rpx;">
								银盾家办以“去风险、增确定、传家业”为使命，秉持“纯粹中立、系统赋能、长期陪伴”核心理念，打破传统家办精英壁垒，覆盖中产家庭、中小企业主、高净值家族全客层，银盾家办以千万家庭的“韧性架构师”自居，守护万家灯火，助力家业长青。
							</view>
							<view class="videoBox">
								<video id="myVideo" src="/myPackageA/assets/video/companyVideo4.mp4"
									object-fit="contain" title="公司介绍视频" style="width: 100%;height: 312.5rpx;"
									poster="/myPackageA/assets/images/videoPoster.webp" playsinline webkit-playsinline
									loop x5-video-player-type="h5" x5-video-player-fullscreen="false" preload="metadata"
									controls ref="myVideo"></video>
							</view>
						</view>
						<!-- 动态渲染：全球经验 ~ 合规保障 -->
						<view class="gapBox" v-for="(section, idx) in sectionList" :key="idx">
							<view class="tabTitle">{{ section.title }}</view>
							<view v-if="section.descriptions && section.descriptions.length">
								<view class="destxt" v-for="(desc, dIdx) in section.descriptions" :key="dIdx">{{ desc }}
								</view>
							</view>
							<view class="boxImage">
								<image v-for="(img, imgIdx) in section.images" :key="imgIdx" :src="img" mode="widthFix"
									@click="previewGroup(section.images, imgIdx,idx)" />
							</view>
						</view>
						<!-- <view class="gapBox">
							<view class="tabTitle">
								全球经验
							</view>
							<view class="boxImage">
								<image src="/myPackageA/assets/images/quanqiu1.webp" mode="widthFix"   @click="previewGroup('quanqiu1',0)"></image>
								<image src="/myPackageA/assets/images/quanqiu2.webp" mode="widthFix"  @click="previewGroup('quanqiu2',0)"></image>
							</view>

						</view>
						<view class="gapBox">
							<view class="tabTitle">
								十余载本土深耕
							</view>
							<view class="boxImage">
								<image src="/myPackageA/assets/images/shiyu1.webp" mode="widthFix" @click="previewGroup('shiyu1',0)"></image>
								<image src="/myPackageA/assets/images/shiyu2.webp" mode="widthFix" @click="previewGroup('shiyu2',0)"></image>
							</view>

						</view>
						<view class="gapBox">
							<view class="tabTitle">
								AI智能硬核支撑
							</view>
							<view class="boxImage">
								<image src="/myPackageA/assets/images/ai1.webp" mode="widthFix" @click="previewGroup('ai1',0)"></image>
								<image src="/myPackageA/assets/images/ai2.webp" mode="widthFix" @click="previewGroup('ai2',0)"></image>
							</view>

						</view>
						<view class="gapBox">
							<view class="tabTitle">
								生态资源
							</view>
							<view class="boxImage">
								<image src="/myPackageA/assets/images/shengtai1.webp" mode="widthFix" @click="previewGroup('shengtai1',0)"></image>
								<image src="/myPackageA/assets/images/shengtai2.webp" mode="widthFix" @click="previewGroup('shengtai2',0)"></image>
							</view>

						</view>
						<view class="gapBox">
							<view class="tabTitle">
								企业荣誉
							</view>
							<view class="destxt">
								-品牌入选"中国金融品牌价值 100 强"候选名单
							</view>
							<view class="destxt"> -获得澳大利亚投资与财务规划师协会（AIOFP）中国地区独家授权资质</view>
							<view class="destxt">-被行业权威机构评为"家庭财事治理标杆机构"</view>
							<view class="destxt">-十年服务零投诉，积累极高市场美誉度，成为客户信赖的财事治理首选品牌</view>
							<view class="boxImage" style="margin-top: 15rpx;">
								<image src="/myPackageA/assets/images/pinpai1.webp" mode="widthFix" @click="previewGroup('pinpai1',0)"></image>
								<image src="/myPackageA/assets/images/pinpai2.webp" mode="widthFix" @click="previewGroup('pinpai2',0)"></image>
							</view>
						</view>
						<view class="gapBox">
							<view class="tabTitle" style="margin-top: 15rpx;">
								合规保障 国际认证
							</view>
							<view class="boxImage">
								<image src="/myPackageA/assets/images/hegui1.webp" mode="widthFix" @click="previewGroup('hegui1',0)"></image>
								<image src="/myPackageA/assets/images/hegui2.webp" mode="widthFix" @click="previewGroup('hegui2',0)"></image>
							</view>

						</view> -->
						<view class="tipTxt">
							—— 已经到底部了 ——
						</view>

					</view>
					<view v-show="current === 1" class="tabcontent">
						<view class="tabTitle">合作模式</view>
						<view class="boxImage">
							<image class="imgItem" v-for="(img, index) in cooperationImages" :key="index" :src="img"
								mode="widthFix" @click="previewGroup(cooperationImages, index,6)" />
						</view>
						<view class="tipTxt">
							—— 已经到底部了 ——
						</view>
					</view>
					<!-- <view v-show="current === 1" class="tabcontent">
						<view class="tabTitle">
							合作模式
						</view>
						<view class="boxImage">
							<image class="imgItem" src="/myPackageA/assets/images/hezuo1.webp" mode="widthFix"
								@click="previewGroup('hezuo1',0)"></image>
							<image class="imgItem" src="/myPackageA/assets/images/hezuo2.webp" mode="widthFix"
								@click="previewGroup('hezuo2',0)"></image>
							<image class="imgItem" src="/myPackageA/assets/images/hezuo3.webp" mode="widthFix"
								@click="previewGroup('hezuo3',0)"></image>
							<image class="imgItem" src="/myPackageA/assets/images/hezuo4.webp" mode="widthFix"
								@click="previewGroup('hezuo4',0)"></image>
							<image class="imgItem" src="/myPackageA/assets/images/hezuo5.webp" mode="widthFix"
								@click="previewGroup('hezuo5',0)"></image>
							<image class="imgItem" src="/myPackageA/assets/images/hezuo6.webp" mode="widthFix"
								@click="previewGroup('hezuo6',0)"></image>
						</view>
						<view class="tipTxt">
							—— 已经到底部了 ——
						</view>
					</view> -->
					<view v-show="current === 2" class="tabcontent">
						<view class="tabTitle">
							关注官微
						</view>
						<view class="qrBox">
							<image src="/myPackageA/assets/images/gongzhonghao.jpg" mode="widthFix"
								style="width:250rpx !important;"></image>
							<view class="description">
								长按识别二维码
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<!-- <view v-if="!isLogin" class="loginTip" @click="sharelogin=true">
			<text style="color: #20269B;">登录</text>之后才能看到名片
		</view> -->
		<uni-popup ref="popup" type="center" background-color="#fff">
			<view class="descriptionBox">
				<view class="popupClose">
					<text class="iconfont icon-guanbi" @click="$refs.popup.close()"></text>

				</view>

				<view class="" v-if="optionType=='shareData'">
					<view class="" v-for="item in staticData" :key="item.name">
						<view class="staticItem">
							<text class="iconfont staticIcon" :class="item.icon"></text>
							{{item.name}}：{{item.value}}{{item.unit}}

						</view>
					</view>

				</view>
				<view class="" v-if="optionType=='focus' || (optionType=='shareCard'&&runEnv=='browser')">
					<view class="codeBox">
						<image v-if="cardInfo.qwQrcode" :src="cardInfo.qwQrcode" mode="widthFix"
							style="width:250rpx !important;"></image>
						<image v-else src="/myPackageA/assets/images/kefu.png" mode="widthFix"
							style="width:250rpx !important;">
						</image>
					</view>
					<view class="description">
						长按识别二维码 保存或分享图片
					</view>
				</view>

			</view>

		</uni-popup>
		<view class="markBox" @click="shareTipsFlag=false" v-if="shareTipsFlag">
			<view class="guideImgBox">
				<image src="../../static/Group132.png" mode="widthFix"></image>
				<view class="tips">
					<view style="margin-bottom:30rpx">请点击右上角菜单</view>
					<view>分享给朋友</view>
				</view>
			</view>
		</view>
		<boot-page loginSource="我的名片" v-if="sharelogin" ref="sharelogin" @close="loginClose()"
			@afterLogin="afterLogin()"></boot-page>
	</view>
</template>

<script>
	import quanqiu1 from '@/myPackageA/assets/images/quanqiu1.webp';
	import quanqiu2 from '@/myPackageA/assets/images/quanqiu2.webp';
	import shiyu1 from '@/myPackageA/assets/images/shiyu1.webp';
	import shiyu2 from '@/myPackageA/assets/images/shiyu2.webp';
	import ai1 from '@/myPackageA/assets/images/ai1.webp';
	import ai2 from '@/myPackageA/assets/images/ai2.webp';
	import shengtai1 from '@/myPackageA/assets/images/shengtai1.webp';
	import shengtai2 from '@/myPackageA/assets/images/shengtai2.webp';
	import pinpai1 from '@/myPackageA/assets/images/pinpai1.webp';
	import pinpai2 from '@/myPackageA/assets/images/pinpai2.webp';
	import hegui1 from '@/myPackageA/assets/images/hegui1.webp';
	import hegui2 from '@/myPackageA/assets/images/hegui2.webp';
	import hezuo1 from '@/myPackageA/assets/images/hezuo1.webp';
	import hezuo2 from '@/myPackageA/assets/images/hezuo2.webp';
	import hezuo5 from '@/myPackageA/assets/images/hezuo5.webp';
	import hezuo3 from '@/myPackageA/assets/images/hezuo3.webp';
	import hezuo4 from '@/myPackageA/assets/images/hezuo4.webp';
	import hezuo6 from '@/myPackageA/assets/images/hezuo6.webp';
	// 新增：图片映射
	const imageMap = {
		quanqiu1,
		quanqiu2,
		shiyu1,
		shiyu2,
		ai1,
		ai2,
		shengtai1,
		shengtai2,
		pinpai1,
		pinpai2,
		hegui1,
		hegui2,
		hezuo1,
		hezuo2,
		hezuo3,
		hezuo4,
		hezuo5,
		hezuo6
	};
	import { initJssdkShare, setWechatShare, hshare } from '@/util/fiveshare';
	import { shareURL, companyInfo } from "@/environments/environment";
	import api from "@/api/api";
	import BootPage from "@/components/bootpage/bootpage.vue";
	import dataHandling from "@/util/dataHandling";
	import customSegmentedControl from '@/components/customSegmentedControl/customSegmentedControl.vue';
	import wx from 'weixin-js-sdk'
	import { previewImages } from '@/util/previewImage.js';

	export default {
		name: 'businessCard',
		components: {
			BootPage,
		},
		data() {
			return {
				visitorUuid: '',
				sharelogin: false, //是否需要登录
				isLogin: true, //登录状态
				shareTipsFlag: false,
				runEnv: dataHandling.getRuntimeEnv(), //运行的环境
				companyType: companyInfo.companyType,
				companyLogo: '../../static/suplogo.png',

				infoList: [
					{ value: '暂无', icon: 'icon-dianhua', id: '1', key: 'phone' },
					{ value: '暂无', icon: 'icon-youxiang', id: '2', key: 'email' },
					{ value: '暂无', icon: 'icon-dingwei', id: '3', key: 'address' },
				],
				items: ["关于我们", "合作模式", "关注官微"],
				current: 0,
				systemInfo: {},
				cardInfo: {}, //名片信息
				isShare: false, //是否通过分享链接进来的
				userId: uni.getStorageSync('cffp_userId'),
				cardId: '',
				staticData: [
					{ name: '总访问人数', value: 0, unit: '人', icon: 'icon-zhongdianrenquntongji', color: '#3639A9' },
					{ name: '总访问量', value: 0, unit: '次', icon: 'icon-zongfangwenliang', color: '#3639A9' },
				],
				optionType: '',
				popupTitle: '',
				tab0List: [{
					title: '品牌简介',
					description1: '银盾家办（Supguard Family Office）由BHL（Budget Holdings Limited)全资控股，来自英国拥有半个世纪的历史。依托BHL亚太区核心平台—Auto&General（A&G）集团专业能力，打造中国首个AI普惠型新家办。它带着国际先进的家庭财事治理经验来到中国，致力于成为中国领先的家事治理与风险管理解决方案供应商，为家庭提供全生命周期的风险管理、财产保值增值以及财富传承规划方案。',
					description2: '银盾家办以“去风险、增确定、传家业”为使命，秉持“纯粹中立、系统赋能、长期陪伴”核心理念，打破传统家办精英壁垒，覆盖中产家庭、中小企业主、高净值家族全客层，银盾家办以千万家庭的“韧性架构师”自居，守护万家灯火，助力家业长青。'

				}],
				
				ImagesPreviewList: [
					[quanqiu1, quanqiu2],
					[shiyu1, shiyu2],
					[ai1, ai2],
					[shengtai1, shengtai2],
					[pinpai1, pinpai2],
					[hegui1, hegui2],
					[hezuo1, hezuo2, hezuo3, hezuo4, hezuo5, hezuo6]
				],
				sectionList: [
				      {
				        title: '全球经验',
				        images: [quanqiu1, quanqiu2]   // 直接使用导入的变量
				      },
				      {
				        title: '十余载本土深耕',
				        images: [shiyu1, shiyu2]
				      },
				      {
				        title: 'AI智能硬核支撑',
				        images: [ai1, ai2]
				      },
				      {
				        title: '生态资源',
				        images: [shengtai1, shengtai2]
				      },
				      {
				        title: '企业荣誉',
				        descriptions: [
				          '-品牌入选"中国金融品牌价值 100 强"候选名单',
				          '-获得澳大利亚投资与财务规划师协会（AIOFP）中国地区独家授权资质',
				          '-被行业权威机构评为"家庭财事治理标杆机构"',
				          '-十年服务零投诉，积累极高市场美誉度，成为客户信赖的财事治理首选品牌'
				        ],
				        images: [pinpai1, pinpai2]
				      },
				      {
				        title: '合规保障 国际认证',
				        images: [hegui1, hegui2]
				      }
				    ],
				    cooperationImages: [hezuo1, hezuo2, hezuo3, hezuo4, hezuo5, hezuo6]
				// cooperationImages: [
				// 	'/myPackageA/assets/images/hezuo1.webp',
				// 	'/myPackageA/assets/images/hezuo2.webp',
				// 	'/myPackageA/assets/images/hezuo3.webp',
				// 	'/myPackageA/assets/images/hezuo4.webp',
				// 	'/myPackageA/assets/images/hezuo5.webp',
				// 	'/myPackageA/assets/images/hezuo6.webp'
				// ],
				// sectionList: [{
				// 		title: '全球经验',
				// 		images: [
				// 			'/myPackageA/assets/images/quanqiu1.webp',
				// 			'/myPackageA/assets/images/quanqiu2.webp'
				// 		]
				// 	},
				// 	{
				// 		title: '十余载本土深耕',
				// 		images: [
				// 			'/myPackageA/assets/images/shiyu1.webp',
				// 			'/myPackageA/assets/images/shiyu2.webp'
				// 		]
				// 	},
				// 	{
				// 		title: 'AI智能硬核支撑',
				// 		images: [
				// 			'/myPackageA/assets/images/ai1.webp',
				// 			'/myPackageA/assets/images/ai2.webp'
				// 		]
				// 	},
				// 	{
				// 		title: '生态资源',
				// 		images: [
				// 			'/myPackageA/assets/images/shengtai1.webp',
				// 			'/myPackageA/assets/images/shengtai2.webp'
				// 		]
				// 	},
				// 	{
				// 		title: '企业荣誉',
				// 		descriptions: [
				// 			'-品牌入选"中国金融品牌价值 100 强"候选名单',
				// 			'-获得澳大利亚投资与财务规划师协会（AIOFP）中国地区独家授权资质',
				// 			'-被行业权威机构评为"家庭财事治理标杆机构"',
				// 			'-十年服务零投诉，积累极高市场美誉度，成为客户信赖的财事治理首选品牌'
				// 		],
				// 		images: [
				// 			'/myPackageA/assets/images/pinpai1.webp',
				// 			'/myPackageA/assets/images/pinpai2.webp'
				// 		]
				// 	},
				// 	{
				// 		title: '合规保障 国际认证',
				// 		images: [
				// 			'/myPackageA/assets/images/hegui1.webp',
				// 			'/myPackageA/assets/images/hegui2.webp'
				// 		]
				// 	}
				// ]
			}
		},
		computed: {
			btnList() {
				if (this.isShare) {
					return [{
							name: '分享名片',
							imgUrl: '/myPackageA/assets/images/share.png',
							id: '1',
							color: '#20269B',
							type: 'shareCard'
						},
						{
							name: '拨打电话',
							imgUrl: '/myPackageA/assets/images/phone.png',
							id: '2',
							color: '#fff',
							phoneNumber: '18918485032',
							type: 'phone'
						},
						{
							name: '关注我',
							imgUrl: '/myPackageA/assets/images/guanzhu.png',
							id: '3',
							color: '#fff',
							type: 'focus'
						},
					]
				} else {
					return [{
							name: '分享名片',
							imgUrl: '/myPackageA/assets/images/share.png',
							id: '1',
							color: '#20269B',
							type: 'shareCard'
						},
						{
							name: '拨打电话',
							imgUrl: '/myPackageA/assets/images/phone.png',
							id: '2',
							color: '#fff',
							phoneNumber: '18918485032',
							type: 'phone'
						},
						{
							name: '关注我',
							imgUrl: '/myPackageA/assets/images/guanzhu.png',
							id: '3',
							color: '#fff',
							type: 'focus'
						},
						{
							name: '分享数据',
							imgUrl: '/myPackageA/assets/images/shareData.png',
							id: '4',
							color: '#fff',
							type: 'shareData'
						},
					]
				}

			}

		},
		onLoad(options) {
			if (options.isShareCard) {
				this.isShare = true
				this.userId = options.userId
				this.cardId = options.cardId

			}
			this.systemInfo = uni.getSystemInfoSync();
			const { platform, deviceType, screenWidth, screenHeight } = this.systemInfo;

		},
		onShow() {
			if (uni.getStorageSync('visitorUuid')) {
				this.visitorUuid = uni.getStorageSync('visitorUuid')
			}
			if (this.companyType == '1') {
				this.companyLogo = '../../static/myteam/Group1633.png';
			} else if (this.companyType == '2') {
				this.companyLogo = '../../static/suplogo.png';
			}

			if (this.isShare) {
				this.businessCradStatic()
				this.getShareCard()
			} else {
				this.getCard()
			}
			// #ifdef H5
			if (dataHandling.h5RuntimeEnv() !== 'miniprogram') {
				initJssdkShare(() => {
					setWechatShare();
				}, window.location.href);
			}

			// #endif
		},
		onUnload() {
			// #ifdef H5
			if (dataHandling.h5RuntimeEnv() !== 'miniprogram') {
				initJssdkShare(() => {
					setWechatShare();
				}, window.location.href);
			}

			// #endif
		},
		methods: {
			previewGroup(images, current, idx) {
				// let urls = this.ImagesPreviewList[idx]
				// console.log('urls', urls);
				// return
				if (!images || images.length === 0) return;
				previewImages(images, current, { indicator: 'number', loop: false });
			},
			// previewGroup(type, current) {
			// 	const urls = imageMap[type];
			// 	if (!urls || urls.length === 0) return;
			// 	previewImages(urls, current, { indicator: 'number', loop: false });
			// },
			// 新增方法：设置真实 meta 并初始化分享
			setRealPageMetaAndShare() {
				
				const data = {
					title: `${this.cardInfo.userName}| ${this.cardInfo.companyInfoList[0].position} - ${this.cardInfo.companyInfoList[0].companyName}`,
					desc: 'AI普惠型新家办领创家庭财事治理蓝海生态',
					link: `${shareURL}/myPackageA/businessCard/businessCard?userId=${this.userId}&cardId=${this.cardId}&isShareCard=1`,
					imgUrl: `${shareURL}/static/suplogo.png`
				};

				// #ifdef H5
				// 分享的时候一定要加这段代码，否则ios首次分享会使用系统默认分享
				//安卓机型获取当前页面路径
				let url = window.location.href.split('#')[0];

				//ios机型获取当前页面路径
				let ua = navigator.userAgent.toLowerCase();
				let isWeixin = ua.indexOf('micromessenger') !== -1;
				if (isWeixin) {
					let isiOS = /(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent); //ios终端
					if (isiOS && window.sessionStorage.getItem('firstEntryUrl')) {
						url = window.sessionStorage.getItem('firstEntryUrl').split('#')[0];
					}
				}
				hshare(data, url);
				// #endif
			},

			handleInfo(item) {
				if (item.key == 'phone') {
					if (item.value) {
						uni.makePhoneCall({
							phoneNumber: item.value.replace(/\s+/g, ''),
							success: () => {
								console.log('拨打电话成功');
							},
							fail: (err) => {

								uni.showToast({
									title: '拨打电话失败',
									icon: 'none'
								});
							}
						});
					} else {
						uni.showToast({
							title: '暂无电话',
							duration: 2000,
							icon: 'none'
						})
					}
				}
			},
			afterLogin() {
				this.sharelogin = false
				this.isLogin = true
				this.getCard()
			},

			// 分享状态下获取名片信息
			getShareCard() {
				api.getShareBusinessCard(
					this.cardId
				).then(res => {
					if (res['success']) {
						this.cardInfo = res.data.data
						this.cardId = res.data.data.id
						// this.infoList[0].value = this.cardInfo.phone || '暂无'
						if (this.cardInfo.phone) {
							this.infoList[0].value = dataHandling.formatPhone(this.cardInfo.phone)
						} else {
							this.infoList[0].value = '暂无'
						}
						this.btnList[1].phoneNumber = this.cardInfo.phone || null
						this.infoList[1].value = this.cardInfo.email || null
						this.infoList[2].value = this.cardInfo.address || '暂无'
						if (dataHandling.h5RuntimeEnv() !== 'miniprogram') {
							this.setRealPageMetaAndShare()
						}
						if (dataHandling.h5RuntimeEnv() == 'wechat-miniprogram') {
							let shareInfo = {
								title: ` ${this.cardInfo.userName}| ${this.cardInfo.companyInfoList[0].position} - ${this.cardInfo.companyInfoList[0].companyName}`,
								desc: '​AI普惠型新家办领创家庭财事治理蓝海生态',
								link: `${shareURL}/pages/lanch/index?userId=${this.userId}&cardId=${this.cardId}&isShareCard=1&landingPage=businessCard&miniShare=1`,
								imgUrl: `${shareURL}/myPackageA/static/images/logo3.png`, //图片
								sharePage: 'businessCard', //分享的哪个页面
								userId: this.userId,
								cardId: this.cardId,
								commonId: this.cardId
							}
							wx.miniProgram.postMessage({
								data: {
									type: 'share',
									shareData: JSON.stringify(shareInfo)
								}

							})
						}
						console.log('cardInfo', this.cardInfo);
					} else {
						uni.showToast({
							title: res['message'],
							duration: 2000,
							icon: 'none'
						})
					}
				})
			},
			// 不是分享状态下获取名片信息
			getCard() {
				api.getBusinessCard(
					this.userId
				).then(res => {
					if (res['success']) {
						this.cardInfo = res.data.data
						this.cardId = res.data.data.id
						// this.cardInfo.avatarUrl = 'https://dev-yindun-store.oss-cn-shanghai-finance-1-pub.aliyuncs.com/dealer/undefined/CCQG38H9-切片 2.png'
						console.log('卡片信息', this.cardInfo);
						// this.infoList[0].value = this.cardInfo.phone || '暂无'
						if (this.cardInfo.phone) {
							this.infoList[0].value = dataHandling.formatPhone(this.cardInfo.phone)
						} else {
							this.infoList[0].value = '暂无'
						}
						this.btnList[1].phoneNumber = this.cardInfo.phone || null
						this.infoList[1].value = this.cardInfo.email || null
						this.infoList[2].value = this.cardInfo.address || '暂无'

						if (dataHandling.h5RuntimeEnv() !== 'miniprogram') {
							this.setRealPageMetaAndShare()

						}
						if (dataHandling.h5RuntimeEnv() == 'wechat-miniprogram') {
							let shareInfo = {
								title: ` ${this.cardInfo.userName}| ${this.cardInfo.companyInfoList[0].position} - ${this.cardInfo.companyInfoList[0].companyName}`,
								desc: '​AI普惠型新家办领创家庭财事治理蓝海生态',
								link: `${shareURL}/pages/lanch/index?userId=${this.userId}&cardId=${this.cardId}&isShareCard=1&landingPage=businessCard&miniShare=1`,
								imgUrl: `${shareURL}/myPackageA/static/images/logo3.png`, //图片
								sharePage: 'businessCard', //分享的哪个页面
								userId: this.userId,
								cardId: this.cardId,
								commonId: this.cardId
							}
							wx.miniProgram.postMessage({
								data: {
									type: 'share',
									shareData: JSON.stringify(shareInfo)
								}

							})
						}
						this.getCardStatic()
					} else {
						uni.showToast({
							title: res['message'],
							duration: 2000,
							icon: 'none'
						})
					}
				})
			},
			// 获取名片统计数据
			getCardStatic() {
				api.getCardStats({ userId: this.userId, cardId: this.cardId }).then(res => {
					if (res['success']) {
						if (res.data.data) {
							this.staticData[0].value = res.data.data.uvNum
							this.staticData[1].value = res.data.data.pvNum
						}

					} else {
						uni.showToast({
							title: res['message'],
							duration: 2000,
							icon: 'none'
						})
					}
				})
			},
			// 统计名片查看次数
			businessCradStatic() {
				api.statusBusinessCard({ visitorUuid: this.visitorUuid, cardId: this.cardId }).then(res => {
					if (res['success']) {


					} else {
						uni.showToast({
							title: res['message'],
							duration: 2000,
							icon: 'none'
						})
					}
				})
			},
			onClickItem(index) {
				if (this.current !== index) {
					this.current = index;

				}
			},
			// 按钮点击事件
			handleBtnClick(item) {
				// // 拨打电话按钮
				if (item.id === '2') {
					if (item.phoneNumber) {
						uni.makePhoneCall({
							phoneNumber: item.phoneNumber.replace(/\s+/g, ''),
							success: () => {
								console.log('拨打电话成功');
							},
							fail: (err) => {

								uni.showToast({
									title: '拨打电话失败',
									icon: 'none'
								});
							}
						});
					} else {
						uni.showToast({
							title: '暂无电话',
							duration: 2000,
							icon: 'none'
						})
					}


				} else {
					// 其他按钮的处理逻辑
					if (item.type !== 'shareCard' || (item.type == 'shareCard' && this.runEnv == 'browser')) {
						this.optionType = item.type
						this.popupTitle = item.name
						this.$refs.popup.open()
						return
					}
					if (dataHandling.h5RuntimeEnv() !== 'wechat-miniprogram') {
						this.setRealPageMetaAndShare()
					}
					// 如果是移动端
					this.shareTipsFlag = true; //提示用户点击小程序的右上角胶囊进行分享
					if (dataHandling.h5RuntimeEnv() == 'wechat-miniprogram') {
						let shareInfo = {
							title: ` ${this.cardInfo.userName}| ${this.cardInfo.companyInfoList[0].position} - ${this.cardInfo.companyInfoList[0].companyName}`,
							desc: '​AI普惠型新家办领创家庭财事治理蓝海生态',
							link: `${shareURL}/pages/lanch/index?userId=${this.userId}&cardId=${this.cardId}&isShareCard=1&landingPage=businessCard&miniShare=1`,
							// link: `${shareURL}/myPackageA/businessCard/businessCard?userId=${this.userId}&cardId=${this.cardId}&isShareCard=1`, //分享链接
							imgUrl: `${shareURL}/myPackageA/static/images/logo3.png`, //图片
							sharePage: 'businessCard', //分享的哪个页面
							userId: this.userId,
							cardId: this.cardId,
							commonId: this.userId
						}
						wx.miniProgram.postMessage({
							data: {
								type: 'share',
								shareData: JSON.stringify(shareInfo)
							}

						})
					}
				}
			},
			//关闭登录
			loginClose(val, loginTypeSync, type) {
				// 直接点击了关闭登录的叉号
				if (type) {
					this.sharelogin = false
					this.isLogin = false
					return
				}
				if (val) {
					this.sharelogin = false

				} else {
					this.sharelogin = false
				}

			},
		},


	}
</script>

<style lang="scss" scoped>
	.container {
		position: relative;
		background-color: rgba(235, 239, 247, 1);
		display: flex;
		flex-direction: column;
		width: 100%;
		height: auto;
		box-sizing: border-box;
		padding: 20rpx;

		.insTxt {
			padding: 0rpx 6rpx;
		}

		.gapBox {
			margin-bottom: 10rpx;
			letter-spacing: 3rpx;
		}

		.boxImage {
			display: flex;
			flex-direction: column;
			width: 100%;
			box-sizing: border-box;
			font-size: 0;
			margin: 0;
			padding: 0;

			image {
				display: block;
				/* 将图像转为块级元素以去除底部空白 */
				width: 100%;
				/* 确保图像宽度适应容器 */

				margin-top: -1rpx;
			}
		}

		.tipTxt {
			width: 100%;
			font-size: 24rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			color: #585858;
			margin-top: 20rpx;
		}

		.loginTip {
			width: 100%;
			height: 50vh;
			font-size: 30rpx;
			display: flex;
			justify-content: center;
			align-items: center;
		}

		.cardHeader {
			box-sizing: border-box;
			border-radius: 20rpx;
			background-color: #fff;

			.introduct {
				box-sizing: border-box;
				background-image: url('/myPackageA/assets/images/cardBg.webp');
				background-repeat: no-repeat;
				background-position: center center;
				background-size: cover;
				padding: 30rpx 20rpx 20rpx 20rpx;
				width: 100%;
				border-radius: 20rpx;

				.introductTitle {
					background-image: url('/myPackageA/assets/images/cardTit.png');
					background-repeat: no-repeat;
					background-position: left center;
					background-size: contain;
					height: 40rpx;
					width: 100%;
					margin-bottom: 10rpx;
				}

				.introductHeader {
					display: flex;
					align-items: center;
					width: 100%;
					box-sizing: border-box;
					margin-bottom: 20rpx;

					.left {
						flex: 1;
						display: flex;
						align-items: center;
						justify-content: center;
						position: relative;

						/* 装饰性背景（白边盾牌）*/
						.shield-bg {
							position: absolute;
							width: 100rpx;
							height: 120rpx;
							background-image: url('/myPackageA/assets/images/touBg4.png');
							background-size: contain;
							background-repeat: no-repeat;
							background-position: center;
							z-index: 1;
						}

						.avatar {
							// margin-top: -5rpx;
							flex-grow: 0;
							width: 100rpx;
							height: 100rpx;
							overflow: hidden;
							// background-image:  url('@/static/images/banner.png');
							// margin-right: 15rpx;
							/* 背景图设置 */
							background-size: cover;
							background-position: center;
							background-repeat: no-repeat;
							/* 添加以下属性强制硬件加速 */
							transform: translateZ(0);
							-webkit-transform: translateZ(0);
							backface-visibility: hidden;
							-webkit-backface-visibility: hidden;
							/* 关键：使用实心 mask */
							-webkit-mask: url('/myPackageA/assets/images/touBg4.png') no-repeat center;
							mask: url('/myPackageA/assets/images/touBg4.png') no-repeat center;
							-webkit-mask-size: contain;
							mask-size: contain;
							z-index: 2;
						}

					}

					.icon-shield {
						font-size: 150rpx;
						color: #fff;
					}

					.right {
						width: 100%;
						margin-left: 10rpx;
						box-sizing: border-box;
						color: #383838;
						display: flex;
						flex-direction: column;

						.top {
							width: 100%;
							font-size: 42rpx;
							font-weight: 700;
							margin-bottom: 10rpx;

						}

						.bottom {
							width: 100%;
							font-size: 24rpx;

							.bottomCon {
								box-sizing: border-box;
								width: 100%;
								display: flex;
								justify-content: space-between;

								.bottomL {
									width: 440rpx;
									overflow-wrap: break-word;
									word-break: break-word;
									/* 更兼容的写法 */
									white-space: normal;

								}
							}

						}
					}
				}

				.introductContent {
					width: 100%;
					box-sizing: border-box;

					.infoCon {
						width: 100%;
						display: flex;
						margin-bottom: 6rpx;
						color: #383838;


						.infoIcon {
							margin-right: 15rpx;
							background-color: #CE0E2D;
							border-radius: 50%;
							padding: 5rpx;
							color: #fff;
							height: 30rpx;
							width: 30rpx;
							display: flex;
							align-items: center;
							justify-content: center;
							font-size: 23rpx;

						}

						.infoTxt {
							font-size: 26rpx;

						}
					}
				}

			}

			.optionBtn {
				width: 100%;
				box-sizing: border-box;
				display: flex;
				justify-content: space-between;
				padding: 20rpx 30rpx;

				.btnCon {
					display: flex;
					flex-direction: column;
					align-items: center;
					justify-content: center;

					.optionIcon {
						width: 100%;
						margin-bottom: 10rpx;

					}

					.btnTxt {
						font-size: 26rpx;
					}
				}

			}
		}

		.descriptionBox {
			width: 510rpx;
			padding: 40rpx;

			.popupTit {
				display: flex;
				align-items: center;
				justify-content: center;
				font-size: 30rpx;
				font-weight: 500;
				margin-bottom: 10rpx;
			}

			.popupClose {
				display: flex;
				align-items: center;
				justify-content: flex-end;

				.icon-guanbi {
					font-size: 28rpx;

				}
			}

			.staticItem {
				font-size: 28rpx;
				margin-bottom: 10rpx;

				.staticIcon {
					font-size: 30rpx;
					color: #CE0E2D;
					margin-right: 5rpx;
				}
			}

			.imageBox {
				display: flex;
				align-items: center;
				justify-content: center;
				flex-direction: column;
				font-size: 32rpx;
				font-weight: 600;

				.subTit {
					font-size: 28rpx;
					color: #919094;
					margin: 15rpx 0;
					font-weight: 400;
				}
			}

			.codeBox {
				display: flex;
				align-items: center;
				justify-content: center;
				height: 250rpx;
			}


		}

		.description {
			color: rgba(56, 56, 56, 1);
			font-size: 28rpx;
			display: flex;
			align-items: center;
			justify-content: center;
		}

		.markBox {
			position: fixed;
			left: 0;
			top: 0;
			bottom: 0;
			right: 0;
			width: 100%;
			height: 100%;
			color: #fff;
			display: flex;
			justify-content: flex-end;
			z-index: 100000;
			background: rgba(0, 0, 0, 0.8);

			.guideImgBox {
				margin: 20px auto;

				uni-image {
					width: 25% !important;
					position: absolute;
					right: 0;
					top: 0;
				}
			}

			.tips {
				margin-top: 30%;
				padding: 0 30px;
			}
		}

		.tabcontent {
			background-color: #fff;
			padding: 20rpx;
			border-radius: 10rpx;
			margin-top: 20rpx;
			font-size: 28rpx;
			box-sizing: border-box;

			.qrBox {
				width: 100%;

				display: flex;
				align-items: center;
				justify-content: center;
				font-size: 28rpx;
				flex-direction: column;

			}

			.tabTitle {
				margin-bottom: 20rpx;
				font-size: 30rpx;
				font-weight: 500;
				position: relative;
				display: inline-block;
			}

			.tabTitle::before {
				content: '';
				position: absolute;
				left: 0;
				bottom: 5rpx;
				height: 10rpx;
				width: 100%;
				background: linear-gradient(to right,
						#CE0E2D,
						#fff);
				z-index: 0;
				opacity: .3;
				border-radius: 3rpx;
			}

			.videoBox {
				margin-top: 20rpx;
			}

			.destxt {
				margin-bottom: 10rpx;
			}

		}
	}

	::v-deep .my-segmented-control .segmented-control__item .uni-segmented-control__text {
		font-size: 30rpx !important;
	}
</style>