card.vue 19 KB

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