dingxin 5 лет назад
Родитель
Сommit
941cd99c7f

+ 0
- 1
src/pages/activity/helpActivity/edithelpActivity.jsx Просмотреть файл

@@ -35,7 +35,6 @@ const Edit = props => {
35 35
   if (helpActivityId) {
36 36
     // eslint-disable-next-line react-hooks/rules-of-hooks
37 37
     useEffect(() => {
38
-      alert(helpActivityId)
39 38
       // eslint-disable-next-line no-use-before-define
40 39
       getDynamicData(helpActivityId);
41 40
     }, [])

+ 36
- 26
src/pages/activity/helpActivity/list.jsx Просмотреть файл

@@ -13,7 +13,7 @@ import AuthButton from '@/components/AuthButton';
13 13
 const { Option } = Select;
14 14
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
15 15
 
16
-const header = (props) => {
16
+const header = props => {
17 17
   const [ data, setData ] = useState({})
18 18
 //   const [page, changePage] = useState({})
19 19
 
@@ -89,26 +89,37 @@ const toEditGoods = (helpActivityId) => () => {
89 89
       dataIndex: 'handle',
90 90
       key: 'handle',
91 91
       align: 'center',
92
-      render: (x,row) => (
92
+      render: (x, row) => (
93 93
         <>
94
+          {row.status === 1 &&
94 95
           <AuthButton name="admin.SignList.get" noRight={null}>
95
-            <span style={{ color: '#1990FF', cursor: 'pointer'}} onClick={getSignList.bind(this, row.dynamicId)}>{row.isEnlist == '1' || row.isEnlist == '2' ? "助力记录" : ""}<Icon type="snippets" className={styles.shoppingCart} /></span>
96
-          </AuthButton>
97
-          <AuthButton name="admin.buildingDynamic.send.dynamicId.put" noRight={null}>
98
-            <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={sendOrPublicDynamic.bind(this,row)}>{ row.status === 1 ? '取消发布' : '发布' }<Icon type="close-circle" className={styles.edit} /></span>
99
-          </AuthButton>
100
-          <AuthButton name="admin.buildingDynamic.finish.put" noRight={null}>
101
-            {row.isEnlist != 2 && <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={finishDynamic.bind(this,row)}>结束活动<Icon type="poweroff" className={styles.edit} /></span>}
102
-          </AuthButton>
103
-          <AuthButton name="admin.buildingDynamic.update.put" noRight={null}>
104
-            <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topDynamic(row)}>{ row.weight === 1 ? '取消置顶' : '置顶' }<Icon type="vertical-align-top" className={styles.edit} /></span>
105
-            {row.isEnlist != 2 && <span style={{ color: '#FF925C', cursor: 'pointer' }} onClick={toEditGoods(row.helpActivityId)}>编辑<Icon type="form" className={styles.edit} /></span>}
106
-          </AuthButton>
96
+        
97
+            <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={ getSignList.bind(this, row.dynamicId)}>助力记录<Icon type="snippets" className={styles.shoppingCart} /></span>
98
+            <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={topDynamic(row, 2)}>结束活动<Icon type="poweroff" className={styles.edit} /></span>
99
+            <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topDynamic(row, 0)}>{ row.weight === 1 ? '取消置顶' : '置顶' }<Icon type="vertical-align-top" className={styles.edit} /></span>
100
+            <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topDynamic(row, 1)}>{ row.isMain === true ? '取消推首页' : '推首页' }<Icon type="vertical-align-top" className={styles.edit} /></span>
101
+          </AuthButton> }
102
+
103
+          {row.status === 0 &&
104
+           <AuthButton name="admin.buildingDynamic.finish.put" noRight={null}>
105
+                      <span style={{ color: '#FF925C', cursor: 'pointer' }} onClick={toEditGoods(row.helpActivityId)}>编辑<Icon type="form" className={styles.edit} /></span>
106
+                      <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={topDynamic(row, 2)}>结束活动<Icon type="poweroff" className={styles.edit} /></span>
107
+            <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topDynamic(row, 0)}>{ row.weight === 1 ? '取消置顶' : '置顶' }<Icon type="vertical-align-top" className={styles.edit} /></span>
108
+            <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topDynamic(row, 1)}>{ row.isMain === true ? '取消推首页' : '推首页' }<Icon type="vertical-align-top" className={styles.edit} /></span>
109
+            </AuthButton>
110
+          }
111
+
112
+          {row.status === 2 &&
113
+        <AuthButton name="admin.buildingDynamic.finish.put" noRight={null}>
114
+           <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={ getSignList.bind(this, row.dynamicId)}>助力记录<Icon type="snippets" className={styles.shoppingCart} /></span>
115
+           <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topDynamic(row, 0)}>{ row.weight === 1 ? '取消置顶' : '置顶' }<Icon type="vertical-align-top" className={styles.edit} /></span>
116
+            <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topDynamic(row, 1)}>{ row.isMain === true ? '取消推首页' : '推首页' }<Icon type="vertical-align-top" className={styles.edit} /></span>
117
+        </AuthButton>
118
+          }
107 119
         </>
108
-      )
120
+      ),
109 121
     },
110 122
   ];
111
-  
112 123
   const getSignList = (dynamicId) => {
113 124
       router.push({
114 125
           pathname: '/activity/helpActivity/helpRecord',
@@ -137,9 +148,8 @@ const toEditGoods = (helpActivityId) => () => {
137 148
   }
138 149
   
139 150
 //   置顶
140
-  const topDynamic = (row) => () => {
141
-      const weight = Math.abs(row.weight - 1)
142
-      request({ ...apis.activity.weight, params: {dynamicId: row.dynamicId, weight} }).then((data) => {
151
+  const topDynamic = (row, code) => () => {
152
+      request({ ...apis.helpActivity.top, data: { helpActivityId: row.helpActivityId, status: code } }).then((data) => {
143 153
           console.log(data)
144 154
           message.info('操作成功!')
145 155
           getList({ pageNum: 1, pageSize: 10 })
@@ -149,13 +159,13 @@ const toEditGoods = (helpActivityId) => () => {
149 159
       })
150 160
   }
151 161
   
152
-  const sendOrPublicDynamic = (row) => {
153
-      if (row.status === 1) {
154
-          cancelDynamic(row)
155
-      } else {
156
-          sendDynamic(row)
157
-      }
158
-  }
162
+  // const sendOrPublicDynamic = (row) => {
163
+  //     if (row.status === 1) {
164
+  //         cancelDynamic(row)
165
+  //     } else {
166
+  //         sendDynamic(row)
167
+  //     }
168
+  // }
159 169
   
160 170
   // 取消活动
161 171
   const cancelDynamic = (row) => {

+ 5
- 0
src/services/apis.js Просмотреть файл

@@ -699,6 +699,11 @@ export default {
699 699
     method: 'put',
700 700
     action: 'admin.taRole.get',
701 701
   },
702
+  top: {
703
+    url: `${prefix}/top/update`,
704
+    method: 'post',
705
+    action: 'admin.taRole.get',
706
+  },
702 707
  },
703 708
  third: {
704 709
   thirdPartyMiniapp: {