|
@ -20,15 +20,9 @@ export default function Header() { |
|
|
const deviceState = useAppSelector(store => store.deviceState); |
|
|
const deviceState = useAppSelector(store => store.deviceState); |
|
|
const userInfo = useAppSelector(store => store.context.user.loginUser); |
|
|
const userInfo = useAppSelector(store => store.context.user.loginUser); |
|
|
let [isConnect, setIsConnect] = useState(deviceState.isConnect); |
|
|
let [isConnect, setIsConnect] = useState(deviceState.isConnect); |
|
|
|
|
|
|
|
|
const [bluetoothInfo, setBluetoothInfo] = useState(deviceState); |
|
|
|
|
|
useEffect(()=>{ |
|
|
|
|
|
setBluetoothInfo(deviceState) |
|
|
|
|
|
},[deviceState]) |
|
|
|
|
|
//获取当前websocet的状态
|
|
|
//获取当前websocet的状态
|
|
|
const showBlueImg = () => { |
|
|
const showBlueImg = () => { |
|
|
console.log('deviceState---', deviceState) |
|
|
|
|
|
if (isConnect) { |
|
|
|
|
|
|
|
|
if (deviceState.isConnect) { |
|
|
return ( |
|
|
return ( |
|
|
<Popover content={getBtContent()} title="" trigger="click"> |
|
|
<Popover content={getBtContent()} title="" trigger="click"> |
|
|
<section className="bg-white rounded-md h-9 w-10 flex justify-center items-center mr-3"> |
|
|
<section className="bg-white rounded-md h-9 w-10 flex justify-center items-center mr-3"> |
|
@ -128,17 +122,16 @@ export default function Header() { |
|
|
|
|
|
|
|
|
//设备已连接
|
|
|
//设备已连接
|
|
|
const getBtContent = () => { |
|
|
const getBtContent = () => { |
|
|
console.log('bluetoothInfo---22----', bluetoothInfo) |
|
|
|
|
|
return ( |
|
|
return ( |
|
|
<div key={bluetoothInfo.sn}> |
|
|
|
|
|
|
|
|
<div> |
|
|
<div> |
|
|
<div> |
|
|
<div className="bluetooth_c"> |
|
|
<div className="bluetooth_c"> |
|
|
<img src={check_mark} alt="" className="ext-base ml-2 h-4" /> |
|
|
<img src={check_mark} alt="" className="ext-base ml-2 h-4" /> |
|
|
<div className="ml-[10px]">设备已连接</div> |
|
|
<div className="ml-[10px]">设备已连接</div> |
|
|
</div> |
|
|
</div> |
|
|
<div className="pl-[15px]"> |
|
|
<div className="pl-[15px]"> |
|
|
<div className="mt-[1rem]">sn码:{bluetoothInfo.sn}</div> |
|
|
|
|
|
<div className="mt-[1rem]">设备描述:{bluetoothInfo.descriptivePortName}</div> |
|
|
|
|
|
|
|
|
<div className="mt-[1rem]">sn码:{deviceState.sn}</div> |
|
|
|
|
|
<div className="mt-[1rem]">设备描述:{deviceState.descriptivePortName}</div> |
|
|
{/* <div className="mt-[1rem]">电量:{bluetoothInfo.power}</div> */} |
|
|
{/* <div className="mt-[1rem]">电量:{bluetoothInfo.power}</div> */} |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|