wangrong
1 天以前 db685b04e52efd75213ef7540fdc0bed7dccfd9e
pages/recycle/banner.vue
@@ -72,10 +72,8 @@
               <text class="qrcode-title">我的回收码</text>
               <text class="qrcode-desc">向回收员出示此码完成回收</text>
               <view class="qrcode-image-wrap">
                  <image class="qrcode-image" :src="qrcodeUrl" mode="aspectFit" />
                  <image v-if="qrcodeUrl" class="qrcode-image" :src="qrcodeUrl" mode="aspectFit" />
               </view>
               <text class="qrcode-code">回收码:{{ userCode }}</text>
               <view class="qrcode-close" @tap="showQrcode = false">
                  <cl-icon name="close" :size="36" color="#999" />
               </view>
@@ -114,7 +112,6 @@
   });
   const showQrcode = ref(false);
   const userCode = ref("");
   const qrcodeUrl = ref("");
   // ========== 初始化加载 ==========
@@ -126,14 +123,18 @@
   async function loadDashboard() {
      try {
         const unionid = user.info?.phone||"18918594752";
         service.user.info.dashboard({ unionid:unionid  }).then((res) => {
            console.log("【再生资源看板数据】", res);
            dashboard.value = {
               carbonPoints: res.carbonPoints ?? 0,
               recycleCount: res.recycleCount ?? 0,
               overPercent: res.overPercent ?? 0,
            };
         });
         service.user.info
            .dashboard({ unionid })
            .then((res) => {
               dashboard.value = {
                  carbonPoints: res.carbonPoints ?? 0,
                  recycleCount: res.recycleCount ?? 0,
                  overPercent: res.overPercent ?? 0,
               };
            })
            .catch((err) => {
               console.error("【再生资源看板加载失败】", err);
            });
      } catch (e) {
         console.error("【再生资源看板加载失败】", e);
      }
@@ -141,15 +142,17 @@
   /** 加载用户回收码 */
   async function loadMyCode() {
      const phone = user.info?.phone;
      if (!phone) {
         uni.showToast({ title: "请先授权手机号", icon: "none" });
         showQrcode.value = false;
         return;
      }
      try {
         const phone = user.info?.phone ?? "18918594752";
         const res = await generateRecycleQrcode(phone);
         userCode.value = phone;
         qrcodeUrl.value = res;
         qrcodeUrl.value = await generateRecycleQrcode(phone);
      } catch (e) {
         console.error("【回收码加载失败】", e);
         // 兜底:没有接口时给个默认值
         userCode.value = "RC-LOADING";
         uni.showToast({ title: "回收码生成失败", icon: "none" });
      }
   }
@@ -347,12 +350,6 @@
      .qrcode-image {
         width: 100%;
         height: 100%;
      }
      .qrcode-code {
         font-size: 26rpx;
         color: #666;
         letter-spacing: 2rpx;
      }
      .qrcode-close {