|
@@ -3,6 +3,8 @@ import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagina
|
3
|
3
|
import { FormattedMessage } from 'umi-plugin-react/locale';
|
4
|
4
|
import styles from '../style/GoodsList.less';
|
5
|
5
|
import router from 'umi/router';
|
|
6
|
+import moment from 'moment';
|
|
7
|
+import SelectCity from '../../components/SelectButton/CitySelect'
|
6
|
8
|
|
7
|
9
|
import request from '../../utils/request'
|
8
|
10
|
|
|
@@ -52,84 +54,155 @@ const columns = [
|
52
|
54
|
},
|
53
|
55
|
{
|
54
|
56
|
title: '活动时间',
|
55
|
|
- dataIndex: 'name',
|
56
|
|
- key: 'name',
|
|
57
|
+ dataIndex: 'startDate',
|
|
58
|
+ key: 'startDate',
|
57
|
59
|
align: 'center',
|
|
60
|
+ render: (x, row) => <><span>{`${moment(row.startDate).format('YYYY-MM-DD')} —— ${moment(row.endDate).format('YYYY-MM-DD')}`}</span></>
|
58
|
61
|
},
|
59
|
62
|
{
|
60
|
63
|
title: '已参加人数',
|
61
|
|
- dataIndex: 'integral',
|
62
|
|
- key: 'integral',
|
|
64
|
+ dataIndex: 'count',
|
|
65
|
+ key: 'count',
|
63
|
66
|
align: 'center',
|
64
|
67
|
},
|
65
|
68
|
{
|
66
|
69
|
title: '阅读量',
|
67
|
|
- dataIndex: 'total',
|
68
|
|
- key: 'total',
|
|
70
|
+ dataIndex: 'pvNum',
|
|
71
|
+ key: 'pvNum',
|
69
|
72
|
align: 'center',
|
70
|
73
|
},
|
71
|
74
|
{
|
72
|
75
|
title: '转发量',
|
73
|
|
- dataIndex: 'exchanged',
|
74
|
|
- key: 'exchanged',
|
|
76
|
+ dataIndex: 'shareNum',
|
|
77
|
+ key: 'shareNum',
|
75
|
78
|
align: 'center',
|
76
|
79
|
},
|
77
|
80
|
{
|
78
|
81
|
title: '收藏数',
|
79
|
|
- dataIndex: 'rest',
|
80
|
|
- key: 'rest',
|
|
82
|
+ dataIndex: 'saveNum',
|
|
83
|
+ key: 'saveNum',
|
81
|
84
|
align: 'center',
|
82
|
85
|
},
|
83
|
86
|
{
|
84
|
87
|
title: '状态',
|
85
|
|
- dataIndex: 'state',
|
86
|
|
- key: 'state',
|
|
88
|
+ dataIndex: 'isEnlist',
|
|
89
|
+ key: 'isEnlist',
|
87
|
90
|
align: 'center',
|
|
91
|
+ render: (isEnlist)=> <><span>{isEnlist == 0 ?"未开始" : isEnlist==1 ? "进行中" : "已结束"}</span></>
|
88
|
92
|
},
|
89
|
93
|
{
|
90
|
94
|
title: '操作',
|
91
|
95
|
dataIndex: 'handle',
|
92
|
96
|
key: 'handle',
|
93
|
97
|
align: 'center',
|
94
|
|
- render: () => <><span style={{ color: '#1990FF', marginRight: '20px' }} onClick={confirm}>下架<Icon type="shopping-cart" className={styles.shoppingCart} /></span><span style={{ color: '#FF925C' }}>编辑<Icon type="form" className={styles.edit} /></span></>,
|
|
98
|
+ render: (x,row) => <><span style={{ color: '#1990FF'}} onClick={getSignList.bind(this, row.dynamicId)}>{row.isEnlist == '1' || row.isEnlist == '2' ? "报名记录" : ""}<Icon type="snippets" className={styles.shoppingCart} /></span>
|
|
99
|
+ <span style={{ color: '#1990FF' }} onClick={sendOrPublicDynamic.bind(this,row)}>{ row.status === 1 ? '取消发布' : '发布' }<Icon type="close-circle" className={styles.edit} /></span>
|
|
100
|
+ <span style={{ color: '#1990FF' }} onClick={finishDynamic.bind(this,row)}>结束活动<Icon type="poweroff" className={styles.edit} /></span>
|
|
101
|
+ <span style={{ color: '#1990FF', marginRight: '20px' }} onClick={topDynamic.bind(this,row)}>{ row.weight === 1 ? '取消置顶' : '置顶' }<Icon type="vertical-align-top" className={styles.edit} /></span>
|
|
102
|
+ <span style={{ color: '#FF925C' }}>编辑<Icon type="form" className={styles.edit} /></span>
|
|
103
|
+ </>
|
95
|
104
|
},
|
96
|
105
|
];
|
97
|
|
-const confirm = () => {
|
98
|
|
- Modal.confirm({
|
99
|
|
- title: '确认下架该商品?',
|
100
|
|
- okText: '确认',
|
101
|
|
- cancelText: '取消',
|
102
|
|
- onOk() {
|
103
|
|
- console.log('OK');
|
104
|
|
- },
|
105
|
|
- onCancel() {
|
106
|
|
- console.log('Cancel');
|
107
|
|
- },
|
108
|
|
- });
|
109
|
106
|
|
|
107
|
+const getSignList = (dynamicId) => {
|
|
108
|
+ router.push({
|
|
109
|
+ pathname: '/activity/SignList',
|
|
110
|
+ query: {
|
|
111
|
+ dynamicId
|
|
112
|
+ },
|
|
113
|
+ });
|
110
|
114
|
}
|
111
|
115
|
|
112
|
|
-const header = (props) => {
|
113
|
|
- const [ data, setData ] = useState({})
|
114
|
|
-// const [page, changePage] = useState({})
|
|
116
|
+const finishDynamic = (row) => {
|
|
117
|
+ Modal.confirm({
|
|
118
|
+ title: '结束以后将无法编辑, 是否继续?',
|
|
119
|
+ okText: '确定',
|
|
120
|
+ cancelText: '取消',
|
|
121
|
+ onOk() {
|
|
122
|
+ request({
|
|
123
|
+ url: '/api/admin/buildingDynamic/finish',
|
|
124
|
+ method: 'PUT',
|
|
125
|
+ data: {dynamicId: row.dynamicId, top: ""},
|
|
126
|
+ }).then((data) => {
|
|
127
|
+ console.log(data)
|
|
128
|
+ message.info('操作成功!')
|
|
129
|
+ // getList()
|
|
130
|
+ }).catch((err) => {
|
|
131
|
+ console.log(err)
|
|
132
|
+ message.info(err.msg || err.message)
|
|
133
|
+ })
|
|
134
|
+ },
|
|
135
|
+ });
|
|
136
|
+}
|
115
|
137
|
|
116
|
|
- useEffect(() => {
|
|
138
|
+const topDynamic = (row) => {
|
|
139
|
+ const weight = Math.abs(row.weight - 1)
|
117
|
140
|
request({
|
118
|
|
- url: '/api/admin/iBuildingDynamicList',
|
119
|
|
- method: 'GET',
|
120
|
|
- params: {pageNum: 1,pageSize: 10},
|
|
141
|
+ url: '/api/admin/buildingDynamic/weight',
|
|
142
|
+ method: 'PUT',
|
|
143
|
+ params: {dynamicId: row.dynamicId, weight},
|
121
|
144
|
}).then((data) => {
|
122
|
145
|
console.log(data)
|
123
|
|
- setData(data)
|
|
146
|
+ message.info('操作成功!')
|
|
147
|
+ // getList()
|
|
148
|
+ }).catch((err) => {
|
|
149
|
+ console.log(err)
|
|
150
|
+ message.info(err.msg || err.message)
|
|
151
|
+ })
|
|
152
|
+}
|
|
153
|
+
|
|
154
|
+const sendOrPublicDynamic = (row) => {
|
|
155
|
+ if (row.status === 1) {
|
|
156
|
+ cancelDynamic(row)
|
|
157
|
+ } else {
|
|
158
|
+ sendDynamic(row)
|
|
159
|
+ }
|
|
160
|
+}
|
|
161
|
+
|
|
162
|
+// 取消活动
|
|
163
|
+const cancelDynamic = (row) => {
|
|
164
|
+ request({
|
|
165
|
+ url: '/api/admin/buildingDynamic/cancel/'+row.dynamicId,
|
|
166
|
+ method: 'PUT',
|
|
167
|
+ }).then((data) => {
|
|
168
|
+ message.info('操作成功!')
|
|
169
|
+ // getList()
|
|
170
|
+ }).catch((err) => {
|
|
171
|
+ console.log(err)
|
|
172
|
+ message.info(err.msg || err.message)
|
|
173
|
+ })
|
|
174
|
+}
|
|
175
|
+
|
|
176
|
+//发布活动
|
|
177
|
+const sendDynamic = (row) => {
|
|
178
|
+ request({
|
|
179
|
+ url: '/api/admin/buildingDynamic/send/'+row.dynamicId,
|
|
180
|
+ method: 'PUT',
|
|
181
|
+ }).then((data) => {
|
|
182
|
+ message.info('操作成功!')
|
|
183
|
+ // getList()
|
|
184
|
+ }).catch((err) => {
|
|
185
|
+ console.log(err)
|
|
186
|
+ message.info(err.msg || err.message)
|
124
|
187
|
})
|
|
188
|
+}
|
|
189
|
+
|
|
190
|
+const header = (props) => {
|
|
191
|
+ const [ data, setData ] = useState({})
|
|
192
|
+// const [page, changePage] = useState({})
|
|
193
|
+
|
|
194
|
+ useEffect(() => {
|
|
195
|
+ getList();
|
125
|
196
|
},[])
|
126
|
197
|
|
|
198
|
+ // 查询列表
|
127
|
199
|
const getList = (e) => {
|
128
|
200
|
request({
|
129
|
|
- url: '/api/xxx',
|
|
201
|
+ url: '/api/admin/iBuildingDynamicList',
|
130
|
202
|
method: 'GET',
|
131
|
|
- params: {},
|
|
203
|
+ params: {pageNum: 1,pageSize: 10},
|
132
|
204
|
}).then((data) => {
|
|
205
|
+ console.log(data)
|
133
|
206
|
setData(data)
|
134
|
207
|
})
|
135
|
208
|
}
|
|
@@ -141,10 +214,7 @@ const header = (props) => {
|
141
|
214
|
<Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
|
142
|
215
|
<Form.Item>
|
143
|
216
|
{getFieldDecorator('goodState')(
|
144
|
|
- <Select style={{ width: '180px' }} placeholder="请选择城市" onChange={handleSelectChange}>
|
145
|
|
- <Option value="1">上架</Option>
|
146
|
|
- <Option value="0">下架</Option>
|
147
|
|
- </Select>,
|
|
217
|
+ <SelectCity />,
|
148
|
218
|
)}
|
149
|
219
|
</Form.Item>
|
150
|
220
|
<Form.Item>
|
|
@@ -164,16 +234,16 @@ const header = (props) => {
|
164
|
234
|
)}
|
165
|
235
|
</Form.Item>
|
166
|
236
|
<Form.Item>
|
167
|
|
- {getFieldDecorator('goodState')(
|
168
|
|
- <Select style={{ width: '180px' }} placeholder="是否报名" onChange={handleSelectChange}>
|
169
|
|
- <Option value="1">上架</Option>
|
170
|
|
- <Option value="0">下架</Option>
|
171
|
|
- </Select>,
|
|
237
|
+ {getFieldDecorator('min')(
|
|
238
|
+ <DatePicker />
|
172
|
239
|
)}
|
173
|
240
|
</Form.Item>
|
174
|
241
|
<Form.Item>
|
175
|
|
- {getFieldDecorator('min')(
|
176
|
|
- <DatePicker />
|
|
242
|
+ {getFieldDecorator('goodState')(
|
|
243
|
+ <Select style={{ width: '180px' }} placeholder="是否报名" onChange={handleSelectChange}>
|
|
244
|
+ <Option value="1">已报名</Option>
|
|
245
|
+ <Option value="0">未报名</Option>
|
|
246
|
+ </Select>,
|
177
|
247
|
)}
|
178
|
248
|
</Form.Item>
|
179
|
249
|
<Form.Item>
|
|
@@ -184,10 +254,6 @@ const header = (props) => {
|
184
|
254
|
</Form>
|
185
|
255
|
<Button type="primary" className={styles.addBtn} onClick={toEditGoods}>新增</Button>
|
186
|
256
|
<Table dataSource={data.list} columns={columns} />
|
187
|
|
- {/* 分页 */
|
188
|
|
- /* <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
|
189
|
|
- <Pagination showQuickJumper defaultCurrent={1} total={500} onChange={onChange} />
|
190
|
|
- </div> */}
|
191
|
257
|
</>
|
192
|
258
|
)
|
193
|
259
|
}
|