Commit 284f1701 by xinla

删除uploadToCos,替换为upload

1 parent 1b70635a
...@@ -199,7 +199,6 @@ import { templateAdd, templateDetail } from '@/api/contentCenter/modleCenter' ...@@ -199,7 +199,6 @@ import { templateAdd, templateDetail } from '@/api/contentCenter/modleCenter'
import DragTable from '@/components/DragTable' import DragTable from '@/components/DragTable'
import MaterialCenter from '@/components/ContentCenter/MaterialCenter' import MaterialCenter from '@/components/ContentCenter/MaterialCenter'
import { string } from 'clipboard' import { string } from 'clipboard'
import UploadToCos from '@/components/UploadToCos'
import { getPosterInfo } from '@/api/material/poster' import { getPosterInfo } from '@/api/material/poster'
import TemplateLibrary from '@/components/ContentCenter/TemplateLibrary' import TemplateLibrary from '@/components/ContentCenter/TemplateLibrary'
import MessageContentForm from '@/components/MessageContentForm' import MessageContentForm from '@/components/MessageContentForm'
...@@ -209,7 +208,6 @@ export default { ...@@ -209,7 +208,6 @@ export default {
PreviewInPhone, PreviewInPhone,
DragTable, DragTable,
MaterialCenter, MaterialCenter,
UploadToCos,
getPosterInfo, getPosterInfo,
TemplateLibrary, TemplateLibrary,
MessageContentForm, MessageContentForm,
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
<!-- 图片 --> <!-- 图片 -->
<template v-else-if="type === '0'"> <template v-else-if="type === '0'">
<el-form-item label="图片" prop="weMaterialImgAoList" v-if="!isedit"> <el-form-item label="图片" prop="weMaterialImgAoList" v-if="!isedit">
<UploadToCos <Upload
v-if="dialogVisible" v-if="dialogVisible"
:fileList.sync="form.weMaterialImgAoList" :fileList.sync="form.weMaterialImgAoList"
:maxSize="20" :maxSize="20"
...@@ -46,17 +46,17 @@ ...@@ -46,17 +46,17 @@
:multiple="true" :multiple="true"
:limit="picMaxlength"> :limit="picMaxlength">
<div slot="tip">支持jpg/jpeg/png格式,图片大小不超过20M,支持最多{{ picMaxlength }}张批量上传</div> <div slot="tip">支持jpg/jpeg/png格式,图片大小不超过20M,支持最多{{ picMaxlength }}张批量上传</div>
</UploadToCos> </Upload>
</el-form-item> </el-form-item>
<el-form-item label="图片" prop="materialUrl" v-else> <el-form-item label="图片" prop="materialUrl" v-else>
<UploadToCos <Upload
:fileUrl.sync="form.materialUrl" :fileUrl.sync="form.materialUrl"
:fileName.sync="form.materialName" :fileName.sync="form.materialName"
:maxSize="20" :maxSize="20"
type="0" type="0"
v-if="dialogVisible"> v-if="dialogVisible">
<div slot="tip">支持jpg/jpeg/png格式,图片大小不超过20M</div> <div slot="tip">支持jpg/jpeg/png格式,图片大小不超过20M</div>
</UploadToCos> </Upload>
</el-form-item> </el-form-item>
</template> </template>
...@@ -86,9 +86,9 @@ ...@@ -86,9 +86,9 @@
placeholder="请输入图文描述"></el-input> placeholder="请输入图文描述"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="图文封面"> <el-form-item label="图文封面">
<UploadToCos :fileUrl.sync="form.coverUrl" type="0" v-if="dialogVisible"> <Upload :fileUrl.sync="form.coverUrl" type="0" v-if="dialogVisible">
<div slot="tip">支持jpg/jpeg/png格式,建议200*200</div> <div slot="tip">支持jpg/jpeg/png格式,建议200*200</div>
</UploadToCos> </Upload>
</el-form-item> </el-form-item>
</template> </template>
...@@ -130,22 +130,22 @@ ...@@ -130,22 +130,22 @@
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="封面" prop="coverUrl"> <el-form-item label="封面" prop="coverUrl">
<UploadToCos :fileUrl.sync="form.coverUrl" type="0" v-if="dialogVisible"> <Upload :fileUrl.sync="form.coverUrl" type="0" v-if="dialogVisible">
<div slot="tip">支持jpg/jpeg/png格式,建议520*416</div> <div slot="tip">支持jpg/jpeg/png格式,建议520*416</div>
</UploadToCos> </Upload>
</el-form-item> </el-form-item>
</template> </template>
<template v-else-if="type === '1'"> <template v-else-if="type === '1'">
<el-form-item label="语音" prop="materialUrl"> <el-form-item label="语音" prop="materialUrl">
<Voice v-if="form.materialUrl" :amrUrl="form.materialUrl"></Voice> <Voice v-if="form.materialUrl" :amrUrl="form.materialUrl"></Voice>
<UploadToCos <Upload
:fileUrl.sync="form.materialUrl" :fileUrl.sync="form.materialUrl"
:fileName.sync="form.materialName || '点击上传'" :fileName.sync="form.materialName || '点击上传'"
:type="type" :type="type"
:format="audioType"> :format="audioType">
<div slot="tip">只能上传amr格式的语音文件。单个文件大小不超过2M,时长不超过1分钟</div> <div slot="tip">只能上传amr格式的语音文件。单个文件大小不超过2M,时长不超过1分钟</div>
</UploadToCos> </Upload>
</el-form-item> </el-form-item>
<el-form-item label="名称" prop="materialName"> <el-form-item label="名称" prop="materialName">
<el-input v-model="form.materialName" placeholder="请输入"></el-input> <el-input v-model="form.materialName" placeholder="请输入"></el-input>
...@@ -170,14 +170,14 @@ ...@@ -170,14 +170,14 @@
show-word-limit></el-input> show-word-limit></el-input>
</el-form-item> </el-form-item>
<el-form-item label="上传视频" prop="materialUrl"> <el-form-item label="上传视频" prop="materialUrl">
<UploadToCos <Upload
:fileUrl.sync="form.materialUrl" :fileUrl.sync="form.materialUrl"
:fileName.sync="form.materialName" :fileName.sync="form.materialName"
:type="type" :type="type"
@getPicUrl="getPicUrl" @getPicUrl="getPicUrl"
v-if="dialogVisible"> v-if="dialogVisible">
<div slot="tip">支持mp4/mov格式,视频大小不超过100M</div> <div slot="tip">支持mp4/mov格式,视频大小不超过100M</div>
</UploadToCos> </Upload>
</el-form-item> </el-form-item>
</template> </template>
...@@ -200,13 +200,13 @@ ...@@ -200,13 +200,13 @@
:autosize="{ minRows: 2, maxRows: 10 }"></el-input> :autosize="{ minRows: 2, maxRows: 10 }"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="上传文件" prop="materialUrl"> <el-form-item label="上传文件" prop="materialUrl">
<UploadToCos <Upload
:fileUrl.sync="form.materialUrl" :fileUrl.sync="form.materialUrl"
:fileName.sync="form.materialName" :fileName.sync="form.materialName"
:type="type" :type="type"
v-if="dialogVisible"> v-if="dialogVisible">
<div slot="tip">支持pdf/ppt/word文件,单个文件大小不超过50M</div> <div slot="tip">支持pdf/ppt/word文件,单个文件大小不超过50M</div>
</UploadToCos> </Upload>
</el-form-item> </el-form-item>
</template> </template>
<!-- 文章 --> <!-- 文章 -->
......
<script>
import { getCosConfig, getVideoPic, upload } from '@/api/common'
import { dateFormat, uuid } from '@/utils/index'
// import Video from 'video.js'
import Cos from 'cos-js-sdk-v5'
import BenzAMRRecorder from 'benz-amr-recorder'
import MP4Box from 'mp4box'
import OSS from 'ali-oss'
export default {
components: {},
props: {
// 单文件上传时使用
fileUrl: {
type: String,
default: ''
},
fileName: {
type: String,
default: ''
},
// 多文件上传时使用,例如: [{name: 'food.jpg', url: 'https://xxx.cdn.com/xxx.jpg'}]
fileList: {
type: Array,
default: () => []
},
// 0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file)
type: {
type: String,
default: '0',
validator: function (value) {
// 这个值必须匹配下列字符串中的一个
return ['0', '1', '2', '3'].includes(value)
}
},
// 上传文件大小不能超过 maxSize MB, 各类型有默认限制 参见: maxSizeDefault
maxSize: {
type: Number,
default: undefined
},
// 图片的宽高像素限制 [width(number), height(number)],默认null不限制
maxImgPx: {
type: Array,
default: null // () => [100, 100]
},
// 允许上传的文件格式后缀名 eg:["jpg", "png"],['*']为不限制,各类型有默认限制 参见: formatDefault
format: {
type: Array,
default: undefined
},
// 选择上传文件类型, 用于过滤系统选择文件类型, 默认根据类型自动匹配:见 acceptAuto,
accept: {
type: String,
default: ''
},
// 是否能上传多个
multiple: {
type: Boolean,
default: false
},
// multiple为true时有效,最多上传几个,默认不限制,最小为1
limit: {
type: Number,
default: undefined
}
// onProgress: {
// type: Function,
// default: null,
// },
// beforeUpload: {
// type: Function,
// default: function() {
// return function() {}
// },
// },
// 图片操作 目前支持有 view:查看,remove:删除,download:下载
// action: {
// type: Array,
// default: () => ["view", "remove"],
// },
},
data() {
return {
loading: false,
fileUrlWatch: this.fileUrl,
fileNameWatch: this.fileName,
fileListWatch: this.fileList,
picUrl: '', // 视频第一帧
file: undefined,
speed: 0, // 上传网速
percentage: 0, //上传进度
// cos配置信息
cosConfig: { bucketName: '', cosImgUrlPrefix: '', region: '' },
cosInstance: undefined, // cos实例
ossObj: undefined
}
},
watch: {
fileUrl: {
handler(value) {
this.fileUrlWatch = value
}
},
fileName: {
handler(value) {
this.fileNameWatch = value
}
},
fileList: {
handler(value) {
this.fileListWatch = value
}
},
loading(val) {
this.$emit('loadingChange', val)
}
},
computed: {
// 识别选择文件类型
acceptAuto() {
return ['image/*', 'amr/*', 'video/*'][this.type]
}
},
created() {
getCosConfig().then((res) => {
this.cosConfig = res
if (this.cosConfig.fileObject == 'tencentOss') {
this.cosInstance = new Cos({
SecretId: res.secretId,
SecretKey: res.secretKey
})
} else if (this.cosConfig.fileObject == 'local') {
} else {
let region =
this.cosConfig.region.indexOf('//') != -1 ? this.cosConfig.region.split('//')[1] : this.cosConfig.region
this.ossObj = new OSS({
// yourRegion填写Bucket所在地域。Region填写为oss-cn-hangzhou。
region: region.split('.')[0],
// 从STS服务获取的临时访问密钥(AccessKey ID和AccessKey Secret)。
accessKeyId: this.cosConfig.secretId,
accessKeySecret: this.cosConfig.secretKey,
// 填写Bucket名称。
bucket: this.cosConfig.bucketName
})
}
})
},
mounted() {
// const cosInstance = new Cos({
// // getAuthorization 必选参数
// getAuthorization: function (options, callback) {
// // 服务端例子:https://github.com/tencentyun/qcloud-cos-sts-sdk/blob/master/scope.md
// // 异步获取临时密钥
// var url = window.lwConfig.SYSTEM_API + '/file/get/config' // url替换成您自己的后端服务
// var xhr = new XMLHttpRequest()
// xhr.open('get', url, true)
// xhr.setRequestHeader('Content-Type', 'application/json')
// xhr.onload = function (e) {
// try {
// var data = JSON.parse(e.target.responseText)
// var credentials = data.credentials
// } catch (e) {}
// if (!data || !credentials) {
// return console.error('credentials invalid:\n' + JSON.stringify(data, null, 2))
// }
// callback({
// TmpSecretId: decrypt(credentials.secretId),
// TmpSecretKey: credentials.secretKey,
// SecurityToken: credentials.sessionToken,
// // 建议返回服务器时间作为签名的开始时间,避免用户浏览器本地时间偏差过大导致签名错误
// StartTime: data.startTime, // 时间戳,单位秒,如:1580000000
// ExpiredTime: data.expiredTime, // 时间戳,单位秒,如:1580000000
// // ScopeLimit: true, // 细粒度控制权限需要设为 true,会限制密钥只在相同请求时重复使用
// })
// }
// xhr.send()
// // xhr.send(JSON.stringify(options.Scope))
// },
// })
},
methods: {
upload() {
if (this.cosConfig.fileObject == 'tencentOss') {
this.tencentFn()
} else if (this.cosConfig.fileObject == 'local') {
this.localFn()
} else if (this.cosConfig.fileObject == 'aliOss') {
this.aliOss()
}
},
localFn() {
this.loading = true
let file = undefined
if (!this.multiple || this.limit == 1) {
file = this.file
} else {
// 多选上传是多次调用单传的
file = this.file.shift()
}
let formData = new FormData()
formData.append('file', file)
upload(formData).then((dd) => {
if (dd.code == 200) {
let location = dd.data.url
this.$emit('upSuccess', location)
this.type == 2
? //获取视频第一帧画面
getVideoPic({ url: location }).then((res) => {
this.loading = false
this.$emit('getPicUrl', res.data.url)
})
: (this.loading = false)
// 使用本地链接提供预览,避免上传后下载的问题
let url = window.URL.createObjectURL(file)
let name = file.name
if (!this.multiple) {
this.fileUrlWatch = url
this.$emit('update:fileUrl', location)
this.$emit('update:fileName', (this.fileNameWatch = name))
} else {
this.fileListWatch = this.fileListWatch.concat({ name, url })
this.$emit('update:fileList', this.fileList.concat({ name, url: location }))
}
} else {
this.loading = false
this.$message.error('上传失败,请稍后再试')
}
})
},
async aliOss() {
this.loading = true
let file = undefined
if (!this.multiple || this.limit == 1) {
file = this.file
} else {
// 多选上传是多次调用单传的
file = this.file.shift()
}
let date = new Date()
let format = file.name.match(/\.(\w+)$/g)
format = format && format[0]
// 实例可能未初始化完成
if (!this.ossObj) {
this.$message.error('存储空间正忙,请稍后再试')
return
}
let name = `${dateFormat(date, 'yyyy-MM-dd')}/t${date.getTime()}-${uuid()}${format}`
try {
const data = await this.ossObj.multipartUpload(name, file, {
progress: (progressData) => {
this.percentage = progressData * 100
// this.speed = (progressData.speed / 1024 / 1024).toFixed(2)
}
})
if (data) {
this.percentage = this.speed = 0
let location = this.cosConfig.cosImgUrlPrefix + data.name
this.$emit('upSuccess', location)
this.type == 2
? //获取视频第一帧画面
getVideoPic({ url: location }).then((res) => {
this.loading = false
this.$emit('getPicUrl', res.data.url)
})
: (this.loading = false)
// 使用本地链接提供预览,避免上传后下载的问题
let url = window.URL.createObjectURL(file)
let name = file.name
if (!this.multiple) {
this.fileUrlWatch = url
this.$emit('update:fileUrl', location)
this.$emit('update:fileName', (this.fileNameWatch = name))
} else {
this.fileListWatch = this.fileListWatch.concat({ name, url })
this.$emit('update:fileList', this.fileList.concat({ name, url: location }))
}
}
} catch (e) {
this.loading = false
this.$message.error('上传失败,请稍后再试')
}
},
tencentFn() {
this.loading = true
let file = undefined
if (!this.multiple || this.limit == 1) {
file = this.file
} else {
// 多选上传是多次调用单传的
file = this.file.shift()
}
let date = new Date()
let format = file.name.match(/\.(\w+)$/g)
format = format && format[0]
const params = {
Bucket: this.cosConfig.bucketName /* 填入您自己的存储桶,必须字段 */,
Region: this.cosConfig.region /* 存储桶所在地域,例如ap-beijing,必须字段 */,
Key: `/${dateFormat(date, 'yyyy-MM-dd')}/t${date.getTime()}-${uuid()}${format}`
/* 存储在桶里的对象键(例如1.jpg,a/b/test.txt),必须字段。*/
// 此处使用的格式: /日期/t时间戳-uid-文件后缀名
}
// 实例可能未初始化完成
if (!this.cosInstance) {
this.$message.error('存储空间正忙,请稍后再试')
return
}
this.cosInstance.uploadFile(
{
...params,
Body: file /* 必须,上传文件对象,可以是input[type="file"]的file对象 */,
onProgress: (progressData) => {
this.percentage = progressData.percent * 100
this.speed = (progressData.speed / 1024 / 1024).toFixed(2)
// this.onProgress && this.onProgress(this.percentage, this.speed)
}
},
(err1, data) => {
this.percentage = this.speed = 0
if (err1) {
this.loading = false
this.$message.error('上传失败,请稍后再试')
} else {
let location = 'https://' + data.Location
this.$emit('upSuccess', location)
this.type == 2
? //获取视频第一帧画面
getVideoPic({ url: location }).then((res) => {
this.loading = false
this.$emit('getPicUrl', res.data.url)
})
: (this.loading = false)
// 使用本地链接提供预览,避免上传后下载的问题
let url = window.URL.createObjectURL(file)
let name = file.name
if (!this.multiple) {
this.fileUrlWatch = url
this.$emit('update:fileUrl', location)
this.$emit('update:fileName', (this.fileNameWatch = name))
} else {
this.fileListWatch = this.fileListWatch.concat({ name, url })
this.$emit('update:fileList', this.fileList.concat({ name, url: location }))
}
}
}
)
},
remove(i) {
this.$confirm('确定要删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let clone = JSON.parse(JSON.stringify(this.fileList))
this.fileListWatch.splice(i, 1)
clone.splice(i, 1)
this.$emit('update:fileList', clone)
})
},
handleExceed(file, fileList) {
this.$message.error('最多上传' + this.limit + '张')
this.loading = false
},
async handleBeforeUpload(file, filelist) {
this.loading = true
let isFormat = true
let isSize = true
// type: 0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file)
// 统一校验文件后缀名格式
// 如果没有显示配置 format 格式限制,则使用默认下面校验
let format = this.format
let tip = ''
if (!format || !format.length) {
let formatDefault = {
0: { tip: 'png/jpg', value: ['png', 'jpg', 'jpeg'] },
1: { value: ['amr'] },
2: { value: ['mp4'] },
3: { tip: 'word/pdf/ppt', value: ['doc', 'docx', 'pdf', 'ppt', 'pptx', 'pps', 'pptsx'] }
}
format = formatDefault[this.type].value
tip = formatDefault[this.type].tip
}
let match = file.name.match(/\.(\w+)$/g)
let fileFormat = match && match[0].replace('.', '').toLowerCase()
isFormat = format[0] === '*' || format.includes(fileFormat)
if (!isFormat) {
this.$message.error('文件格式错误,仅支持 ' + (tip || format.join(',')) + ' 格式!')
this.loading = false
return Promise.reject()
}
// 统一校验文件体积
// 如果没有显式配置 maxSize 限制大小,则使用下面默认值,单位 MB,
let maxSize = this.maxSize
if (!maxSize) {
let maxSizeDefault = { 0: 2, 1: 2, 2: 100, 3: 50 }
maxSize || (maxSize = maxSizeDefault[this.type])
}
isSize = file.size / 1024 / 1024 < maxSize
if (!isSize) {
this.$message.error('上传文件大小不能超过 ' + maxSize + 'MB!')
this.loading = false
return Promise.reject()
}
// 各类型独有的校验
let validate = true
if (this.type === '0') {
// 图片
let maxImgPx = this.maxImgPx
if (maxImgPx) {
try {
await new Promise((resolve) => {
let width, height
let image = new Image()
//加载图片获取图片真实宽度和高度
image.onload = () => {
width = image.width
height = image.height
if (width > maxImgPx[0]) {
validate = false
this.$message.error(`图片“宽”度超过${maxImgPx[0]}像素,请重新选择`)
} else if (height > maxImgPx[1]) {
this.$message.error(`图片“高”度超过${maxImgPx[1]}像素,请重新选择`)
validate = false
}
window.URL && window.URL.revokeObjectURL(image.src)
resolve()
}
if (window.URL) {
let url = window.URL.createObjectURL(file)
image.src = url
} else if (window.FileReader) {
let reader = new FileReader()
reader.onload = function (e) {
let data = e.target.result
image.src = data
}
reader.readAsDataURL(file)
}
})
} catch (e) {
console.error(e)
}
}
} else if (this.type === '1') {
// 语音
let amr = new BenzAMRRecorder()
try {
await amr.initWithBlob(file)
validate = amr.getDuration() <= 60
if (!validate) {
this.$message.error('上传文件时长不能超过 60秒!')
}
} catch (error) {
console.log(error)
this.$message.error('文件已损坏')
}
} else if (this.type === '2') {
// 视频
let result = await this.checkVideoCode(file)
if (result.mime.indexOf('video/mp4') === -1) {
this.$message.error('mp4 格式不正确, 请使用标准编码视频!')
this.loading = false
return Promise.reject()
}
} else if (this.type === '3') {
// 普通文件
}
if (!validate) {
this.loading = false
}
// if (beforeUpload) {
// return beforeUpload(file)
// }
if (!this.multiple || this.limit == 1) {
this.file = file
} else {
Array.isArray(this.file) || (this.file = []) // 多选
this.file.push(file)
}
return validate || Promise.reject()
},
onError(err, file, fileList) {
this.loading = false
this.$message.error('上传文件失败')
},
checkVideoCode(file) {
return new Promise((resolve, reject) => {
const mp4boxFile = MP4Box.createFile()
const reader = new FileReader()
reader.readAsArrayBuffer(file)
reader.onload = function (e) {
const arrayBuffer = e.target.result
arrayBuffer.fileStart = 0
mp4boxFile.appendBuffer(arrayBuffer)
}
mp4boxFile.onReady = function (info) {
resolve(info)
}
mp4boxFile.onError = function (info) {
reject(info)
}
})
},
showView(index) {
let imager = index !== undefined ? this.$refs.image[index] : this.$refs.image
imager.clickHandler()
this.$nextTick(() => {
// 为遮罩层添加关闭事件
let maskEl = imager.$children[0].$refs['el-image-viewer__wrapper'].firstChild
maskEl.addEventListener('click', () => {
event.stopPropagation()
imager.closeViewer()
})
})
// this.$refs.image.$refs.closeViewer();
}
}
}
</script>
<template>
<div>
<!-- 多个上传文件列表展示 -->
<template v-if="multiple">
<!-- 图片 -->
<template v-if="type == 0">
<!-- <transition-group> -->
<div v-for="(item, index) in fileListWatch" :key="index" class="img-item upload-item">
<el-image
ref="image"
class="upload-img uploader-size"
:src="item.url"
fit="contain"
:preview-src-list="fileListWatch.map((e) => e.url)"
alt=""
/>
<div class="action-mask">
<i class="el-icon-search mr5" @click="showView(index)"></i>
<!-- <span v-if="action.includes('download')" @click="download(item)">
<i class="el-icon-download"></i>
</span> -->
<i class="el-icon-delete mr5" @click="remove(index)"></i>
</div>
</div>
<!-- </transition-group> -->
</template>
<!-- 后续再这里扩展其他文件列表 -->
</template>
<el-upload
v-if="!multiple || !limit || fileListWatch.length < limit"
class="uploader"
action="/api"
:accept="accept || acceptAuto"
:http-request="upload"
:data="{ mediaType: type }"
:show-file-list="false"
:file-list="fileListWatch"
:disabled="loading"
:multiple="multiple && limit != 1"
:limit="limit"
:on-error="onError"
:on-exceed="handleExceed"
:before-upload="handleBeforeUpload"
>
<!--
element-loading-text="正在上传..."
:on-success="onSuccess"
-->
<slot>
<i v-if="!loading && !fileUrlWatch" class="el-icon-plus uploader-icon upload-action uploader-size"></i>
<transition>
<!-- 上传进度条 -->
<div class="upload-action uploader-size" v-if="loading">
<el-progress class="progress cc" type="circle" :percentage="percentage"></el-progress>
<div class="el-loading-spinner">
<svg viewBox="25 25 50 50" class="circular">
<circle cx="50" cy="50" r="20" fill="none" class="path"></circle>
</svg>
</div>
<div class="cc" style="margin-top: 35px;" v-if="speed">
{{ speed + 'M/s' }}
</div>
</div>
<!-- 单文件上传的文件展示 -->
<div v-if="!loading && fileUrlWatch && !multiple" class="upload-item">
<template v-if="type === '0'">
<el-image
v-if="fileUrlWatch"
ref="image"
:src="fileUrlWatch"
class="upload-img upload-img-single uploader-size"
:preview-src-list="[fileUrlWatch]"
fit="contain"
/>
<div class="action-mask" @click.self.stop>
<i class="el-icon-search" @click.prevent.stop="showView()"></i>
<i class="el-icon-edit"></i>
<!-- <span v-if="action.includes('download')" @click.prevent.stop="download(item)">
<i class="el-icon-download"></i>
</span> -->
<!-- <span @click.prevent.stop="remove()">
<i class="el-icon-delete"></i>
</span> -->
</div>
</template>
<template v-else-if="type === '2'">
<video
ref="video"
id="myVideo"
class="upload-video"
width="100%"
controls
webkit-playsinline="true"
playsinline="true"
:autoplay="false"
:key="fileUrlWatch"
preload="auto"
>
<source :src="fileUrlWatch" type="video/mp4" />
</video>
<div class="action-mask" style="height: 30%;" @click.self.stop>
<i class="el-icon-edit"></i>
</div>
</template>
<template v-else class="al">
{{ fileNameWatch || fileUrlWatch }}
<i class="el-icon-edit ml10"></i>
<!-- a链接用本地视频打不开,视频地址使用远程地址 -->
<a @click.stop :href="/\.mp4$/.test(fileNameWatch) ? fileUrl : fileUrlWatch" target="_blank">
<i class="el-icon-view ml10" style="vertical-align: middle;"></i>
</a>
</template>
</div>
</transition>
</slot>
</el-upload>
<!-- 上传格式,大小等提示语 -->
<div class="tip">
<slot name="tip"></slot>
</div>
</div>
</template>
<style lang="scss" scoped>
::v-deep.uploader {
display: inline-block;
vertical-align: middle;
.el-upload {
display: block;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
}
// 默认组件大小,如需修改,请通过外部重写该类样式
.uploader-size {
width: 178px;
height: 178px;
}
.upload-action {
position: relative;
text-align: center;
}
.uploader-icon {
display: flex;
font-size: 28px;
align-items: center;
justify-content: center;
color: #8c939d;
border-radius: 6px;
border: 1px dashed #d9d9d9;
transition: all 0.3s;
&:hover {
border-color: var(--color);
color: var(--color);
}
}
.progress {
overflow: hidden;
}
.upload-img-single {
border: 1px dashed #eee;
}
.upload-img {
display: block;
}
.upload-video {
display: block;
width: 300px;
height: 150px;
box-sizing: border-box;
color: #fff;
background-color: #000;
position: relative;
padding: 0;
font-size: 10px;
line-height: 1;
font-weight: normal;
font-style: normal;
word-break: initial;
}
.tip {
margin-top: 10px;
color: #aaa;
font-size: 12px;
}
.img-item {
position: relative;
display: inline-block;
vertical-align: middle;
margin: 0 10px 10px 0;
transition: all 0.3s;
}
.action-mask {
position: absolute;
display: flex;
justify-content: space-around;
align-items: center;
padding: 0 30px;
width: 100%;
height: 100%;
left: 0;
top: 0;
cursor: pointer;
text-align: center;
color: #fff;
opacity: 0;
font-size: 20px;
transition: opacity 0.3s;
background-color: rgba(0, 0, 0, 0.5);
z-index: 1;
}
.upload-item {
&:hover {
.action-mask {
opacity: 1;
}
}
}
</style>
<template> <template>
<div class="quill-wrap" v-loading="uploadLoading"> <div class="quill-wrap" v-loading="uploadLoading">
<quill-editor v-model="content" ref="quill" @change="onEditorChange($event)" :options="editorOption"></quill-editor> <quill-editor v-model="content" ref="quill" @change="onEditorChange($event)" :options="editorOption"></quill-editor>
<UploadToCos <Upload v-show="false" :fileUrl.sync="imgUrl" type="0" @loadingChange="(val) => (uploadLoading = val)"></Upload>
v-show="false"
:fileUrl.sync="imgUrl"
type="0"
@loadingChange="(val) => (uploadLoading = val)"></UploadToCos>
<SelectEmoji ref="emoji" @select="insertContent" /> <SelectEmoji ref="emoji" @select="insertContent" />
</div> </div>
</template> </template>
......
...@@ -27,7 +27,6 @@ import './permission' // permission control ...@@ -27,7 +27,6 @@ import './permission' // permission control
Vue.component('Pagination', () => import('@/components/Pagination')) Vue.component('Pagination', () => import('@/components/Pagination'))
Vue.component('RightToolbar', () => import('@/components/RightToolbar')) Vue.component('RightToolbar', () => import('@/components/RightToolbar'))
Vue.component('Upload', () => import('@/components/Upload')) Vue.component('Upload', () => import('@/components/Upload'))
Vue.component('UploadToCos', () => import('@/components/UploadToCos'))
Vue.component('ButtonSync', () => import('@/components/ButtonSync')) Vue.component('ButtonSync', () => import('@/components/ButtonSync'))
Vue.component('TagEllipsis', () => import('@/components/TagEllipsis')) Vue.component('TagEllipsis', () => import('@/components/TagEllipsis'))
Vue.component('SelectUser', () => import('@/components/SelectUser')) Vue.component('SelectUser', () => import('@/components/SelectUser'))
......
<template> <template>
<div> <div>
<el-form-item :label="lableOne" style="margin-right: 200px !important;" :error="templateInfo"> <el-form-item :label="lableOne" style="margin-right: 200px !important" :error="templateInfo">
<div v-if="showModle && !isDetail" style="margin-bottom: 10px;"> <div v-if="showModle && !isDetail" style="margin-bottom: 10px">
<el-button type="primary" @click="welcomVisible = true">从模板库中选择</el-button> <el-button type="primary" @click="welcomVisible = true">从模板库中选择</el-button>
</div> </div>
<TextareaExtend <TextareaExtend
...@@ -14,8 +14,7 @@ ...@@ -14,8 +14,7 @@
:autosize="{ minRows: 5, maxRows: 20 }" :autosize="{ minRows: 5, maxRows: 20 }"
clearable clearable
:autofocus="false" :autofocus="false"
@input="changeInfo" @input="changeInfo" />
/>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<div slot="label" class="title" v-if="otherType !== 3"> <div slot="label" class="title" v-if="otherType !== 3">
...@@ -26,19 +25,17 @@ ...@@ -26,19 +25,17 @@
</div> </div>
<div> <div>
<div> <div>
<div style="text-align: left;" class="flex"> <div style="text-align: left" class="flex">
<el-popover <el-popover
v-if="!isDetail" v-if="!isDetail"
trigger="hover" trigger="hover"
:content="'最多添加' + maxlength + '个' + fontType + ',如需修改请删除已有' + fontType + '后重新尝试'" :content="'最多添加' + maxlength + '个' + fontType + ',如需修改请删除已有' + fontType + '后重新尝试'"
placement="top-start" placement="top-start"
:disabled="talkList.length < maxlength" :disabled="talkList.length < maxlength">
>
<el-dropdown <el-dropdown
slot="reference" slot="reference"
@command="moveGroup" @command="moveGroup"
:disabled="talkList.length > maxlength || talkList.length === maxlength" :disabled="talkList.length > maxlength || talkList.length === maxlength">
>
<el-button type="primary">+ {{ '新建' + fontType }}</el-button> <el-button type="primary">+ {{ '新建' + fontType }}</el-button>
<el-dropdown-menu slot="dropdown" trigger="click"> <el-dropdown-menu slot="dropdown" trigger="click">
<!-- <el-dropdown-item :command="'4'" v-if="!this.templateType && this.moduleType !== 4"> <!-- <el-dropdown-item :command="'4'" v-if="!this.templateType && this.moduleType !== 4">
...@@ -73,13 +70,11 @@ ...@@ -73,13 +70,11 @@
trigger="hover" trigger="hover"
:content="'最多添加' + maxlength + '个' + fontType + ',如需修改请删除已有' + fontType + '后重新尝试'" :content="'最多添加' + maxlength + '个' + fontType + ',如需修改请删除已有' + fontType + '后重新尝试'"
placement="top-start" placement="top-start"
:disabled="talkList.length < maxlength" :disabled="talkList.length < maxlength">
>
<div slot="reference" class="ml20"> <div slot="reference" class="ml20">
<el-button <el-button
@click="choseCenter" @click="choseCenter"
:disabled="talkList.length > maxlength || talkList.length === maxlength" :disabled="talkList.length > maxlength || talkList.length === maxlength">
>
从素材中心选择 从素材中心选择
</el-button> </el-button>
</div> </div>
...@@ -95,8 +90,7 @@ ...@@ -95,8 +90,7 @@
:tableData2="talkList" :tableData2="talkList"
@setData="setData" @setData="setData"
@getEdit="getEdit" @getEdit="getEdit"
:dargAble="[2].includes(moduleType)" :dargAble="[2].includes(moduleType)" />
/>
</div> </div>
</el-form-item> </el-form-item>
...@@ -112,8 +106,7 @@ ...@@ -112,8 +106,7 @@
@dialogClose="dialogClose" @dialogClose="dialogClose"
:materialTalkList="talkList" :materialTalkList="talkList"
:moduleType="moduleType" :moduleType="moduleType"
:maxlength="maxlength" :maxlength="maxlength" />
/>
<!-- 模板库 --> <!-- 模板库 -->
<el-dialog <el-dialog
:title="otherType === 2 ? '选择群发模板' : '选择欢迎语模板'" :title="otherType === 2 ? '选择群发模板' : '选择欢迎语模板'"
...@@ -121,8 +114,7 @@ ...@@ -121,8 +114,7 @@
width="60%" width="60%"
append-to-body append-to-body
:close-on-click-modal="false" :close-on-click-modal="false"
v-if="welcomVisible" v-if="welcomVisible">
>
<TemplateLibrary @changeObj="changeObj" :isGroup="otherType === 2" /> <TemplateLibrary @changeObj="changeObj" :isGroup="otherType === 2" />
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="selectModle" :loading="libraryLoading">确 定</el-button> <el-button type="primary" @click="selectModle" :loading="libraryLoading">确 定</el-button>
...@@ -137,39 +129,35 @@ ...@@ -137,39 +129,35 @@
:tplType="tplType" :tplType="tplType"
:moduleType="moduleType" :moduleType="moduleType"
:maxlength="maxlength" :maxlength="maxlength"
:noApplets="otherType === 3" :noApplets="otherType === 3" />
/>
<SelectUser <SelectUser
:defaultValues="selectedUserList" :defaultValues="selectedUserList"
:visible.sync="dialogVisibleSelectUser" :visible.sync="dialogVisibleSelectUser"
title="选择使用员工" title="选择使用员工"
@success="selectedUser" @success="selectedUser"></SelectUser>
></SelectUser>
</div> </div>
</template> </template>
<script> <script>
import PreviewInPhone from '@/components/ContentCenter/PreviewInPhone' import PreviewInPhone from '@/components/ContentCenter/PreviewInPhone'
import { getTree } from '@/api/material' import { getTree } from '@/api/material'
import { lexicalAdd, lexicalDetail } from '@/api/contentCenter/scriptCenter' import { lexicalAdd, lexicalDetail } from '@/api/contentCenter/scriptCenter'
import { templateAdd, templateDetail } from '@/api/contentCenter/modleCenter' import { templateAdd, templateDetail } from '@/api/contentCenter/modleCenter'
import DragTable from './DragTable' import DragTable from './DragTable'
import MaterialCenter from '@/components/ContentCenter/MaterialCenter' import MaterialCenter from '@/components/ContentCenter/MaterialCenter'
import { string } from 'clipboard' import { string } from 'clipboard'
import UploadToCos from '@/components/UploadToCos' import { getPosterInfo } from '@/api/material/poster'
import { getPosterInfo } from '@/api/material/poster' import TemplateLibrary from '@/components/ContentCenter/TemplateLibrary'
import TemplateLibrary from '@/components/ContentCenter/TemplateLibrary' import MessageContentForm from '@/components/MessageContentForm'
import MessageContentForm from '@/components/MessageContentForm' export default {
export default {
name: 'add-material', name: 'add-material',
components: { components: {
PreviewInPhone, PreviewInPhone,
DragTable, DragTable,
MaterialCenter, MaterialCenter,
UploadToCos,
getPosterInfo, getPosterInfo,
TemplateLibrary, TemplateLibrary,
MessageContentForm MessageContentForm,
}, },
data() { data() {
return { return {
...@@ -189,22 +177,22 @@ ...@@ -189,22 +177,22 @@
children: 'children', children: 'children',
label: 'name', label: 'name',
value: 'id', value: 'id',
emitPath: false emitPath: false,
}, },
mobForm: { mobForm: {
welcomeMsg: '', welcomeMsg: '',
materialMsgList: [], materialMsgList: [],
userIds: '', userIds: '',
userNames: '' userNames: '',
}, },
form: { form: {
weMaterialImgAoList: [] weMaterialImgAoList: [],
}, },
talkForm: {}, // 话术表单 talkForm: {}, // 话术表单
treeData: [{}], // 树 treeData: [{}], // 树
talkRules: Object.freeze({ talkRules: Object.freeze({
categoryId: [{ required: true, message: '不能为空', trigger: 'change' }], categoryId: [{ required: true, message: '不能为空', trigger: 'change' }],
talkTitle: [{ required: true, message: '不能为空', trigger: 'blur' }] talkTitle: [{ required: true, message: '不能为空', trigger: 'blur' }],
}), }),
type: undefined, type: undefined,
dialogVisible: false, // 新建素材表格对话框显隐 dialogVisible: false, // 新建素材表格对话框显隐
...@@ -217,7 +205,7 @@ ...@@ -217,7 +205,7 @@
welcomVisible: false, welcomVisible: false,
fontType: '', fontType: '',
maxlength: 8, maxlength: 8,
libraryLoading: false libraryLoading: false,
} }
}, },
props: { props: {
...@@ -226,75 +214,75 @@ ...@@ -226,75 +214,75 @@
default: () => { default: () => {
return { return {
templateInfo: '', templateInfo: '',
attachments: [] attachments: [],
}
} }
}, },
},
// 查询会话详情的id // 查询会话详情的id
talkId: { talkId: {
type: string, type: string,
default: null default: null,
}, },
// 查询模板中心详情的id // 查询模板中心详情的id
modelId: { modelId: {
type: string, type: string,
default: null default: null,
}, },
// 话术类形 0企业话术1客服话术 // 话术类形 0企业话术1客服话术
talkType: { talkType: {
type: string, type: string,
default: null default: null,
}, },
// 1欢迎语 2群发 3sop // 1欢迎语 2群发 3sop
templateType: { templateType: {
type: Number, type: Number,
default: 1 default: 1,
}, },
// 1:活码欢迎语;2:员工欢迎语;3:入群欢迎语 // 1:活码欢迎语;2:员工欢迎语;3:入群欢迎语
tplType: { tplType: {
type: String, type: String,
default: null default: null,
}, },
// 模块类型 1:素材;2:话术;3:模板;4:其他模块 // 模块类型 1:素材;2:话术;3:模板;4:其他模块
moduleType: { moduleType: {
type: Number, type: Number,
default: 4 default: 4,
}, },
// 是否为欢迎语模板 // 是否为欢迎语模板
iswelcom: { iswelcom: {
type: Boolean, type: Boolean,
default: false default: false,
}, },
// 是否显示模板库 // 是否显示模板库
showModle: { showModle: {
type: Boolean, type: Boolean,
default: false default: false,
}, },
// 1.员工活码;2:企微营销;3:企业动态;4:门店活码 // 1.员工活码;2:企微营销;3:企业动态;4:门店活码
otherType: { otherType: {
type: Number, type: Number,
default: null default: null,
}, },
// 是否显示手机 // 是否显示手机
showPhone: { showPhone: {
type: Boolean, type: Boolean,
default: true default: true,
}, },
// 直播链接 // 直播链接
liveUrl: { liveUrl: {
type: String, type: String,
default: null default: null,
}, },
// 是否显示提交取消按钮 // 是否显示提交取消按钮
showFooter: { showFooter: {
type: Boolean, type: Boolean,
default: true default: true,
}, },
isDetail: { isDetail: {
type: Boolean, type: Boolean,
default: false default: false,
} },
}, },
watch: { watch: {
baseData(val) { baseData(val) {
...@@ -315,7 +303,7 @@ ...@@ -315,7 +303,7 @@
this.getDeatil(val) this.getDeatil(val)
} }
}, },
immediate: true immediate: true,
}, },
modelId: { modelId: {
handler(val) { handler(val) {
...@@ -323,8 +311,8 @@ ...@@ -323,8 +311,8 @@
this.getTelDeatil(val) this.getTelDeatil(val)
} }
}, },
immediate: true immediate: true,
} },
}, },
methods: { methods: {
changeInfo(val) { changeInfo(val) {
...@@ -448,7 +436,7 @@ ...@@ -448,7 +436,7 @@
arr = this.talkForm.userIds.split(',').map((dd, index) => { arr = this.talkForm.userIds.split(',').map((dd, index) => {
return { return {
userId: dd, userId: dd,
name: this.talkForm.userNames.split(',')[index] name: this.talkForm.userNames.split(',')[index],
} }
}) })
} }
...@@ -461,7 +449,7 @@ ...@@ -461,7 +449,7 @@
arr = this.talkForm.userIds.split(',').map((dd, index) => { arr = this.talkForm.userIds.split(',').map((dd, index) => {
return { return {
userId: dd, userId: dd,
name: this.talkForm.userNames.split(',')[index] name: this.talkForm.userNames.split(',')[index],
} }
}) })
} }
...@@ -476,7 +464,7 @@ ...@@ -476,7 +464,7 @@
names.push(d.name) names.push(d.name)
return { return {
userId: d.userId, userId: d.userId,
name: d.name name: d.name,
} }
}) })
this.users = selectedUserList this.users = selectedUserList
...@@ -555,8 +543,8 @@ ...@@ -555,8 +543,8 @@
parentId: '0', parentId: '0',
hasParent: false, hasParent: false,
hasChildren: true, hasChildren: true,
children: data || [] children: data || [],
} },
] ]
}) })
}, },
...@@ -765,7 +753,7 @@ ...@@ -765,7 +753,7 @@
this.dealOtherModleType(talkForm) this.dealOtherModleType(talkForm)
} }
this.$emit('update', talkForm) this.$emit('update', talkForm)
} },
}, },
mounted() { mounted() {
if (this.$route.query.categoryId) { if (this.$route.query.categoryId) {
...@@ -791,12 +779,12 @@ ...@@ -791,12 +779,12 @@
} else { } else {
this.fontType = '素材' this.fontType = '素材'
} }
} },
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
::v-deep .ql-editor { ::v-deep .ql-editor {
min-height: 200px; min-height: 200px;
.ql-container { .ql-container {
.ql-snow { .ql-snow {
...@@ -805,8 +793,8 @@ ...@@ -805,8 +793,8 @@
} }
} }
} }
} }
::v-deep .el-button.is-disabled { ::v-deep .el-button.is-disabled {
color: #fff; color: #fff;
background-color: #cccccc; background-color: #cccccc;
border-color: #cccccc; border-color: #cccccc;
...@@ -816,20 +804,20 @@ ...@@ -816,20 +804,20 @@
background-color: #cccccc; background-color: #cccccc;
border-color: #cccccc; border-color: #cccccc;
} }
.footer { .footer {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
} }
.footerColor { .footerColor {
font-weight: 500; font-weight: 500;
font-size: 18px; font-size: 18px;
color: var(--color); color: var(--color);
margin: 0 4px; margin: 0 4px;
} }
.radius { .radius {
border-radius: 4px; border-radius: 4px;
} }
.boxClass { .boxClass {
padding: 20px 10px 0 0; padding: 20px 10px 0 0;
} }
</style> </style>
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
<div v-if="type === '0'"> <div v-if="type === '0'">
<div v-if="!disabled"> <div v-if="!disabled">
<!-- <el-form-item label="图片"> <!-- <el-form-item label="图片">
<UploadToCos <Upload
:fileUrl.sync="form.materialUrl" :fileUrl.sync="form.materialUrl"
:fileName.sync="form.materialName" :fileName.sync="form.materialName"
:maxSize="20" :maxSize="20"
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
<div slot="tip"> <div slot="tip">
支持jpg/jpeg/png格式,图片大小不超过20M,支持最多10张批量上传 支持jpg/jpeg/png格式,图片大小不超过20M,支持最多10张批量上传
</div> </div>
</UploadToCos> </Upload>
</el-form-item> --> </el-form-item> -->
</div> </div>
<div v-else> <div v-else>
...@@ -76,9 +76,9 @@ ...@@ -76,9 +76,9 @@
<div v-if="type === '9'"> <div v-if="type === '9'">
<div v-if="!disabled"> <div v-if="!disabled">
<el-form-item label="图文封面"> <el-form-item label="图文封面">
<UploadToCos :fileUrl.sync="form.coverUrl" type="0"> <Upload :fileUrl.sync="form.coverUrl" type="0">
<div slot="tip">支持jpg/jpeg/png格式,建议200*200</div> <div slot="tip">支持jpg/jpeg/png格式,建议200*200</div>
</UploadToCos> </Upload>
</el-form-item> </el-form-item>
<el-form-item label="图文描述"> <el-form-item label="图文描述">
<el-input <el-input
...@@ -119,9 +119,9 @@ ...@@ -119,9 +119,9 @@
<div v-if="type === '11'"> <div v-if="type === '11'">
<div v-if="!disabled"> <div v-if="!disabled">
<el-form-item label="封面" prop="coverUrl"> <el-form-item label="封面" prop="coverUrl">
<UploadToCos :fileUrl.sync="form.coverUrl" type="0"> <Upload :fileUrl.sync="form.coverUrl" type="0">
<div slot="tip">支持jpg/jpeg/png格式,建议520*416</div> <div slot="tip">支持jpg/jpeg/png格式,建议520*416</div>
</UploadToCos> </Upload>
</el-form-item> </el-form-item>
<el-form-item label="小程序ID" prop="digest"> <el-form-item label="小程序ID" prop="digest">
<el-input v-model="form.digest" placeholder="小程序AppID"></el-input> <el-input v-model="form.digest" placeholder="小程序AppID"></el-input>
......
...@@ -12,7 +12,6 @@ import { delAndRemoves } from '@/api/contentCenter/common' ...@@ -12,7 +12,6 @@ import { delAndRemoves } from '@/api/contentCenter/common'
import { importTemplate, importData } from '@/api/contentCenter/basicMaterials' import { importTemplate, importData } from '@/api/contentCenter/basicMaterials'
import PreviewInPhone from '@/components/ContentCenter/PreviewInPhone' import PreviewInPhone from '@/components/ContentCenter/PreviewInPhone'
import { download, toFormData } from '@/utils/common' import { download, toFormData } from '@/utils/common'
import UploadToCos from '@/components/UploadToCos'
import { dateFormat } from '@/utils/index' import { dateFormat } from '@/utils/index'
var validateHtml = (rule, value, callback) => { var validateHtml = (rule, value, callback) => {
...@@ -35,7 +34,6 @@ export default { ...@@ -35,7 +34,6 @@ export default {
quillEditor, quillEditor,
Voice, Voice,
PreviewInPhone, PreviewInPhone,
UploadToCos,
}, },
props: { props: {
// 0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file), 4 文本, 5 海报, 6 活码, 7 人群, 8 旅程,9 图文,10 链接,11 小程序 // 0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file), 4 文本, 5 海报, 6 活码, 7 人群, 8 旅程,9 图文,10 链接,11 小程序
...@@ -686,7 +684,7 @@ export default { ...@@ -686,7 +684,7 @@ export default {
<!-- 图片 --> <!-- 图片 -->
<template v-else-if="type === '0'"> <template v-else-if="type === '0'">
<el-form-item label="图片" prop="weMaterialImgAoList" v-if="!form.id"> <el-form-item label="图片" prop="weMaterialImgAoList" v-if="!form.id">
<UploadToCos <Upload
v-if="dialogVisible" v-if="dialogVisible"
:fileList.sync="form.weMaterialImgAoList" :fileList.sync="form.weMaterialImgAoList"
:maxSize="20" :maxSize="20"
...@@ -694,7 +692,7 @@ export default { ...@@ -694,7 +692,7 @@ export default {
:multiple="true" :multiple="true"
:limit="10"> :limit="10">
<div slot="tip">支持jpg/jpeg/png格式,图片大小不超过20M,支持最多10张批量上传</div> <div slot="tip">支持jpg/jpeg/png格式,图片大小不超过20M,支持最多10张批量上传</div>
</UploadToCos> </Upload>
</el-form-item> </el-form-item>
<el-form-item label="图片标题" prop="materialName" v-else> <el-form-item label="图片标题" prop="materialName" v-else>
<el-input <el-input
...@@ -732,9 +730,9 @@ export default { ...@@ -732,9 +730,9 @@ export default {
placeholder="请输入图文描述"></el-input> placeholder="请输入图文描述"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="图文封面"> <el-form-item label="图文封面">
<UploadToCos :fileUrl.sync="form.coverUrl" type="0" v-if="dialogVisible"> <Upload :fileUrl.sync="form.coverUrl" type="0" v-if="dialogVisible">
<div slot="tip">支持jpg/jpeg/png格式,建议200*200</div> <div slot="tip">支持jpg/jpeg/png格式,建议200*200</div>
</UploadToCos> </Upload>
</el-form-item> </el-form-item>
<!-- <el-form-item label="内容"> <!-- <el-form-item label="内容">
富文本content 富文本content
...@@ -782,22 +780,22 @@ export default { ...@@ -782,22 +780,22 @@ export default {
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="封面" prop="coverUrl"> <el-form-item label="封面" prop="coverUrl">
<UploadToCos :fileUrl.sync="form.coverUrl" type="0" v-if="dialogVisible"> <Upload :fileUrl.sync="form.coverUrl" type="0" v-if="dialogVisible">
<div slot="tip">支持jpg/jpeg/png格式,建议520*416</div> <div slot="tip">支持jpg/jpeg/png格式,建议520*416</div>
</UploadToCos> </Upload>
</el-form-item> </el-form-item>
</template> </template>
<template v-else-if="type === '1'"> <template v-else-if="type === '1'">
<el-form-item label="语音" prop="materialUrl"> <el-form-item label="语音" prop="materialUrl">
<Voice v-if="form.materialUrl" :amrUrl="form.materialUrl"></Voice> <Voice v-if="form.materialUrl" :amrUrl="form.materialUrl"></Voice>
<UploadToCos <Upload
:fileUrl.sync="form.materialUrl" :fileUrl.sync="form.materialUrl"
:fileName.sync="form.materialName || '点击上传'" :fileName.sync="form.materialName || '点击上传'"
:type="type" :type="type"
:format="audioType"> :format="audioType">
<div slot="tip">只能上传amr格式的语音文件。单个文件大小不超过2M,时长不超过1分钟</div> <div slot="tip">只能上传amr格式的语音文件。单个文件大小不超过2M,时长不超过1分钟</div>
</UploadToCos> </Upload>
</el-form-item> </el-form-item>
<el-form-item label="名称" prop="materialName"> <el-form-item label="名称" prop="materialName">
<el-input v-model="form.materialName" placeholder="请输入"></el-input> <el-input v-model="form.materialName" placeholder="请输入"></el-input>
...@@ -822,7 +820,7 @@ export default { ...@@ -822,7 +820,7 @@ export default {
show-word-limit></el-input> show-word-limit></el-input>
</el-form-item> </el-form-item>
<el-form-item label="上传视频" prop="materialUrl" v-if="!form.id"> <el-form-item label="上传视频" prop="materialUrl" v-if="!form.id">
<UploadToCos <Upload
v-if="dialogVisible" v-if="dialogVisible"
:fileUrl.sync="form.materialUrl" :fileUrl.sync="form.materialUrl"
:fileName.sync="form.materialName" :fileName.sync="form.materialName"
...@@ -830,7 +828,7 @@ export default { ...@@ -830,7 +828,7 @@ export default {
@getPicUrl="getPicUrl" @getPicUrl="getPicUrl"
:type="type"> :type="type">
<div slot="tip">支持mp4/mov格式,视频大小不超过100M</div> <div slot="tip">支持mp4/mov格式,视频大小不超过100M</div>
</UploadToCos> </Upload>
</el-form-item> </el-form-item>
<!-- <el-form-item label="封面"> <!-- <el-form-item label="封面">
<upload :fileUrl.sync="form.coverUrl" type="0"> <upload :fileUrl.sync="form.coverUrl" type="0">
...@@ -858,14 +856,14 @@ export default { ...@@ -858,14 +856,14 @@ export default {
:autosize="{ minRows: 3, maxRows: 10 }"></el-input> :autosize="{ minRows: 3, maxRows: 10 }"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="上传文件" prop="materialUrl" v-if="!form.id"> <el-form-item label="上传文件" prop="materialUrl" v-if="!form.id">
<UploadToCos <Upload
v-if="dialogVisible" v-if="dialogVisible"
:fileUrl.sync="form.materialUrl" :fileUrl.sync="form.materialUrl"
:fileName.sync="form.materialName" :fileName.sync="form.materialName"
:type="type" :type="type"
:format="['doc', 'docx', 'pdf', 'ppt', 'pptx', 'pps', 'pptsx']"> :format="['doc', 'docx', 'pdf', 'ppt', 'pptx', 'pps', 'pptsx']">
<div slot="tip">支持pdf/ppt/word文件,单个文件大小不超过50M</div> <div slot="tip">支持pdf/ppt/word文件,单个文件大小不超过50M</div>
</UploadToCos> </Upload>
</el-form-item> </el-form-item>
</template> </template>
</el-form> </el-form>
......
...@@ -44,11 +44,7 @@ ...@@ -44,11 +44,7 @@
<!-- <div class="tips upload"> <!-- <div class="tips upload">
<i class="el-icon-plus"></i><span> 本地上传</span> <i class="el-icon-plus"></i><span> 本地上传</span>
</div> --> </div> -->
<UploadToCos <Upload :fileUrl.sync="form.backgroundImgPath" :maxSize="20" type="0" @upSuccess="upSuccess"></Upload>
:fileUrl.sync="form.backgroundImgPath"
:maxSize="20"
type="0"
@upSuccess="upSuccess"></UploadToCos>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
...@@ -224,7 +220,7 @@ ...@@ -224,7 +220,7 @@
fit="fit"></el-image> fit="fit"></el-image>
</div> </div>
<div class="up-style" v-else> <div class="up-style" v-else>
<UploadToCos :fileUrl.sync="formDate.imgUrl" :maxSize="20" type="0"></UploadToCos> <Upload :fileUrl.sync="formDate.imgUrl" :maxSize="20" type="0"></Upload>
<el-button size="mini" type="text" style="margin-left: 10px" @click="addObj('imageShow')"> <el-button size="mini" type="text" style="margin-left: 10px" @click="addObj('imageShow')">
从素材库中选取 从素材库中选取
</el-button> </el-button>
...@@ -436,6 +432,8 @@ export default { ...@@ -436,6 +432,8 @@ export default {
materialName: data.materialName, materialName: data.materialName,
digest: data.digest, digest: data.digest,
backgroundImgPath: data.backgroundImgPath, backgroundImgPath: data.backgroundImgPath,
width: data.width,
height: data.height,
posterJSON: JSON.parse(data.otherField), posterJSON: JSON.parse(data.otherField),
} }
this.posterSubassemblyList = data.posterSubassemblyList || [] this.posterSubassemblyList = data.posterSubassemblyList || []
...@@ -671,10 +669,15 @@ export default { ...@@ -671,10 +669,15 @@ export default {
scaleY: canvas.width / img.width, scaleY: canvas.width / img.width,
}) })
canvas.setWidth(375) canvas.setWidth(375)
canvas.setHeight(img.height * (canvas.width / img.width)) let height = img.height * (canvas.width / img.width)
canvas.setHeight(height)
this.form.width = 375
this.form.height = height
} else { } else {
canvas.setWidth(img.width) canvas.setWidth(img.width)
canvas.setHeight(img.height) canvas.setHeight(img.height)
this.form.width = img.width
this.form.height = img.height
} }
canvas.setBackgroundImage(img, canvas.renderAll.bind(canvas)) canvas.setBackgroundImage(img, canvas.renderAll.bind(canvas))
......
...@@ -38,13 +38,13 @@ ...@@ -38,13 +38,13 @@
<div v-if="type === '2'"> <div v-if="type === '2'">
<div v-if="!disabled"> <div v-if="!disabled">
<!-- <el-form-item label="上传视频" prop="materialUrl"> <!-- <el-form-item label="上传视频" prop="materialUrl">
<UploadToCos <Upload
:fileUrl.sync="form.materialUrl" :fileUrl.sync="form.materialUrl"
:fileName.sync="form.materialName" :fileName.sync="form.materialName"
:type="type" :type="type"
> >
<div slot="tip">支持mp4/mov格式,视频大小不超过100M</div> <div slot="tip">支持mp4/mov格式,视频大小不超过100M</div>
</UploadToCos> </Upload>
</el-form-item> --> </el-form-item> -->
<el-form-item label="视频描述"> <el-form-item label="视频描述">
<el-input <el-input
...@@ -74,13 +74,13 @@ ...@@ -74,13 +74,13 @@
<div v-if="type === '3'"> <div v-if="type === '3'">
<div v-if="!disabled"> <div v-if="!disabled">
<!-- <el-form-item label="上传文件" prop="materialUrl"> <!-- <el-form-item label="上传文件" prop="materialUrl">
<UploadToCos <Upload
:fileUrl.sync="form.materialUrl" :fileUrl.sync="form.materialUrl"
:fileName.sync="form.materialName" :fileName.sync="form.materialName"
:type="type" :type="type"
> >
<div slot="tip">支持pdf/ppt/word文件,单个文件大小不超过50M</div> <div slot="tip">支持pdf/ppt/word文件,单个文件大小不超过50M</div>
</UploadToCos> </Upload>
</el-form-item> --> </el-form-item> -->
<el-form-item label="文件描述"> <el-form-item label="文件描述">
<el-input <el-input
...@@ -138,9 +138,9 @@ ...@@ -138,9 +138,9 @@
<div v-if="type === '5'"> <div v-if="type === '5'">
<div v-if="!disabled"> <div v-if="!disabled">
<el-form-item label="封面" prop="materialUrl"> <el-form-item label="封面" prop="materialUrl">
<UploadToCos :fileUrl.sync="form.materialUrl" :fileName.sync="form.materialName" :type="type"> <Upload :fileUrl.sync="form.materialUrl" :fileName.sync="form.materialName" :type="type">
<div slot="tip">支持pdf/ppt/word文件,单个文件大小不超过50M</div> <div slot="tip">支持pdf/ppt/word文件,单个文件大小不超过50M</div>
</UploadToCos> </Upload>
</el-form-item> </el-form-item>
<el-form-item label="文件描述"> <el-form-item label="文件描述">
<el-input <el-input
......
<template> <template>
<div> <div>
<el-form-item <el-form-item :label="lableOne" required style="margin-right: 200px !important" :error="templateInfo">
:label="lableOne"
required
style="margin-right: 200px !important"
:error="templateInfo"
>
<div v-if="showModle" style="margin-bottom: 10px"> <div v-if="showModle" style="margin-bottom: 10px">
<el-button type="primary" @click="welcomVisible = true">从模板库中选择</el-button> <el-button type="primary" @click="welcomVisible = true">从模板库中选择</el-button>
</div> </div>
...@@ -18,17 +13,12 @@ ...@@ -18,17 +13,12 @@
:autosize="{ minRows: 5, maxRows: 20 }" :autosize="{ minRows: 5, maxRows: 20 }"
clearable clearable
:autofocus="true" :autofocus="true"
@input="changeInfo" @input="changeInfo" />
/>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<div slot="label" class="title" v-if="otherType !== 3"> <div slot="label" class="title" v-if="otherType !== 3">
{{ titleTwo }} {{ titleTwo }}
<el-popover <el-popover trigger="hover" :content="'最多添加' + maxlength + '个素材'" placement="top-start">
trigger="hover"
:content="'最多添加' + maxlength + '个素材'"
placement="top-start"
>
<i slot="reference" class="el-icon-question"></i> <i slot="reference" class="el-icon-question"></i>
</el-popover> </el-popover>
</div> </div>
...@@ -37,23 +27,13 @@ ...@@ -37,23 +27,13 @@
<div style="text-align: left" class="flex"> <div style="text-align: left" class="flex">
<el-popover <el-popover
trigger="hover" trigger="hover"
:content=" :content="'最多添加' + maxlength + '个' + fontType + ',如需修改请删除已有' + fontType + '后重新尝试'"
'最多添加' +
maxlength +
'个' +
fontType +
',如需修改请删除已有' +
fontType +
'后重新尝试'
"
placement="top-start" placement="top-start"
:disabled="talkList.length < maxlength" :disabled="talkList.length < maxlength">
>
<el-dropdown <el-dropdown
slot="reference" slot="reference"
@command="moveGroup" @command="moveGroup"
:disabled="talkList.length > maxlength || talkList.length === maxlength" :disabled="talkList.length > maxlength || talkList.length === maxlength">
>
<el-button type="primary">+ {{ '新建' + fontType }}</el-button> <el-button type="primary">+ {{ '新建' + fontType }}</el-button>
<el-dropdown-menu slot="dropdown" trigger="click"> <el-dropdown-menu slot="dropdown" trigger="click">
<!-- <el-dropdown-item :command="'4'" v-if="!this.templateType && this.moduleType !== 4"> <!-- <el-dropdown-item :command="'4'" v-if="!this.templateType && this.moduleType !== 4">
...@@ -85,23 +65,13 @@ ...@@ -85,23 +65,13 @@
</el-popover> </el-popover>
<el-popover <el-popover
trigger="hover" trigger="hover"
:content=" :content="'最多添加' + maxlength + '个' + fontType + ',如需修改请删除已有' + fontType + '后重新尝试'"
'最多添加' +
maxlength +
'个' +
fontType +
',如需修改请删除已有' +
fontType +
'后重新尝试'
"
placement="top-start" placement="top-start"
:disabled="talkList.length < maxlength" :disabled="talkList.length < maxlength">
>
<div slot="reference" class="ml20"> <div slot="reference" class="ml20">
<el-button <el-button
@click="choseCenter" @click="choseCenter"
:disabled="talkList.length > maxlength || talkList.length === maxlength" :disabled="talkList.length > maxlength || talkList.length === maxlength">
>
从素材中心选择 从素材中心选择
</el-button> </el-button>
</div> </div>
...@@ -112,12 +82,7 @@ ...@@ -112,12 +82,7 @@
</el-form-item> </el-form-item>
<div style="margin-top: 10px; margin-left: 150px" v-show="talkList.length"> <div style="margin-top: 10px; margin-left: 150px" v-show="talkList.length">
<DragTable <DragTable :tableData2="talkList" @setData="setData" @getEdit="getEdit" :dargAble="[2].includes(moduleType)" />
:tableData2="talkList"
@setData="setData"
@getEdit="getEdit"
:dargAble="[2].includes(moduleType)"
/>
</div> </div>
<!-- <el-col :span="8" class="g-card" style="margin-top: 20px; padding: 20px;" v-if="showPhone"> <!-- <el-col :span="8" class="g-card" style="margin-top: 20px; padding: 20px;" v-if="showPhone">
<PreviewInPhone :list="talkList" :templateInfo="talkForm.templateInfo" :liveUrl="liveUrl" /> <PreviewInPhone :list="talkList" :templateInfo="talkForm.templateInfo" :liveUrl="liveUrl" />
...@@ -131,8 +96,7 @@ ...@@ -131,8 +96,7 @@
@dialogClose="dialogClose" @dialogClose="dialogClose"
:materialTalkList="talkList" :materialTalkList="talkList"
:moduleType="moduleType" :moduleType="moduleType"
:maxlength="maxlength" :maxlength="maxlength" />
/>
<!-- 模板库 --> <!-- 模板库 -->
<el-dialog <el-dialog
:title="otherType === 2 ? '选择群发模板' : '选择欢迎语模板'" :title="otherType === 2 ? '选择群发模板' : '选择欢迎语模板'"
...@@ -140,8 +104,7 @@ ...@@ -140,8 +104,7 @@
width="60%" width="60%"
append-to-body append-to-body
:close-on-click-modal="false" :close-on-click-modal="false"
v-if="welcomVisible" v-if="welcomVisible">
>
<TemplateLibrary @changeObj="changeObj" :isGroup="otherType === 2" /> <TemplateLibrary @changeObj="changeObj" :isGroup="otherType === 2" />
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="selectModle" :loading="libraryLoading">确 定</el-button> <el-button type="primary" @click="selectModle" :loading="libraryLoading">确 定</el-button>
...@@ -156,14 +119,12 @@ ...@@ -156,14 +119,12 @@
:tplType="tplType" :tplType="tplType"
:moduleType="moduleType" :moduleType="moduleType"
:maxlength="maxlength" :maxlength="maxlength"
:noApplets="otherType === 3" :noApplets="otherType === 3" />
/>
<SelectUser <SelectUser
:defaultValues="selectedUserList" :defaultValues="selectedUserList"
:visible.sync="dialogVisibleSelectUser" :visible.sync="dialogVisibleSelectUser"
title="选择使用员工" title="选择使用员工"
@success="selectedUser" @success="selectedUser"></SelectUser>
></SelectUser>
</div> </div>
</template> </template>
...@@ -175,7 +136,6 @@ import { templateAdd, templateDetail } from '@/api/contentCenter/modleCenter' ...@@ -175,7 +136,6 @@ import { templateAdd, templateDetail } from '@/api/contentCenter/modleCenter'
import DragTable from '@/components/DragTable' import DragTable from '@/components/DragTable'
import MaterialCenter from '@/components/ContentCenter/MaterialCenter' import MaterialCenter from '@/components/ContentCenter/MaterialCenter'
import { string } from 'clipboard' import { string } from 'clipboard'
import UploadToCos from '@/components/UploadToCos'
import { getPosterInfo } from '@/api/material/poster' import { getPosterInfo } from '@/api/material/poster'
import TemplateLibrary from '@/components/ContentCenter/TemplateLibrary' import TemplateLibrary from '@/components/ContentCenter/TemplateLibrary'
import MessageContentForm from '@/components/MessageContentForm' import MessageContentForm from '@/components/MessageContentForm'
...@@ -185,7 +145,6 @@ export default { ...@@ -185,7 +145,6 @@ export default {
PreviewInPhone, PreviewInPhone,
DragTable, DragTable,
MaterialCenter, MaterialCenter,
UploadToCos,
getPosterInfo, getPosterInfo,
TemplateLibrary, TemplateLibrary,
MessageContentForm, MessageContentForm,
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
<div class="g-card"> <div class="g-card">
<div class="my-title">企业配置</div> <div class="my-title">企业配置</div>
<el-form-item label="企业ID:" prop="corpId"> <el-form-item label="企业ID:" prop="corpId">
<el-input style="width: 40%;" v-model="form.corpId" placeholder=""></el-input> <el-input style="width: 40%" v-model="form.corpId" placeholder=""></el-input>
<div class="tips">企业ID即CorpID,在企微后台->我的企业中获取</div> <div class="tips">企业ID即CorpID,在企微后台->我的企业中获取</div>
</el-form-item> </el-form-item>
<el-form-item label="企业名称:" prop="companyName" required> <el-form-item label="企业名称:" prop="companyName" required>
<el-input style="width: 40%;" v-model="form.companyName" placeholder="企业名称"></el-input> <el-input style="width: 40%" v-model="form.companyName" placeholder="企业名称"></el-input>
<div class="tips">根据企业 ID 配置后回显</div> <div class="tips">根据企业 ID 配置后回显</div>
</el-form-item> </el-form-item>
<el-form-item label="企业logo" required prop="logoUrl"> <el-form-item label="企业logo" required prop="logoUrl">
...@@ -22,22 +22,20 @@ ...@@ -22,22 +22,20 @@
<div> <div>
<el-input <el-input
:disabled="!corpSecretEditState" :disabled="!corpSecretEditState"
style="width: 40%;" style="width: 40%"
:type="corpSecretEditState ? 'text' : 'password'" :type="corpSecretEditState ? 'text' : 'password'"
v-model="form.corpSecret" v-model="form.corpSecret"
placeholder="请输入通讯录Secret" placeholder="请输入通讯录Secret"></el-input>
></el-input> <el-button style="margin-left: 20px" plain v-if="corpSecretEditState" @click="cancelEditCorpSecret">
<el-button style="margin-left: 20px;" plain v-if="corpSecretEditState" @click="cancelEditCorpSecret">
取消 取消
</el-button> </el-button>
<el-button type="primary" plain v-if="corpSecretEditState" @click="submitEditCorpSecret">保存</el-button> <el-button type="primary" plain v-if="corpSecretEditState" @click="submitEditCorpSecret">保存</el-button>
<el-button <el-button
type="primary" type="primary"
style="margin-left: 20px;" style="margin-left: 20px"
plain plain
v-if="!corpSecretEditState" v-if="!corpSecretEditState"
@click="editCorpSecret" @click="editCorpSecret">
>
修改 修改
</el-button> </el-button>
</div> </div>
...@@ -50,12 +48,11 @@ ...@@ -50,12 +48,11 @@
<div> <div>
<el-input <el-input
:disabled="!contactSecretEditState" :disabled="!contactSecretEditState"
style="width: 40%;" style="width: 40%"
:type="contactSecretEditState ? 'text' : 'password'" :type="contactSecretEditState ? 'text' : 'password'"
v-model="form.contactSecret" v-model="form.contactSecret"
placeholder="请输入客户联系Secret" placeholder="请输入客户联系Secret"></el-input>
></el-input> <el-button style="margin-left: 20px" plain v-if="contactSecretEditState" @click="cancelEditContactSecret">
<el-button style="margin-left: 20px;" plain v-if="contactSecretEditState" @click="cancelEditContactSecret">
取消 取消
</el-button> </el-button>
<el-button type="primary" plain v-if="contactSecretEditState" @click="submitEditContactSecret"> <el-button type="primary" plain v-if="contactSecretEditState" @click="submitEditContactSecret">
...@@ -63,11 +60,10 @@ ...@@ -63,11 +60,10 @@
</el-button> </el-button>
<el-button <el-button
type="primary" type="primary"
style="margin-left: 20px;" style="margin-left: 20px"
plain plain
v-if="!contactSecretEditState" v-if="!contactSecretEditState"
@click="editContactSecret" @click="editContactSecret">
>
修改 修改
</el-button> </el-button>
</div> </div>
...@@ -77,10 +73,10 @@ ...@@ -77,10 +73,10 @@
<div class="g-card"> <div class="g-card">
<div class="my-title">回调配置</div> <div class="my-title">回调配置</div>
<el-form-item label="Token:" prop="token"> <el-form-item label="Token:" prop="token">
<el-input style="width: 40%;" v-model="form.token" placeholder="请输入Token"></el-input> <el-input style="width: 40%" v-model="form.token" placeholder="请输入Token"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="EncodingAESKey:" prop="encodingAesKey"> <el-form-item label="EncodingAESKey:" prop="encodingAesKey">
<el-input style="width: 40%;" v-model="form.encodingAesKey" placeholder="请输入EncodingAESKey"></el-input> <el-input style="width: 40%" v-model="form.encodingAesKey" placeholder="请输入EncodingAESKey"></el-input>
</el-form-item> </el-form-item>
</div> </div>
<el-form-item label="" class="ar"> <el-form-item label="" class="ar">
...@@ -90,9 +86,8 @@ ...@@ -90,9 +86,8 @@
</div> </div>
</template> </template>
<script> <script>
import UploadToCos from '../../components/UploadToCos.vue' export default {
export default { components: {},
components: { UploadToCos },
name: 'enterprise-wechat-part1', name: 'enterprise-wechat-part1',
data() { data() {
return { return {
...@@ -108,18 +103,18 @@ ...@@ -108,18 +103,18 @@
contactSecret: [{ required: true, message: '必填项', trigger: 'blur' }], contactSecret: [{ required: true, message: '必填项', trigger: 'blur' }],
logoUrl: [{ required: true, message: '必填项', trigger: 'blur' }], logoUrl: [{ required: true, message: '必填项', trigger: 'blur' }],
token: [{ required: true, message: '必填项', trigger: 'blur' }], token: [{ required: true, message: '必填项', trigger: 'blur' }],
encodingAesKey: [{ required: true, message: '必填项', trigger: 'blur' }] encodingAesKey: [{ required: true, message: '必填项', trigger: 'blur' }],
} },
} }
}, },
watch: { watch: {
data: 'setData' data: 'setData',
}, },
props: { props: {
data: { data: {
type: Object, type: Object,
default: {} default: {},
} },
}, },
methods: { methods: {
editContactSecret() { editContactSecret() {
...@@ -164,17 +159,17 @@ ...@@ -164,17 +159,17 @@
if (Object.keys(this.data).length) { if (Object.keys(this.data).length) {
this.form = this.data this.form = this.data
} }
} },
}, },
mounted() {}, mounted() {},
created() {} created() {},
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.my-title { .my-title {
} }
.tips { .tips {
color: #aaa; color: #aaa;
font-size: 12px; font-size: 12px;
} }
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!