From 2833cd589a5429990acb28e3ceb04b820822b5b6 Mon Sep 17 00:00:00 2001 From: yanran200730 Date: Fri, 30 Dec 2022 14:55:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=B0=E9=83=BD=20=E6=8A=95=E7=A5=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/AppWechatVote/components/Detail.vue | 47 +++++++--- .../app/AppWechatVote/components/List.vue | 92 ++++++++++++------- 2 files changed, 91 insertions(+), 48 deletions(-) diff --git a/project/fengdu/app/AppWechatVote/components/Detail.vue b/project/fengdu/app/AppWechatVote/components/Detail.vue index 31f633d8..ec9a9c26 100644 --- a/project/fengdu/app/AppWechatVote/components/Detail.vue +++ b/project/fengdu/app/AppWechatVote/components/Detail.vue @@ -8,19 +8,24 @@ + @@ -39,7 +44,8 @@ form: { day: '', preface: '', - end: '' + ending: '', + id: '' } } }, @@ -50,23 +56,36 @@ methods: { getInfo () { - + this.instance.post(`/app/appvideovoteconfig/queryDetailByCorpId`).then(res => { + if (res.code == 0) { + if (res.data) { + this.id = res.data.id + this.form = { + ...res.data + } + } + } + }) }, onConfirm () { this.$refs.form.validate((valid) => { if (valid) { - this.instance.post(`/app/appassessmentscorev2task/addOrUpdate`, { + if (!this.form.preface) { + return this.$message.error('请输入前言设置') + } + + if (!this.form.ending) { + return this.$message.error('请输入前言设置') + } + + this.instance.post(`/app/appvideovoteconfig/addOrUpdate`, { ...this.form, - beginTime: this.form.date[0], - endTime: this.form.date[1], - date: '' + id: this.id || '' }).then(res => { if (res.code == 0) { this.$message.success('提交成功!') - this.isShow = false - - this.getList() + this.cancel() } }) } diff --git a/project/fengdu/app/AppWechatVote/components/List.vue b/project/fengdu/app/AppWechatVote/components/List.vue index 605772cd..15019762 100644 --- a/project/fengdu/app/AppWechatVote/components/List.vue +++ b/project/fengdu/app/AppWechatVote/components/List.vue @@ -10,12 +10,12 @@ @@ -31,9 +31,8 @@ @@ -42,15 +41,15 @@ - - + + - - + + @@ -100,20 +99,27 @@ data () { return { accept: '.mp4', + id: '', search: { current: 1, size: 10, - title: '' + videoName: '' }, isShow: false, form: { - title: '', - files: [] + files: [], + imageFileId: '', + imageFileUrl: '', + videoFileId: '', + videoFileUrl: '', + videoIntroduction: '', + videoName: '' }, + id: '', colConfigs: [ - { prop: 'title', label: '视频名称' }, - { prop: 'createUserName', align: 'center', label: '视频简介' }, - { prop: 'createUserName', align: 'center', label: '票数' } + { prop: 'videoName', label: '视频名称' }, + { prop: 'videoIntroduction', align: 'center', label: '视频简介' }, + { prop: 'voteNumber', align: 'center', label: '票数' } ], tableData: [], total: 0 @@ -126,12 +132,33 @@ methods: { onClose () { - this.form.date = '' - this.form.templateId = '' - this.form.title = '' + this.id = '' + this.form.files = [] + this.form.videoName = '' + this.form.videoIntroduction = '' + this.form.videoFileUrl = '' + this.form.videoFileId = '' + this.form.imageFileUrl = '' + this.form.imageFileId = '' this.isShow = false }, + edit (e) { + this.id = e.id + + this.form.videoName = e.videoName + this.form.videoIntroduction = e.videoIntroduction + this.form.videoFileUrl = e.videoFileUrl + this.form.videoFileId = e.videoFileId + this.form.imageFileUrl = e.imageFileUrl + this.form.imageFileId = e.imageFileId + this.form.files = [{ + id: e.videoFileId, + url: e.videoFileUrl + }] + + this.isShow = true + }, submitUpload(file) { this.$refs['upload1']?.clearFiles(); @@ -159,21 +186,21 @@ if (fileType && this.accept.indexOf(fileType.toLocaleLowerCase()) > -1) { let formData = new FormData() - formData.append('file', file.file); - this.isLoading = true - this.instance.post(`/admin/file/add-unlimited`, formData).then(res => { + formData.append('file', file.file) + formData.append('bizType', 1) + this.instance.post(`/admin/file/addVideo`, formData).then(res => { if (res && res.data) { - let videoList = res.data[0].split(";"); + let videoList = res.data[0].split(";") + this.form.videoFileUrl = res.data[0].split(";")[0] + this.form.videoFileId = res.data[0].split(";")[1] + this.form.imageFileUrl = res.data[1].split(";")[0] + this.form.imageFileId = res.data[1].split(";")[1] this.form.files = [{ id: videoList[1], url: videoList[0] }] } - - this.isLoading = false - }).catch(() => { - this.isLoading = false }) } else { return this.$message.error("视频格式错误") @@ -184,11 +211,9 @@ onConfirm () { this.$refs.form.validate((valid) => { if (valid) { - this.instance.post(`/app/appassessmentscorev2task/addOrUpdate`, { + this.instance.post(`/app/appvideoinfo/addOrUpdate`, { ...this.form, - beginTime: this.form.date[0], - endTime: this.form.date[1], - date: '' + id: this.id || '' }).then(res => { if (res.code == 0) { this.$message.success('提交成功!') @@ -202,7 +227,7 @@ }, getList () { - this.instance.post(`/app/appassessmentscorev2task/list`, null, { + this.instance.post(`/app/appvideoinfo/list`, null, { params: { ...this.search } @@ -210,7 +235,6 @@ if (res.code == 0) { this.tableData = res.data.records this.total = res.data.total - this.loading = false } }) }, @@ -226,7 +250,7 @@ remove (id) { this.$confirm('确定删除该数据?').then(() => { - this.instance.post(`/app/appassessmentscorev2task/delete?ids=${id}`).then(res => { + this.instance.post(`/app/appvideoinfo/delete?ids=${id}`).then(res => { if (res.code == 0) { this.$message.success('删除成功!') this.getList()