魏超 vor 5 Jahren
Ursprung
Commit
94f7d874df

+ 11
- 0
src/pages/activity/groupActivity/editGroupActivity.jsx Datei anzeigen

@@ -147,6 +147,17 @@ const Edit = props => {
147 147
         ],
148 148
         help: '建议宽度:335px,高度不限',
149 149
       },
150
+      {
151
+        label: '权重',
152
+        name: 'heavy',
153
+        type: FieldTypes.Number,
154
+        render: <Input type="number" style={{ width: 80}}/>,
155
+        value: dynamicData.heavy,
156
+        rules: [
157
+          { required: true, message: '请输入权重' },
158
+        ],
159
+        help: '数字越大越靠前',
160
+      },
150 161
     ]
151 162
 
152 163
     const handleSubmit = val => {

+ 2
- 23
src/pages/activity/groupActivity/list.jsx Datei anzeigen

@@ -106,12 +106,12 @@ const header = props => {
106 106
               <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={getSignList.bind(this, row.groupActivityId)}>拼团记录<Icon type="snippets" className={styles.shoppingCart} /></span>
107 107
             </AuthButton>
108 108
           }
109
-          {row.activityStatus === 0 &&
109
+          {
110 110
             <AuthButton name="admin.buildingDynamic.send.dynamicId.put" noRight={null}>
111 111
               <span style={{ color: '#1990FF',marginRight: '20px', cursor: 'pointer' }} onClick={sendOrPublicDynamic.bind(this, row)}>{row.status === 1 ? '取消发布' : '发布'}<Icon type="close-circle" className={styles.edit} /></span>
112 112
             </AuthButton>
113 113
           }
114
-          {row.activityStatus === 0 &&
114
+          {
115 115
             <AuthButton name="admin.taShareActivity.list.get" noRight={null}>
116 116
               <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topGroupActivity(row, row.weight)}>{row.weight === 1 ? '取消标签' : '添加标签'}<Icon type="vertical-align-top" className={styles.edit} /></span>
117 117
               <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={recommendGroupActivity(row)}>{row.sort === true ? '取消推荐首页' : '推荐首页'}<Icon type="vertical-align-top" className={styles.edit} /></span>
@@ -122,27 +122,6 @@ const header = props => {
122 122
               <span style={{ color: '#FF925C', marginRight: '20px', cursor: 'pointer' }} onClick={toEditActivity(row.groupActivityId)}>编辑<Icon type="form" className={styles.edit} /></span>
123 123
             </AuthButton>
124 124
           }
125
-          {row.activityStatus === 1 &&
126
-            <AuthButton name="admin.taShareActivity.finish.put" noRight={null}>
127
-              <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={endGroupActivity(row)}>结束活动<Icon type="poweroff" className={styles.edit} /></span>
128
-            </AuthButton>
129
-          }
130
-          {row.activityStatus === 1 &&
131
-            <AuthButton name="admin.taShareActivity.weight.put" noRight={null}>
132
-              <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topGroupActivity(row, row.weight)}>{row.weight === 1 ? '取消置顶' : '置顶'}<Icon type="vertical-align-top" className={styles.edit} /></span>
133
-              <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={recommendGroupActivity(row)}>{row.sort === true ? '取消推荐首页' : '推荐首页'}<Icon type="vertical-align-top" className={styles.edit} /></span>
134
-            </AuthButton>
135
-          }
136
-
137
-          {row.activityStatus === 2 &&
138
-            <AuthButton><span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={getSignList.bind(this, row.groupActivityId)}>拼团记录<Icon type="snippets" className={styles.shoppingCart} /></span></AuthButton>
139
-          }
140
-          {row.activityStatus === 2 &&
141
-            <AuthButton name="admin.taShareActivity.weight.put" noRight={null}>
142
-              <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topGroupActivity(row, row.weight)}>{row.weight === 1 ? '取消置顶' : '置顶'}<Icon type="vertical-align-top" className={styles.edit} /></span>
143
-              <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={recommendGroupActivity(row)}>{row.sort === true ? '取消推荐首页' : '推荐首页'}<Icon type="vertical-align-top" className={styles.edit} /></span>
144
-            </AuthButton>
145
-          }
146 125
         </>
147 126
       ),
148 127
     },

+ 19
- 5
src/pages/activity/helpActivity/edithelpActivity.jsx Datei anzeigen

@@ -22,6 +22,8 @@ const { TextArea } = Input;
22 22
 
