diff --git a/src/pages/Setting.tsx b/src/pages/Setting.tsx index 046bbb1..44b325d 100644 --- a/src/pages/Setting.tsx +++ b/src/pages/Setting.tsx @@ -1,9 +1,10 @@ -import { NavBar, Toast } from 'antd-mobile'; -// import icon_arr_r from '../assets/icon_arr_s_r.svg'; -import { useEffect, useRef } from 'react'; +import { NavBar, Picker, Toast } from 'antd-mobile'; +import icon_arr_r from '../assets/icon_arr_s_r.svg'; +import { useEffect, useRef, useState } from 'react'; import { useNavigate } from 'react-router'; import { useAppDispatch, useAppSelector } from '../utils/hooks'; import { fetchConfig, saveConfig } from '../store/features/contextSlice'; +import { standbyMinutes } from '../utils/constant'; export default function Setting() { const navigate = useNavigate(); @@ -11,6 +12,8 @@ export default function Setting() { const context = useAppSelector((state) => state.context); const addrInput = useRef(null); + const [standbyPickerVisible, setStandbyPickerVisible] = useState(false); + const [selectStandby, setSelectStandby] = useState([20]); // const [addr, setAddr] = useState(''); // const [port, setPort] = useState(80); @@ -65,6 +68,20 @@ export default function Setting() { +
+
+

设备设置

+
+
+
setStandbyPickerVisible(true)}> + 自动待机 + + {standbyMinutes.find((r) => r.value === selectStandby[0])?.label || ''} + + arr +
+
+
+ { + setStandbyPickerVisible(false); + }} + value={selectStandby} + onConfirm={(v) => { + setSelectStandby(v as number[]); + }} + /> ); } diff --git a/src/utils/constant.ts b/src/utils/constant.ts index 8bc4a97..9ab4ec6 100644 --- a/src/utils/constant.ts +++ b/src/utils/constant.ts @@ -1667,6 +1667,12 @@ export const XB_CODES = [ }, ]; +export const XB_CODES_MAP = { + S: '上行', + X: '下行', + D: '单行' +} + export const MILE_TYPES = [ { label: '大里程', @@ -1678,6 +1684,11 @@ export const MILE_TYPES = [ }, ]; +export const MILE_TYPES_MAP = { + D: '大里程', + X: '小里程' +} + //股别 type 1:直线 2:曲线 export const RAIN_TYPES = [ { @@ -1711,3 +1722,30 @@ export const RAIN_TYPES = [ type: 2, }, ]; + +export const standbyMinutes = [ + { + label: '1分钟', + value: 1, + }, + { + label: '2分钟', + value: 2, + }, + { + label: '5分钟', + value: 5, + }, + { + label: '10分钟', + value: 10, + }, + { + label: '20分钟', + value: 20, + }, + { + label: '30分钟', + value: 30, + }, +] \ No newline at end of file