Bladeren bron

资讯发布

魏超 5 jaren geleden
bovenliggende
commit
4978d89102
2 gewijzigde bestanden met toevoegingen van 37 en 7 verwijderingen
  1. 34
    4
      src/pages/news/list/NewsList.jsx
  2. 3
    3
      src/pages/news/list/editNewsList.jsx

+ 34
- 4
src/pages/news/list/NewsList.jsx Bestand weergeven

@@ -21,7 +21,7 @@ const tempDate = [{ code: 's101' }]
21 21
  */
22 22
 function CartBody(props) {
23 23
   const { data } = props
24
-
24
+  console.log(data);
25 25
   const cancelPage = () =>{
26 26
     router.push({
27 27
       pathname: '/news/list/NewsList',
@@ -66,6 +66,29 @@ function CartBody(props) {
66 66
         newsId
67 67
       },
68 68
     });
69
+  } 
70
+
71
+  function cancelRelease (newsId, newsStatus, buildingId,newsTypeId) {
72
+    console.log("newsId" + newsId + "status" + newsStatus);
73
+    Modal.confirm({
74
+      title: '确认发布或取消该资讯?',
75
+      okText: '确认',
76
+      cancelText: '取消',
77
+      onOk () {
78
+        request({
79
+          url: '/api/admin/taNews/' + newsId,
80
+          method: 'PUT',
81
+          data: { "newsStatus": newsStatus, "buildingId":buildingId, "newsTypeId":newsTypeId },
82
+        }).then((data) => {
83
+          message.info('操作成功!')
84
+          getList({ pageNum: 1, pageSize: 10 });
85
+        })
86
+      },
87
+      onCancel () {
88
+        console.log('Cancel');
89
+      },
90
+    });
91
+  
69 92
   }
70 93
 
71 94
   return (
@@ -108,10 +131,17 @@ function CartBody(props) {
108 131
               <span >:{ data.createDate }</span>
109 132
             </p>
110 133
             <p style={{ margin: '15px 0', position: 'relative', fontSize: '18px' }}>
111
-              <span style={{ color: '#1990FF' }}>
112
-                取消发布
113
-                <Icon type="close-circle" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
134
+              {data.newsStatus === 0 ? 
135
+              <span style={{ color: '#1990FF' }} onClick={cancelRelease.bind(this,data.newsId, 1, data.buildingId, data.newsType.newsTypeId)}>
136
+              取消发布
137
+              <Icon type="close-circle" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
138
+              </span>:
139
+              <span style={{ color: '#1990FF' }} onClick={cancelRelease.bind(this,data.newsId, 0, data.buildingId, data.newsType.newsTypeId)}>
140
+              发布
141
+              <Icon type="close-circle" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
114 142
               </span>
143
+              }
144
+              
115 145
               <span style={{
116 146
                 color: '#FF4A4A', position: 'absolute', right: '0',
117 147
               }} onClick={changeNewsListStatus(data.newsId)}>

+ 3
- 3
src/pages/news/list/editNewsList.jsx Bestand weergeven

@@ -90,10 +90,10 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
90 90
   
91 91
     const handleSubmit = val => { 
92 92
       let {...submitValue} = val
93
-      if(dynamicId){
94
-        submitValue.dynamicId = dynamicId
93
+      if(newsId){
94
+        submitValue.newsId = newsId
95 95
         request({
96
-          url: '/api/admin/buildingDynamic/update',
96
+          url: '/api/admin/taNews/' + newsId,
97 97
           method: 'PUT',
98 98
           data: submitValue,
99 99
         }).then((data) => {