Browse Source

修复user.nickname

feature/rail
zhangjiming 5 months ago
parent
commit
55b32c305e
  1. BIN
      public/logo192.png
  2. BIN
      public/logo512.png
  3. 10
      public/manifest.json
  4. 17
      src/components/Header.tsx

BIN
public/logo192.png

Before

Width: 192  |  Height: 192  |  Size: 5.2 KiB

BIN
public/logo512.png

Before

Width: 512  |  Height: 512  |  Size: 9.4 KiB

10
public/manifest.json

@ -6,16 +6,6 @@
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",

17
src/components/Header.tsx

@ -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",

Loading…
Cancel
Save