|
|
@ -19,8 +19,10 @@ export default function Header() { |
|
|
|
const dispatch = useAppDispatch(); |
|
|
|
const deviceInfo = useAppSelector(store => store.context.device); |
|
|
|
const deviceState = useAppSelector(store => store.deviceState); |
|
|
|
const userInfo = useAppSelector(store => store.context.user.loginUser); |
|
|
|
let [isConnect, setIsConnect] = useState(true); |
|
|
|
const [bluetoothInfo, setBluetoothInfo] = useState(deviceState); |
|
|
|
|
|
|
|
//获取当前websocet的状态
|
|
|
|
const showBlueImg = () => { |
|
|
|
if (isConnect) { |
|
|
@ -58,13 +60,8 @@ export default function Header() { |
|
|
|
let [bluetoothList, setbluetoothList] = useState(list); |
|
|
|
//获取mock数据
|
|
|
|
useEffect(() => { |
|
|
|
// getDeviceInfo().then(res => {
|
|
|
|
// console.log('res===', res)
|
|
|
|
// //@ts-ignore
|
|
|
|
// setbluetoothList(res.data.list)
|
|
|
|
// })
|
|
|
|
if (context.user.loginUser && context.user.loginUser.nickName) { |
|
|
|
setNickname(context.user.loginUser.nickName); |
|
|
|
if (userInfo.nickname) { |
|
|
|
setNickname(userInfo.nickname); |
|
|
|
} else { |
|
|
|
const user = localStorage.getItem("user"); |
|
|
|
if (user) { |
|
|
@ -72,12 +69,10 @@ export default function Header() { |
|
|
|
setNickname(userData.nickname); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
},[userInfo.nickname]); |
|
|
|
|
|
|
|
//@ts-ignore
|
|
|
|
const context = useSelector(store => store.context); |
|
|
|
const [messageApi, contextHolder] = message.useMessage(); |
|
|
|
const [nickname, setNickname] = useState(); |
|
|
|
const [nickname, setNickname] = useState<string>(); |
|
|
|
const items: MenuProps["items"] = [ |
|
|
|
// {
|
|
|
|
// key: "1",
|
|
|
|