Преглед на файлове

Merge branch 'master' of http://git.ycjcjy.com/zhiyuxing/estateagents-admin-manager

傅行帆 преди 5 години
родител
ревизия
04aae4cbec
променени са 3 файла, в които са добавени 52 реда и са изтрити 28 реда
  1. 14
    17
      src/pages/news/list/NewsList.jsx
  2. 16
    11
      src/pages/news/type/NewsType.jsx
  3. 22
    0
      src/services/apis.js

+ 14
- 17
src/pages/news/list/NewsList.jsx Целия файл

@@ -97,13 +97,12 @@ function body(props) {
97 97
         okText: '确认',
98 98
         cancelText: '取消',
99 99
         onOk() {
100
-          request({
101
-            url: '/api/admin/taNews/' + newsId,
102
-            method: 'DELETE',
103
-            // data: { ...row },
104
-          }).then((data) => {
100
+          request({ ...apis.news.delete, urlData: { id: newsId },}).then((data) => {
105 101
             message.info('操作成功!')
106 102
             getList({ pageNum: 1, pageSize: 10 });
103
+          }).catch((err) => {
104
+            console.log(err)
105
+            message.info(err.msg || err.message)
107 106
           })
108 107
         }
109 108
       });
@@ -127,13 +126,12 @@ function body(props) {
127 126
           okText: '确认',
128 127
           cancelText: '取消',
129 128
           onOk() {
130
-            request({
131
-              url: '/api/admin/taNews/' + newsId,
132
-              method: 'PUT',
133
-              data: { "newsStatus": newsStatus, "buildingId": buildingId, "newsTypeId": newsTypeId },
134
-            }).then((data) => {
129
+            request({ ...apis.news.cancel, data:{"newsStatus": newsStatus, "buildingId": buildingId, "newsTypeId": newsTypeId}, urlData: { id: newsId },}).then((data) => {
135 130
               message.info('操作成功!')
136 131
               getList({ pageNum: 1, pageSize: 10 });
132
+            }).catch((err) => {
133
+              console.log(err)
134
+              message.info(err.msg || err.message)
137 135
             })
138 136
           },
139 137
           onCancel() {
@@ -146,13 +144,12 @@ function body(props) {
146 144
           okText: '确认',
147 145
           cancelText: '取消',
148 146
           onOk() {
149
-            request({
150
-              url: '/api/admin/taNews/' + newsId,
151
-              method: 'PUT',
152
-              data: { "newsStatus": newsStatus, "buildingId": buildingId, "newsTypeId": newsTypeId },
153
-            }).then((data) => {
147
+            request({ ...apis.news.cancel, data:{"newsStatus": newsStatus, "buildingId": buildingId, "newsTypeId": newsTypeId}, urlData: { id: newsId },}).then((data) => {
154 148
               message.info('操作成功!')
155 149
               getList({ pageNum: 1, pageSize: 10 });
150
+            }).catch((err) => {
151
+              console.log(err)
152
+              message.info(err.msg || err.message)
156 153
             })
157 154
           },
158 155
           onCancel() {
@@ -175,11 +172,11 @@ function body(props) {
175 172
                   <Icon type="form" style={{ color: '#C0C4CC', marginLeft: '10px' }} />
176 173
           </span>
177 174
           {data.newsStatus === 0 ?
178
-            <span style={{ position: 'absolute', left: '280px', bottom: ' 0.11rem', fontSize: ' 0.11rem', color: '#FF7E48' }} onClick={cancelRelease.bind(this, data.newsId, 1, data.buildingId, data.newsType.newsTypeId)}>
175
+            <span style={{ position: 'absolute', left: '280px', bottom: ' 0.11rem', fontSize: ' 0.11rem', color: '#FF7E48',zIndex:1 }} onClick={cancelRelease.bind(this, data.newsId, 1, data.buildingId, data.newsType.newsTypeId)}>
179 176
               取消发布
180 177
                 <Icon type="close-circle" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
181 178
             </span> :
182
-            <span style={{ position: 'absolute', left: '280px', bottom: ' 0.11rem', fontSize: ' 0.11rem', color: '#FF7E48' }} onClick={cancelRelease.bind(this, data.newsId, 0, data.buildingId, data.newsType.newsTypeId)}>
179
+            <span style={{ position: 'absolute', left: '280px', bottom: ' 0.11rem', fontSize: ' 0.11rem', color: '#FF7E48',zIndex:1 }} onClick={cancelRelease.bind(this, data.newsId, 0, data.buildingId, data.newsType.newsTypeId)}>
183 180
               发布
184 181
                 <Icon type="form" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
185 182
             </span>

+ 16
- 11
src/pages/news/type/NewsType.jsx Целия файл

@@ -5,7 +5,7 @@ import styles from '../../style/GoodsList.less';
5 5
 import router from 'umi/router';
6 6
 import BuildSelect from '../../../components/SelectButton/BuildSelect';
7 7
 import AuthButton from '@/components/AuthButton';
8
-
8
+import apis from '../../../services/apis';
9 9
 import request from '../../../utils/request'
10 10
 
11 11
 const { Option } = Select;
@@ -21,15 +21,12 @@ function header(props) {
21 21
 
22 22
   // 查询列表
23 23
   const getList = (params) => {
24
-    request({
25
-        url: '/api/admin/taNewsType',
26
-        method: 'GET',
27
-        params: { ...params },
28
-    }).then((data) => {
24
+    request({ ...apis.newsType.list, params: { ...params } }).then((data) => {
29 25
         console.log(data)
30 26
         setData(data)
31 27
     })
32 28
   }
29
+
33 30
   
34 31
   // 提交事件
35 32
   const handleSubmit = (e, props) => {
@@ -63,14 +60,22 @@ function header(props) {
63 60
       okText: '确认',
64 61
       cancelText: '取消',
65 62
       onOk() {
66
-        request({
67
-          url: '/api/admin/taNewsType/' + newsId,
68
-          method: 'DELETE',
69
-          data: { ...row },
70
-        }).then((data) => {
63
+        request({ ...apis.newsType.delete, urlData: { id: newsId },}).then((data) => {
71 64
           message.info('操作成功!')
72 65
           getList({ pageNum: 1, pageSize: 10 });
66
+        }).catch((err) => {
67
+          console.log(err)
68
+          message.info(err.msg || err.message)
73 69
         })
70
+
71
+        // request({
72
+        //   url: '/api/admin/taNewsType/' + newsId,
73
+        //   method: 'DELETE',
74
+        //   data: { ...row },
75
+        // }).then((data) => {
76
+        //   message.info('操作成功!')
77
+        //   getList({ pageNum: 1, pageSize: 10 });
78
+        // })
74 79
       }
75 80
     });
76 81
   }

+ 22
- 0
src/services/apis.js Целия файл

@@ -126,6 +126,28 @@ export default {
126 126
       url: `${prefix}/taNews`,
127 127
       action: 'admin.taNews.get',
128 128
     },
129
+    delete: {
130
+        method: 'DELETE',
131
+        url: `${prefix}/taNews/:id`,
132
+        action: 'admin.taNews.id.delete',
133
+    },
134
+    cancel: {
135
+        method: 'PUT',
136
+        url: `${prefix}/taNews/:id`,
137
+        action: 'admin.taNews.id.put',
138
+    },
139
+  },
140
+  newsType: {
141
+    list: {
142
+        method: 'GET',
143
+        url: `${prefix}/taNewsType`,
144
+        action: 'admin.taNewsType.get',
145
+      },
146
+    delete: {
147
+        method: 'DELETE',
148
+        url: `${prefix}/taNewsType/:id`,
149
+        action: 'admin.taNewsType.id.delete',
150
+    },
129 151
   },
130 152
   customer: {
131 153
     drift: {