From 2acd340fccf3aa7f5c95b136ec362a24bdab28fc Mon Sep 17 00:00:00 2001 From: mk <2403457699@qq.com> Date: Thu, 30 May 2024 09:10:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=AB=E7=A0=81=E5=90=8E=E6=88=BF=E5=B1=8BId?= =?UTF-8?q?=E6=88=AA=E5=8F=96=E6=96=B9=E5=BC=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/index.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pages/index/index.js b/pages/index/index.js index f402041..2836a0f 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -304,12 +304,11 @@ door(){ success: (res) => { console.log(res); console.log(res.result); - var parts = res.result.split('/'); - var number = parts[parts.length - 1]; - - console.log(number) + const homeIdMatch = res.result.match(/&homeId=([^&]*)/); + const homeIdValue = homeIdMatch ? homeIdMatch[1] : null; + console.log(homeIdValue) wx.navigateTo({ - url: `/subpages/house/pages/housePortrait/housePortrait?resiId=${number}`, + url: `/subpages/house/pages/housePortrait/housePortrait?resiId=${homeIdValue}`, }) },