diff --git a/src/components/Header.tsx b/src/components/Header.tsx index 552bc39..e682d99 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -15,32 +15,35 @@ import { updateUser } from "../store/features/contextSlice"; import "./bluetooth.scss"; import { loginUser } from "../services/wsTypes"; export default function Header() { - const navigate = useNavigate(); - const dispatch = useAppDispatch(); + const navigate = useNavigate(); + const dispatch = useAppDispatch(); const deviceInfo = useAppSelector(store => store.context.device); - //@ts-ignoref - const deviceState = useSelector(store => store.deviceState); - let [isConnect, setIsConnect] = useState(deviceState.isConnect) - const [bluetoothInfo, setBluetoothInfo] = useState(deviceState) - //获取当前websocet的状态 - const showBlueImg = () => { - if(isConnect){ - return - - - } - return null; - // if(!isConnect){ - // return - //
- // - //
- // }else { - // return - // - // - // } + const deviceState = useAppSelector(store => store.deviceState); + let [isConnect, setIsConnect] = useState(true); + const [bluetoothInfo, setBluetoothInfo] = useState(deviceState); + //获取当前websocet的状态 + const showBlueImg = () => { + if (isConnect) { + return ( + +
+ +
+
+ ); } + return null; + // if(!isConnect){ + // return + //
+ // + //
+ // }else { + // return + // + // + // } + }; let list = [ { @@ -112,34 +115,35 @@ export default function Header() { if (!isConnect) { Dom = (
- {bluetoothList.map(item => { + {bluetoothList.map(item => { return (
- -
+ +
); })} - + ); } return Dom; }; //设备已连接 - const getBtContent = ()=> { - return
+ const getBtContent = () => { + return (
-
- -
设备已连接
-
-
-
sn码:{bluetoothInfo.sn}
-
设备描述:{bluetoothInfo.descriptivePortName}
- {/*
电量:{bluetoothInfo.power}
*/} +
+
+ +
设备已连接
+
+
+
sn码:{bluetoothInfo.sn}
+
设备描述:{bluetoothInfo.descriptivePortName}
+ {/*
电量:{bluetoothInfo.power}
*/} +
-
); }; @@ -170,13 +174,11 @@ export default function Header() { />

{deviceInfo.power.toFixed()}%

-
+ {/*
icon -
- -
- {showBlueImg()} -
+
*/} + {showBlueImg()} +