card.vue 21 KB

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