diff --git a/src/views/modules/communityParty/article/index.vue b/src/views/modules/communityParty/article/index.vue index ac8ae1b0f..8c2aa34e6 100644 --- a/src/views/modules/communityParty/article/index.vue +++ b/src/views/modules/communityParty/article/index.vue @@ -42,7 +42,7 @@ 取消置顶 @@ -67,6 +67,57 @@ @close="offlineShowed = false" @afterOffline="handleOfflineSuccess"> + + + + + + + + + + 选择图片 + + + + + + + + + + + 取 消 + 确 定 + + @@ -475,6 +526,15 @@ export default { return true; }, }, + + formData: {}, + showAddImage: false, + uploadUlr: window.SITE_CONFIG["apiURL"] + "/oss/file/uploadvariedfile", + replayImgList: [], + hideUploadBtn: false, + selType: 'top', + selArticleId: '', + selImgUrl: '' }; }, components: { basePage, offline }, @@ -491,24 +551,103 @@ export default { this.$refs.offlineForm.initForm(item); }, + async handleAddImage () { + console.log('formData', this.formData) + this.topArticle() + }, + async handleCancleTopArticle (item, type) { + this.selType = type + this.selArticleId = item.articleId + await this.topArticle() + }, + async handleTopArticle (item, type) { - const url = "/gov/voice/article/topArticle"; + this.selType = type + this.selArticleId = item.articleId + + let hasImage = await this.isHasImage() + + if (hasImage === 'refrsh') { + this.$message.error("请求失败,请重新尝试"); + + } else if (hasImage === 'no') { + // this.$message.info("请先上传封面图片"); + this.showAddImage = true + } else { + await this.topArticle() + } + + }, + + async isHasImage () { + const url = "/gov/voice/article/detailV2"; const { tableData } = this; const { data, code, msg } = await requestPost(url, { - articleId: item.articleId, - type: type + articleId: this.selArticleId, + }); + if (code === 0) { + // this.formData = data + if (data.imgUrl) { + return 'has' + } else { + return 'no' + } + } else { + return 'refrsh' + } + }, + + async topArticle () { + const url = "/gov/voice/article/topArticle"; + const { tableData } = this; + let params = { + articleId: this.selArticleId, + type: this.selType + } + if (this.selImgUrl) { + params.imgUrl = this.selImgUrl + } + const { data, code, msg } = await requestPost(url, params); + if (code === 0) { this.$message.success("操作成功!"); + this.showAddImage = false this.$refs.basePage.refresh(); } else { this.$message.success("操作失败!"); } }, + removePic (file, fileList) { + this.selImgUrl = ""; + this.replayImgList = []; + this.hideUploadBtn = fileList.length >= 1; + }, + // 最多上传3张图,超过时隐藏上传按钮 + handleEditChange (file, fileList) { + this.hideUploadBtn = fileList.length >= 1; + }, + exceedPic () { + this.$message.warning("只能上传1张封面图"); + }, + beforeAvatarUpload (file) { + const isJPG = file.type === "image/jpeg"; + const isLt2M = file.size / 1024 / 1024 < 10; + + if (!isLt2M) { + this.$message.error("上传图片大小不能超过 10MB!"); + } + return isLt2M; + }, + handleSuccess (response, file, fileList) { + this.replayImgList.push(file); + this.selImgUrl = response.data.url; + }, + handleOfflineSuccess () { this.$refs.basePage.refresh(); this.offlineShowed = false; @@ -541,4 +680,18 @@ export default { }; - + + + diff --git a/src/views/modules/communityParty/heart/heartForm.vue b/src/views/modules/communityParty/heart/heartForm.vue index 093b3e690..7a3cfdfe6 100644 --- a/src/views/modules/communityParty/heart/heartForm.vue +++ b/src/views/modules/communityParty/heart/heartForm.vue @@ -1,279 +1,215 @@ - + - - - + + + - - + + - - + + 选择图片 - - + + 至 - + - - + + - - + + - - + + - - + + - + - + - (选中后报名参加活动人员可以直接审核通过) + (选中后报名参加活动人员可以直接审核通过) - - + + - - + + - - + + 至 - + - - + + - + - + - 查询 - + 查询 +