协同宣发

This commit is contained in:
yanran200730
2022-07-19 10:58:14 +08:00
parent 6d50374606
commit 62f92569b3

View File

@@ -42,7 +42,7 @@
<div class="fileList" v-if="fileList.length">
<div class="add-item" v-for="(item, index) in fileList" :key="index">
<div class="left">
<img :src="mapIcon(item.media.type)" />
<img :src="mapIcon(item.msgType)" />
<span>{{ item.name }}</span>
</div>
<i @click="removeFile(index)">删除</i>
@@ -67,7 +67,7 @@
:limit="9"
action="/app/wxcp/upload/uploadFile"
accept=".jpg,.png,.jpeg"
:http-request="v => submitUpload(v, 'image')">
:http-request="v => submitUpload(v, '1')">
<div class="content-item" trigger>
<img src="https://cdn.cunwuyun.cn/dvcp/announce/big-img.png" />
<p>图片</p>
@@ -82,7 +82,7 @@
:limit="9"
action="/app/wxcp/upload/uploadFile"
accept=".mp4"
:http-request="v => submitUpload(v, 'video')">
:http-request="v => submitUpload(v, '2')">
<div class="content-item" trigger>
<img src="https://cdn.cunwuyun.cn/dvcp/announce/big-video.png" />
<p>视频</p>
@@ -97,13 +97,13 @@
:limit="9"
action="/app/wxcp/upload/uploadFile"
accept=".zip.rar.doc.docx.xls.xlsx.ppt.pptx.pdf.txt"
:http-request="v => submitUpload(v, 'file')">
:http-request="v => submitUpload(v, '3')">
<div class="content-item" trigger>
<img src="https://cdn.cunwuyun.cn/dvcp/announce/folder.png" />
<p>文件</p>
</div>
</el-upload>
<div class="content-item">
<div class="content-item" @click="isShowAddLink = true">
<img src="https://cdn.cunwuyun.cn/dvcp/announce/site.png" />
<p>网页</p>
</div>
@@ -144,6 +144,41 @@
</div>
</div>
<ai-dialog
:visible.sync="isShowAddLink"
width="920px"
title="链接消息"
@close="onClose"
@onConfirm="onLinkConfirm">
<el-form ref="linkForm" :model="linkForm" label-width="110px" label-position="right">
<div class="ai-form">
<el-form-item label="标题" style="width: 100%;" prop="linkTitle" :rules="[{ required: true, message: '请输入标题', trigger: 'blur' }]">
<el-input
size="small"
placeholder="请输入标题"
v-model="linkForm.linkTitle">
</el-input>
</el-form-item>
<el-form-item label="链接" style="width: 100%;" prop="linkUrl" :rules="[{ required: true, message: '请输入链接', trigger: 'blur' }]">
<el-input
size="small"
placeholder="请输入链接"
v-model="linkForm.linkUrl">
</el-input>
</el-form-item>
<el-form-item label="描述" style="width: 100%;" prop="linkDesc" :rules="[{ required: true, message: '请输入描述', trigger: 'blur' }]">
<el-input
size="small"
placeholder="请输入描述"
v-model="linkForm.linkDesc">
</el-input>
</el-form-item>
<el-form-item label="封面图" prop="linkPicUrl" style="width: 100%;" :rules="[{ required: true, message: '请上传封面图', trigger: 'change' }]">
<ai-uploader :instance="instance" v-model="form.linkPicUrl" :limit="1"></ai-uploader>
</el-form-item>
</div>
</el-form>
</ai-dialog>
</div>
</template>
<template #footer>
@@ -169,6 +204,13 @@
info: {},
department: [],
fileList: [],
isShowAddLink: false,
linkForm: {
linkPicUrl: [],
linkDesc: '',
linkTitle: '',
linkUrl: ''
},
form: {
content: '',
choiceTime: '',
@@ -218,17 +260,38 @@
})
},
onLinkConfirm () {
this.$refs.linkForm.validate((valid) => {
if (valid) {
this.fileList.push({
...this.linkForm,
linkPicUrl: this.linkPicUrl[0].url,
msgType: '4'
})
this.isShowAddLink = false
}
})
},
onClose () {
this.linkForm.linkPicUrl = []
this.linkForm.linkDesc = ''
this.linkForm.linkTitle = ''
this.linkForm.linkUrl = ''
},
removeFile (index) {
this.fileList.splice(index, 1)
},
mapIcon (type) {
return {
image: 'https://cdn.cunwuyun.cn/dvcp/announce/img.png',
video: 'https://cdn.cunwuyun.cn/dvcp/announce/video.png',
folder: 'https://cdn.cunwuyun.cn/dvcp/announce/folder.png',
site: 'https://cdn.cunwuyun.cn/dvcp/announce/site.png',
miniapp: 'https://cdn.cunwuyun.cn/dvcp/announce/miniapp.png'
1: 'https://cdn.cunwuyun.cn/dvcp/announce/img.png',
2: 'https://cdn.cunwuyun.cn/dvcp/announce/video.png',
3: 'https://cdn.cunwuyun.cn/dvcp/announce/folder.png',
4: 'https://cdn.cunwuyun.cn/dvcp/announce/site.png',
5: 'https://cdn.cunwuyun.cn/dvcp/announce/miniapp.png'
}[type]
},
@@ -259,16 +322,22 @@
},
submitUpload (file, type) {
const fileType = {
'1': 'image',
'2': 'video',
'3': 'file'
}[type]
let formData = new FormData()
formData.append('file', file.file)
formData.append('type', type)
formData.append('type', fileType)
this.instance.post(`/app/wxcp/upload/uploadFile`, formData, {
withCredentials: false
}).then(res => {
if (res.code == 0) {
this.fileList.push({
...res.data.file,
media: res.data.media
media: res.data.media,
msgType: type
})
this.$message.success('上传成功')
@@ -294,10 +363,6 @@
})
},
onClose () {
this.form.explain = ''
},
confirm () {
this.$refs.form.validate((valid) => {
if (valid) {