|
|
@@ -4,7 +4,7 @@ import '@rongmz/react-stock-heatmap/example/src/index.css';
|
|
|
import toast, { Toaster } from 'react-hot-toast';
|
|
|
import { v4 as uuidv4 } from 'uuid';
|
|
|
import axios from 'axios';
|
|
|
-import { Select, Button, Input, Space } from 'tdesign-react';
|
|
|
+import { Select, Button, Input, Space, Checkbox } from "tdesign-react";
|
|
|
import { DeleteIcon } from 'tdesign-icons-react';
|
|
|
import 'tdesign-react/es/style/index.css';
|
|
|
|
|
|
@@ -100,6 +100,7 @@ export default () => {
|
|
|
const [isActivation, setIsActivation] = React.useState(false);
|
|
|
const [activationCode, setActivationCode] = React.useState();
|
|
|
const [loginSymbol,setLoginSymbol]= React.useState();
|
|
|
+ const [isPersistent,setIsPersistent]= React.useState(false);
|
|
|
const [loading, setLoading] = React.useState(true);
|
|
|
const progressRef = React.useRef(null);
|
|
|
/** @type {React.MutableRefObject<StockHeatmap>} */
|
|
|
@@ -247,14 +248,16 @@ export default () => {
|
|
|
toast.success(response.data.msg)
|
|
|
setInterval(()=>{
|
|
|
checkStatus()
|
|
|
- },5000)
|
|
|
+ }, 5000)
|
|
|
setIsActivation(true)
|
|
|
await readLocalDb()
|
|
|
connectWebSocket()
|
|
|
- // 每300秒存放一次本地数据
|
|
|
- // setInterval(() => {
|
|
|
- // saveLocalDb()
|
|
|
- // }, 300 * 1000)
|
|
|
+ if (isPersistent){
|
|
|
+ // 每30秒存放一次本地数据
|
|
|
+ setInterval(() => {
|
|
|
+ saveLocalDb()
|
|
|
+ }, 30 * 1000)
|
|
|
+ }
|
|
|
}else{
|
|
|
toast.error(response.data.msg);
|
|
|
}
|
|
|
@@ -281,6 +284,10 @@ export default () => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 处理持久化选项
|
|
|
+ let persistent = await window.electronAPI.getIsPersistentData() || false;
|
|
|
+ if (persistent) setIsPersistent(persistent)
|
|
|
+
|
|
|
const updateFn = () => {
|
|
|
setWindowDim([
|
|
|
window.innerWidth,
|
|
|
@@ -419,6 +426,10 @@ export default () => {
|
|
|
</Option>
|
|
|
))}
|
|
|
</Select>
|
|
|
+ <Checkbox checked={isPersistent} onChange={async (value)=>{
|
|
|
+ setIsPersistent(value)
|
|
|
+ await window.electronAPI.setIsPersistentData(value)
|
|
|
+ }}>是否持久化数据</Checkbox>
|
|
|
</div>
|
|
|
<div className="btnWp">
|
|
|
<div className="btn" onClick={handleActivation}>登 录</div>
|