card.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977
  1. <template>
  2. <view class="card-container">
  3. <!-- 顶部背景 -->
  4. <image class="top-bg" src="/static/image/home/top-bg.png" />
  5. <NavBar title="我的名片" color="#FFFFFF" :fixed="true" :bg="'transparent'"></NavBar>
  6. <!-- 名片卡片 -->
  7. <view class="page-top">
  8. <view class="user-card" id="user-card">
  9. <!-- 背景图 -->
  10. <image class="user-card-bg" src="/static/image/home/usecard-bg.png" />
  11. <!-- 左上:姓名 + 职位 -->
  12. <view class="user-header">
  13. <view class="name-row">
  14. <text class="user-name">{{ cardInfo.nickName || '用户' }}</text>
  15. <text class="user-role">{{ cardInfo.postName || '职位' }}</text>
  16. </view>
  17. <text class="company-name">{{ cardInfo.companyName || '公司名称' }}</text>
  18. </view>
  19. <!-- 右上:头像 -->
  20. <view class="avatar-wrapper">
  21. <UserAvatar :src="cardInfo.avatar" :name="cardInfo.nickName" :size="130" :badge-src="'/static/image/public/badge-icon.png'" :badge-size="56" />
  22. </view>
  23. <!-- 左下:联系方式 -->
  24. <view class="user-contact">
  25. <view class="contact-row" @click="makeCall">
  26. <uni-icons type="phone" :size="18" color="#666666"></uni-icons>
  27. <text class="contact-text">{{ cardInfo.phonenumber || '暂无电话' }}</text>
  28. </view>
  29. <view class="contact-row">
  30. <uni-icons type="email" :size="18" color="#666666"></uni-icons>
  31. <text class="contact-text">{{ cardInfo.email || '暂无邮箱' }}</text>
  32. </view>
  33. <view class="contact-row">
  34. <uni-icons type="location" :size="18" color="#666666"></uni-icons>
  35. <text class="contact-text">{{ cardInfo.companyAddress || '暂无地址' }}</text>
  36. </view>
  37. </view>
  38. </view>
  39. <view class="control-card">
  40. <view class="item" @click="shareUserCard">
  41. <image src="/static/image/public/card-sharing.png"></image>
  42. <text class="text">分享名片</text>
  43. </view>
  44. <view class="item" @click="saveCard">
  45. <image src="/static/image/public/card-save.png"></image>
  46. <text class="text">保存名片</text>
  47. </view>
  48. <view class="item" @click="showQRCode">
  49. <image src="/static/image/public/card-qr.png"></image>
  50. <text class="text">名片码</text>
  51. </view>
  52. </view>
  53. </view>
  54. <view class="card-content">
  55. <!-- Tab 切换 -->
  56. <view class="tab-section">
  57. <view class="tab-wrapper">
  58. <!-- <view class="tab-item" :class="{ active: currentTab === 'products' }"
  59. @click="switchTab('products')">
  60. <text class="tab-text">产品列表</text>
  61. <view class="tab-indicator" v-if="currentTab === 'products'"></view>
  62. </view> -->
  63. <!-- <view class="tab-item" :class="{ active: currentTab === 'company' }" @click="switchTab('company')">
  64. <text class="tab-text">企业简介</text>
  65. <view class="tab-indicator" v-if="currentTab === 'company'"></view>
  66. </view> -->
  67. </view>
  68. </view>
  69. <!-- 产品列表 -->
  70. <view class="product-list" v-if="currentTab === 'products'">
  71. <EmptyState
  72. v-if="productList.length === 0"
  73. text="暂无产品"
  74. sub-text="还没有添加产品信息"
  75. icon="gift"
  76. />
  77. <view class="product-item" v-for="(item, index) in productList" :key="index">
  78. <image class="product-image" :src="item.image" mode="aspectFill" />
  79. <view class="product-info">
  80. <text class="product-title">{{ item.title }}</text>
  81. <text class="product-desc">{{ item.description }}</text>
  82. </view>
  83. </view>
  84. </view>
  85. <!-- 企业简介 -->
  86. <view class="company-section" v-if="currentTab === 'company'">
  87. <view class="company-content">
  88. <rich-text class="company-text" :nodes="companyInfo.introduce"></rich-text>
  89. </view>
  90. </view>
  91. </view>
  92. <!-- 隐藏的 Canvas 用于生成名片快照 -->
  93. <canvas id="posterCanvas" type="2d"
  94. style="position: fixed; left: -9999px; top: -9999px; width: 750px; height: 900px;"></canvas>
  95. <!-- 隐藏的 Canvas 用于生成二维码海报 -->
  96. <view class="hidden-canvas-box">
  97. <canvas id="qrPosterCanvas" type="2d" style="width: 600px; height: 700px;"></canvas>
  98. </view>
  99. <!-- 名片分享弹窗 -->
  100. <uni-popup ref="cardPopup" type="center">
  101. <view class="card-popup">
  102. <!-- 顶部装饰条 -->
  103. <view class="popup-decor">
  104. <view class="decor-line"></view>
  105. </view>
  106. <!-- 标题 -->
  107. <view class="popup-title-box">
  108. <text class="popup-title">我的名片</text>
  109. <text class="popup-desc">分享给朋友或保存到相册</text>
  110. </view>
  111. <!-- 名片卡片 -->
  112. <view class="card-box">
  113. <view class="user-card">
  114. <!-- 背景图 -->
  115. <image class="user-card-bg" src="/static/image/home/usecard-bg.png" mode="aspectFill" />
  116. <!-- 左上:姓名 + 职位 -->
  117. <view class="user-header">
  118. <view class="name-row">
  119. <text class="user-name">{{ cardInfo.nickName || '用户' }}</text>
  120. <text class="user-role">{{ cardInfo.postName || '职位' }}</text>
  121. </view>
  122. <text class="company-name">{{ cardInfo.companyName || '公司名称' }}</text>
  123. </view>
  124. <!-- 右上:头像 -->
  125. <view class="user-avatar-box">
  126. <UserAvatar :src="cardInfo.avatar" :name="cardInfo.nickName" :size="120" :badge-src="'/static/image/public/badge-icon.png'" :badge-size="50" />
  127. </view>
  128. <!-- 左下:联系方式 -->
  129. <view class="user-contact">
  130. <view class="contact-row" @click="makeCall">
  131. <view class="contact-icon">
  132. <uni-icons type="phone" :size="16" color="#4080FF"></uni-icons>
  133. </view>
  134. <text class="contact-text">{{ cardInfo.phonenumber || '暂无电话' }}</text>
  135. </view>
  136. <view class="contact-row">
  137. <view class="contact-icon">
  138. <uni-icons type="email" :size="16" color="#4080FF"></uni-icons>
  139. </view>
  140. <text class="contact-text">{{ cardInfo.email || '暂无邮箱' }}</text>
  141. </view>
  142. <view class="contact-row">
  143. <view class="contact-icon">
  144. <uni-icons type="location" :size="16" color="#4080FF"></uni-icons>
  145. </view>
  146. <text class="contact-text">{{ cardInfo.companyAddress || '暂无地址' }}</text>
  147. </view>
  148. </view>
  149. <!-- 名片底部二维码 -->
  150. <view class="card-qr-section">
  151. <view class="qr-divider"></view>
  152. <view class="qr-wrapper">
  153. <view class="qr-icon-area">
  154. <image
  155. v-if="qrInfo && qrInfo.image"
  156. :src="(qrInfo.image || '').startsWith('data:') ? qrInfo.image : 'data:image/png;base64,' + qrInfo.image"
  157. class="qr-code-img"
  158. mode="aspectFit"
  159. />
  160. <view v-else class="qr-placeholder">
  161. <text class="qr-placeholder-text">名片码</text>
  162. </view>
  163. </view>
  164. <text class="qr-hint">扫一扫查看我的名片</text>
  165. </view>
  166. </view>
  167. </view>
  168. </view>
  169. <!-- 操作按钮 -->
  170. <view class="popup-btns">
  171. <view class="btn btn-cancel" @click="closeCardPopup">
  172. <text class="btn-text">取消</text>
  173. </view>
  174. <view class="btn btn-confirm" @click="shareCardConfirm">
  175. <text class="btn-text">分享名片</text>
  176. </view>
  177. </view>
  178. <!-- 底部全宽按钮 -->
  179. <view class="popup-footer">
  180. <view class="btn btn-full" @click="shareCardConfirm">
  181. <uni-icons type="paperplane" size="22" color="#ffffff"></uni-icons>
  182. <text class="btn-text">立即分享名片给朋友</text>
  183. </view>
  184. </view>
  185. </view>
  186. </uni-popup>
  187. <!-- 二维码弹窗 -->
  188. <uni-popup ref="qrPopup" type="center">
  189. <view class="qr-popup">
  190. <view class="qr-header">
  191. <text class="qr-title">名片二维码</text>
  192. <text class="qr-subtitle">扫一扫查看我的名片信息</text>
  193. </view>
  194. <view class="qr-content">
  195. <image v-if="qrInfo && qrInfo.image"
  196. :src="qrInfo.image.startsWith('data:') ? qrInfo.image : 'data:image/png;base64,' + qrInfo.image"
  197. class="qr-image" mode="aspectFit" />
  198. <view v-else class="qr-loading">
  199. <text>加载中...</text>
  200. </view>
  201. </view>
  202. <view class="qr-actions">
  203. <view class="action-btn" @click="saveQRCode">
  204. <uni-icons type="download" size="24" color="#4080FF"></uni-icons>
  205. <text class="action-text">保存到相册</text>
  206. </view>
  207. <view class="action-btn" @click="handleShare">
  208. <uni-icons type="paperplane" size="24" color="#4080FF"></uni-icons>
  209. <!-- <button open-type="share" class="action-text">分享给好友</button> -->
  210. <text class="action-text">分享给好友</text>
  211. </view>
  212. </view>
  213. </view>
  214. </uni-popup>
  215. </view>
  216. </template>
  217. <script setup>
  218. import {
  219. ref,
  220. onMounted
  221. } from 'vue'
  222. import {
  223. onShareAppMessage
  224. } from '@dcloudio/uni-app';
  225. import NavBar from '@/components/nav-bar/index.vue'
  226. import UserAvatar from '@/components/user-avatar/index.vue'
  227. import EmptyState from '@/components/empty-state/index.vue'
  228. import {
  229. useUserStore
  230. } from '@/store/modules/user.js'
  231. import {
  232. storeToRefs
  233. } from 'pinia'
  234. import {
  235. generateCardPoster,
  236. savePosterToAlbum,
  237. } from '@/utils/poster.js'
  238. // 使用 Pinia 管理用户状态
  239. const userStore = useUserStore()
  240. const {
  241. cardInfo,
  242. companyInfo,
  243. qrInfo,
  244. } = storeToRefs(userStore)
  245. const currentTab = ref('company')
  246. // 名片快照图片路径
  247. const cardSnapshot = ref('')
  248. // 二维码海报图片路径
  249. const qrCodePoster = ref('')
  250. // 二维码弹窗引用
  251. const qrPopup = ref(null)
  252. const cardPopup = ref(null)
  253. const productList = ref([])
  254. onShareAppMessage(() => {
  255. return {
  256. userName: '小程序',
  257. path: 'pages/splash/splash?userId=' + cardInfo.value.userId,
  258. };
  259. });
  260. onMounted(async () => {
  261. // 如果没有数据,重新获取
  262. if (!cardInfo.value.nickName) {
  263. await userStore.queryCardInfo()
  264. }
  265. if (!companyInfo.value.name) {
  266. await userStore.queryCompanyInfo()
  267. }
  268. // 预加载名片二维码,确保分享弹窗底部显示名片码
  269. if (!qrInfo.value || !qrInfo.value.image) {
  270. await userStore.queryCardQrcode()
  271. }
  272. })
  273. const makeCall = () => {
  274. if (cardInfo.value.phonenumber) {
  275. uni.makePhoneCall({
  276. phoneNumber: cardInfo.value.phonenumber
  277. })
  278. } else {
  279. uni.showToast({
  280. title: '暂无电话号码',
  281. icon: 'none'
  282. })
  283. }
  284. }
  285. // 生成名片快照并保存
  286. const saveCard = async () => {
  287. uni.showLoading({
  288. title: '生成快照中...',
  289. mask: true
  290. })
  291. try {
  292. // 确保二维码已加载
  293. if (!qrInfo.value || !qrInfo.value.image) {
  294. await userStore.queryCardQrcode()
  295. }
  296. // 生成名片快照
  297. const snapshotPath = await generateCardPoster(cardInfo.value, qrInfo.value)
  298. console.log(snapshotPath, "snapshotPathsnapshotPathsnapshotPath");
  299. // 用属性接收快照路径
  300. cardSnapshot.value = snapshotPath
  301. console.log('名片快照路径:', cardSnapshot.value)
  302. // 保存到相册
  303. await savePosterToAlbum(snapshotPath)
  304. uni.hideLoading()
  305. uni.showToast({
  306. title: '已保存到相册',
  307. icon: 'success'
  308. })
  309. } catch (error) {
  310. console.error('保存失败:', error)
  311. uni.hideLoading()
  312. uni.showToast({
  313. title: '保存失败,请重试',
  314. icon: 'none'
  315. })
  316. }
  317. }
  318. // 显示二维码
  319. const showQRCode = async () => {
  320. // 打开弹窗
  321. qrPopup.value.open()
  322. }
  323. const close = async () => {
  324. cardPopup.value.close()
  325. }
  326. const shareUserCard = async () => {
  327. uni.showLoading({
  328. title: '生成分享图片...',
  329. mask: true
  330. })
  331. try {
  332. // 确保二维码已加载
  333. if (!qrInfo.value || !qrInfo.value.image) {
  334. await userStore.queryCardQrcode()
  335. }
  336. const snapshotPath = await generateCardPoster(cardInfo.value, qrInfo.value)
  337. uni.hideLoading()
  338. wx.showShareImageMenu({
  339. path: snapshotPath,
  340. entrancePath:'pages/splash/splash?userId=' + cardInfo.value.userId,
  341. success: () => {
  342. console.log('分享菜单已调起');
  343. },
  344. fail: (err) => {
  345. console.error('调起分享菜单失败', err);
  346. }
  347. });
  348. } catch (error) {
  349. console.error('分享失败:', error)
  350. uni.hideLoading()
  351. uni.showToast({
  352. title: '分享失败,请重试',
  353. icon: 'none'
  354. })
  355. }
  356. }
  357. const base64ToImage = async (base64Data) => {
  358. return new Promise((resolve, reject) => {
  359. try {
  360. const filePath = `${wx.env.USER_DATA_PATH}/temp_image.png`;
  361. let pureBase64Data = base64Data
  362. if (pureBase64Data.startsWith('data:image')) {
  363. pureBase64Data = pureBase64Data.replace(/^data:image\/\w+;base64,/, '');
  364. }
  365. const fs = wx.getFileSystemManager();
  366. fs.writeFile({
  367. filePath: filePath,
  368. data: pureBase64Data,
  369. encoding: 'base64',
  370. success: (res) => {
  371. console.log("resresweresresresres", res);
  372. resolve(filePath)
  373. },
  374. fail: (err) => {
  375. console.error('写入临时文件失败', err);
  376. }
  377. });
  378. } catch (error) {
  379. console.error('base64 转换异常:', error)
  380. reject(error)
  381. }
  382. })
  383. }
  384. const handleShare = async () => {
  385. const qrFilePath = await base64ToTempFile(qrInfo.value.image)
  386. wx.showShareImageMenu({
  387. path: qrFilePath,
  388. entrancePath:'pages/splash/splash?userId=' + cardInfo.value.userId,
  389. success: () => {
  390. console.log('分享菜单已调起');
  391. },
  392. fail: (err) => {
  393. console.error('调起分享菜单失败', err);
  394. }
  395. });
  396. }
  397. // 保存二维码到相册
  398. const saveQRCode = async () => {
  399. if (!qrInfo.value.image) {
  400. uni.showToast({
  401. title: '二维码图片不存在',
  402. icon: 'none'
  403. })
  404. return
  405. }
  406. try {
  407. // 将 base64 转换为临时文件
  408. const qrFilePath = await base64ToTempFile(qrInfo.value.image)
  409. // 保存到相册
  410. await savePosterToAlbum(qrFilePath)
  411. uni.showToast({
  412. title: '已保存到相册',
  413. icon: 'success'
  414. })
  415. } catch (error) {
  416. console.error('保存失败:', error)
  417. uni.showToast({
  418. title: '保存失败,请重试',
  419. icon: 'none'
  420. })
  421. }
  422. }
  423. const switchTab = (tab) => {
  424. currentTab.value = tab
  425. }
  426. // 将 base64 转换为临时文件路径
  427. const base64ToTempFile = async (base64Data) => {
  428. return new Promise((resolve, reject) => {
  429. try {
  430. // 移除 data:image/png;base64, 前缀(如果有)
  431. const pureBase64 = base64Data.replace(/^data:image\/\w+;base64,/, '')
  432. const fileName = `${Date.now()}_qrcode.png`
  433. const filePath = `${wx.env.USER_DATA_PATH}/${fileName}`
  434. const fs = uni.getFileSystemManager()
  435. fs.writeFile({
  436. filePath: filePath,
  437. data: pureBase64,
  438. encoding: 'base64',
  439. success: () => {
  440. console.log('base64 转文件成功:', filePath)
  441. resolve(filePath)
  442. },
  443. fail: (err) => {
  444. console.error('base64 转文件失败:', err)
  445. reject(err)
  446. }
  447. })
  448. } catch (error) {
  449. console.error('base64 转换异常:', error)
  450. reject(error)
  451. }
  452. })
  453. }
  454. </script>
  455. <style lang="scss" scoped>
  456. .card-container {
  457. background: #f5f6f8;
  458. }
  459. .top-bg {
  460. width: 750rpx;
  461. height: 634rpx;
  462. position: fixed;
  463. top: 0;
  464. left: 0;
  465. z-index: 1;
  466. }
  467. // 顶部背景区域
  468. .header-bg {
  469. background: linear-gradient(135deg, #4A90E2 0%, #6FB3F2 50%, #87CEEB 100%);
  470. padding: 0 40rpx;
  471. padding-top: calc(var(--status-bar-height) + 20rpx);
  472. padding-bottom: 60rpx;
  473. position: relative;
  474. overflow: hidden;
  475. // 背景光效
  476. &::before {
  477. content: '';
  478. position: absolute;
  479. top: -100rpx;
  480. right: -100rpx;
  481. width: 500rpx;
  482. height: 500rpx;
  483. background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
  484. border-radius: 50%;
  485. }
  486. // 导航栏
  487. .nav-bar {
  488. display: flex;
  489. align-items: center;
  490. justify-content: space-between;
  491. height: 88rpx;
  492. position: relative;
  493. z-index: 10;
  494. .nav-back {
  495. width: 60rpx;
  496. height: 60rpx;
  497. display: flex;
  498. align-items: center;
  499. justify-content: center;
  500. }
  501. .nav-title {
  502. font-size: 32rpx;
  503. font-weight: 600;
  504. color: #ffffff;
  505. text-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
  506. }
  507. .nav-right {
  508. display: flex;
  509. align-items: center;
  510. .more-btn,
  511. .refresh-btn {
  512. width: 64rpx;
  513. height: 64rpx;
  514. border-radius: 50%;
  515. background: rgba(255, 255, 255, 0.15);
  516. display: flex;
  517. align-items: center;
  518. justify-content: center;
  519. margin-left: 16rpx;
  520. }
  521. }
  522. }
  523. }
  524. .user-card {
  525. position: relative;
  526. z-index: 2;
  527. width: 100%;
  528. height: 400rpx;
  529. box-sizing: border-box;
  530. padding: 80rpx 40rpx 32rpx;
  531. position: relative;
  532. .user-card-bg {
  533. position: absolute;
  534. top: 0;
  535. left: 0;
  536. width: 100%;
  537. height: 100%;
  538. z-index: 0;
  539. }
  540. view,
  541. text {
  542. position: relative;
  543. z-index: 1;
  544. }
  545. .user-header {
  546. .name-row {
  547. display: flex;
  548. align-items: center;
  549. margin-bottom: 16rpx;
  550. .user-name {
  551. font-size: 44rpx;
  552. font-weight: 700;
  553. color: #202020;
  554. line-height: 1.2;
  555. }
  556. .user-role {
  557. margin-left: 16rpx;
  558. padding: 6rpx 16rpx;
  559. background: rgba(68, 110, 255, 0.10);
  560. border-radius: 8rpx;
  561. font-size: 24rpx;
  562. font-weight: 500;
  563. color: #446eff;
  564. }
  565. }
  566. .company-name {
  567. font-size: 28rpx;
  568. font-weight: 500;
  569. color: #666666;
  570. line-height: 1.4;
  571. }
  572. }
  573. .avatar-wrapper {
  574. position: absolute;
  575. top: 32rpx;
  576. right: 36rpx;
  577. z-index: 2;
  578. }
  579. .user-contact {
  580. margin-top: 32rpx;
  581. .contact-row {
  582. display: flex;
  583. align-items: center;
  584. margin-bottom: 16rpx;
  585. uni-icons {
  586. margin-right: 12rpx;
  587. flex-shrink: 0;
  588. }
  589. .contact-text {
  590. font-size: 26rpx;
  591. color: #666666;
  592. }
  593. }
  594. }
  595. }
  596. /* 用户信息卡片 */
  597. .page-top {
  598. margin: 0 24rpx 24rpx;
  599. .control-card {
  600. background-color: #fff;
  601. border-radius: 0 0 24rpx 24rpx;
  602. position: relative;
  603. z-index: 1;
  604. bottom: 24rpx;
  605. display: flex;
  606. align-items: center;
  607. justify-content: space-around;
  608. padding-top: 48rpx;
  609. padding-bottom: 24rpx;
  610. .item {
  611. display: flex;
  612. flex-direction: column;
  613. align-items: center;
  614. justify-content: center;
  615. gap: 4rpx;
  616. image {
  617. width: 64rpx;
  618. height: 64rpx;
  619. }
  620. .text {
  621. font-size: 26rpx !important;
  622. color: #202020;
  623. }
  624. }
  625. }
  626. }
  627. // 名片内容区域
  628. .card-content {
  629. margin: 0 24rpx;
  630. padding: 0 24rpx;
  631. border-radius: 24rpx;
  632. background: #ffffff;
  633. box-shadow: 0 -2rpx 12rpx rgba(0, 0, 0, 0.04);
  634. position: relative;
  635. bottom: 24rpx;
  636. z-index: 2;
  637. }
  638. // Tab 切换区域
  639. .tab-section {
  640. border-radius: 24rpx 24rpx 0 0;
  641. padding: 0 40rpx;
  642. .tab-wrapper {
  643. display: flex;
  644. border-bottom: 1rpx solid #f0f0f0;
  645. .tab-item {
  646. flex: 1;
  647. display: flex;
  648. flex-direction: column;
  649. align-items: center;
  650. padding: 32rpx 0;
  651. position: relative;
  652. .tab-text {
  653. font-size: 28rpx;
  654. color: #999999;
  655. font-weight: 500;
  656. }
  657. &.active .tab-text {
  658. color: #333333;
  659. font-weight: 600;
  660. }
  661. .tab-indicator {
  662. position: absolute;
  663. bottom: 0;
  664. width: 60rpx;
  665. height: 4rpx;
  666. background: linear-gradient(90deg, #4A90E2 0%, #6FB3F2 100%);
  667. border-radius: 2rpx;
  668. }
  669. }
  670. }
  671. }
  672. // 产品列表
  673. .product-list {
  674. padding: 24rpx 40rpx;
  675. .product-item {
  676. display: flex;
  677. padding: 24rpx 0;
  678. border-bottom: 1rpx solid #f0f0f0;
  679. &:last-child {
  680. border-bottom: none;
  681. }
  682. .product-image {
  683. width: 160rpx;
  684. height: 160rpx;
  685. border-radius: 12rpx;
  686. background: #f5f5f5;
  687. flex-shrink: 0;
  688. margin-right: 24rpx;
  689. }
  690. .product-info {
  691. flex: 1;
  692. display: flex;
  693. flex-direction: column;
  694. justify-content: center;
  695. .product-title {
  696. font-size: 28rpx;
  697. color: #333333;
  698. margin-bottom: 12rpx;
  699. line-height: 1.5;
  700. }
  701. .product-desc {
  702. font-size: 24rpx;
  703. color: #999999;
  704. }
  705. }
  706. }
  707. }
  708. // 企业简介
  709. .company-section {
  710. background: #ffffff;
  711. padding: 40rpx;
  712. .company-content {
  713. .company-text {
  714. display: block;
  715. font-size: 28rpx;
  716. color: #666666;
  717. line-height: 1.8;
  718. margin-bottom: 24rpx;
  719. ::v-deep img {
  720. max-width: 100% !important;
  721. height: auto !important;
  722. }
  723. &:last-child {
  724. margin-bottom: 0;
  725. }
  726. }
  727. }
  728. }
  729. // 隐藏的 canvas 容器
  730. .hidden-canvas-box {
  731. position: fixed;
  732. left: -9999px;
  733. top: -9999px;
  734. width: 1px;
  735. height: 1px;
  736. overflow: hidden;
  737. }
  738. // 二维码弹窗样式
  739. .qr-popup {
  740. margin: 100rpx auto;
  741. width: 600rpx;
  742. background: #ffffff;
  743. border-radius: 24rpx;
  744. padding: 40rpx;
  745. box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.15);
  746. .qr-header {
  747. text-align: center;
  748. margin-bottom: 40rpx;
  749. .qr-title {
  750. display: block;
  751. font-size: 36rpx;
  752. font-weight: 600;
  753. color: #202020;
  754. margin-bottom: 12rpx;
  755. }
  756. .qr-subtitle {
  757. display: block;
  758. font-size: 26rpx;
  759. color: #999999;
  760. }
  761. }
  762. .qr-content {
  763. display: flex;
  764. justify-content: center;
  765. align-items: center;
  766. min-height: 400rpx;
  767. margin-bottom: 40rpx;
  768. .qr-image {
  769. width: 400rpx;
  770. height: 400rpx;
  771. border-radius: 16rpx;
  772. box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.1);
  773. }
  774. .qr-loading {
  775. display: flex;
  776. justify-content: center;
  777. align-items: center;
  778. }
  779. }
  780. .qr-actions {
  781. display: flex;
  782. justify-content: space-around;
  783. .action-btn {
  784. display: flex;
  785. flex-direction: column;
  786. align-items: center;
  787. gap: 12rpx;
  788. padding: 20rpx 40rpx;
  789. border-radius: 16rpx;
  790. background: rgba(64, 128, 255, 0.08);
  791. .action-text {
  792. &::after {
  793. border: none;
  794. }
  795. line-height: 1;
  796. background-color: transparent;
  797. font-size: 26rpx;
  798. color: #4080FF;
  799. font-weight: 500;
  800. }
  801. }
  802. }
  803. }
  804. // 分享弹窗卡片底部二维码
  805. .card-qr-section {
  806. position: relative;
  807. z-index: 1;
  808. display: flex;
  809. flex-direction: column;
  810. align-items: center;
  811. padding: 8rpx 0 4rpx;
  812. .qr-divider {
  813. width: 80%;
  814. height: 1rpx;
  815. background: #e8e8e8;
  816. margin-bottom: 12rpx;
  817. }
  818. .qr-wrapper {
  819. display: flex;
  820. flex-direction: column;
  821. align-items: center;
  822. gap: 6rpx;
  823. .qr-icon-area {
  824. width: 96rpx;
  825. height: 96rpx;
  826. border-radius: 12rpx;
  827. overflow: hidden;
  828. border: 2rpx solid #e8e8e8;
  829. background: #ffffff;
  830. display: flex;
  831. align-items: center;
  832. justify-content: center;
  833. .qr-code-img {
  834. width: 100%;
  835. height: 100%;
  836. }
  837. .qr-placeholder {
  838. width: 100%;
  839. height: 100%;
  840. display: flex;
  841. align-items: center;
  842. justify-content: center;
  843. background: #f5f5f5;
  844. .qr-placeholder-text {
  845. font-size: 18rpx;
  846. color: #cccccc;
  847. }
  848. }
  849. }
  850. .qr-hint {
  851. font-size: 18rpx;
  852. color: #b0b0b0;
  853. }
  854. }
  855. }
  856. .resetButton {
  857. background-color: transparent !important;
  858. border: none !important;
  859. display: inline !important;
  860. &::after {
  861. border: none !important;
  862. }
  863. }
  864. </style>