23 23
 const header = props => {
24 24
   const [isEnlist, setIsEnlist] = useState(1)
25
+  const [activityStatus, setActivityStatus] = useState(1)  
26
+  const [disable, setDisable] = useState(false)
25 27
 
26 28
   const radioOnChange = e => {
27 29
     // console.log(e.target.value)
@@ -42,6 +44,8 @@ const header = props => {
42 44
           data.activityTime = [moment(data.startDate), moment(data.endDate)]
43 45
           const num = data.helpNum > 0 ? 1 : 0
44 46
           setIsEnlist(num)
47
+          setActivityStatus(data.activityStatus)
48
+          setDisable(data.activityStatus === 0 ? true : false)
45 49
           data.isEnlist = num
46 50
           props.form.setFieldsValue(data)
47 51
           setDynamicData(data)
@@ -140,7 +144,7 @@ const header = props => {
140 144
               message: '请选择所属项目',
141 145
             },
142 146
           ],
143
-        })(<BuildSelect />)}
147
+        })(<BuildSelect disabled={disable} />)}
144 148
         </Form.Item>
145 149
 
146 150
         <Form.Item label="活动标题">
@@ -173,7 +177,7 @@ const header = props => {
173 177
               message: '请选择活动时间',
174 178
             },
175 179
           ],
176
-        })(<RangePicker format="YYYY-MM-DD HH:mm:ss" showTime={{ format: 'HH:mm:ss' }}/>)}
180
+        })(<RangePicker format="YYYY-MM-DD HH:mm:ss" showTime={{ format: 'HH:mm:ss' }} disabled={activityStatus===0 ? true : false}/>)}
177 181
         </Form.Item>
178 182
 
179 183
         <Form.Item label="助力邀请人数" min={1} max={10}>
@@ -184,7 +188,7 @@ const header = props => {
184 188
               message: '请输入活动人数',
185 189
             },
186 190
           ],
187
-        })(<Input type="number" />)}
191
+        })(<Input type="number" disabled={activityStatus===0 ? true : false}/>)}
188 192
         </Form.Item>
189 193
 
190 194
         <Form.Item label="助力次数">
@@ -196,7 +200,7 @@ const header = props => {
196 200
             },
197 201
           ],
198 202
         })(
199
-          <Radio.Group onChange={(e) => radioOnChange(e)}>
203
+          <Radio.Group disabled={activityStatus===0 ? true : false} onChange={(e) => radioOnChange(e)}>
200 204
             <Radio value={0}>不限制</Radio>
201 205
             <Radio value={1}>限制</Radio>
202 206
           </Radio.Group>,
@@ -211,7 +215,7 @@ const header = props => {
211 215
                  message: '请输入助力人数',
212 216
                },
213 217
              ],
214
-           })(<Input type="number" placeholder="助力人数限制"/>)}
218
+           })(<Input type="number" placeholder="助力人数限制" disabled={activityStatus===0 ? true : false}/>)}
215 219
            </Form.Item>
216 220
          }
217 221
 
@@ -225,6 +229,16 @@ const header = props => {
225 229
           ],
226 230
         })(<ImageUploader />)}
227 231
         </Form.Item>
232
+        <Form.Item label="权重">
233
+        {getFieldDecorator('heavy', {
234
+          rules: [
235
+            {
236
+              required: true,
237
+              message: '请输入权重',
238
+            },
239
+          ],
240
+        })(<Input type="number" disabled={activityStatus===0 ? true : false} style={{ width: 80}}/>)}<span style={{ marginLeft: 30, color:'grey'}}>数字越大越靠前</span>
241
+        </Form.Item>
228 242
         <Form.Item wrapperCol={{ span: 12, offset: 8 }}>
229 243
           <Button type="primary" htmlType="submit">
230 244
             确认

+ 19
- 29
src/pages/activity/helpActivity/list.jsx Datei anzeigen

