From 13d7e61b60e78fb8936bf89efa7b12970efefae7 Mon Sep 17 00:00:00 2001 From: zhangjiming Date: Tue, 8 Apr 2025 14:01:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=BE=85=E6=9C=BA=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Setting.tsx | 34 +++++++++++++++++++++++++++++++--- src/utils/constant.ts | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 3 deletions(-) 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