From 5882ba8863d77fdcc168b176c3ffb30e8a20556a Mon Sep 17 00:00:00 2001
From: longz <longzhaoz@qq.com>
Date: 星期一, 13 七月 2026 17:54:25 +0800
Subject: [PATCH] 缩短二维码原始参数

---
 yuyueMiniProgram/src/pages/visitorCodeShare/index.vue |   46 +++++++++++++++++++++++++++++++++-------------
 1 files changed, 33 insertions(+), 13 deletions(-)

diff --git a/yuyueMiniProgram/src/pages/visitorCodeShare/index.vue b/yuyueMiniProgram/src/pages/visitorCodeShare/index.vue
index edd467f..c18ffd6 100644
--- a/yuyueMiniProgram/src/pages/visitorCodeShare/index.vue
+++ b/yuyueMiniProgram/src/pages/visitorCodeShare/index.vue
@@ -7,6 +7,10 @@
   qrCode: string
 }
 
+function wait(ms: number) {
+  return new Promise(resolve => setTimeout(resolve, ms))
+}
+
 interface VisitorCodeDisplayOrder extends Omit<MiniMyVisitorCodeOrderItem, 'qrCodes'> {
   qrCodes: VisitorCodeDisplayTicket[]
 }
@@ -19,7 +23,6 @@
   },
 })
 
-const router = useRouter()
 const sysInfo = uni.getSystemInfoSync()
 const statusBarHeight = sysInfo.statusBarHeight || 0
 const navBarHeight = 44
@@ -30,7 +33,22 @@
 const currentTicket = computed(() => order.value?.qrCodes?.[0] || null)
 
 function handleBack() {
-  router.back()
+  const pages = getCurrentPages()
+  if (pages.length > 1) {
+    uni.navigateBack({
+      delta: 1,
+      fail: () => {
+        uni.switchTab({ url: '/pages/index/index' })
+      },
+    })
+    return
+  }
+  uni.switchTab({
+    url: '/pages/index/index',
+    fail: () => {
+      uni.reLaunch({ url: '/pages/index/index' })
+    },
+  })
 }
 
 function ticketTimeText() {
@@ -49,7 +67,7 @@
     errorCorrectionLevel: 'M',
     margin: 1,
   })
-  const size = 400
+  const size = 448
   const moduleCount = qr.modules.size
   const tileSize = size / moduleCount
   const canvasId = 'sharedSingleVisitorQrCanvas'
@@ -75,14 +93,16 @@
     }
 
     context.draw(false, () => {
-      uni.canvasToTempFilePath({
-        canvasId,
-        width: size,
-        height: size,
-        destWidth: size * 2,
-        destHeight: size * 2,
-        success: res => resolve(res.tempFilePath),
-        fail: reject,
+      void wait(500).then(() => {
+        uni.canvasToTempFilePath({
+          canvasId,
+          width: size,
+          height: size,
+          destWidth: size * 2,
+          destHeight: size * 2,
+          success: res => resolve(res.tempFilePath),
+          fail: reject,
+        })
       })
     })
   })
@@ -286,8 +306,8 @@
   position: fixed;
   left: -9999px;
   top: -9999px;
-  width: 400px;
-  height: 400px;
+  width: 448px;
+  height: 448px;
   opacity: 0;
   pointer-events: none;
 }

--
Gitblit v1.7.1