@@ -91,40 +91,30 @@ const toEditGoods = (helpActivityId) => () => {
91 91
       align: 'center',
92 92
       render: (x, row) => (
93 93
         <>
94
-          {row.activityStatus === 0 &&
94
+          {(row.activityStatus === 0 || row.activityStatus === 2) &&
95 95
           <AuthButton name="admin.helpRecord.get">
96 96
              <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={ getSignList.bind(this, row.helpActivityId)}>助力记录<Icon type="snippets" style={{color:'#bebebe'}}   className={styles.shoppingCart} /></span>
97 97
           </AuthButton>}
98
+          {
99
+            <AuthButton name="admin.top.update.post" noRight={null}>
100
+              <span style={{ color: '#1990FF',marginRight: '20px', cursor: 'pointer' }} onClick={sendOrPublicDynamic.bind(this, row)}>{row.status === 1 ? '取消发布' : '发布'}<Icon type="close-circle" className={styles.edit} /></span>
101
+            </AuthButton>
102
+          }
98 103
           {row.activityStatus === 0 &&
104
+            <AuthButton name="admin.top.update.post" noRight={null}>
105
+            <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topDynamic(row, 2)}>结束活动<Icon type="poweroff" style={{color:'#bebebe'}} className={styles.edit} /></span> </AuthButton>
106
+          }
107
+          {
99 108
           <AuthButton name="admin.top.update.post" noRight={null}>
100
-            <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topDynamic(row, 2)}>结束活动<Icon type="poweroff" style={{color:'#bebebe'}} className={styles.edit} /></span>
101
-            <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topDynamic(row, 0)}>{ row.weight === 1 ? '取消置顶' : '置顶' }<Icon type="vertical-align-top"  style={{color:'#bebebe'}} className={styles.edit} /></span>
109
+            <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topDynamic(row, 0)}>{ row.weight === 1 ? '取消标签' : '添加标签' }<Icon type="vertical-align-top"  style={{color:'#bebebe'}} className={styles.edit} /></span>
102 110
             <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topDynamic(row, 1)}>{ row.isMain === true ? '取消推首页' : '推首页' }<Icon type="vertical-align-top" style={{color:'#bebebe'}} className={styles.edit} /></span>
103 111
           </AuthButton> }
104 112
 
105
-          {row.activityStatus === 1 &&
113
+          {(row.activityStatus === 1 || row.activityStatus === 0) &&
106 114
           <AuthButton name="admin.helpActivity.update.put" noRight={null}>
107 115
             <span style={{ color: '#FF925C', marginRight: '20px', cursor: 'pointer' }} onClick={toEditGoods(row.helpActivityId)}>编辑<Icon type="form" style={{color:'#bebebe'}} className={styles.edit} /></span>
108 116
           </AuthButton>
109 117
           }
110
-          {row.activityStatus === 1 &&
111
-           <AuthButton name="admin.top.update.post" noRight={null}>
112
-            <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topDynamic(row, 0)}>{ row.weight === 1 ? '取消置顶' : '置顶' }<Icon type="vertical-align-top" style={{color:'#bebebe'}} className={styles.edit} /></span>
113
-            <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topDynamic(row, 1)}>{ row.isMain === true ? '取消推首页' : '推首页' }<Icon type="vertical-align-top" style={{color:'#bebebe'}} className={styles.edit} /></span>
114
-            </AuthButton>
115
-          }
116
-
117
-          {row.activityStatus === 2 &&
118
-          <AuthButton name="admin.helpRecord.get" noRight={null}>
119
-            <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={ getSignList.bind(this, row.helpActivityId)}>助力记录<Icon type="snippets" style={{color:'#bebebe'}} className={styles.shoppingCart} /></span>
120
-          </AuthButton>
121
-          }
122
-           {row.activityStatus === 2 &&
123
-        <AuthButton name="admin.top.update.post" noRight={null}>
124
-           <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topDynamic(row, 0)}>{ row.weight === 1 ? '取消置顶' : '置顶' }<Icon type="vertical-align-top" style={{color:'#bebebe'}} className={styles.edit} /></span>
125
-            <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topDynamic(row, 1)}>{ row.isMain === true ? '取消推首页' : '推首页' }<Icon type="vertical-align-top" style={{color:'#bebebe'}} className={styles.edit} /></span>
126
-        </AuthButton>
127
-          }
128 118
         </>
129 119
       ),
130 120
     },
@@ -168,13 +158,13 @@ const toEditGoods = (helpActivityId) => () => {
168 158
       })
169 159
   }
170 160
   
171
-  // const sendOrPublicDynamic = (row) => {
172
-  //     if (row.status === 1) {
173
-  //         cancelDynamic(row)
174
-  //     } else {
175
-  //         sendDynamic(row)
176
-  //     }
177
-  // }
161
+  const sendOrPublicDynamic = (row) => {
162
+      if (row.status === 1) {
163
+          cancelDynamic(row)
164
+      } else {
165
+          sendDynamic(row)
166
+      }
167
+  }
178 168
   
179 169
   // 取消活动
180 170
   const cancelDynamic = (row) => {

+ 10
- 0
src/services/apis.js Datei anzeigen

@@ -770,6 +770,16 @@ export default {
770 770
     method: 'post',
771 771
     action: 'admin.top.update.post',
772 772
   },
773
+  cancel: {
774
+    method: 'PUT',
775
+    url: `${prefix}/helpActivity/cancel/:id`,
776
+    action: 'admin.helpActivity.update.put',
777
+  },
778
+  send: {
779
+    url: `${prefix}/helpActivity/send/:id`,
780
+    method: 'PUT',
781
+    action: 'admin.helpActivity.update.put',
782
+  },
773 783
   record: {
774 784
     url: `${prefix}/helpRecord`,
775 785
     method: 'get',