diff --git a/src/views/modules/communityParty/brilliantActivity/index.vue b/src/views/modules/communityParty/brilliantActivity/index.vue index d16169424..9f918f36e 100644 --- a/src/views/modules/communityParty/brilliantActivity/index.vue +++ b/src/views/modules/communityParty/brilliantActivity/index.vue @@ -4,8 +4,7 @@
- + @@ -16,8 +15,8 @@ - + @@ -31,15 +30,18 @@
+ 新增
- + - + - +
+ :page-sizes="[10, 20, 50]" :page-size="pageSize" layout="sizes, prev, pager, next, total" :total="total">
+ :close-on-press-escape="false" :title="'活动详情'" width="950px" top="5vh" @closed="detailClosed"> - + -
{{addForm.title}}
+
{{ addForm.title }}
- + -
{{addForm.releaseTime}}
+
{{ addForm.releaseTime }}
@@ -104,15 +111,16 @@ -
待发布
-
已上线
-
已下线
+
待发布
+
已上线
+
已下线
- + @@ -125,18 +133,19 @@ - + -
{{addForm.content}}
+
{{ addForm.content }}
- + -
-
+
+
@@ -162,7 +171,7 @@ export default { components: { quillEditor // 注册富文本组件 }, - data () { + data() { return { srcList: [], loading: false, @@ -174,8 +183,8 @@ export default { agencyId: '', gridList: [],//所属网格 unitList: [], - typeList:[],//活动类型 - corganizerList:[],//协办方list + typeList: [],//活动类型 + corganizerList: [],//协办方list value1: [], value11: [], formData: { @@ -187,7 +196,7 @@ export default { tableData: [], formTitle: '新增活动', detailShow: false, - detail:{}, + detail: {}, // 表单数据 addForm: { title: "", @@ -241,13 +250,13 @@ export default { previewImage: "" } }, - async mounted () { + async mounted() { const { user } = this.$store.state this.agencyId = user.agencyId this.communityActivityList() }, methods: { - imageClick(val){ + imageClick(val) { this.srcList = [] this.srcList.push(val) }, @@ -266,27 +275,27 @@ export default { this.$message.error(msg) } }, - async handleSearch () { - if(this.value1){ - if(this.value1.length==2){ + async handleSearch() { + if (this.value1) { + if (this.value1.length == 2) { this.formData.startTime = this.value1[0] this.formData.endTime = this.value1[1] } - }else { + } else { this.formData.startTime = '' this.formData.endTime = '' } this.communityActivityList() }, - detailClosed () { + detailClosed() { this.detailShow = false }, - async handleDetail (row) { + async handleDetail(row) { this.lookDetail = true - const url = "/actual/base/partyActivity/"+row.id; + const url = "/actual/base/partyActivity/" + row.id; let params = {}; let data = await requestPost(url, params); - console.log(data,"1111111111111") + console.log(data, "1111111111111") if (data.code === 0) { this.addForm = data.data } else { @@ -295,22 +304,22 @@ export default { this.detailShow = true this.formTitle = '详情' }, - async handleEdit (row) { + async handleEdit(row) { this.resetForm() this.lookDetail = false - const url = "/actual/base/partyActivity/"+row.id; + const url = "/actual/base/partyActivity/" + row.id; let params = {}; let data = await requestPost(url, params); - console.log(data,"1111111111111") + console.log(data, "1111111111111") if (data.code === 0) { this.addForm.id = data.data.id this.addForm.title = data.data.title - this.addForm.coverPic = [{name: new Date(), url: data.data.coverPic}] + this.addForm.coverPic = [{ name: new Date(), url: data.data.coverPic }] this.addForm.releaseTime = data.data.releaseTime this.addForm.content = data.data.content this.addForm.top = data.data.top - if(data.data.status=='0'||data.data.status=='1'||data.data.status=='2'){ + if (data.data.status == '0' || data.data.status == '1' || data.data.status == '2') { this.addForm.status = data.data.status.toString() } this.addForm.agencyName = data.data.agencyName @@ -321,13 +330,13 @@ export default { this.formTitle = '修改' this.detailShow = true }, - async handleSumm(row, val){ + async handleSumm(row, val) { //上架 - this.$confirm(val=='1'?'确定上架?':'确定下架?', "提示", { + this.$confirm(val == '1' ? '确定上架?' : '确定下架?', "提示", { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning" - }).then( async () => { + }).then(async () => { const url = "/actual/base/partyActivity/updateStatus" const { data, code, msg } = await requestPost(url, { id: row.id, status: val }) if (code === 0) { @@ -343,7 +352,7 @@ export default { }); }, - resetForm(){ + resetForm() { this.addForm = { title: "", coverPic: [], // 上传图片的文件列表 @@ -355,7 +364,7 @@ export default { endTime: '', } }, - handleInitAdd (e) { + handleInitAdd(e) { this.resetForm() this.lookDetail = false this.formTitle = '新增' @@ -373,14 +382,14 @@ export default { // 3. 包裹数组括号 return `[${arrStr}]`; }, - async handleDelete (row) { + async handleDelete(row) { this.$confirm("确认删除?", "提示", { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning" - }).then( async () => { + }).then(async () => { const url = "/actual/base/partyActivity/delete" - const { data, code, msg } = await requestPost(url, this.strToArrStr(row.id),{ + const { data, code, msg } = await requestPost(url, this.strToArrStr(row.id), { 'Content-Type': 'application/json' // 关键:改为后端支持的类型 }) if (code === 0) { @@ -397,7 +406,7 @@ export default { }); }, //重置搜索条件 - resetSearch () { + resetSearch() { this.formData = { title: "", status: "", @@ -409,13 +418,13 @@ export default { // this.loadTable() this.communityActivityList() }, - handleSizeChange (val) { + handleSizeChange(val) { this.pageSize = val this.pageNo = 1 // this.loadTable() this.communityActivityList() }, - handleCurrentChange (val) { + handleCurrentChange(val) { this.pageNo = val // this.loadTable() this.communityActivityList() @@ -440,10 +449,10 @@ export default { } return isJPG && isLt2M; }, - handleAvatarSuccess(res, file, fileList){ - console.log(res,"++++++++++res") - console.log(file,"++++++++++file") - console.log(fileList,"++++++++++fileList") + handleAvatarSuccess(res, file, fileList) { + console.log(res, "++++++++++res") + console.log(file, "++++++++++file") + console.log(fileList, "++++++++++fileList") this.addForm.coverPic.push(res.data); }, // 图片预览 @@ -466,43 +475,47 @@ export default { }, // 确定按钮:提交表单 handleSubmit() { - console.log(this.addForm,"++++++++++++addForm") - if(this.value11.length==2){ - this.addForm.startTime = this.value11[0] - this.addForm.endTime = this.value11[1] - } - this.addForm.coverPic = this.addForm.coverPic[0].url; + console.log(this.addForm, "++++++++++++addForm") + this.$refs.addFormRef.validate(async (valid) => { if (valid) { // 表单验证通过,这里写提交接口的逻辑 // 示例:this.$api.addData(this.addForm).then(res => { ... }) + if (this.value11.length == 2) { + this.addForm.startTime = this.value11[0] + this.addForm.endTime = this.value11[1] + } + this.addForm.coverPic = this.addForm.coverPic[0].url; - if(this.addForm.id){ + if (this.addForm.id) { const url = "/actual/base/partyActivity/update"; let data = await requestPost(url, this.addForm); - console.log(data,"1111111111111") + console.log(data, "1111111111111") if (data.code === 0) { this.detailShow = false this.communityActivityList() this.$message.success("操作成功!"); + // 提交后重置表单 + this.resetSearch() } else { this.$message.error(data.msg) } - }else { + } else { const url = "/actual/base/partyActivity/save"; let data = await requestPost(url, this.addForm); - console.log(data,"1111111111111") + console.log(data, "1111111111111") if (data.code === 0) { this.detailShow = false this.communityActivityList() this.$message.success("操作成功!"); + // 提交后重置表单 + this.resetSearch() } else { this.$message.error(data.msg) } } - // 提交后重置表单 - this.resetSearch() + } else { this.$message.error("请完善必填项!"); return false; @@ -511,7 +524,7 @@ export default { } }, computed: { - tableHeight () { + tableHeight() { return this.$store.state.inIframe ? this.clientHeight - 430 + this.iframeHeight : this.clientHeight - 430 }, @@ -525,7 +538,7 @@ export default { } } -