|
@@ -51,6 +51,7 @@ const TableList: React.FC<{}> = () => {
|
|
tag: '',
|
|
tag: '',
|
|
updateTime: '',
|
|
updateTime: '',
|
|
userId: 0,
|
|
userId: 0,
|
|
|
|
+ onlyText: ''
|
|
});
|
|
});
|
|
|
|
|
|
const isPracticeFocus = () => {
|
|
const isPracticeFocus = () => {
|
|
@@ -60,11 +61,11 @@ const TableList: React.FC<{}> = () => {
|
|
/**
|
|
/**
|
|
* 设置复习状态,对手机端返回页面的时候有用
|
|
* 设置复习状态,对手机端返回页面的时候有用
|
|
*/
|
|
*/
|
|
- const setMemeory = () => {
|
|
|
|
|
|
+ const setMemoryTag = () => {
|
|
localStorage.setItem("memory", '1');
|
|
localStorage.setItem("memory", '1');
|
|
}
|
|
}
|
|
const checkMemeory = () => {
|
|
const checkMemeory = () => {
|
|
- if (localStorage.getItem("memory") === '1') {
|
|
|
|
|
|
+ if (localStorage.getItem("memory") === '1' && state.step !== Step.MEMORY) {
|
|
setState({step: Step.MEMORY});
|
|
setState({step: Step.MEMORY});
|
|
} else {
|
|
} else {
|
|
countRemind();
|
|
countRemind();
|
|
@@ -134,7 +135,7 @@ const TableList: React.FC<{}> = () => {
|
|
const res = await service.findNext({});
|
|
const res = await service.findNext({});
|
|
if (res.success) {
|
|
if (res.success) {
|
|
setMemory({...memory, ...res.data});
|
|
setMemory({...memory, ...res.data});
|
|
- setMemeory();
|
|
|
|
|
|
+ setMemoryTag();
|
|
} else {
|
|
} else {
|
|
setState({step: Step.MAIN});
|
|
setState({step: Step.MAIN});
|
|
removeMemeory();
|
|
removeMemeory();
|
|
@@ -195,9 +196,22 @@ const TableList: React.FC<{}> = () => {
|
|
const isBackEmpty = () => {
|
|
const isBackEmpty = () => {
|
|
return getTextFromHtml(memory.back).length === 0 && memory.back.indexOf('img') < 0;
|
|
return getTextFromHtml(memory.back).length === 0 && memory.back.indexOf('img') < 0;
|
|
}
|
|
}
|
|
|
|
+ // 检测是否应该自动跳转
|
|
|
|
+ const checkGotoUrl = () => {
|
|
|
|
+ if (memory.onlyText.trim().startsWith("url") && localStorage.getItem("auto-url") !== memory.id + "") {
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ localStorage.setItem("auto-url", memory.id + "");
|
|
|
|
+ let a = document.querySelector(".ql-editor a");
|
|
|
|
+ if (a) {
|
|
|
|
+ // @ts-ignore
|
|
|
|
+ a.click()
|
|
|
|
+ }
|
|
|
|
+ }, 1500);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
- checkMemeory();
|
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
countRemind();
|
|
countRemind();
|
|
}, 1000 * 60 * 60); // 每隔一个小时查询一次
|
|
}, 1000 * 60 * 60); // 每隔一个小时查询一次
|
|
@@ -223,6 +237,8 @@ const TableList: React.FC<{}> = () => {
|
|
if (memory.front.length === 0) {
|
|
if (memory.front.length === 0) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ // 检测是否需要跳转
|
|
|
|
+ checkGotoUrl()
|
|
// 进入复习页面后
|
|
// 进入复习页面后
|
|
// 如果没有文字,并且也没有图片
|
|
// 如果没有文字,并且也没有图片
|
|
if (isBackEmpty()) {
|
|
if (isBackEmpty()) {
|