From caa8c853dd2a2ec0bd081ddf833288c0785e5e2e Mon Sep 17 00:00:00 2001 From: blak-kong <546598185@qq.com> Date: Thu, 14 Mar 2024 09:12:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E6=8E=89=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E7=94=A8=E7=9A=84=E6=B5=8B=E8=AF=95=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/index/index.tsx | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index f2d8273..fbfc699 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -175,20 +175,24 @@ class Index extends Component { componentDidShow() { const tabbar = Taro.getTabBar(this.$instance.page); tabbar?.setSelected(0); - console.log(this.state.instrumentInfo, '查看', this.state.instrumentList, Taro.getStorageSync("skipRegister")); + console.log( + this.state.instrumentInfo, + "查看", + this.state.instrumentList, + Taro.getStorageSync("skipRegister") + ); const handleAsyncLogic = async () => { // 判断是否跳过了注册 if (Taro.getStorageSync("skipRegister")) { await this.EquipmentNo(); // 扫码序列号查询:注册后才调用,因为扫码未注册直接跳转注册页 this.setState({ showEquipment: true }); Taro.removeStorageSync("skipRegister"); - } else { // 已注册且非跳过,正常执行逻辑 this.showInit(); } - } - handleAsyncLogic() + }; + handleAsyncLogic(); } componentDidHide() { @@ -216,7 +220,7 @@ class Index extends Component { } // 非扫码进入小程序,需判断是否跳转欢迎页;扫码进入小程序,先缓存序列号,再检测隐私弹窗 let serial = Taro.getStorageSync("serial"); - console.log(this.$instance, '2222', serial); + console.log(this.$instance, "2222", serial); let url = this.$instance.router?.params?.q || ""; if (!url) { // 非扫码或扫码已跳转的返回进入 @@ -231,8 +235,6 @@ class Index extends Component { // 是否可以运行扫码逻辑:每次扫码后设为真, Taro.setStorageSync("isScanRun", true); if (url) { - - let _url = decodeURIComponent(url); if (_url.indexOf("?")) { @@ -331,7 +333,7 @@ class Index extends Component { // } } // this.removeScanFun(); - } + }; initPageData = async () => { const mobile = Taro.getStorageSync("mobile"); const isToken = getStorageSync("token"); @@ -342,12 +344,10 @@ class Index extends Component { console.log("initPageData", Taro.getStorageSync("serial")); // 如果是扫码且已有token则跳转 if (Taro.getStorageSync("serial")) { - console.log(mobile, 'mobile'); + console.log(mobile, "mobile"); // 如果已注册绑定手机号不用跳转 if (!mobile) { - - setTimeout(() => { go("/pages/register/register"); }, 300); @@ -651,7 +651,6 @@ class Index extends Component { }; // 根据扫码的序列号获取仪器信息 getInstrumentInfoBySerial = async () => { - let url = this.$instance.router?.params?.q || ""; let isScan = Taro.getStorageSync("isScan"); // 判断是否扫码进入 let serial = Taro.getStorageSync("serial"); // 扫码可能跳转注册页,所以先缓存 @@ -659,7 +658,7 @@ class Index extends Component { let { data } = await InstrumentInfo.getInstrumentInfoBySerial({ serial: serial, }); - console.log(data, '查看赋值'); + console.log(data, "查看赋值"); if (data.code === 200) { let instrumentInfo = data.data; @@ -1389,10 +1388,6 @@ class Index extends Component { )} - - 假按钮跳转蓝牙调试设备页 - -