Browse Source

活动 发布 和 取消发布

魏熙美 5 years ago
parent
commit
9722cc1d8f
1 changed files with 27 additions and 0 deletions
  1. 27
    0
      src/views/activity/list.vue

+ 27
- 0
src/views/activity/list.vue View File

69
         <el-button type="text" @click="toDetail(scope.row.dynamicId)" size="small">编辑</el-button>
69
         <el-button type="text" @click="toDetail(scope.row.dynamicId)" size="small">编辑</el-button>
70
         <el-button type="text" @click="finish(scope.row.dynamicId)" size="small">结束活动</el-button>
70
         <el-button type="text" @click="finish(scope.row.dynamicId)" size="small">结束活动</el-button>
71
         <el-button type="text" @click="top(scope.row)" size="small">{{ scope.row.weight === 1 ? '取消置顶' : '置顶' }}</el-button>
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
       </template>
73
       </template>
73
     </el-table-column>
74
     </el-table-column>
74
   </el-table>
75
   </el-table>
129
       "getActivityList",
130
       "getActivityList",
130
       'finishActivity',
131
       'finishActivity',
131
       'updateWeight',
132
       'updateWeight',
133
+
132
       ]),
134
       ]),
133
     getList() {
135
     getList() {
134
       this.getActivityList(this.filterData,this.filterData.pageSize,this.filterData.pageNum).then(res => {
136
       this.getActivityList(this.filterData,this.filterData.pageSize,this.filterData.pageNum).then(res => {
204
     formateDate(dt) {
206
     formateDate(dt) {
205
       return !dt ? '' : dayjs(dt).format('YYYY-MM-DD HH:mm')
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
   created() {
235
   created() {
209
     this.pageNavi.current = this.$route.query.page || 1;
236
     this.pageNavi.current = this.$route.query.page || 1;