|
|
@ -25,9 +25,6 @@ export default function Setting() { |
|
|
|
// setPort(+evt.target.value);
|
|
|
|
// }
|
|
|
|
// };
|
|
|
|
useEffect(() => { |
|
|
|
dispatch(fetchConfig()); |
|
|
|
}, [dispatch]); |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
if (addrInput.current && context.setting.server) { |
|
|
@ -36,6 +33,10 @@ export default function Setting() { |
|
|
|
setSelectStandby([context.setting.standbyMinutes]); |
|
|
|
}, [context.setting]); |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
dispatch(fetchConfig()); |
|
|
|
}, [dispatch]); |
|
|
|
|
|
|
|
const onSaveClick = async () => { |
|
|
|
const server = addrInput.current!.value; |
|
|
|
const res = await dispatch(saveConfig({ server, standbyMinutes: selectStandby[0] })).unwrap(); |
|
|
@ -71,20 +72,24 @@ export default function Setting() { |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</section> |
|
|
|
<section> |
|
|
|
<div className="h-[42px] px-5"> |
|
|
|
<h1 className="h-[42px] leading-[42px] text-base text-text font-medium">设备设置</h1> |
|
|
|
</div> |
|
|
|
<div className="bg-white px-5 text-sm text-text"> |
|
|
|
<div className="h-12 flex items-center" onClick={() => setStandbyPickerVisible(true)}> |
|
|
|
<span>自动待机</span> |
|
|
|
<span className="ml-auto mr-4"> |
|
|
|
{standbyMinutes.find((r) => r.value === selectStandby[0])?.label || ''} |
|
|
|
</span> |
|
|
|
<img src={icon_arr_r} alt="arr" /> |
|
|
|
|
|
|
|
{context.device.connected && ( |
|
|
|
<section> |
|
|
|
<div className="h-[42px] px-5"> |
|
|
|
<h1 className="h-[42px] leading-[42px] text-base text-text font-medium">设备设置</h1> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</section> |
|
|
|
<div className="bg-white px-5 text-sm text-text"> |
|
|
|
<div className="h-12 flex items-center" onClick={() => setStandbyPickerVisible(true)}> |
|
|
|
<span>自动待机</span> |
|
|
|
<span className="ml-auto mr-4"> |
|
|
|
{standbyMinutes.find((r) => r.value === selectStandby[0])?.label || ''} |
|
|
|
</span> |
|
|
|
<img src={icon_arr_r} alt="arr" /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</section> |
|
|
|
)} |
|
|
|
|
|
|
|
<div |
|
|
|
className="btn-contained rounded-md h-12 mx-9 my-8 text-base font-medium" |
|
|
|
onClick={onSaveClick} |
|
|
|