Commit 4299affc by 怪兽?别跑

接口调试

1 parent 40248e56
<template> <template>
<div> <div>
<el-form-item :label="lableOne" required style="margin-right: 200px !important" :error="templateInfo"> <el-form-item :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>
<TextareaExtend <TextareaExtend
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
placeholder="请输入" placeholder="请输入"
:autosize="{ minRows: 5, maxRows: 20 }" :autosize="{ minRows: 5, maxRows: 20 }"
clearable clearable
:autofocus="true" :autofocus="false"
@input="changeInfo" /> />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<template #label> <template #label>
...@@ -28,16 +28,18 @@ ...@@ -28,16 +28,18 @@
</template> </template>
<div> <div>
<div> <div>
<div style="text-align: left" class="flex"> <div style="text-align: left;" class="flex">
<el-popover <el-popover
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"
>
<template #reference> <template #reference>
<el-dropdown <el-dropdown
@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>
<template #dropdown> <template #dropdown>
<el-dropdown-menu trigger="click"> <el-dropdown-menu trigger="click">
...@@ -74,12 +76,14 @@ ...@@ -74,12 +76,14 @@
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"
>
<template #reference> <template #reference>
<div class="ml20"> <div 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>
...@@ -90,7 +94,7 @@ ...@@ -90,7 +94,7 @@
</div> </div>
</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 :tableData2="talkList" @setData="setData" @getEdit="getEdit" :dargAble="[2].includes(moduleType)" /> <DragTable :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">
...@@ -105,7 +109,8 @@ ...@@ -105,7 +109,8 @@
@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 ? '选择群发模板' : '选择欢迎语模板'"
...@@ -113,7 +118,8 @@ ...@@ -113,7 +118,8 @@
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" />
<template #footer> <template #footer>
<div class="dialog-footer"> <div class="dialog-footer">
...@@ -130,735 +136,743 @@ ...@@ -130,735 +136,743 @@
:tplType="tplType" :tplType="tplType"
:moduleType="moduleType" :moduleType="moduleType"
:maxlength="maxlength" :maxlength="maxlength"
:noApplets="otherType === 3" /> :noApplets="otherType === 3"
/>
<SelectUser <SelectUser
:defaultValues="selectedUserList" :defaultValues="selectedUserList"
v-model:visible="dialogVisibleSelectUser" v-model:visible="dialogVisibleSelectUser"
title="选择使用员工" title="选择使用员工"
@success="selectedUser"></SelectUser> @success="selectedUser"
></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 '@/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 { 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,
getPosterInfo, getPosterInfo,
TemplateLibrary, TemplateLibrary,
MessageContentForm, MessageContentForm
}, },
data() { data() {
return { return {
titleOne: '欢迎语', titleOne: '欢迎语',
lableOne: '欢迎语', lableOne: '欢迎语',
titleTwo: '欢迎语附件', titleTwo: '欢迎语附件',
templateInfo: '', templateInfo: '',
userInfo: '', userInfo: '',
editMaterialForm: {}, editMaterialForm: {},
choseDialog: false, choseDialog: false,
ids: [], ids: [],
// materialIds: [], //素材id // materialIds: [], //素材id
// 分组props // 分组props
groupProps: { groupProps: {
expandTrigger: 'hover', expandTrigger: 'hover',
checkStrictly: true, checkStrictly: true,
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, // 新建素材表格对话框显隐
talkLoading: false, talkLoading: false,
talkList: [], talkList: [],
users: [], users: [],
selectedUserList: [], selectedUserList: [],
dialogVisibleSelectUser: false, dialogVisibleSelectUser: false,
isedit: false, // 是否为图片编辑 isedit: false, // 是否为图片编辑
welcomVisible: false, welcomVisible: false,
fontType: '', fontType: '',
maxlength: 9, maxlength: 9,
libraryLoading: false, libraryLoading: false
} }
}, },
props: { props: {
baseData: { baseData: {
type: Object, type: Object,
default: () => { default: () => {
return { return {
templateInfo: '', templateInfo: '',
attachments: [], attachments: []
}
} }
}, },
}, // 最多上传的素材数
// 最多上传的素材数 maxlengthTwo: {
maxlengthTwo: { type: Number,
type: Number, default: 9
default: 9, },
}, // 查询会话详情的id
// 查询会话详情的id talkId: {
talkId: { type: string,
type: string, default: null
default: null,
},
// 查询模板中心详情的id
modelId: {
type: string,
default: null,
},
// 话术类形 0企业话术1客服话术
talkType: {
type: string,
default: null,
},
// 1欢迎语 2群发 3sop
templateType: {
type: Number,
default: 1,
},
// 1:活码欢迎语;2:员工欢迎语;3:入群欢迎语
tplType: {
type: String,
default: null,
},
// 模块类型 1:素材;2:话术;3:模板;4:其他模块
moduleType: {
type: Number,
default: 4,
},
// 是否为欢迎语模板
iswelcom: {
type: Boolean,
default: false,
},
// 是否显示模板库
showModle: {
type: Boolean,
default: true,
},
// 1.员工活码;2:企微营销;3:企业动态;4:门店活码
otherType: {
type: Number,
default: null,
},
// 是否显示手机
showPhone: {
type: Boolean,
default: true,
},
// 直播链接
liveUrl: {
type: String,
default: null,
},
// 是否显示提交取消按钮
showFooter: {
type: Boolean,
default: true,
},
},
watch: {
maxlengthTwo: {
handler(val) {
this.maxlength = val
}, },
immediate: true, // 查询模板中心详情的id
modelId: {
type: string,
default: null
},
// 话术类形 0企业话术1客服话术
talkType: {
type: string,
default: null
},
// 1欢迎语 2群发 3sop
templateType: {
type: Number,
default: 1
},
// 1:活码欢迎语;2:员工欢迎语;3:入群欢迎语
tplType: {
type: String,
default: null
},
// 模块类型 1:素材;2:话术;3:模板;4:其他模块
moduleType: {
type: Number,
default: 4
},
// 是否为欢迎语模板
iswelcom: {
type: Boolean,
default: false
},
// 是否显示模板库
showModle: {
type: Boolean,
default: true
},
// 1.员工活码;2:企微营销;3:企业动态;4:门店活码
otherType: {
type: Number,
default: null
},
// 是否显示手机
showPhone: {
type: Boolean,
default: true
},
// 直播链接
liveUrl: {
type: String,
default: null
},
// 是否显示提交取消按钮
showFooter: {
type: Boolean,
default: true
}
}, },
baseData(val) { watch: {
if (val.templateInfo) { talkForm: {
this.form.templateInfo = val.templateInfo handler(val) {
this.form.attachments = val.attachments this.changeInfo(val.templateInfo)
if (this.form.templateInfo) { },
// this.form.templateInfo = this.baseData.templateInfo deep: true
this.talkForm = this.form },
this.talkList = this.form.attachments maxlengthTwo: {
handler(val) {
this.maxlength = val
},
immediate: true
},
baseData(val) {
if (val.templateInfo) {
this.form.templateInfo = val.templateInfo
this.form.attachments = val.attachments
if (this.form.templateInfo) {
// this.form.templateInfo = this.baseData.templateInfo
this.talkForm = this.form
this.talkList = this.form.attachments
}
// this.$forceUpdate()
} }
// this.$forceUpdate() },
talkId: {
handler(val) {
if (val) {
this.getDeatil(val)
}
},
immediate: true
},
modelId: {
handler(val) {
if (val) {
this.getTelDeatil(val)
}
},
immediate: true
} }
}, },
talkId: { methods: {
handler(val) { changeInfo(val) {
if (val) { this.$emit('changeInfo', val)
this.getDeatil(val) },
dialogClose(val, list) {
this.dialogVisible = val
if (list) {
this.talkList = [...list]
this.$emit('phoneData', this.talkList)
this.$emit('success', this.setResult())
} }
}, },
immediate: true, setResult() {
}, let arr = []
modelId: { this.talkList.forEach((item) => {
handler(val) { let attachments = {}
if (val) { switch (item.mediaType) {
this.getTelDeatil(val) case '0':
// 图片
attachments.picUrl = item.materialUrl
attachments.msgType = 'image'
break
case '2':
// 视频
attachments.picUrl = item.coverUrl
attachments.fileUrl = item.materialUrl
attachments.description = item.digest
attachments.title = item.materialName
attachments.msgType = 'video'
break
case '3':
// 文件
attachments.picUrl = this.filPicType(item.materialUrl)
attachments.fileUrl = item.materialUrl
attachments.description = item.digest
attachments.title = item.materialName
attachments.msgType = 'file'
break
case '4':
// 文本
attachments.content = item.content
attachments.msgType = 'text'
break
case '5':
// 海报
attachments.fileUrl = item.materialUrl
attachments.msgType = 'posters'
break
case '9':
// 图文
attachments.content = item.content
attachments.picUrl = item.coverUrl
attachments.linkUrl = item.materialUrl
attachments.title = item.materialName
attachments.msgType = 'link'
break
case '11':
// 小程序
attachments.picUrl = item.coverUrl
attachments.fileUrl = item.materialUrl
attachments.appId = item.digest
attachments.title = item.materialName
attachments.msgType = 'miniprogram'
break
case '12':
// 文章
attachments.fileUrl = item.materialUrl
attachments.description = item.digest
attachments.content = item.content
attachments.picUrl = item.coverUrl
attachments.title = item.materialName
attachments.msgType = 'news'
break
}
arr.push(attachments)
})
return arr
},
filPicType(file) {
let filecontent = JSON.parse(JSON.stringify(file))
filecontent = filecontent.split('.')
let type = filecontent[filecontent.length - 1]
if (type === 'pdf') {
return window.lwConfig.DEFAULT_H5_PDF
} else if (['doc', 'docx'].includes(type)) {
return window.lwConfig.DEFAULT_H5_WORDE
} else if (['ppt', 'pptx', 'pps', 'pptsx'].includes(type)) {
return window.lwConfig.DEFAULT_H5_PPT
} else {
return ''
} }
}, },
immediate: true, dealType() {
}, if (this.moduleType === 4) {
}, switch (this.otherType) {
methods: { case 1:
changeInfo(val) { case 4:
this.$emit('changeInfo', val) this.titleOne = '欢迎语'
}, this.lableOne = '欢迎语'
dialogClose(val, list) { this.titleTwo = '欢迎语附件'
this.dialogVisible = val break
if (list) { case 2:
this.talkList = [...list] this.titleOne = '群发内容'
this.lableOne = '内容'
this.titleTwo = '群发附件'
break
case 3:
this.titleOne = '动态内容'
this.lableOne = '动态文本'
break
}
} else if (this.iswelcom) {
this.titleOne = '欢迎语'
this.lableOne = '欢迎语'
this.titleTwo = '欢迎语附件'
} else if (this.templateType === 2) {
this.lableOne = '群发内容'
this.titleTwo = '群发附件'
} else if (this.templateType === 3) {
this.lableOne = ' SOP内容'
this.titleTwo = '群发附件'
} else {
this.titleOne = '欢迎语'
this.lableOne = '消息内容'
this.titleTwo = '话术素材'
}
},
// 模板库点击确定
selectModle() {
this.libraryLoading = true
if (this.selectObj) {
this.talkForm = this.selectObj
this.welcomVisible = false
this.talkList = [...this.selectObj.weMaterialList]
this.$emit('phoneData', [...this.selectObj.weMaterialList])
this.$emit('changeInfo', this.selectObj.templateInfo)
this.$emit('success', this.setResult())
} else {
this.$message.error('请选择模板')
}
this.libraryLoading = false
},
changeObj(id) {
if (id) {
templateDetail(id).then((res) => {
this.selectObj = res.data
})
}
},
setUserData() {
this.selectedUserList = []
let arr = []
if (this.talkForm.userIds) {
arr = this.talkForm.userIds.split(',').map((dd, index) => {
return {
userId: dd,
name: this.talkForm.userNames.split(',')[index]
}
})
}
this.users = arr
},
onSelectUser() {
this.selectedUserList = []
let arr = []
if (this.talkForm.userIds) {
arr = this.talkForm.userIds.split(',').map((dd, index) => {
return {
userId: dd,
name: this.talkForm.userNames.split(',')[index]
}
})
}
this.selectedUserList = arr
this.dialogVisibleSelectUser = true
},
selectedUser(users) {
let ids = []
let names = []
const selectedUserList = users.map((d) => {
ids.push(d.userId)
names.push(d.name)
return {
userId: d.userId,
name: d.name
}
})
this.users = selectedUserList
this.talkForm.userIds = ids.join(',')
this.talkForm.userNames = names.join(',')
},
// 获取详情
getDeatil(id) {
lexicalDetail(id)
.then((res) => {
this.talkForm = res.data
this.talkList = res.data.weMaterialList
})
.catch(() => {})
},
// 获取模板中心详情
getTelDeatil(id) {
templateDetail(id)
.then((res) => {
this.talkForm = res.data
this.talkList = res.data.weMaterialList
this.setUserData()
})
.catch(() => {})
},
getEdit(val) {
this.type = val.mediaType
this.editMaterialForm = JSON.parse(JSON.stringify(val))
},
setData(val) {
this.talkList = val
this.$emit('phoneData', this.talkList) this.$emit('phoneData', this.talkList)
this.$emit('success', this.setResult()) this.$emit('success', this.setResult())
} },
}, getItemArry(val) {
setResult() { this.talkList = this.talkList.concat(val)
let arr = [] // 当手机为非内嵌时
this.talkList.forEach((item) => { this.$emit('phoneData', this.talkList)
let attachments = {} this.$emit('success', this.setResult())
switch (item.mediaType) { },
case '0': centerSubmit() {},
// 图片 selectCenter() {},
attachments.picUrl = item.materialUrl choseCenter() {
attachments.msgType = 'image' this.choseDialog = true
break },
case '2': getIds(value) {
// 视频 this.ids = value
attachments.picUrl = item.coverUrl },
attachments.fileUrl = item.materialUrl moveGroup(type) {
attachments.description = item.digest this.type = ''
attachments.title = item.materialName this.type = type
attachments.msgType = 'video' if (this.otherType === 3 && type == '2') {
break this.choseDialog = true
case '3': } else {
// 文件 this.dialogVisible = true
attachments.picUrl = this.filPicType(item.materialUrl)
attachments.fileUrl = item.materialUrl
attachments.description = item.digest
attachments.title = item.materialName
attachments.msgType = 'file'
break
case '4':
// 文本
attachments.content = item.content
attachments.msgType = 'text'
break
case '5':
// 海报
attachments.fileUrl = item.materialUrl
attachments.msgType = 'posters'
break
case '9':
// 图文
attachments.content = item.content
attachments.picUrl = item.coverUrl
attachments.linkUrl = item.materialUrl
attachments.title = item.materialName
attachments.msgType = 'link'
break
case '11':
// 小程序
attachments.picUrl = item.coverUrl
attachments.fileUrl = item.materialUrl
attachments.appId = item.digest
attachments.title = item.materialName
attachments.msgType = 'miniprogram'
break
case '12':
// 文章
attachments.fileUrl = item.materialUrl
attachments.description = item.digest
attachments.content = item.content
attachments.picUrl = item.coverUrl
attachments.title = item.materialName
attachments.msgType = 'news'
break
} }
arr.push(attachments) },
}) // 获取类目树
return arr getTree() {
}, var mediaType = null
filPicType(file) { if (this.talkType == 0) {
let filecontent = JSON.parse(JSON.stringify(file)) mediaType = 13
filecontent = filecontent.split('.') } else if (this.talkType == 1) {
let type = filecontent[filecontent.length - 1] mediaType = 14
if (type === 'pdf') {
return window.lwConfig.DEFAULT_H5_PDF
} else if (['doc', 'docx'].includes(type)) {
return window.lwConfig.DEFAULT_H5_WORDE
} else if (['ppt', 'pptx', 'pps', 'pptsx'].includes(type)) {
return window.lwConfig.DEFAULT_H5_PPT
} else {
return ''
}
},
dealType() {
if (this.moduleType === 4) {
switch (this.otherType) {
case 1:
case 4:
this.titleOne = '欢迎语'
this.lableOne = '欢迎语'
this.titleTwo = '欢迎语附件'
break
case 2:
this.titleOne = '群发内容'
this.lableOne = '内容'
this.titleTwo = '群发附件'
break
case 3:
this.titleOne = '动态内容'
this.lableOne = '动态文本'
break
} }
} else if (this.iswelcom) { if (this.templateType == 2) {
this.titleOne = '欢迎语' mediaType = 17
this.lableOne = '欢迎语' } else if (this.templateType == 3) {
this.titleTwo = '欢迎语附件' mediaType = 16
} else if (this.templateType === 2) { }
this.lableOne = '群发内容' getTree(mediaType).then(({ data }) => {
this.titleTwo = '群发附件' this.treeData = [
} else if (this.templateType === 3) { {
this.lableOne = ' SOP内容' id: '',
this.titleTwo = '群发附件' name: '全部',
} else { parentId: '0',
this.titleOne = '欢迎语' hasParent: false,
this.lableOne = '消息内容' hasChildren: true,
this.titleTwo = '话术素材' children: data || []
} }
}, ]
// 模板库点击确定
selectModle() {
this.libraryLoading = true
if (this.selectObj) {
this.talkForm = this.selectObj
this.welcomVisible = false
this.talkList = [...this.selectObj.weMaterialList]
this.$emit('phoneData', [...this.selectObj.weMaterialList])
this.$emit('changeInfo', this.selectObj.templateInfo)
this.$emit('success', this.setResult())
} else {
this.$message.error('请选择模板')
}
this.libraryLoading = false
},
changeObj(id) {
if (id) {
templateDetail(id).then((res) => {
this.selectObj = res.data
}) })
} },
}, // 新建话术
setUserData() { tackSubmit() {
this.selectedUserList = [] this.talkLoading = true
let arr = [] if ([3, 4].includes(this.moduleType) && !this.talkForm.templateInfo) {
if (this.talkForm.userIds) { this.templateInfo = '请输入' + this.lableOne
arr = this.talkForm.userIds.split(',').map((dd, index) => { this.talkLoading = false
return { return
userId: dd, } else {
name: this.talkForm.userNames.split(',')[index], this.templateInfo = ''
}
if (!this.talkForm.userIds && this.tplType == 2) {
this.userInfo = '请选择员工'
this.talkLoading = false
return
} else {
this.userInfo = ''
}
if (this.talkType === '0') {
this.talkForm.talkType = 0
} else if (this.talkType === '1') {
this.talkForm.talkType = 1
}
if (!this.templateType) {
this.talkForm.talkMaterialList = []
this.talkList.forEach((item, index) => {
this.talkForm.talkMaterialList.push({ materialId: item.id, sort: index })
})
}
this.$refs['talkform'].validate((valid) => {
if (valid) {
let talkForm = JSON.parse(JSON.stringify(this.talkForm))
// 如果是关联模块
if (this.moduleType === 4) {
this.talkLoading = true
talkForm.attachments = []
if (this.talkList.length !== 0) {
this.dealOtherModleType(talkForm)
}
this.$emit('submit', talkForm)
// this.$refs['talkForm'].resetFields()
// this.talkForm = {}
setTimeout(() => {
this.talkLoading = false
}, 5000)
} else {
talkForm.attachmentList = []
talkForm.weTlpMaterialList = []
this.talkId ? (talkForm.talkId = this.talkId) : ''
this.modelId ? (talkForm.modelId = this.modelId) : ''
if (this.templateType) {
// 如果是模板中心
this.talkForm.weTlpMaterialList = []
this.dealTemplateType(talkForm)
}
;(this.templateType ? templateAdd : lexicalAdd)(talkForm)
.then(() => {
this.msgSuccess('操作成功')
// this.getList()
this.$router.push('list')
this.$refs['talkForm'].resetFields()
this.talkForm = {}
this.talkLoading = false
})
.catch(() => {
this.talkLoading = false
})
}
} else {
this.talkLoading = false
} }
}) })
} },
this.users = arr dealOtherModleType(talkForm) {
}, this.talkList.forEach((item) => {
onSelectUser() { let attachments = {}
this.selectedUserList = [] attachments.title = item.materialName
let arr = [] attachments.realType = +item.mediaType
if (this.talkForm.userIds) { attachments.materialId = item.id //素材
arr = this.talkForm.userIds.split(',').map((dd, index) => { switch (item.mediaType) {
return { case '0':
userId: dd, // 图片
name: this.talkForm.userNames.split(',')[index], attachments.picUrl = item.materialUrl
attachments.msgType = 'image'
break
case '2':
// 视频
attachments.picUrl = item.coverUrl
attachments.fileUrl = item.materialUrl
attachments.description = item.digest
attachments.msgType = 'video'
break
case '3':
// 文件
attachments.picUrl = this.filPicType(item.materialUrl)
attachments.fileUrl = item.materialUrl
attachments.description = item.digest
attachments.msgType = 'file'
break
case '4':
// 文本
attachments.content = item.content
attachments.msgType = 'text'
break
case '5':
// 海报
attachments.fileUrl = item.materialUrl
attachments.msgType = 'posters'
break
case '9':
// 图文
attachments.content = item.content
attachments.picUrl = item.coverUrl
attachments.linkUrl = item.materialUrl
attachments.msgType = 'link'
if (this.otherType === 3) {
attachments.materialName = item.materialName
}
break
case '11':
// 小程序
attachments.picUrl = item.coverUrl
attachments.fileUrl = item.materialUrl
attachments.appId = item.digest
attachments.msgType = 'miniprogram'
break
case '12':
// 文章
attachments.fileUrl = item.materialUrl
attachments.description = item.digest
attachments.content = item.content
attachments.picUrl = item.coverUrl
attachments.msgType = 'news'
break
} }
talkForm.attachments.push(attachments)
}) })
} },
this.selectedUserList = arr dealTemplateType(talkForm) {
this.dialogVisibleSelectUser = true this.talkList.forEach((item) => {
}, let attachmentFrom = {}
selectedUser(users) { attachmentFrom.msgType = item.mediaType
let ids = [] attachmentFrom.mediaId = item.id
let names = [] if (item.mediaType != '0') {
const selectedUserList = users.map((d) => { attachmentFrom.title = item.materialName
ids.push(d.userId) }
names.push(d.name) switch (item.mediaType) {
return { case '0':
userId: d.userId, case '5':
name: d.name, // 图片
} attachmentFrom.picUrl = item.materialUrl
}) break
this.users = selectedUserList case '2':
this.talkForm.userIds = ids.join(',') // 视频
this.talkForm.userNames = names.join(',') attachmentFrom.picUrl = item.coverUrl
}, attachmentFrom.fileUrl = item.materialUrl
// 获取详情 attachmentFrom.description = item.digest
getDeatil(id) { break
lexicalDetail(id) case '3':
.then((res) => { // 文件
this.talkForm = res.data attachmentFrom.fileUrl = item.materialUrl
this.talkList = res.data.weMaterialList attachmentFrom.description = item.digest
}) break
.catch(() => {}) case '4':
}, // 文本
// 获取模板中心详情 attachmentFrom.content = item.content
getTelDeatil(id) { break
templateDetail(id) case '4':
.then((res) => { // 海报
this.talkForm = res.data break
this.talkList = res.data.weMaterialList case '9':
this.setUserData() // 图文
attachmentFrom.content = item.content
attachmentFrom.picUrl = item.coverUrl
attachmentFrom.linkUrl = item.materialUrl
break
case '11':
// 小程序
attachmentFrom.picUrl = item.coverUrl
attachmentFrom.fileUrl = item.materialUrl
attachmentFrom.appId = item.digest
break
case '12':
// 文章
attachmentFrom.fileUrl = item.materialUrl
attachmentFrom.description = item.digest
attachmentFrom.content = item.content
attachmentFrom.picUrl = item.coverUrl
break
}
talkForm.attachmentList.push(attachmentFrom)
talkForm.weTlpMaterialList.push({ materialId: item.id })
}) })
.catch(() => {}) talkForm.templateType = this.templateType
}, talkForm.tplType = this.tplType
getEdit(val) { },
this.type = val.mediaType getCancel() {
this.editMaterialForm = JSON.parse(JSON.stringify(val)) this.$router.back()
}, },
setData(val) { goBack() {
this.talkList = val let talkForm = JSON.parse(JSON.stringify(this.talkForm))
this.$emit('phoneData', this.talkList) talkForm.attachments = []
this.$emit('success', this.setResult()) if (this.talkList.length !== 0) {
}, this.dealOtherModleType(talkForm)
getItemArry(val) { }
this.talkList = this.talkList.concat(val) this.$emit('update', talkForm)
// 当手机为非内嵌时
this.$emit('phoneData', this.talkList)
this.$emit('success', this.setResult())
},
centerSubmit() {},
selectCenter() {},
choseCenter() {
this.choseDialog = true
},
getIds(value) {
this.ids = value
},
moveGroup(type) {
this.type = ''
this.type = type
if (this.otherType === 3 && type == '2') {
this.choseDialog = true
} else {
this.dialogVisible = true
} }
}, },
// 获取类目树 mounted() {
getTree() { if (this.$route.query.categoryId) {
var mediaType = null let form = { categoryId: this.$route.query.categoryId }
if (this.talkType == 0) { this.talkForm = { ...form }
mediaType = 13
} else if (this.talkType == 1) {
mediaType = 14
} }
if (this.templateType == 2) { if (this.templateType != 1 && this.moduleType != 4) {
mediaType = 17 this.getTree()
} else if (this.templateType == 3) {
mediaType = 16
} }
getTree(mediaType).then(({ data }) => { if (this.baseData.templateInfo) {
this.treeData = [ // this.form.templateInfo = this.baseData.templateInfo
{ this.talkForm = this.baseData
id: '', this.talkList = this.baseData.attachments
name: '全部',
parentId: '0',
hasParent: false,
hasChildren: true,
children: data || [],
},
]
})
},
// 新建话术
tackSubmit() {
this.talkLoading = true
if ([3, 4].includes(this.moduleType) && !this.talkForm.templateInfo) {
this.templateInfo = '请输入' + this.lableOne
this.talkLoading = false
return
} else {
this.templateInfo = ''
} }
if (!this.talkForm.userIds && this.tplType == 2) { // this.dealType()
this.userInfo = '请选择员工' if (this.otherType === 3 || this.tplType == 3) {
this.talkLoading = false this.maxlength = 1
return
} else { } else {
this.userInfo = '' this.maxlength = this.maxlengthTwo
}
if (this.talkType === '0') {
this.talkForm.talkType = 0
} else if (this.talkType === '1') {
this.talkForm.talkType = 1
}
if (!this.templateType) {
this.talkForm.talkMaterialList = []
this.talkList.forEach((item, index) => {
this.talkForm.talkMaterialList.push({ materialId: item.id, sort: index })
})
} }
this.$refs['talkform'].validate((valid) => { if ([3, 4].includes(this.moduleType)) {
if (valid) { this.fontType = '附件'
let talkForm = JSON.parse(JSON.stringify(this.talkForm)) } else {
// 如果是关联模块 this.fontType = '素材'
if (this.moduleType === 4) {
this.talkLoading = true
talkForm.attachments = []
if (this.talkList.length !== 0) {
this.dealOtherModleType(talkForm)
}
this.$emit('submit', talkForm)
// this.$refs['talkForm'].resetFields()
// this.talkForm = {}
setTimeout(() => {
this.talkLoading = false
}, 5000)
} else {
talkForm.attachmentList = []
talkForm.weTlpMaterialList = []
this.talkId ? (talkForm.talkId = this.talkId) : ''
this.modelId ? (talkForm.modelId = this.modelId) : ''
if (this.templateType) {
// 如果是模板中心
this.talkForm.weTlpMaterialList = []
this.dealTemplateType(talkForm)
}
;(this.templateType ? templateAdd : lexicalAdd)(talkForm)
.then(() => {
this.msgSuccess('操作成功')
// this.getList()
this.$router.push('list')
this.$refs['talkForm'].resetFields()
this.talkForm = {}
this.talkLoading = false
})
.catch(() => {
this.talkLoading = false
})
}
} else {
this.talkLoading = false
}
})
},
dealOtherModleType(talkForm) {
this.talkList.forEach((item) => {
let attachments = {}
attachments.title = item.materialName
attachments.realType = +item.mediaType
attachments.materialId = item.id //素材
switch (item.mediaType) {
case '0':
// 图片
attachments.picUrl = item.materialUrl
attachments.msgType = 'image'
break
case '2':
// 视频
attachments.picUrl = item.coverUrl
attachments.fileUrl = item.materialUrl
attachments.description = item.digest
attachments.msgType = 'video'
break
case '3':
// 文件
attachments.picUrl = this.filPicType(item.materialUrl)
attachments.fileUrl = item.materialUrl
attachments.description = item.digest
attachments.msgType = 'file'
break
case '4':
// 文本
attachments.content = item.content
attachments.msgType = 'text'
break
case '5':
// 海报
attachments.fileUrl = item.materialUrl
attachments.msgType = 'posters'
break
case '9':
// 图文
attachments.content = item.content
attachments.picUrl = item.coverUrl
attachments.linkUrl = item.materialUrl
attachments.msgType = 'link'
if (this.otherType === 3) {
attachments.materialName = item.materialName
}
break
case '11':
// 小程序
attachments.picUrl = item.coverUrl
attachments.fileUrl = item.materialUrl
attachments.appId = item.digest
attachments.msgType = 'miniprogram'
break
case '12':
// 文章
attachments.fileUrl = item.materialUrl
attachments.description = item.digest
attachments.content = item.content
attachments.picUrl = item.coverUrl
attachments.msgType = 'news'
break
}
talkForm.attachments.push(attachments)
})
},
dealTemplateType(talkForm) {
this.talkList.forEach((item) => {
let attachmentFrom = {}
attachmentFrom.msgType = item.mediaType
attachmentFrom.mediaId = item.id
if (item.mediaType != '0') {
attachmentFrom.title = item.materialName
}
switch (item.mediaType) {
case '0':
case '5':
// 图片
attachmentFrom.picUrl = item.materialUrl
break
case '2':
// 视频
attachmentFrom.picUrl = item.coverUrl
attachmentFrom.fileUrl = item.materialUrl
attachmentFrom.description = item.digest
break
case '3':
// 文件
attachmentFrom.fileUrl = item.materialUrl
attachmentFrom.description = item.digest
break
case '4':
// 文本
attachmentFrom.content = item.content
break
case '4':
// 海报
break
case '9':
// 图文
attachmentFrom.content = item.content
attachmentFrom.picUrl = item.coverUrl
attachmentFrom.linkUrl = item.materialUrl
break
case '11':
// 小程序
attachmentFrom.picUrl = item.coverUrl
attachmentFrom.fileUrl = item.materialUrl
attachmentFrom.appId = item.digest
break
case '12':
// 文章
attachmentFrom.fileUrl = item.materialUrl
attachmentFrom.description = item.digest
attachmentFrom.content = item.content
attachmentFrom.picUrl = item.coverUrl
break
}
talkForm.attachmentList.push(attachmentFrom)
talkForm.weTlpMaterialList.push({ materialId: item.id })
})
talkForm.templateType = this.templateType
talkForm.tplType = this.tplType
},
getCancel() {
this.$router.back()
},
goBack() {
let talkForm = JSON.parse(JSON.stringify(this.talkForm))
talkForm.attachments = []
if (this.talkList.length !== 0) {
this.dealOtherModleType(talkForm)
} }
this.$emit('update', talkForm)
},
},
mounted() {
if (this.$route.query.categoryId) {
let form = { categoryId: this.$route.query.categoryId }
this.talkForm = { ...form }
}
if (this.templateType != 1 && this.moduleType != 4) {
this.getTree()
}
if (this.baseData.templateInfo) {
// this.form.templateInfo = this.baseData.templateInfo
this.talkForm = this.baseData
this.talkList = this.baseData.attachments
} }
// this.dealType() }
if (this.otherType === 3 || this.tplType == 3) {
this.maxlength = 1
} else {
this.maxlength = this.maxlengthTwo
}
if ([3, 4].includes(this.moduleType)) {
this.fontType = '附件'
} else {
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 {
.ql-tooltip { .ql-tooltip {
left: 0px !important; left: 0px !important;
}
} }
} }
} }
} ::v-deep .el-button.is-disabled {
::v-deep .el-button.is-disabled { color: var(--font-white, #fff);
color: var(--font-white, #fff); background-color: var(--bg-black-8);
background-color: var(--bg-black-8); border-color: #cccccc;
border-color: #cccccc; }
} ::v-deep.el-dropdown [disabled] {
::v-deep.el-dropdown [disabled] { color: var(--font-white, #fff);
color: var(--font-white, #fff); background-color: var(--bg-black-8);
background-color: var(--bg-black-8); 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>
...@@ -196,6 +196,9 @@ ...@@ -196,6 +196,9 @@
return return
} }
this.loading = true this.loading = true
if (this.form.attachments == null) {
this.form.attachments = []
}
this.form.attachments.unshift({ this.form.attachments.unshift({
content: this.templateInfo, content: this.templateInfo,
msgType: 'text' msgType: 'text'
......
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
@click=" @click="
$router.push({ $router.push({
path: 'detail', path: 'detail',
query: { id: row.id } query: { linkId: row.linkId, id: row.id }
}) })
" "
> >
......
...@@ -73,18 +73,20 @@ ...@@ -73,18 +73,20 @@
userNames: '', userNames: '',
dialogVisible: false, dialogVisible: false,
userArray: [], userArray: [],
list: [] list: [],
tableSearch: {}
} }
}, },
components: { components: {
SearchTitle SearchTitle
}, },
created() { created() {
this.query.linkId = this.$route.query.id this.query.linkId = this.$route.query.linkId
}, },
methods: { methods: {
getData(data) { getData(data) {
this.query.linkId = this.$route.query.id this.tableSearch = data
this.query.linkId = this.$route.query.linkId
getCustomerInLink(Object.assign({}, this.query, data)).then((res) => { getCustomerInLink(Object.assign({}, this.query, data)).then((res) => {
this.list = res.rows this.list = res.rows
this.total = res.total this.total = res.total
...@@ -109,6 +111,11 @@ ...@@ -109,6 +111,11 @@
return obj.userId return obj.userId
}) })
.join(',') .join(',')
this.query.pageNum = 1
getCustomerInLink(Object.assign({}, this.query, this.tableSearch)).then((res) => {
this.list = res.rows
this.total = res.total
})
} }
}, },
created() {} created() {}
......
...@@ -185,7 +185,7 @@ ...@@ -185,7 +185,7 @@
} }
}, },
created() { created() {
this.id = this.$route.query.id this.id = this.$route.query.linkId
this.getTabTotalFn() this.getTabTotalFn()
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!