Selaa lähdekoodia

活动 发布 和 取消发布

魏熙美 5 vuotta sitten
vanhempi
commit
9722cc1d8f
1 muutettua tiedostoa jossa 27 lisäystä ja 0 poistoa
  1. 27
    0
      src/views/activity/list.vue

+ 27
- 0
src/views/activity/list.vue Näytä tiedosto

@@ -69,6 +69,7 @@
69 69
         <el-button type="text" @click="toDetail(scope.row.dynamicId)" size="small">编辑</el-button>
70 70
         <el-button type="text" @click="finish(scope.row.dynamicId)" size="small">结束活动</el-button>
71 71
         <el-button type="text" @click="top(scope.row)" size="small">{{ scope.row.weight === 1 ? '取消置顶' : '置顶' }}</el-button>
72
+        <el-button type="text" @click="sendOrPublicDynamic(scope.row)" size="small">{{ scope.row.status === 1 ? '取消发布' : '发布' }}</el-button>
72 73
       </template>
73 74
     </el-table-column>
74 75
   </el-table>
@@ -129,6 +130,7 @@ export default {
129 130
       "getActivityList",
130 131
       'finishActivity',
131 132
       'updateWeight',
133
+
132 134
       ]),
133 135
     getList() {
134 136
       this.getActivityList(this.filterData,this.filterData.pageSize,this.filterData.pageNum).then(res => {
@@ -204,6 +206,31 @@ export default {
204 206
     formateDate(dt) {
205 207
       return !dt ? '' : dayjs(dt).format('YYYY-MM-DD HH:mm')
206 208
     },
209
+    sendDynamic(row) { // 发布活动
210
+       const data = { id: row.dynamicId }
211
+       this.$store.dispatch('dynamic/publicDynamic', data).then((res) => {
212
+           this.$notify.success('操作成功!')
213
+           this.getList()
214
+       }).catch((err) => {
215
+           this.$notify.error(err.msg || err.message)
216
+       })
217
+    },
218
+    cancelDynamic(row) { // 取消活动
219
+       const data = { id: row.dynamicId }
220
+       this.$store.dispatch('dynamic/cancelDynamic', data).then((res) => {
221
+         this.$notify.success('操作成功!')
222
+         this.getList()
223
+        }).catch((err) => {
224
+          this.$notify.error(err.msg || err.message)
225
+       })
226
+    },
227
+    sendOrPublicDynamic(row) {
228
+       if (row.status === 1) {
229
+           this.cancelDynamic(row)
230
+       } else {
231
+           this.sendDynamic(row)
232
+       }
233
+    }
207 234
   },
208 235
   created() {
209 236
     this.pageNavi.current = this.$route.query.page || 1;