import { ScrollView, View } from "@tarojs/components" import { memo, useEffect, useState } from "react" import Loading from "@/components/loading" import style from "./css/popup.module.scss" interface params { state: any, show: Boolean, onClose: (Boolean) => void, onLink: (any) => void, children?: React.ReactNode onOff: () => void, onFind: () => void, } export default memo(({state, show=false, onClose, onLink, onOff, onFind}:params) => { const [popupShow, setPopupShow] = useState(show) useEffect(() => { setPopupShow(show) }, [show]) const onCloseListener = () => { onClose(false) } return ( <> { popupShow&& 搜索设备 { (state.devices&&state.devices.length > 0)&&state?.devices.map(item => { return ( onLink(item)}> {item.name} { (!state.connecting&&!state.connected)&&链接|| (state.connecting&&item.deviceId == state.connecting.deviceId)&&正在链接...|| (state.connected&&item.deviceId == state.connected.deviceId)&&链接成功 } ) })|| { (!state.discovering)&& <> 暂无设备,请按以下条件检查 1.请确保取色仪处于激活状态 2.请确保取色仪没有链接其他设备 3.请打开手机定位 || 设备搜索中 } } { state.connected&&断开链接|| (!state.connected&&state.discovering)&&搜索中|| 重新搜索 } } ) })