Commit 30cc90a2 by test

素材字段变更调整

1 parent 3affafe9
......@@ -37,8 +37,8 @@
const titleMap = {
4: '文本',
0: '图片',
7: '图文',
8: '小程序'
8: '图文',
9: '小程序'
}
return titleMap[this.type] || '素材'
},
......
......@@ -122,15 +122,21 @@
<el-table-column prop="materialUrl" v-if="type == 0" label="图片地址"></el-table-column>
<!-- 图文 -->
<template v-if="type == 7">
<el-table-column prop="materialName" label="图片标题"></el-table-column>
<el-table-column prop="content" label="图文链接"></el-table-column>
<!-- <template v-if="type == 7">
<el-table-column prop="materialName" label="图文标题"></el-table-column>
<el-table-column prop="materialUrl" label="图文链接"></el-table-column>
</template> -->
<!-- 链接 -->
<template v-if="type == 8">
<el-table-column prop="materialName" label="图文标题"></el-table-column>
<el-table-column prop="materialUrl" label="图文链接"></el-table-column>
</template>
<!-- 小程序 -->
<template v-if="type == 8">
<template v-if="type == 9">
<el-table-column prop="materialName" label="小程序标题"></el-table-column>
<el-table-column prop="materialUrl" label="小程序AppID"></el-table-column>
<el-table-column prop="digest" label="小程序AppID"></el-table-column>
</template>
<el-table-column prop="updateTime" label="最近更新时间"></el-table-column>
......
......@@ -61,7 +61,7 @@
</el-form-item>
</div>
<!-- 图文 -->
<div class="my-cord" v-else-if="item.msgType == '7'">
<div class="my-cord" v-else-if="item.msgType == '8'">
<div class="operation">
<div v-if="showMorMaterial" class="algin" @click="onChooseMaterial(item.msgType, index)">
<img style="margin-right: 3px" :src="require('@/assets/drainageCode/code-add.png')" alt="" />从素材中选择
......@@ -73,15 +73,15 @@
<el-form-item label="图文标题" style="width: 50%" required :error="item.materialNameError">
<el-input v-model="item.materialName" placeholder="请输入图文标题" maxlength="64" show-word-limit clearable></el-input>
</el-form-item>
<el-form-item label="图文链接" style="width: 50%" required :error="item.contentError">
<el-input v-model="item.content" placeholder="请输入图文链接"></el-input>
<el-form-item label="图文链接" style="width: 50%" required :error="item.materialUrlError">
<el-input v-model="item.materialUrl" placeholder="请输入图文链接"></el-input>
<div class="sub-des">
仅支持公众号图文链接,且必须以 http://或 https://开头
</div>
</el-form-item>
</div>
<!-- 小程序 -->
<div class="my-cord" v-else-if="item.msgType == '8'">
<div class="my-cord" v-else-if="item.msgType == '9'">
<div class="operation">
<div v-if="showMorMaterial" class="algin" @click="onChooseMaterial(item.msgType, index)">
<img style="margin-right: 3px" :src="require('@/assets/drainageCode/code-add.png')" alt="" />从素材中选择
......@@ -93,14 +93,14 @@
<el-form-item label="小程序标题" style="width: 50%" required :error="item.materialNameError">
<el-input v-model="item.materialName" placeholder="请输入小程序标题" maxlength="64" show-word-limit clearable></el-input>
</el-form-item>
<el-form-item label="小程序AppID" style="width: 50%" required :error="item.materialUrlError">
<el-input v-model="item.materialUrl" placeholder="请输入小程序AppID"></el-input>
<el-form-item label="小程序AppID" style="width: 50%" required :error="item.digestError">
<el-input v-model="item.digest" placeholder="请输入小程序AppID"></el-input>
<div class="sub-des">
必须是审核通过,正常发布,且关联到企业的小程序应用
</div>
</el-form-item>
<el-form-item label="小程序路径" style="width: 50%" required :error="item.contentError">
<el-input v-model="item.content" placeholder="请输入小程序路径"></el-input>
<el-form-item label="小程序路径" style="width: 50%" required :error="item.materialUrlError">
<el-input v-model="item.materialUrl" placeholder="请输入小程序路径"></el-input>
<div class="sub-des">必须以 html 作为后缀</div>
</el-form-item>
<el-form-item label="小程序封面" required :error="item.coverUrlError">
......@@ -122,10 +122,10 @@
<el-dropdown-item :command="'0'" v-if="showType('0')">
<el-button type="text">图片</el-button>
</el-dropdown-item>
<el-dropdown-item :command="'7'" v-if="showType('7')">
<el-dropdown-item :command="'8'" v-if="showType('8')">
<el-button type="text">图文</el-button>
</el-dropdown-item>
<el-dropdown-item :command="'8'" v-if="showType('8')">
<el-dropdown-item :command="'9'" v-if="showType('9')">
<el-button type="text">小程序</el-button>
</el-dropdown-item>
</el-dropdown-menu>
......@@ -380,32 +380,32 @@
errorMsg: '请上传图片'
}
],
'7': [
'8': [
{
checkField: 'materialName',
errorField: 'materialNameError',
errorMsg: '请输入图文标题'
},
{
checkField: 'content',
errorField: 'contentError',
checkField: 'materialUrl',
errorField: 'materialUrlError',
errorMsg: '请输入图文链接'
}
],
'8': [
'9': [
{
checkField: 'materialName',
errorField: 'materialNameError',
errorMsg: '请输入小程序标题'
},
{
checkField: 'materialUrl',
errorField: 'materialUrlError',
checkField: 'digest',
errorField: 'digestError',
errorMsg: '请输入小程序AppID'
},
{
checkField: 'content',
errorField: 'contentError',
checkField: 'materialUrl',
errorField: 'materialUrlError',
errorMsg: '请输入小程序路径'
},
{
......@@ -455,18 +455,18 @@
if (checkMaterialResult) {
let goto = true
this.form.materialMsgList.forEach((dd) => {
if (dd.msgType === '7') {
if (dd.msgType === '8') {
let reUrl = /(http|https):\/\/([\w.]+\/?)\S*/
if (!reUrl.test(dd.content)) {
if (!reUrl.test(dd.materialUrl)) {
goto = false
dd.contentError = '必须以 http://或 https://开头'
dd.materialUrlError = '必须以 http://或 https://开头'
}
}
if (dd.msgType === '8') {
if (dd.msgType === '9') {
let htm = /^.*html$/
if (!htm.test(dd.content)) {
if (!htm.test(dd.materialUrl)) {
goto = false
dd.contentError = '必须以 html 作为后缀'
dd.materialUrlError = '必须以 html 作为后缀'
}
}
})
......
......@@ -22,14 +22,14 @@
<img :src="data.materialUrl" />
</div>
</div>
<div class="msg" v-if="data.msgType === '7'">
<div class="msg" v-if="data.msgType === '8'">
<div class="word-and-image">
<div>
{{data.materialName}}
</div>
<div class="sub-content">
<div>
{{data.digest}}
<!-- {{data.materialUrl}} -->
</div>
<div>
<img src="../assets/drainageCode/default_icon.png" />
......@@ -37,7 +37,7 @@
</div>
</div>
</div>
<div class="msg" v-if="data.msgType === '8'">
<div class="msg" v-if="data.msgType === '9'">
<div class="miniprogram">
<div class="mini-header">
<img src="../assets/drainageCode/miniprogram-icon.png" alt=""> {{data.materialName}}
......
......@@ -495,7 +495,7 @@
}
this.materialData = {
welcomeMsg: base.qrAttachments ? base.qrAttachments[0].content : '',
materialMsgList: base.qrAttachments ? this.setEditList(base.qrAttachments.slice(1)) : []
materialMsgList: base.qrAttachments ? this.setEditList(base.qrAttachments) : []
}
// this.materialData.materialMsgList.forEach(ddd => {
// ddd.msgType = Number(ddd.msgType)
......@@ -515,18 +515,18 @@
arr.push(obj)
} else if (dd.msgType === 'link') {
let ob = {
msgType: '7',
msgType: '8',
materialName: dd.title,
content: dd.linkUrl
materialUrl: dd.linkUrl
}
arr.push(ob)
} else if (dd.msgType === 'miniprogram') {
let ff = {
msgType: '8',
materialUrl: dd.appId,
msgType: '9',
digest: dd.appId,
materialName: dd.title,
coverUrl: dd.picUrl,
content: dd.linkUrl
materialUrl: dd.linkUrl
}
arr.push(ff)
}
......@@ -642,20 +642,20 @@
picUrl: dd.materialUrl
}
arr.push(obj)
} else if (dd.msgType === '7') {
} else if (dd.msgType === '8') {
let ob = {
msgType: 'link',
title: dd.materialName,
linkUrl: dd.content
linkUrl: dd.materialUrl
}
arr.push(ob)
} else if (dd.msgType === '8') {
} else if (dd.msgType === '9') {
let ff = {
msgType: 'miniprogram',
appId: dd.materialUrl,
appId: dd.digest,
title: dd.materialName,
picUrl: dd.coverUrl,
linkUrl: dd.content
linkUrl: dd.materialUrl
}
arr.push(ff)
}
......
......@@ -243,7 +243,7 @@
this.form = res.data
if (this.form.qrAttachments && this.form.qrAttachments.length) {
this.form.welcomeMsg = this.form.qrAttachments[0].content
this.form.materialMsgList = this.setEditList(this.form.qrAttachments.slice(1))
this.form.materialMsgList = this.setEditList(this.form.qrAttachments)
}
this.form.qrUserInfos.forEach(dd => {
if (dd.workCycle) {
......@@ -268,18 +268,18 @@
arr.push(obj)
} else if (dd.msgType === 'link') {
let ob = {
msgType: '7',
msgType: '8',
materialName: dd.title,
content: dd.linkUrl
materialUrl: dd.linkUrl
}
arr.push(ob)
} else if (dd.msgType === 'miniprogram') {
let ff = {
msgType: '8',
materialUrl: dd.appId,
msgType: '9',
digest: dd.appId,
materialName: dd.title,
coverUrl: dd.picUrl,
content: dd.linkUrl
materialUrl: dd.linkUrl
}
arr.push(ff)
}
......
......@@ -66,18 +66,18 @@
if (unit.msgType === '0') {
img.push(unit.materialUrl)
}
if (unit.msgType === '7') {
if (unit.msgType === '8') {
let obj = {
imageTextTile: unit.materialName,
imageTextUrl: unit.content
imageTextUrl: unit.materialUrl
}
imgText.push(obj)
}
if (unit.msgType === '8') {
if (unit.msgType === '9') {
let oob = {
appTile: unit.materialName,
appId: unit.materialUrl,
appPath: unit.content,
appId: unit.digest,
appPath: unit.materialUrl,
appPic: unit.coverUrl
}
applet.push(oob)
......@@ -108,7 +108,6 @@
getData () {
// getPreview(this.form.id).then(({ data }) => {
this.materialData = this.form
console.log(this.materialData)
this.materialData.users = []
if (this.materialData.userIds) {
let name = this.materialData.userNames.split(',')
......@@ -120,7 +119,6 @@
this.materialData.users.push(obj)
})
}
console.log(this.materialData.users)
this.materialData.materialMsgList = []
let img = []
let imgText = []
......@@ -138,8 +136,8 @@
this.form.imageText.forEach(dd => {
let obj = {
materialName: dd.imageTextTile,
content: dd.imageTextUrl,
msgType: '7'
materialUrl: dd.imageTextUrl,
msgType: '8'
}
imgText.push(obj)
})
......@@ -148,10 +146,10 @@
this.form.applet.forEach(cc => {
let obj = {
materialName: cc.appTile,
materialUrl: cc.appId,
content: cc.appPath,
digest: cc.appId,
materialUrl: cc.appPath,
coverUrl: cc.appPic,
msgType: '8'
msgType: '9'
}
applet.push(obj)
})
......
......@@ -181,8 +181,8 @@
data.imageText.forEach(dd => {
let obj = {
materialName: dd.imageTextTile,
content: dd.imageTextUrl,
msgType: '7'
materialUrl: dd.imageTextUrl,
msgType: '8'
}
imgText.push(obj)
})
......@@ -191,10 +191,10 @@
data.applet.forEach(cc => {
let obj = {
materialName: cc.appTile,
materialUrl: cc.appId,
content: cc.appPath,
digest: cc.appId,
materialUrl: cc.appPath,
coverUrl: cc.appPic,
msgType: '8'
msgType: '9'
}
applet.push(obj)
})
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!