|
@@ -12,171 +12,6 @@ import request from '../../utils/request'
|
12
|
12
|
const { Option } = Select;
|
13
|
13
|
const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
|
14
|
14
|
|
15
|
|
-// 跳转到编辑商品
|
16
|
|
-function toEditGoods() {
|
17
|
|
- router.push({
|
18
|
|
- pathname: '/activity/editActivity',
|
19
|
|
- query: {
|
20
|
|
- a: 'b',
|
21
|
|
- },
|
22
|
|
- });
|
23
|
|
-}
|
24
|
|
-
|
25
|
|
-/**
|
26
|
|
- *
|
27
|
|
- *
|
28
|
|
- * @param {*} props
|
29
|
|
- * @returns
|
30
|
|
- */
|
31
|
|
-
|
32
|
|
-const columns = [
|
33
|
|
- {
|
34
|
|
- title: '活动标题',
|
35
|
|
- dataIndex: 'title',
|
36
|
|
- key: 'title',
|
37
|
|
- align: 'center',
|
38
|
|
- },
|
39
|
|
- {
|
40
|
|
- title: '活动时间',
|
41
|
|
- dataIndex: 'startDate',
|
42
|
|
- key: 'startDate',
|
43
|
|
- align: 'center',
|
44
|
|
- render: (x, row) => <><span>{`${moment(row.startDate).format('YYYY-MM-DD')} —— ${moment(row.endDate).format('YYYY-MM-DD')}`}</span></>
|
45
|
|
- },
|
46
|
|
- {
|
47
|
|
- title: '已参加人数',
|
48
|
|
- dataIndex: 'count',
|
49
|
|
- key: 'count',
|
50
|
|
- align: 'center',
|
51
|
|
- },
|
52
|
|
- {
|
53
|
|
- title: '阅读量',
|
54
|
|
- dataIndex: 'pvNum',
|
55
|
|
- key: 'pvNum',
|
56
|
|
- align: 'center',
|
57
|
|
- },
|
58
|
|
- {
|
59
|
|
- title: '转发量',
|
60
|
|
- dataIndex: 'shareNum',
|
61
|
|
- key: 'shareNum',
|
62
|
|
- align: 'center',
|
63
|
|
- },
|
64
|
|
- {
|
65
|
|
- title: '收藏数',
|
66
|
|
- dataIndex: 'saveNum',
|
67
|
|
- key: 'saveNum',
|
68
|
|
- align: 'center',
|
69
|
|
- },
|
70
|
|
- {
|
71
|
|
- title: '状态',
|
72
|
|
- dataIndex: 'isEnlist',
|
73
|
|
- key: 'isEnlist',
|
74
|
|
- align: 'center',
|
75
|
|
- render: (isEnlist)=> <><span>{isEnlist == 0 ?"未开始" : isEnlist==1 ? "进行中" : "已结束"}</span></>
|
76
|
|
- },
|
77
|
|
- {
|
78
|
|
- title: '操作',
|
79
|
|
- dataIndex: 'handle',
|
80
|
|
- key: 'handle',
|
81
|
|
- align: 'center',
|
82
|
|
- 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>
|
83
|
|
- <span style={{ color: '#1990FF' }} onClick={sendOrPublicDynamic.bind(this,row)}>{ row.status === 1 ? '取消发布' : '发布' }<Icon type="close-circle" className={styles.edit} /></span>
|
84
|
|
- <span style={{ color: '#1990FF' }} onClick={finishDynamic.bind(this,row)}>结束活动<Icon type="poweroff" className={styles.edit} /></span>
|
85
|
|
- <span style={{ color: '#1990FF', marginRight: '20px' }} onClick={topDynamic.bind(this,row)}>{ row.weight === 1 ? '取消置顶' : '置顶' }<Icon type="vertical-align-top" className={styles.edit} /></span>
|
86
|
|
- <span style={{ color: '#FF925C' }}>编辑<Icon type="form" className={styles.edit} /></span>
|
87
|
|
- </>
|
88
|
|
- },
|
89
|
|
-];
|
90
|
|
-
|
91
|
|
-const getSignList = (dynamicId) => {
|
92
|
|
- router.push({
|
93
|
|
- pathname: '/activity/SignList',
|
94
|
|
- query: {
|
95
|
|
- dynamicId
|
96
|
|
- },
|
97
|
|
- });
|
98
|
|
-}
|
99
|
|
-
|
100
|
|
-const finishDynamic = (row) => {
|
101
|
|
- Modal.confirm({
|
102
|
|
- title: '结束以后将无法编辑, 是否继续?',
|
103
|
|
- okText: '确定',
|
104
|
|
- cancelText: '取消',
|
105
|
|
- onOk() {
|
106
|
|
- request({
|
107
|
|
- url: '/api/admin/buildingDynamic/finish',
|
108
|
|
- method: 'PUT',
|
109
|
|
- data: {dynamicId: row.dynamicId, top: ""},
|
110
|
|
- }).then((data) => {
|
111
|
|
- console.log(data)
|
112
|
|
- message.info('操作成功!')
|
113
|
|
- // getList()
|
114
|
|
- }).catch((err) => {
|
115
|
|
- console.log(err)
|
116
|
|
- message.info(err.msg || err.message)
|
117
|
|
- })
|
118
|
|
- },
|
119
|
|
- });
|
120
|
|
-}
|
121
|
|
-
|
122
|
|
-const topDynamic = (row) => {
|
123
|
|
- const weight = Math.abs(row.weight - 1)
|
124
|
|
- request({
|
125
|
|
- url: '/api/admin/buildingDynamic/weight',
|
126
|
|
- method: 'PUT',
|
127
|
|
- params: {dynamicId: row.dynamicId, weight},
|
128
|
|
- }).then((data) => {
|
129
|
|
- console.log(data)
|
130
|
|
- message.info('操作成功!')
|
131
|
|
- // getList()
|
132
|
|
- }).catch((err) => {
|
133
|
|
- console.log(err)
|
134
|
|
- message.info(err.msg || err.message)
|
135
|
|
- })
|
136
|
|
-}
|
137
|
|
-
|
138
|
|
-const sendOrPublicDynamic = (row) => {
|
139
|
|
- if (row.status === 1) {
|
140
|
|
- cancelDynamic(row)
|
141
|
|
- } else {
|
142
|
|
- sendDynamic(row)
|
143
|
|
- }
|
144
|
|
-}
|
145
|
|
-
|
146
|
|
-// 取消活动
|
147
|
|
-const cancelDynamic = (row) => {
|
148
|
|
- request({
|
149
|
|
- url: '/api/admin/buildingDynamic/cancel/'+row.dynamicId,
|
150
|
|
- method: 'PUT',
|
151
|
|
- }).then((data) => {
|
152
|
|
- message.info('操作成功!')
|
153
|
|
- // getList()
|
154
|
|
- }).catch((err) => {
|
155
|
|
- console.log(err)
|
156
|
|
- message.info(err.msg || err.message)
|
157
|
|
- })
|
158
|
|
-}
|
159
|
|
-
|
160
|
|
-//发布活动
|
161
|
|
-const sendDynamic = (row) => {
|
162
|
|
- request({
|
163
|
|
- url: '/api/admin/buildingDynamic/send/'+row.dynamicId,
|
164
|
|
- method: 'PUT',
|
165
|
|
- }).then((data) => {
|
166
|
|
- message.info('操作成功!')
|
167
|
|
- // getList()
|
168
|
|
- }).catch((err) => {
|
169
|
|
- console.log(err)
|
170
|
|
- message.info(err.msg || err.message)
|
171
|
|
- })
|
172
|
|
-}
|
173
|
|
-
|
174
|
|
-const changePageNum = (pageNumber) => {
|
175
|
|
- getList({ pageNum: pageNumber, pageSize: 10 })
|
176
|
|
-}
|
177
|
|
-
|
178
|
|
-
|
179
|
|
-
|
180
|
15
|
const header = (props) => {
|
181
|
16
|
const [ data, setData ] = useState({})
|
182
|
17
|
// const [page, changePage] = useState({})
|
|
@@ -197,6 +32,170 @@ const header = (props) => {
|
197
|
32
|
})
|
198
|
33
|
}
|
199
|
34
|
|
|
35
|
+
|
|
36
|
+// 跳转到编辑商品
|
|
37
|
+const toEditGoods = (dynamicId) => {
|
|
38
|
+ router.push({
|
|
39
|
+ pathname: '/activity/editActivity',
|
|
40
|
+ query: {
|
|
41
|
+ dynamicId
|
|
42
|
+ },
|
|
43
|
+ });
|
|
44
|
+ }
|
|
45
|
+
|
|
46
|
+ /**
|
|
47
|
+ *
|
|
48
|
+ *
|
|
49
|
+ * @param {*} props
|
|
50
|
+ * @returns
|
|
51
|
+ */
|
|
52
|
+
|
|
53
|
+ const columns = [
|
|
54
|
+ {
|
|
55
|
+ title: '活动标题',
|
|
56
|
+ dataIndex: 'title',
|
|
57
|
+ key: 'title',
|
|
58
|
+ align: 'center',
|
|
59
|
+ },
|
|
60
|
+ {
|
|
61
|
+ title: '活动时间',
|
|
62
|
+ dataIndex: 'startDate',
|
|
63
|
+ key: 'startDate',
|
|
64
|
+ align: 'center',
|
|
65
|
+ render: (x, row) => <><span>{`${moment(row.startDate).format('YYYY-MM-DD')} —— ${moment(row.endDate).format('YYYY-MM-DD')}`}</span></>
|
|
66
|
+ },
|
|
67
|
+ {
|
|
68
|
+ title: '已参加人数',
|
|
69
|
+ dataIndex: 'count',
|
|
70
|
+ key: 'count',
|
|
71
|
+ align: 'center',
|
|
72
|
+ },
|
|
73
|
+ {
|
|
74
|
+ title: '阅读量',
|
|
75
|
+ dataIndex: 'pvNum',
|
|
76
|
+ key: 'pvNum',
|
|
77
|
+ align: 'center',
|
|
78
|
+ },
|
|
79
|
+ {
|
|
80
|
+ title: '转发量',
|
|
81
|
+ dataIndex: 'shareNum',
|
|
82
|
+ key: 'shareNum',
|
|
83
|
+ align: 'center',
|
|
84
|
+ },
|
|
85
|
+ {
|
|
86
|
+ title: '收藏数',
|
|
87
|
+ dataIndex: 'saveNum',
|
|
88
|
+ key: 'saveNum',
|
|
89
|
+ align: 'center',
|
|
90
|
+ },
|
|
91
|
+ {
|
|
92
|
+ title: '状态',
|
|
93
|
+ dataIndex: 'isEnlist',
|
|
94
|
+ key: 'isEnlist',
|
|
95
|
+ align: 'center',
|
|
96
|
+ render: (isEnlist)=> <><span>{isEnlist == 0 ?"未开始" : isEnlist==1 ? "进行中" : "已结束"}</span></>
|
|
97
|
+ },
|
|
98
|
+ {
|
|
99
|
+ title: '操作',
|
|
100
|
+ dataIndex: 'handle',
|
|
101
|
+ key: 'handle',
|
|
102
|
+ align: 'center',
|
|
103
|
+ 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>
|
|
104
|
+ <span style={{ color: '#1990FF' }} onClick={sendOrPublicDynamic.bind(this,row)}>{ row.status === 1 ? '取消发布' : '发布' }<Icon type="close-circle" className={styles.edit} /></span>
|
|
105
|
+ <span style={{ color: '#1990FF' }} onClick={finishDynamic.bind(this,row)}>结束活动<Icon type="poweroff" className={styles.edit} /></span>
|
|
106
|
+ <span style={{ color: '#1990FF', marginRight: '20px' }} onClick={topDynamic.bind(this,row)}>{ row.weight === 1 ? '取消置顶' : '置顶' }<Icon type="vertical-align-top" className={styles.edit} /></span>
|
|
107
|
+ <span style={{ color: '#FF925C' }} onClick={toEditGoods.bind(this, row.dynamicId)}>编辑<Icon type="form" className={styles.edit} /></span>
|
|
108
|
+ </>
|
|
109
|
+ },
|
|
110
|
+ ];
|
|
111
|
+
|
|
112
|
+ const getSignList = (dynamicId) => {
|
|
113
|
+ router.push({
|
|
114
|
+ pathname: '/activity/SignList',
|
|
115
|
+ query: {
|
|
116
|
+ dynamicId
|
|
117
|
+ },
|
|
118
|
+ });
|
|
119
|
+ }
|
|
120
|
+
|
|
121
|
+ const finishDynamic = (row) => {
|
|
122
|
+ Modal.confirm({
|
|
123
|
+ title: '结束以后将无法编辑, 是否继续?',
|
|
124
|
+ okText: '确定',
|
|
125
|
+ cancelText: '取消',
|
|
126
|
+ onOk() {
|
|
127
|
+ request({
|
|
128
|
+ url: '/api/admin/buildingDynamic/finish',
|
|
129
|
+ method: 'PUT',
|
|
130
|
+ data: {dynamicId: row.dynamicId, top: ""},
|
|
131
|
+ }).then((data) => {
|
|
132
|
+ console.log(data)
|
|
133
|
+ message.info('操作成功!')
|
|
134
|
+ getList({ pageNum: 1, pageSize: 10 })
|
|
135
|
+ }).catch((err) => {
|
|
136
|
+ console.log(err)
|
|
137
|
+ message.info(err.msg || err.message)
|
|
138
|
+ })
|
|
139
|
+ },
|
|
140
|
+ });
|
|
141
|
+ }
|
|
142
|
+
|
|
143
|
+ const topDynamic = (row) => {
|
|
144
|
+ const weight = Math.abs(row.weight - 1)
|
|
145
|
+ request({
|
|
146
|
+ url: '/api/admin/buildingDynamic/weight',
|
|
147
|
+ method: 'PUT',
|
|
148
|
+ params: {dynamicId: row.dynamicId, weight},
|
|
149
|
+ }).then((data) => {
|
|
150
|
+ console.log(data)
|
|
151
|
+ message.info('操作成功!')
|
|
152
|
+ getList({ pageNum: 1, pageSize: 10 })
|
|
153
|
+ }).catch((err) => {
|
|
154
|
+ console.log(err)
|
|
155
|
+ message.info(err.msg || err.message)
|
|
156
|
+ })
|
|
157
|
+ }
|
|
158
|
+
|
|
159
|
+ const sendOrPublicDynamic = (row) => {
|
|
160
|
+ if (row.status === 1) {
|
|
161
|
+ cancelDynamic(row)
|
|
162
|
+ } else {
|
|
163
|
+ sendDynamic(row)
|
|
164
|
+ }
|
|
165
|
+ }
|
|
166
|
+
|
|
167
|
+ // 取消活动
|
|
168
|
+ const cancelDynamic = (row) => {
|
|
169
|
+ request({
|
|
170
|
+ url: '/api/admin/buildingDynamic/cancel/'+row.dynamicId,
|
|
171
|
+ method: 'PUT',
|
|
172
|
+ }).then((data) => {
|
|
173
|
+ message.info('操作成功!')
|
|
174
|
+ getList({ pageNum: 1, pageSize: 10 })
|
|
175
|
+ }).catch((err) => {
|
|
176
|
+ console.log(err)
|
|
177
|
+ message.info(err.msg || err.message)
|
|
178
|
+ })
|
|
179
|
+ }
|
|
180
|
+
|
|
181
|
+ //发布活动
|
|
182
|
+ const sendDynamic = (row) => {
|
|
183
|
+ request({
|
|
184
|
+ url: '/api/admin/buildingDynamic/send/'+row.dynamicId,
|
|
185
|
+ method: 'PUT',
|
|
186
|
+ }).then((data) => {
|
|
187
|
+ message.info('操作成功!')
|
|
188
|
+ getList({ pageNum: 1, pageSize: 10 });
|
|
189
|
+ }).catch((err) => {
|
|
190
|
+ console.log(err)
|
|
191
|
+ message.info(err.msg || err.message)
|
|
192
|
+ })
|
|
193
|
+ }
|
|
194
|
+
|
|
195
|
+ const changePageNum = (pageNumber) => {
|
|
196
|
+ getList({ pageNum: pageNumber, pageSize: 10 })
|
|
197
|
+ }
|
|
198
|
+
|
200
|
199
|
// 提交事件
|
201
|
200
|
const handleSubmit = (e, props) => {
|
202
|
201
|
e.preventDefault();
|