From 30a84112b74aab55c4d087e8c478189a35c66347 Mon Sep 17 00:00:00 2001 From: blak-kong <546598185@qq.com> Date: Mon, 29 Jan 2024 10:25:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=B4=E6=97=B6=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/popup/popup-binding.tsx | 6 ++++- src/components/popup/popup-confirm.tsx | 3 +-- src/pages/index/index.tsx | 31 ++++++++++++++------------ src/pages/instrument/instrument.tsx | 5 ++--- src/pages/instrument/intro.config.js | 3 +++ src/pages/instrument/intro.less | 0 src/pages/instrument/intro.tsx | 0 7 files changed, 28 insertions(+), 20 deletions(-) create mode 100644 src/pages/instrument/intro.config.js create mode 100644 src/pages/instrument/intro.less create mode 100644 src/pages/instrument/intro.tsx diff --git a/src/components/popup/popup-binding.tsx b/src/components/popup/popup-binding.tsx index 4870441..90995c1 100644 --- a/src/components/popup/popup-binding.tsx +++ b/src/components/popup/popup-binding.tsx @@ -1,5 +1,6 @@ import classnames from "classnames"; import { Component } from "react"; +import Taro from "@tarojs/taro"; import { Block, View, Button, PageMeta } from "@tarojs/components"; @@ -78,6 +79,9 @@ export default class PopupBinding extends Component { isLarge, type, } = this.props; + + let serial = Taro.getStorageSync("serial"); + let isSerial = String(serial) === String(data.serial) ? true : false; return ( @@ -103,7 +107,7 @@ export default class PopupBinding extends Component { > )} - {isRegisterBoolean && type === 0 && ( + {isRegisterBoolean && (type === 1 || type === 2) && ( { isShow, isClose, isLarge, - type = 0, + type, } = this.props; - console.log("type", type); return ( diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index 55ba9c6..3e71c3d 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -202,7 +202,6 @@ class Index extends Component { initPageData() { const mobile = Taro.getStorageSync("mobile"); - this.GetSiteCarousel(); if (mobile) { @@ -269,10 +268,8 @@ class Index extends Component { GetSiteAddTag = async (id) => { let res = await GetSiteAddTag(id); - console.log("tag", res.data); if (res.data.code === 200) { - if (res.data.data) { - } + console.log("点击自动上报,不需要逻辑处理"); } }; @@ -369,9 +366,9 @@ class Index extends Component { title: "请求中...", mask: true, }); - let { instrumentInfo } = this.state; + // let { instrumentInfo } = this.state; let { data } = await InstrumentInfo.bindingInstrumentList(); - console.log("bindingInstrument", data); + console.log("bindingInstrumentList", data); Taro.hideLoading(); if (data.code === 200) { this.setState({ instrumentList: data.data }); @@ -386,7 +383,7 @@ class Index extends Component { // 扫码进入强制重新登录 this.WCUserLogin(); } else { - this.initPageData(); + this.initData(); } }; async WCUserLogin() { @@ -413,11 +410,8 @@ class Index extends Component { this.setState({ isVisibleBinding: false }); }; confirmBinding = () => { - let { instrumentInfo } = this.state; - // 0未绑定 1 2 - if (instrumentInfo.bindingStatus === 0) { - this.bindingInstrument(); - } + // let { instrumentInfo } = this.state; + this.bindingInstrument(); }; // 根据扫码的序列号获取仪器信息 getInstrumentInfoBySerial = async () => { @@ -432,14 +426,23 @@ class Index extends Component { Taro.removeStorageSync("isScan"); Taro.removeStorageSync("serial"); // 获取成功,以后删除缓存的扫码序列号 let isVisibleBinding = false; - if (data.data.bindingStatus === 0) { + let instrumentInfo = data.data; + // 1有效 0无效 + if (instrumentInfo.validStatus === 0) { + this.setState({ isBindingError: true }); + } + // 0已绑定 1未绑定 2已解绑 + if ( + instrumentInfo.bindingStatus === 1 || + instrumentInfo.bindingStatus === 2 + ) { isVisibleBinding = true; } // 更新扫码进入仪器信息 this.setState({ isVisibleBinding, - instrumentInfo: data.data, + instrumentInfo: instrumentInfo, }); } else { // 获取失败和绑定失败一个弹窗 diff --git a/src/pages/instrument/instrument.tsx b/src/pages/instrument/instrument.tsx index 9b02317..e8174e7 100644 --- a/src/pages/instrument/instrument.tsx +++ b/src/pages/instrument/instrument.tsx @@ -21,7 +21,6 @@ import { InstrumentInfo } from "../../utils/Interface"; import { go, back, loading, msg, showModal } from "../../utils/traoAPI"; import { isVideo } from "../../utils/util"; import utilHtml from "../../utils/utilhtml"; -// const log = require("../../utils/log"); import { getImgInfo, contraction } from "../../utils/compressImage"; @@ -350,7 +349,7 @@ export default class Instrument extends Component { } = this.state; return ( - {/* { textAlgin="center" close={this.closeDev} confirm={this.closeDev} - /> */} + />