Pārlūkot izejas kodu

登录页面bug修复

chengjunhui 1 mēnesi atpakaļ
vecāks
revīzija
bfef53d20d
2 mainītis faili ar 12 papildinājumiem un 16 dzēšanām
  1. 11 15
      pages/login.js
  2. 1 1
      pages/login.wxml

+ 11 - 15
pages/login.js

@@ -77,31 +77,27 @@ Page({
         );
       },
     });
-    // if (options.inviteCode) {
-    //   let sceneStr = decodeURIComponent(options.scene);
-    //   const params = new URLSearchParams(sceneStr);
-    //   const inviteCode = params.get('inviteCode');
-    //   // let inviteCode = options.inviteCode;
-    //   this.setData({
-    //     inviteCode,
-    //   });
-    // }
     try {
+      // options.scene = 'inviteCode_2025102991706'
       if (options.scene) {
         // 解码scene参数
         const sceneStr = decodeURIComponent(options.scene);
         console.log('解码后的scene:', sceneStr);
 
-        // 解析参数格式:inviteCode=xxx
-        const params = new URLSearchParams(sceneStr);
-        const inviteCode = params.get('inviteCode');
+        // 解析新的参数格式:inviteCode_xxx
+        let inviteCode = '';
+        if (sceneStr.startsWith('inviteCode_')) {
+          inviteCode = sceneStr.substring(11);
+        }
 
         if (inviteCode) {
           console.log('获取到邀请码:', inviteCode);
           // 在这里处理邀请码逻辑
-          this.setData({
-            inviteCode,
-          });
+          wx.nextTick(() => {
+            taht.setData({
+              inviteCode: inviteCode + '',
+            });
+          })
         } else {
           console.log('未找到邀请码参数');
         }

+ 1 - 1
pages/login.wxml

@@ -74,7 +74,7 @@
             <text class="txt">邀请码</text>
           </div>
           <view class="box-right">
-            <input maxlength="30" placeholder="请填写邀请码(非必填)" value="{{invitecode}}" bindinput="inviteCodeInput"/>
+            <input maxlength="30" placeholder="请填写邀请码(非必填)" value="{{inviteCode}}" bindinput="inviteCodeInput"/>
           </view>
         </view>
       </view>