From 5df76815f7d79e8bd75542c52d2141db664bb623 Mon Sep 17 00:00:00 2001 From: jiangyy Date: Fri, 14 Oct 2022 16:15:51 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/communityParty/article/index.vue | 163 ++++- .../communityParty/heart/heartForm.vue | 573 ++++++++---------- .../shequzhili/issue/cpts/issue-detail.vue | 10 +- .../shequzhili/issue/cptsAudit/issue-info.vue | 19 +- 4 files changed, 427 insertions(+), 338 deletions(-) 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 @@ @@ -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 @@