|
@@ -63,7 +63,7 @@ function body(props) {
|
63
|
63
|
}
|
64
|
64
|
|
65
|
65
|
// 跳转到编辑资讯列表
|
66
|
|
- const toEditList = (id) => () => {
|
|
66
|
+ const toEditList = (id) => () => {
|
67
|
67
|
router.push({
|
68
|
68
|
pathname: '/news/list/editNewsList',
|
69
|
69
|
query: {
|
|
@@ -74,153 +74,145 @@ function body(props) {
|
74
|
74
|
|
75
|
75
|
|
76
|
76
|
|
77
|
|
-/**
|
78
|
|
- *卡片
|
79
|
|
- *
|
80
|
|
- * @returns
|
81
|
|
- */
|
82
|
|
-function CartBody(props) {
|
83
|
|
- const { data } = props
|
84
|
|
- console.log(data);
|
85
|
|
- const cancelPage = () =>{
|
86
|
|
- router.push({
|
87
|
|
- pathname: '/news/list/NewsList',
|
88
|
|
- });
|
89
|
|
- }
|
90
|
|
-
|
91
|
|
- //删除资讯
|
92
|
|
- const changeNewsListStatus = (newsId) => () => {
|
93
|
|
- Modal.confirm({
|
94
|
|
- title: '确认删除该资讯?',
|
95
|
|
- okText: '确认',
|
96
|
|
- cancelText: '取消',
|
97
|
|
- onOk() {
|
98
|
|
- request({
|
99
|
|
- url: '/api/admin/taNews/' + newsId,
|
100
|
|
- method: 'DELETE',
|
101
|
|
- // data: { ...row },
|
102
|
|
- }).then((data) => {
|
103
|
|
- message.info('操作成功!')
|
104
|
|
- getList({ pageNum: 1, pageSize: 10 });
|
105
|
|
- })
|
106
|
|
- }
|
107
|
|
- });
|
108
|
|
- }
|
109
|
|
-
|
110
|
|
- // 跳转到编辑资讯列表
|
111
|
|
- const toEditList = (newsId) => () => {
|
112
|
|
- router.push({
|
113
|
|
- pathname: '/news/list/editNewsList',
|
114
|
|
- query: {
|
115
|
|
- newsId
|
116
|
|
- },
|
117
|
|
- });
|
118
|
|
- }
|
|
77
|
+ /**
|
|
78
|
+ *卡片
|
|
79
|
+ *
|
|
80
|
+ * @returns
|
|
81
|
+ */
|
|
82
|
+ function CartBody(props) {
|
|
83
|
+ const { data } = props
|
|
84
|
+ console.log(data);
|
|
85
|
+ const cancelPage = () => {
|
|
86
|
+ router.push({
|
|
87
|
+ pathname: '/news/list/NewsList',
|
|
88
|
+ });
|
|
89
|
+ }
|
119
|
90
|
|
120
|
|
- function cancelRelease (newsId, newsStatus, buildingId,newsTypeId) {
|
121
|
|
- console.log("newsId" + newsId + "status" + newsStatus);
|
122
|
|
- if (newsStatus === 1){
|
|
91
|
+ //删除资讯
|
|
92
|
+ const changeNewsListStatus = (newsId) => () => {
|
123
|
93
|
Modal.confirm({
|
124
|
|
- title: '确认取消该资讯?',
|
|
94
|
+ title: '确认删除该资讯?',
|
125
|
95
|
okText: '确认',
|
126
|
96
|
cancelText: '取消',
|
127
|
|
- onOk () {
|
|
97
|
+ onOk() {
|
128
|
98
|
request({
|
129
|
99
|
url: '/api/admin/taNews/' + newsId,
|
130
|
|
- method: 'PUT',
|
131
|
|
- data: { "newsStatus": newsStatus, "buildingId":buildingId, "newsTypeId":newsTypeId },
|
|
100
|
+ method: 'DELETE',
|
|
101
|
+ // data: { ...row },
|
132
|
102
|
}).then((data) => {
|
133
|
103
|
message.info('操作成功!')
|
134
|
104
|
getList({ pageNum: 1, pageSize: 10 });
|
135
|
105
|
})
|
136
|
|
- },
|
137
|
|
- onCancel () {
|
138
|
|
- console.log('Cancel');
|
139
|
|
- },
|
|
106
|
+ }
|
140
|
107
|
});
|
141
|
|
- }else if (newsStatus === 0){
|
142
|
|
- Modal.confirm({
|
143
|
|
- title: '确认发布该资讯?',
|
144
|
|
- okText: '确认',
|
145
|
|
- cancelText: '取消',
|
146
|
|
- onOk () {
|
147
|
|
- request({
|
148
|
|
- url: '/api/admin/taNews/' + newsId,
|
149
|
|
- method: 'PUT',
|
150
|
|
- data: { "newsStatus": newsStatus, "buildingId":buildingId, "newsTypeId":newsTypeId },
|
151
|
|
- }).then((data) => {
|
152
|
|
- message.info('操作成功!')
|
153
|
|
- getList({ pageNum: 1, pageSize: 10 });
|
154
|
|
- })
|
155
|
|
- },
|
156
|
|
- onCancel () {
|
157
|
|
- console.log('Cancel');
|
|
108
|
+ }
|
|
109
|
+
|
|
110
|
+ // 跳转到编辑资讯列表
|
|
111
|
+ const toEditList = (newsId) => () => {
|
|
112
|
+ router.push({
|
|
113
|
+ pathname: '/news/list/editNewsList',
|
|
114
|
+ query: {
|
|
115
|
+ newsId
|
158
|
116
|
},
|
159
|
117
|
});
|
160
|
|
- }
|
161
|
|
- }
|
|
118
|
+ }
|
162
|
119
|
|
163
|
|
- return (
|
164
|
|
- <Card
|
165
|
|
- hoverable
|
166
|
|
- style={{ minWidth: '400px', borderRadius: '12px', margin: '10px', boxShadow: '0px 0px 16px 2px rgba(0,0,0,0.12)' }}
|
167
|
|
- cover={<img alt="example" src={ data.newsImg } style={{ borderRadius: '12px 12px 0 0', width: '100%', height: '14vw' }}></img>}
|
168
|
|
- bodyStyle={{ padding: '10px 20px' }}
|
169
|
|
- >
|
170
|
|
- <p className={Styles.cardText}>
|
171
|
|
- <span className={Styles.title}>资讯类型</span>
|
172
|
|
- <span >:{ data.newsType.newsTypeName }</span>
|
173
|
|
- <span className={Styles.ediText} onClick={toEditList(data.newsId)}>
|
174
|
|
- 编辑
|
|
120
|
+ function cancelRelease(newsId, newsStatus, buildingId, newsTypeId) {
|
|
121
|
+ console.log("newsId" + newsId + "status" + newsStatus);
|
|
122
|
+ if (newsStatus === 1) {
|
|
123
|
+ Modal.confirm({
|
|
124
|
+ title: '确认取消该资讯?',
|
|
125
|
+ okText: '确认',
|
|
126
|
+ cancelText: '取消',
|
|
127
|
+ onOk() {
|
|
128
|
+ request({
|
|
129
|
+ url: '/api/admin/taNews/' + newsId,
|
|
130
|
+ method: 'PUT',
|
|
131
|
+ data: { "newsStatus": newsStatus, "buildingId": buildingId, "newsTypeId": newsTypeId },
|
|
132
|
+ }).then((data) => {
|
|
133
|
+ message.info('操作成功!')
|
|
134
|
+ getList({ pageNum: 1, pageSize: 10 });
|
|
135
|
+ })
|
|
136
|
+ },
|
|
137
|
+ onCancel() {
|
|
138
|
+ console.log('Cancel');
|
|
139
|
+ },
|
|
140
|
+ });
|
|
141
|
+ } else if (newsStatus === 0) {
|
|
142
|
+ Modal.confirm({
|
|
143
|
+ title: '确认发布该资讯?',
|
|
144
|
+ okText: '确认',
|
|
145
|
+ cancelText: '取消',
|
|
146
|
+ onOk() {
|
|
147
|
+ request({
|
|
148
|
+ url: '/api/admin/taNews/' + newsId,
|
|
149
|
+ method: 'PUT',
|
|
150
|
+ data: { "newsStatus": newsStatus, "buildingId": buildingId, "newsTypeId": newsTypeId },
|
|
151
|
+ }).then((data) => {
|
|
152
|
+ message.info('操作成功!')
|
|
153
|
+ getList({ pageNum: 1, pageSize: 10 });
|
|
154
|
+ })
|
|
155
|
+ },
|
|
156
|
+ onCancel() {
|
|
157
|
+ console.log('Cancel');
|
|
158
|
+ },
|
|
159
|
+ });
|
|
160
|
+ }
|
|
161
|
+ }
|
|
162
|
+
|
|
163
|
+ return (
|
|
164
|
+ <Card
|
|
165
|
+ hoverable
|
|
166
|
+ style={{ height: '255px', minWidth: '640px', borderRadius: '12px', margin: '10px', boxShadow: '0px 0px 16px 2px rgba(0,0,0,0.12)', position: 'relative' }}
|
|
167
|
+ cover={<img alt="example" src={data.newsImg} style={{ borderRadius: '12px 0 0 12px', width: '260px', height: '253px' }}></img>}
|
|
168
|
+ bodyStyle={{ padding: '10px 20px' }}
|
|
169
|
+ >
|
|
170
|
+ <span style={{ position: 'absolute', right: '20px', top: '20px', fontSize: '18px', color: '#FF7E48' }} onClick={toEditList(data.newsId)}>
|
|
171
|
+ 编辑
|
175
|
172
|
<Icon type="form" style={{ color: '#C0C4CC', marginLeft: '10px' }} />
|
176
|
|
- </span>
|
177
|
|
- </p>
|
178
|
|
- <p className={Styles.cardText}>
|
179
|
|
- <span className={Styles.title}>状态</span>
|
180
|
|
- <span >:{ data.newsStatus == 0 ? "已发布" : "未发布" }</span>
|
181
|
|
- </p>
|
182
|
|
- <p className={Styles.cardItem}>
|
183
|
|
- <span className={Styles.title}>阅读数量</span>
|
184
|
|
- <span > :{ data.pvNum }</span>
|
185
|
|
- </p>
|
186
|
|
- <p className={Styles.cardItem}>
|
187
|
|
- <span className={Styles.title}>转发数量</span>
|
188
|
|
- <span>:{ data.shareNum }</span>
|
189
|
|
- </p>
|
190
|
|
- <p className={Styles.cardItem}>
|
191
|
|
- <span className={Styles.title}>点赞数量</span>
|
192
|
|
- <span >:{ data.favorNum }</span>
|
193
|
|
- </p>
|
194
|
|
- <p className={Styles.cardItem}>
|
195
|
|
- <span className={Styles.title}>收藏数量</span>
|
196
|
|
- <span >:{ data.saveNum }</span>
|
197
|
|
- </p>
|
198
|
|
- <p className={Styles.cardItem}>
|
199
|
|
- <span className={Styles.title}>录入时间</span>
|
200
|
|
- <span >:{ data.createDate }</span>
|
201
|
|
- </p>
|
202
|
|
- <p style={{ margin: '15px 0', position: 'relative', fontSize: '18px' }}>
|
203
|
|
- {data.newsStatus === 0 ?
|
204
|
|
- <span style={{ color: '#1990FF' }} onClick={cancelRelease.bind(this,data.newsId, 1, data.buildingId, data.newsType.newsTypeId)}>
|
205
|
|
- 取消发布
|
|
173
|
+ </span>
|
|
174
|
+ {data.newsStatus === 0 ?
|
|
175
|
+ <span style={{ position: 'absolute', left: '280px', bottom: '18px', fontSize: '18px', color: '#FF7E48' }} onClick={cancelRelease.bind(this, data.newsId, 1, data.buildingId, data.newsType.newsTypeId)}>
|
|
176
|
+ 取消发布
|
206
|
177
|
<Icon type="close-circle" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
|
207
|
|
- </span>:
|
208
|
|
- <span style={{ color: '#1990FF' }} onClick={cancelRelease.bind(this,data.newsId, 0, data.buildingId, data.newsType.newsTypeId)}>
|
209
|
|
- 发布
|
|
178
|
+ </span> :
|
|
179
|
+ <span style={{ position: 'absolute', left: '280px', bottom: '18px', fontSize: '18px', color: '#FF7E48' }} onClick={cancelRelease.bind(this, data.newsId, 0, data.buildingId, data.newsType.newsTypeId)}>
|
|
180
|
+ 发布
|
210
|
181
|
<Icon type="close-circle" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
|
211
|
|
- </span>
|
212
|
|
- }
|
213
|
|
-
|
214
|
|
- <span style={{
|
215
|
|
- color: '#FF4A4A', position: 'absolute', right: '0',
|
216
|
|
- }} onClick={changeNewsListStatus(data.newsId)}>
|
217
|
|
- 删除
|
|
182
|
+ </span>
|
|
183
|
+ }
|
|
184
|
+
|
|
185
|
+ <span style={{ position: 'absolute', right: '20px', bottom: '18px', fontSize: '18px', color: '#FF7E48' }} onClick={changeNewsListStatus(data.newsId)}>
|
|
186
|
+ 删除
|
218
|
187
|
<Icon type="rest" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
|
219
|
|
- </span>
|
220
|
|
- </p>
|
221
|
|
- </Card>
|
222
|
|
- )
|
223
|
|
-}
|
|
188
|
+ </span>
|
|
189
|
+ <div style={{ position: 'absolute', left: '260px', top: '0px', padding: '20px' }}>
|
|
190
|
+ <p style={{
|
|
191
|
+ fontSize: '18px', color: '#333', fontWeight: '600', marginBottom: '10px', overflow: 'hidden',
|
|
192
|
+ textOverflow: 'ellipsis',
|
|
193
|
+ whiteSpace: 'nowrap',
|
|
194
|
+ width: '300px',
|
|
195
|
+ }}>{data.newsName}</p>
|
|
196
|
+ <p style={{ fontSize: '18px', color: '#555', marginBottom: '10px' }}>
|
|
197
|
+ <span style={{ display: 'inline-block', width: '190px' }}>咨询类型:{data.newsType.newsTypeName}</span>
|
|
198
|
+ <span>状态:{data.newsStatus == 0 ? "已发布" : "未发布"}</span>
|
|
199
|
+ </p>
|
|
200
|
+
|
|
201
|
+ <p style={{ fontSize: '18px', color: '#555', marginBottom: '10px' }}>
|
|
202
|
+ <span style={{ display: 'inline-block', width: '190px' }}>阅读数量:{data.pvNum}</span>
|
|
203
|
+ <span>转发数量:{data.shareNum}</span>
|
|
204
|
+ </p>
|
|
205
|
+
|
|
206
|
+ <p style={{ fontSize: '18px', color: '#555', marginBottom: '10px' }}>
|
|
207
|
+ <span style={{ display: 'inline-block', width: '190px' }}>点赞数量:{data.favorNum}</span>
|
|
208
|
+ <span>收藏数量:{data.saveNum}</span>
|
|
209
|
+ </p>
|
|
210
|
+
|
|
211
|
+ <p style={{ fontSize: '18px', color: '#999', marginBottom: '10px' }}>发布时间:{data.createDate}</p>
|
|
212
|
+ </div>
|
|
213
|
+ </Card>
|
|
214
|
+ )
|
|
215
|
+ }
|
224
|
216
|
|
225
|
217
|
|
226
|
218
|
// Change 事件
|
|
@@ -232,7 +224,7 @@ function CartBody(props) {
|
232
|
224
|
// 分页
|
233
|
225
|
function onChange(pageNumber) {
|
234
|
226
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
235
|
|
- getList({ pageNum: pageNumber, pageSize: 6 })
|
|
227
|
+ getList({ pageNum: pageNumber, pageSize: 6 })
|
236
|
228
|
}
|
237
|
229
|
|
238
|
230
|
function getDate(value, dateString) {
|
|
@@ -246,27 +238,27 @@ function CartBody(props) {
|
246
|
238
|
|
247
|
239
|
<Form.Item>
|
248
|
240
|
{getFieldDecorator('cityId')(
|
249
|
|
- <SelectCity />,
|
|
241
|
+ <SelectCity />,
|
250
|
242
|
)}
|
251
|
243
|
</Form.Item>
|
252
|
244
|
<Form.Item>
|
253
|
245
|
{getFieldDecorator('buildingId')(
|
254
|
|
- <BuildSelect />,
|
255
|
|
- )}
|
|
246
|
+ <BuildSelect />,
|
|
247
|
+ )}
|
256
|
248
|
</Form.Item>
|
257
|
|
- <Form.Item>
|
|
249
|
+ {/* <Form.Item>
|
258
|
250
|
{getFieldDecorator('title')(
|
259
|
251
|
<Input
|
260
|
252
|
prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
|
261
|
253
|
placeholder="请输入标题"
|
262
|
254
|
/>,
|
263
|
255
|
)}
|
264
|
|
- </Form.Item>
|
|
256
|
+ </Form.Item> */}
|
265
|
257
|
<Form.Item>
|
266
|
258
|
{getFieldDecorator('newsTypeId')(
|
267
|
259
|
<NewsTypeSelect />,
|
268
|
260
|
)}
|
269
|
|
- </Form.Item>
|
|
261
|
+ </Form.Item>
|
270
|
262
|
<Form.Item>
|
271
|
263
|
{getFieldDecorator('newsStatus')(
|
272
|
264
|
<Select style={{ width: '180px' }} placeholder="状态">
|
|
@@ -276,12 +268,12 @@ function CartBody(props) {
|
276
|
268
|
)}
|
277
|
269
|
</Form.Item>
|
278
|
270
|
<Form.Item>
|
279
|
|
- <Button type="primary" htmlType="submit" className={Styles.SubmitButton}>
|
|
271
|
+ <Button type="primary" htmlType="submit" >
|
280
|
272
|
搜索
|
281
|
273
|
</Button>
|
282
|
274
|
</Form.Item>
|
283
|
275
|
</Form>
|
284
|
|
- <Button type="primary" className={Styles.addButton} onClick={toEditList()}>
|
|
276
|
+ <Button type="danger" style={{ padding: '0 40px', margin: '20px 0' }} onClick={toEditList()}>
|
285
|
277
|
新增
|
286
|
278
|
</Button>
|
287
|
279
|
|
|
@@ -289,10 +281,10 @@ function CartBody(props) {
|
289
|
281
|
<Row style={{ padding: ' 0 10px' }}>
|
290
|
282
|
{
|
291
|
283
|
dataSource.records.map((item, index) => (
|
292
|
|
- <Col span={8}>
|
293
|
|
- <CartBody data={item} key={item.buildingId}/>
|
294
|
|
- </Col>
|
295
|
|
- ))
|
|
284
|
+ <Col span={12}>
|
|
285
|
+ <CartBody data={item} key={item.buildingId} />
|
|
286
|
+ </Col>
|
|
287
|
+ ))
|
296
|
288
|
}
|
297
|
289
|
</Row>
|
298
|
290
|
{/* 分页 */}
|