Commit 62be76e8 authored by 罗林杰's avatar 罗林杰

修改活动发布

parent 1353b6a1
import request from '@/utils/request'
import Qs from 'qs'
import {parseTime} from '@/utils/common';
import { parseTime } from '@/utils/common'
/**
* 1. 列表查询
......@@ -77,3 +77,11 @@ export function updateStatus(data) {
data: data
})
}
// 7. 修改活动发布状态
export function updatePushStatus(data) {
return request({
url: '/cmsActivity/pushActivityInfo',
method: 'put',
params: { businessId: data.businessId, status: data.publishStatus }
})
}
......@@ -121,10 +121,10 @@
{{ scope.row.weight || '-' }}
</template>
</el-table-column>
<el-table-column align="center" prop="releaseStatus" label="状态" min-width="80" show-overflow-tooltip>
<el-table-column align="center" prop="publishStatus" label="发布状态" min-width="80" show-overflow-tooltip>
<template slot-scope="scope">
<el-switch
v-model="scope.row.flag"
v-model="scope.row.publishStatus"
class="switchDisabledStyle"
inactive-value="0"
active-value="1"
......@@ -309,7 +309,7 @@
import commonField from '@/utils/commonField'
import {
delCmsActivity,
listCmsActivity, updateStatus
listCmsActivity, updatePushStatus, updateStatus
} from '@/api/contentManagement/activity'
import { parseTime } from '@/utils'
import { getDataCache, setDataCache } from '@/assets/js/filterData'
......@@ -626,24 +626,24 @@ export default {
},
// 修改状态
handleStatusChange(row) {
const text = row.flag === '1' ? '启用' : '停用'
const text = row.publishStatus === '1' ? '发布' : '取消发布'
const params = {
businessId: row.businessId,
flag: row.flag
publishStatus: row.publishStatus
}
this.$confirm('是否确认操作?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
return updateStatus(params)
return updatePushStatus(params)
}).then(() => {
this.$message({
message: text + '成功',
type: 'success'
})
}).catch(function() {
row.flag = row.flag === '0' ? '1' : '0'
row.publishStatus = row.publishStatus === '0' ? '1' : '0'
})
},
handleExamination(data) {
......
......@@ -165,7 +165,7 @@
:rules="[
{ required: !(controls.isOperation === '3'), message: '请选择结束时间', trigger: 'blur' },
{ validator: validateEndTime, trigger: 'blur' }
]"
]"
>
<el-date-picker
v-model="form.endTime"
......@@ -337,17 +337,14 @@
</div>
</div>
<el-dialog :visible.sync="open" width="500px" append-to-body>
<div v-if="form.details" class="preview-content" v-html="form.details"></div>
<div v-if="form.details" class="preview-content" v-html="form.details" />
<div v-else>暂无预览内容</div>
</el-dialog>
<!-- 按钮区 -->
<div class="btn-box">
<el-button v-if="controls.isOperation !== '3'" style="width: 80px; height: 40px;font-size: 16px; width: 138px;height: 38px " @click="submit">保存
</el-button>
<el-button v-if="controls.isOperation !== '3'" style="width: 80px; height: 40px;font-size: 16px; width: 138px;height: 38px " type="primary" :loading="pubLoading" @click="publish">发布
<el-button v-if="controls.isOperation !== '3'" type="primary" style="width: 80px; height: 40px;font-size: 16px; width: 138px;height: 38px " @click="submit">保存
</el-button>
<el-button
v-if="controls.isOperation === '3'"
style="width: 80px; height: 40px;font-size: 16px; width: 138px;height: 38px "
@click="goBack"
>返回
......@@ -453,20 +450,20 @@ export default {
this.setFormDefaults()
},
methods: {
//时间填写验证
// 时间填写验证
validateEndTime(rule, value, callback) {
if (value && this.form.startTime) {
const startTime = new Date(this.form.startTime);
const endTime = new Date(value);
if (endTime < startTime) {
callback(new Error('结束时间不能早于开始时间'));
if (value && this.form.startTime) {
const startTime = new Date(this.form.startTime)
const endTime = new Date(value)
if (endTime < startTime) {
callback(new Error('结束时间不能早于开始时间'))
} else {
callback()
}
} else {
callback();
callback()
}
} else {
callback();
}
},
},
// 活动内容预览
contentPreview() {
this.open = true
......@@ -564,7 +561,7 @@ export default {
if (response.code === 200) {
this.form = response.data
this.imageUrl = response.data.url
console.log('this.imageUrl:',this.imageUrl)
console.log('this.imageUrl:', this.imageUrl)
}
})
}
......@@ -604,8 +601,6 @@ export default {
this.$refs.deviceFormRef.validate(valid => {
if (valid) {
if (this.form.businessId !== null) {
// 编辑
console.log('编辑打印', this.form)
updateCmsActivity(this.form).then(res => {
if (res.code === 200) {
this.$message({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment