mirror of
https://github.com/whyour/qinglong.git
synced 2026-07-17 01:14:50 +08:00
antd notification改为message
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import React, { PureComponent, Fragment, useState, useEffect } from 'react';
|
||||
import { Button, notification, Modal } from 'antd';
|
||||
import { Button, message, Modal } from 'antd';
|
||||
import config from '@/utils/config';
|
||||
import { PageContainer } from '@ant-design/pro-layout';
|
||||
import { Controlled as CodeMirror } from 'react-codemirror2';
|
||||
@@ -16,7 +16,7 @@ const Config = () => {
|
||||
setLoading(true);
|
||||
request
|
||||
.get(`${config.apiPrefix}config/config`)
|
||||
.then((data) => {
|
||||
.then((data: any) => {
|
||||
setValue(data.data);
|
||||
})
|
||||
.finally(() => setLoading(false));
|
||||
@@ -27,10 +27,8 @@ const Config = () => {
|
||||
.post(`${config.apiPrefix}save`, {
|
||||
data: { content: value, name: 'config.sh' },
|
||||
})
|
||||
.then((data) => {
|
||||
notification.success({
|
||||
message: data.msg,
|
||||
});
|
||||
.then((data: any) => {
|
||||
message.success(data.msg);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { useCallback, useRef, useState, useEffect } from 'react';
|
||||
import {
|
||||
Button,
|
||||
notification,
|
||||
message,
|
||||
Modal,
|
||||
Table,
|
||||
Tag,
|
||||
@@ -230,7 +230,7 @@ const Config = () => {
|
||||
(value as any).splice(index, 1, data.data);
|
||||
setValue([...(value as any)] as any);
|
||||
} else {
|
||||
notification.error({ message: '更新状态失败' });
|
||||
message.error('更新状态失败');
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -260,11 +260,9 @@ const Config = () => {
|
||||
)
|
||||
.then((data: any) => {
|
||||
if (data.code === 200) {
|
||||
notification.success({
|
||||
message: `${
|
||||
record.status === Status.已禁用 ? '启用' : '禁用'
|
||||
}成功`,
|
||||
});
|
||||
message.success(
|
||||
`${record.status === Status.已禁用 ? '启用' : '禁用'}成功`,
|
||||
);
|
||||
const newStatus =
|
||||
record.status === Status.已禁用 ? Status.未获取 : Status.已禁用;
|
||||
const result = [...value];
|
||||
@@ -274,9 +272,7 @@ const Config = () => {
|
||||
});
|
||||
setValue(result);
|
||||
} else {
|
||||
notification.error({
|
||||
message: data,
|
||||
});
|
||||
message.error(data);
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -313,16 +309,12 @@ const Config = () => {
|
||||
.delete(`${config.apiPrefix}cookies`, { data: [record._id] })
|
||||
.then((data: any) => {
|
||||
if (data.code === 200) {
|
||||
notification.success({
|
||||
message: '删除成功',
|
||||
});
|
||||
message.success('删除成功');
|
||||
const result = [...value];
|
||||
result.splice(index, 1);
|
||||
setValue(result);
|
||||
} else {
|
||||
notification.error({
|
||||
message: data,
|
||||
});
|
||||
message.error(data);
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -377,9 +369,7 @@ const Config = () => {
|
||||
})
|
||||
.then((data: any) => {
|
||||
if (data.code !== 200) {
|
||||
notification.error({
|
||||
message: data,
|
||||
});
|
||||
message.error(data);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { Modal, notification, Input, Form } from 'antd';
|
||||
import { Modal, message, Input, Form } from 'antd';
|
||||
import { request } from '@/utils/http';
|
||||
import config from '@/utils/config';
|
||||
|
||||
@@ -22,7 +22,7 @@ const CookieModal = ({
|
||||
let flag = false;
|
||||
for (const coo of cookies) {
|
||||
if (!/pt_key=\S*;\s*pt_pin=\S*;\s*/.test(coo)) {
|
||||
notification.error({ message: `${coo}格式有误` });
|
||||
message.error(`${coo}格式有误`);
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
@@ -37,13 +37,9 @@ const CookieModal = ({
|
||||
data: payload,
|
||||
});
|
||||
if (code === 200) {
|
||||
notification.success({
|
||||
message: cookie ? '更新Cookie成功' : '添加Cookie成功',
|
||||
});
|
||||
message.success(cookie ? '更新Cookie成功' : '添加Cookie成功');
|
||||
} else {
|
||||
notification.error({
|
||||
message: data,
|
||||
});
|
||||
message.error(data);
|
||||
}
|
||||
setLoading(false);
|
||||
handleCancel(cookie ? [data] : data);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { PureComponent, Fragment, useState, useEffect } from 'react';
|
||||
import {
|
||||
Button,
|
||||
notification,
|
||||
message,
|
||||
Modal,
|
||||
Table,
|
||||
Tag,
|
||||
@@ -231,16 +231,12 @@ const Crontab = () => {
|
||||
.delete(`${config.apiPrefix}crons`, { data: [record._id] })
|
||||
.then((data: any) => {
|
||||
if (data.code === 200) {
|
||||
notification.success({
|
||||
message: '删除成功',
|
||||
});
|
||||
message.success('删除成功');
|
||||
const result = [...value];
|
||||
result.splice(index, 1);
|
||||
setValue(result);
|
||||
} else {
|
||||
notification.error({
|
||||
message: data,
|
||||
});
|
||||
message.error(data);
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -274,9 +270,7 @@ const Crontab = () => {
|
||||
});
|
||||
setValue(result);
|
||||
} else {
|
||||
notification.error({
|
||||
message: data,
|
||||
});
|
||||
message.error(data);
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -311,9 +305,7 @@ const Crontab = () => {
|
||||
});
|
||||
setValue(result);
|
||||
} else {
|
||||
notification.error({
|
||||
message: data,
|
||||
});
|
||||
message.error(data);
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -356,9 +348,7 @@ const Crontab = () => {
|
||||
});
|
||||
setValue(result);
|
||||
} else {
|
||||
notification.error({
|
||||
message: data,
|
||||
});
|
||||
message.error(data);
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -484,15 +474,11 @@ const Crontab = () => {
|
||||
.delete(`${config.apiPrefix}crons`, { data: selectedRowIds })
|
||||
.then((data: any) => {
|
||||
if (data.code === 200) {
|
||||
notification.success({
|
||||
message: '批量删除成功',
|
||||
});
|
||||
message.success('批量删除成功');
|
||||
setSelectedRowIds([]);
|
||||
getCrons();
|
||||
} else {
|
||||
notification.error({
|
||||
message: data,
|
||||
});
|
||||
message.error(data);
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -515,9 +501,7 @@ const Crontab = () => {
|
||||
if (data.code === 200) {
|
||||
getCrons();
|
||||
} else {
|
||||
notification.error({
|
||||
message: data,
|
||||
});
|
||||
message.error(data);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { Modal, notification, Input, Form } from 'antd';
|
||||
import { Modal, message, Input, Form } from 'antd';
|
||||
import { request } from '@/utils/http';
|
||||
import config from '@/utils/config';
|
||||
import cronParse from 'cron-parser';
|
||||
@@ -27,13 +27,9 @@ const CronModal = ({
|
||||
data: payload,
|
||||
});
|
||||
if (code === 200) {
|
||||
notification.success({
|
||||
message: cron ? '更新Cron成功' : '添加Cron成功',
|
||||
});
|
||||
message.success(cron ? '更新Cron成功' : '添加Cron成功');
|
||||
} else {
|
||||
notification.error({
|
||||
message: data,
|
||||
});
|
||||
message.error(data);
|
||||
}
|
||||
setLoading(false);
|
||||
handleCancel(data);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { PureComponent, Fragment, useState, useEffect } from 'react';
|
||||
import { Button, notification, Modal } from 'antd';
|
||||
import { Button, message, Modal } from 'antd';
|
||||
import config from '@/utils/config';
|
||||
import { PageContainer } from '@ant-design/pro-layout';
|
||||
import { request } from '@/utils/http';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { PureComponent, Fragment, useState, useEffect } from 'react';
|
||||
import { Button, notification, Modal } from 'antd';
|
||||
import { Button, message, Modal } from 'antd';
|
||||
import config from '@/utils/config';
|
||||
import { PageContainer } from '@ant-design/pro-layout';
|
||||
import { Controlled as CodeMirror } from 'react-codemirror2';
|
||||
@@ -28,9 +28,7 @@ const Crontab = () => {
|
||||
data: { content: value, name: 'extra.sh' },
|
||||
})
|
||||
.then((data) => {
|
||||
notification.success({
|
||||
message: data.msg,
|
||||
});
|
||||
message.success(data.msg);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { PureComponent, Fragment, useState, useEffect } from 'react';
|
||||
import { Button, notification, Modal, TreeSelect } from 'antd';
|
||||
import { Button, message, Modal, TreeSelect } from 'antd';
|
||||
import config from '@/utils/config';
|
||||
import { PageContainer } from '@ant-design/pro-layout';
|
||||
import { Controlled as CodeMirror } from 'react-codemirror2';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { Fragment, useEffect } from 'react';
|
||||
import { Button, Row, Input, Form, notification } from 'antd';
|
||||
import { Button, Row, Input, Form, message } from 'antd';
|
||||
import config from '@/utils/config';
|
||||
import { history, Link } from 'umi';
|
||||
import styles from './index.less';
|
||||
@@ -21,13 +21,9 @@ const Login = () => {
|
||||
localStorage.setItem(config.authKey, data.token);
|
||||
history.push('/crontab');
|
||||
} else if (data.code === 100) {
|
||||
notification.warn({
|
||||
message: data.msg,
|
||||
});
|
||||
message.warn(data.msg);
|
||||
} else {
|
||||
notification.error({
|
||||
message: data.msg,
|
||||
});
|
||||
message.error(data.msg);
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
|
||||
Reference in New Issue
Block a user