增加登录日志

This commit is contained in:
hanhh
2021-09-07 01:40:25 +08:00
parent 0cbfca979e
commit eb196bd40d
11 changed files with 233 additions and 12 deletions
+24 -4
View File
@@ -15,7 +15,6 @@ import { request } from '@/utils/http';
import styles from './index.module.less';
import EditModal from './editModal';
import { Controlled as CodeMirror } from 'react-codemirror2';
import { useCtx, useTheme } from '@/utils/hooks';
import SplitPane from 'react-split-pane';
const { Text } = Typography;
@@ -82,9 +81,29 @@ const Script = ({ headerStyle, isPhone, theme }: any) => {
getDetail(node);
};
const onTreeSelect = useCallback((keys: Key[], e: any) => {
onSelect(keys[0], e.node);
}, []);
const onTreeSelect = useCallback(
(keys: Key[], e: any) => {
const content = editorRef.current
? editorRef.current.getValue().replace(/\r\n/g, '\n')
: value;
if (content !== value) {
Modal.confirm({
title: `确认离开`,
content: <></>,
onOk() {
onSelect(keys[0], e.node);
setIsEditing(false);
},
onCancel() {
console.log('Cancel');
},
});
} else {
onSelect(keys[0], e.node);
}
},
[value],
);
const onSearch = useCallback(
(e) => {
@@ -132,6 +151,7 @@ const Script = ({ headerStyle, isPhone, theme }: any) => {
.then((_data: any) => {
if (_data.code === 200) {
message.success(`保存成功`);
setValue(content);
setIsEditing(false);
} else {
message.error(_data);