Ver código fonte

删除资讯

魏超 5 anos atrás
pai
commit
1fd4ffc871
1 arquivos alterados com 4 adições e 4 exclusões
  1. 4
    4
      src/pages/news/type/NewsType.jsx

+ 4
- 4
src/pages/news/type/NewsType.jsx Ver arquivo

56
   }
56
   }
57
 
57
 
58
   
58
   
59
-  const changeNewsStatus = (row) => () => {
59
+  const changeNewsStatus = (row, newsId) => () => {
60
     Modal.confirm({
60
     Modal.confirm({
61
       title: '确认删除该商品?',
61
       title: '确认删除该商品?',
62
       okText: '确认',
62
       okText: '确认',
63
       cancelText: '取消',
63
       cancelText: '取消',
64
       onOk() {
64
       onOk() {
65
         request({
65
         request({
66
-          url: '/api/admin/taNewsType',
67
-          method: 'PUT',
66
+          url: '/api/admin/taNewsType/' + newsId,
67
+          method: 'DELETE',
68
           data: { ...row },
68
           data: { ...row },
69
         }).then((data) => {
69
         }).then((data) => {
70
           message.info('操作成功!')
70
           message.info('操作成功!')
99
       dataIndex: 'handle',
99
       dataIndex: 'handle',
100
       key: 'handle',
100
       key: 'handle',
101
       align: 'center',
101
       align: 'center',
102
-      render: (x, row) => <><span style={{ color: '#EF273A', marginRight: '20px' }} onClick={changeNewsStatus(row)}>{row.status == 1 ? '下架' : '上架'}<Icon type="shopping-cart" className={styles.shoppingCart} />
102
+      render: (x, row) => <><span style={{ color: '#EF273A', marginRight: '20px' }} onClick={changeNewsStatus(row, row.newsTypeId)}>{row.status == 1 ? '删除' : '上架'}<Icon type="shopping-cart" className={styles.shoppingCart} />
103
                             </span><span style={{ color: '#FF925C' }} onClick={toEditNews(row.newsTypeId)}>编辑<Icon type="form" className={styles.edit} /></span></>,
103
                             </span><span style={{ color: '#FF925C' }} onClick={toEditNews(row.newsTypeId)}>编辑<Icon type="form" className={styles.edit} /></span></>,
104
     },
104
     },
105
   ];
105
   ];