refactor:检查书签是否最新代码移动到书签管理页中
This commit is contained in:
parent
1f430c3b48
commit
e35433b178
@ -116,5 +116,10 @@ public class UserController {
|
|||||||
return Result.success(userService.checkPassword(obj.getString("password")));
|
return Result.success(userService.checkPassword(obj.getString("password")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/loginStatus")
|
||||||
|
public Result checkLoginStatus() {
|
||||||
|
return Result.success(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { Input, Select, Empty } from "antd";
|
import { Input, Select, Empty } from "antd";
|
||||||
import styles from "./index.module.less";
|
import styles from "./index.module.less";
|
||||||
import httpUtil from "../../util/httpUtil";
|
|
||||||
import { keySearch } from "../../util/cacheUtil";
|
import { keySearch } from "../../util/cacheUtil";
|
||||||
|
|
||||||
class Search extends React.Component {
|
class Search extends React.Component {
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { Link, withRouter } from "react-router-dom";
|
import { Link, withRouter } from "react-router-dom";
|
||||||
import { Menu, Dropdown, Divider, Modal } from "antd";
|
import { Menu, Dropdown, Divider} from "antd";
|
||||||
import httpUtil from "../../util/httpUtil";
|
import httpUtil from "../../util/httpUtil";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import styles from "./index.module.less";
|
import styles from "./index.module.less";
|
||||||
import * as infoAction from "../../redux/action/LoginInfoAction";
|
import * as infoAction from "../../redux/action/LoginInfoAction";
|
||||||
import { checkCacheStatus, clearCache } from "../../util/cacheUtil";
|
|
||||||
|
|
||||||
const { confirm } = Modal;
|
|
||||||
|
|
||||||
function mapStateToProps(state) {
|
function mapStateToProps(state) {
|
||||||
return state[infoAction.DATA_NAME];
|
return state[infoAction.DATA_NAME];
|
||||||
@ -31,37 +29,8 @@ class MainLayout extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async componentWillMount() {
|
async componentWillMount() {
|
||||||
if (!this.props.username) {
|
|
||||||
let res = await httpUtil.get("/user/currentUserInfo");
|
let res = await httpUtil.get("/user/currentUserInfo");
|
||||||
this.props.changeUserInfo(res);
|
this.props.changeUserInfo(res);
|
||||||
if (this.state.timer != null) {
|
|
||||||
clearInterval(this.state.timer);
|
|
||||||
}
|
|
||||||
await this.checkCache();
|
|
||||||
this.state.timer = setInterval(this.checkCache.bind(this), 5 * 60 * 1000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async checkCache() {
|
|
||||||
//检查缓存情况
|
|
||||||
if (this.state.showDialog) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let _this = this;
|
|
||||||
if (!(await checkCacheStatus())) {
|
|
||||||
this.state.showDialog = true;
|
|
||||||
confirm({
|
|
||||||
title: "缓存过期",
|
|
||||||
content: "书签数据有更新,是否立即刷新?",
|
|
||||||
onOk() {
|
|
||||||
_this.state.showDialog = false;
|
|
||||||
clearCache();
|
|
||||||
},
|
|
||||||
onCancel() {
|
|
||||||
_this.state.showDialog = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
renderUserArea() {
|
renderUserArea() {
|
||||||
|
@ -124,12 +124,7 @@ class AddModal extends React.Component {
|
|||||||
* 新增一个节点
|
* 新增一个节点
|
||||||
*/
|
*/
|
||||||
async addOne() {
|
async addOne() {
|
||||||
const {
|
const { currentAddFolder, updateTreeData, closeModal } = this.props;
|
||||||
currentAddFolder,
|
|
||||||
updateTreeData,
|
|
||||||
closeModal,
|
|
||||||
treeData
|
|
||||||
} = this.props;
|
|
||||||
const path =
|
const path =
|
||||||
currentAddFolder == null
|
currentAddFolder == null
|
||||||
? ""
|
? ""
|
||||||
|
@ -152,7 +152,7 @@ export function batchDelete() {
|
|||||||
* @param {*} bookmarkIdList
|
* @param {*} bookmarkIdList
|
||||||
*/
|
*/
|
||||||
function deleteBookmark(nodeList) {
|
function deleteBookmark(nodeList) {
|
||||||
const { updateTreeData, treeData, changeCheckedKeys } = this.props;
|
const { updateTreeData, changeCheckedKeys } = this.props;
|
||||||
const folderIdList = [],
|
const folderIdList = [],
|
||||||
bookmarkIdList = [],
|
bookmarkIdList = [],
|
||||||
dataNodeList = [];
|
dataNodeList = [];
|
||||||
|
@ -1,19 +1,23 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { Tree, Empty, Button, Spin } from "antd";
|
import { Tree, Empty, Button, Spin, Modal } from "antd";
|
||||||
import MainLayout from "../../../layout/MainLayout";
|
import MainLayout from "../../../layout/MainLayout";
|
||||||
import styles from "./index.module.less";
|
import styles from "./index.module.less";
|
||||||
import { batchDelete, renderTreeNodes, onDrop } from "./function.js";
|
import { batchDelete, renderTreeNodes, onDrop } from "./function.js";
|
||||||
import {
|
import {
|
||||||
cacheBookmarkData,
|
cacheBookmarkData,
|
||||||
getBookmarkList,
|
getBookmarkList,
|
||||||
|
checkCacheStatus,
|
||||||
clearCache
|
clearCache
|
||||||
} from "../../../util/cacheUtil";
|
} from "../../../util/cacheUtil";
|
||||||
|
import httpUtil from "../../../util/httpUtil";
|
||||||
import AddModal from "./AddModal";
|
import AddModal from "./AddModal";
|
||||||
import Search from "../../../components/Search";
|
import Search from "../../../components/Search";
|
||||||
|
|
||||||
import * as action from "../../../redux/action/BookmarkTreeOverview";
|
import * as action from "../../../redux/action/BookmarkTreeOverview";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
|
|
||||||
|
const { confirm } = Modal;
|
||||||
|
|
||||||
function mapStateToProps(state) {
|
function mapStateToProps(state) {
|
||||||
return state[action.DATA_NAME];
|
return state[action.DATA_NAME];
|
||||||
}
|
}
|
||||||
@ -44,6 +48,40 @@ class OverView extends React.Component {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async componentWillUnmount() {
|
||||||
|
if (this.state.timer != null) {
|
||||||
|
clearInterval(this.state.timer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async componentWillMount() {
|
||||||
|
await httpUtil.get("/user/loginStatus");
|
||||||
|
this.state.timer = setInterval(this.checkCache.bind(this), 5 * 60 * 1000);
|
||||||
|
setTimeout(this.checkCache.bind(this), 5000);
|
||||||
|
}
|
||||||
|
|
||||||
|
async checkCache() {
|
||||||
|
//检查缓存情况
|
||||||
|
if (this.state.showDialog) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let _this = this;
|
||||||
|
if (!(await checkCacheStatus())) {
|
||||||
|
this.state.showDialog = true;
|
||||||
|
confirm({
|
||||||
|
title: "缓存过期",
|
||||||
|
content: "书签数据有更新,是否立即刷新?",
|
||||||
|
onOk() {
|
||||||
|
_this.state.showDialog = false;
|
||||||
|
clearCache();
|
||||||
|
},
|
||||||
|
onCancel() {
|
||||||
|
_this.state.showDialog = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化第一级书签
|
* 初始化第一级书签
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user