Yansen 5 years ago
parent
commit
fbe0db3536
1 changed files with 12 additions and 17 deletions
  1. 12
    17
      src/pages/news/type/NewsType.jsx

+ 12
- 17
src/pages/news/type/NewsType.jsx View File

@@ -4,6 +4,7 @@ import router from 'umi/router';
4 4
 import AuthButton from '@/components/AuthButton';
5 5
 import withActions from '@/components/ActionList';
6 6
 import EditIcon from '@/components/EditIcon';
7
+import { ConfirmButton } from '@/components/ModalButton';
7 8
 import apis from '../../../services/apis';
8 9
 import request from '../../../utils/request'
9 10
 import BuildSelect from '../../../components/SelectButton/BuildSelect';
@@ -58,21 +59,13 @@ function NewsType(props) {
58 59
 
59 60
 
60 61
   const changeNewsStatus = (row, newsId) => () => {
61
-    Modal.confirm({
62
-      title: '确认删除?',
63
-      okText: '确认',
64
-      cancelText: '取消',
65
-      onOk() {
66
-        request({ ...apis.newsType.put, urlData: { id: newsId }, data: { ...row, status: -1 } }).then((data) => {
67
-          message.info('操作成功!')
68
-          getList({ pageNum: 1, pageSize: 10 });
69
-        }).catch((err) => {
70
-          console.log(err)
71
-          message.info(err.msg || err.message)
72
-        })
73
-
74
-      }
75
-    });
62
+    request({ ...apis.newsType.put, urlData: { id: newsId }, data: { ...row, status: -1 } }).then((data) => {
63
+      message.info('操作成功!')
64
+      getList({ pageNum: 1, pageSize: 10 });
65
+    }).catch((err) => {
66
+      console.log(err)
67
+      message.info(err.msg || err.message)
68
+    })
76 69
   }
77 70
   /**
78 71
    *
@@ -102,7 +95,9 @@ function NewsType(props) {
102 95
       align: 'center',
103 96
       render: withActions((x, row) => [
104 97
         <AuthButton name="admin.taNewsType.id.delete" noRight={null}>
105
-          <EditIcon text={row.status === 1 ? '删除' : '上架'} type={row.status === 1 ? 'delete' : 'up'} onClick={changeNewsStatus(row, row.newsTypeId)} />
98
+          <ConfirmButton type="link" title="确认删除?" onClick={changeNewsStatus(row, row.newsTypeId)}>
99
+            <EditIcon text="删除" type="delete" />
100
+          </ConfirmButton>
106 101
         </AuthButton>,
107 102
         <AuthButton name="admin.taNewsType.id.put" noRight={null}>
108 103
           <EditIcon text="编辑" type="edit" onClick={toEditNews(row.newsTypeId)} />
@@ -110,7 +105,7 @@ function NewsType(props) {
110 105
       ]),
111 106
     },
112 107
   ];
113
-  
108
+
114 109
   function handleReset() {
115 110
     props.form.resetFields();
116 111
     getList({ pageNum: 1, pageSize: 10 })