|
|
@ -2,15 +2,28 @@ import icon_bluetooth from '../assets/icon_bluetooth.svg'; |
|
|
|
import icon_arr_d from '../assets/icon_arr_down.svg'; |
|
|
|
import power_icon from '../assets/power.svg'; |
|
|
|
import './CustomNavBar.scss'; |
|
|
|
import { useState } from 'react'; |
|
|
|
import {useEffect, useRef, useState} from 'react'; |
|
|
|
import { useAppSelector } from '../utils/hooks'; |
|
|
|
import { useNavigate } from 'react-router-dom'; |
|
|
|
import {Dialog} from "antd-mobile"; |
|
|
|
|
|
|
|
export default function CustomNavBar({ title }: { title: string }) { |
|
|
|
const navigate = useNavigate(); |
|
|
|
const device = useAppSelector((state) => state.context.device); |
|
|
|
const [showDetail, setShowDetail] = useState(false); |
|
|
|
|
|
|
|
const hasWarned = useRef(false); |
|
|
|
useEffect(() => { |
|
|
|
if (device.connected && device.power< 20 && !hasWarned.current) { |
|
|
|
Dialog.alert({ |
|
|
|
content: '设备电量过低,请及时充电', |
|
|
|
onConfirm: () => { |
|
|
|
}, |
|
|
|
}).then(r => {}); |
|
|
|
hasWarned.current = true; // 标记已弹窗
|
|
|
|
} |
|
|
|
}, [device]); |
|
|
|
|
|
|
|
return ( |
|
|
|
<div className="relative bg-white h-[--navBarHeight] border-b border-[#D8D8D8]"> |
|
|
|
{/** 温度,水平仪 */} |
|
|
|