|
@@ -1,4 +1,4 @@
|
|
-import { Button, message } from 'antd';
|
|
|
|
|
|
+import {Button, message, Modal} from 'antd';
|
|
import React, {useEffect, useState} from 'react';
|
|
import React, {useEffect, useState} from 'react';
|
|
import { PageHeaderWrapper } from '@ant-design/pro-layout';
|
|
import { PageHeaderWrapper } from '@ant-design/pro-layout';
|
|
import { useSingleState } from 'nice-hooks';
|
|
import { useSingleState } from 'nice-hooks';
|
|
@@ -7,6 +7,7 @@ import UpdateForm from '@/pages/Memory/components/UpdateForm';
|
|
import { TableListItem } from '../MemoryList/data.d';
|
|
import { TableListItem } from '../MemoryList/data.d';
|
|
import service from './service';
|
|
import service from './service';
|
|
import styles from './index.less';
|
|
import styles from './index.less';
|
|
|
|
+import {ExclamationCircleOutlined} from "@ant-design/icons/lib";
|
|
|
|
|
|
enum Step {
|
|
enum Step {
|
|
MAIN = 0,
|
|
MAIN = 0,
|
|
@@ -23,6 +24,8 @@ interface State {
|
|
const TableList: React.FC<{}> = () => {
|
|
const TableList: React.FC<{}> = () => {
|
|
const [btnDisable, setBtnDisable] = useState(false);
|
|
const [btnDisable, setBtnDisable] = useState(false);
|
|
|
|
|
|
|
|
+ const { confirm } = Modal;
|
|
|
|
+
|
|
const [state, setState] = useSingleState<State>({
|
|
const [state, setState] = useSingleState<State>({
|
|
remindCount: 0,
|
|
remindCount: 0,
|
|
step: Step.MAIN, // 0 主页,1 复习,2 添加
|
|
step: Step.MAIN, // 0 主页,1 复习,2 添加
|
|
@@ -242,7 +245,20 @@ const TableList: React.FC<{}> = () => {
|
|
type="primary"
|
|
type="primary"
|
|
disabled={btnDisable}
|
|
disabled={btnDisable}
|
|
onClick={async () => {
|
|
onClick={async () => {
|
|
- memoryRes(await service.delete(memory));
|
|
|
|
|
|
+ confirm({
|
|
|
|
+ title: '确定删除吗?',
|
|
|
|
+ icon: <ExclamationCircleOutlined />,
|
|
|
|
+ content: '删除后无法恢复',
|
|
|
|
+ okText: '确定',
|
|
|
|
+ okType: 'danger',
|
|
|
|
+ cancelText: '取消',
|
|
|
|
+ async onOk() {
|
|
|
|
+ memoryRes(await service.delete(memory));
|
|
|
|
+ },
|
|
|
|
+ onCancel() {
|
|
|
|
+ console.log('Cancel');
|
|
|
|
+ },
|
|
|
|
+ });
|
|
}}
|
|
}}
|
|
>
|
|
>
|
|
删除
|
|
删除
|