Commit 77d9948a by chenwq

编辑sop,选择内容

1 parent f528d744
...@@ -13,8 +13,8 @@ export default { ...@@ -13,8 +13,8 @@ export default {
data() { data() {
return { return {
activeName: 'baseInfo', // activeName: 'baseInfo',
// activeName: 'editEvent', activeName: 'editEvent',
routeInfo: { routeInfo: {
// add-新增;edit-编辑;look-查看 // add-新增;edit-编辑;look-查看
addOrEdit: 'add', addOrEdit: 'add',
......
<!-- 编辑sop - 添加事件 --> <!-- 编辑sop - 添加事件 -->
<template> <template>
<div class="edit-zone marketing p-t-20 edit-box"> <div class="edit-event marketing p-t-20 edit-box">
<!-- 营销时间 --> <!-- 营销时间 -->
<div class="container m-b-20"> <div class="container m-b-20">
<p class="edit-title">营销时间{{ editForm.sopName }}</p> <p class="edit-title">营销时间{{ editForm.sopName }}</p>
...@@ -38,6 +38,47 @@ ...@@ -38,6 +38,47 @@
<!-- 营销内容 --> <!-- 营销内容 -->
<div class="container m-b-20"> <div class="container m-b-20">
<p class="edit-title">营销内容{{ editForm.sopName }}</p> <p class="edit-title">营销内容{{ editForm.sopName }}</p>
<glsx-combi-form class="edit-form-container m-r-20" ref="editFormRefContent" :isEdit="isEdit" :labelWidth="labelWidth" defaultWidth="320px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormDataContent" :formRules="editRule">
<div slot="eventContent" class="content">
<div class="content-bg">
<!-- <wTextarea ref="textContent" v-model="textValue" @updateText="updateText"></wTextarea> -->
<el-input type="textarea" :rows="9" maxlength="280" show-word-limit v-model="editForm.eventContent" @input="textInput" style="-webkit-user-modify: read-write-plaintext-only !important; width: 656px;" placeholder="请输入营销文案"></el-input>
<div v-for="(itm, index) in previewList" :key="itm.id">
<div class="welcome-file" v-if="itm.attType != 1">
<template v-if="itm.attType == 2">
<i v-show="index == previewList.length - 1 && loading" class="el-icon-loading"></i>
<img v-show="!loading" src="@/assets/guestCustom/icon-img.png" alt />
<span :title="itm.attContent">{{ itm.attContent }}</span>
</template>
<!-- <template v-else-if="itm.attType == 3">
<img src="@/assets/guestCustom/icon-img.png" alt />
<span :title="itm.attContent">{{ itm.attContent }}</span>
</template> -->
<template v-else-if="itm.attType == 7">
<img src="@/assets/guestCustom/icon-applet.png" alt />
<span :title="itm.attContent.marketingName">{{ itm.attContent.marketingName }}</span>
</template>
<template v-else-if="itm.attType == 5">
<img src="@/assets/guestCustom/icon-applet.png" alt />
<span :title="itm.attContent.title">{{ itm.attContent.title }}</span>
</template>
<i class="el-icon-circle-close" @click="close(index)"></i>
</div>
</div>
<div class="btn-group">
<div class="add-btn" v-for="item in btnList" :key="item.id">
<!-- <img :src="require(`@/assets/guestCustom/add-${item.type}.png`)" alt v-if="item.id == 1" @click="selectEmotion" /> -->
<img :src="require(`@/assets/guestCustom/add-${item.type}.png`)" alt />
<!-- <span v-if="item.id == 1" @click.stop="selectEmotion">{{ item.name }}</span> -->
<span>{{ item.name }}</span>
<!-- <input v-if="item.type == 'img'" type="file" style="opacity: 0" :id="item.name + 'file'" ref="file" class="welcome-input upload-img" :accept="item.accept || 'image/png, image/jpeg, image/jpg'" @change="e => handleImgChange(e, item)" />
<input v-else-if="item.type == 'video'" type="file" style="opacity: 0" :id="item.name + 'file'" ref="file" class="welcome-input" :accept="item.accept || 'video/*'" @change="e => handleVideoChange(e, item)" /> -->
<el-link v-if="item.type == 'nickname' || item.type == 'acivity'" style="opacity: 0" @click="handleFun(item.funName)">{{ item.name }}</el-link>
</div>
</div>
</div>
</div>
</glsx-combi-form>
</div> </div>
<!-- 营销渠道 --> <!-- 营销渠道 -->
<div class="container edit-container"> <div class="container edit-container">
...@@ -48,10 +89,22 @@ ...@@ -48,10 +89,22 @@
<el-button type="primary" @click="handleConfirm">确定</el-button> <el-button type="primary" @click="handleConfirm">确定</el-button>
<el-button type="default" @click="handleCancel">取消</el-button> <el-button type="default" @click="handleCancel">取消</el-button>
</div> </div>
<ActivityModel ref="activity" @selectActivity="selectActivity"></ActivityModel>
<!-- <MessageModel ref="message" @selectItem="selectMessage"></MessageModel> -->
</div> </div>
</template> </template>
<script> <script>
const ATT_TYPE = {
TEXT: 1,
IMAGE: 2,
VEDIO: 3,
URL: 4,
MINIPROGRAM: 5,
FILE: 6,
ACTIVITY: 7
}
import ActivityModel from './components/activityModel'
export default { export default {
name: 'editGift', name: 'editGift',
data() { data() {
...@@ -76,8 +129,40 @@ export default { ...@@ -76,8 +129,40 @@ export default {
repeatMode: '1', repeatMode: '1',
repeatTime: '', repeatTime: '',
eventEndDate: '', eventEndDate: '',
pushChannelType: '' pushChannelType: '',
// 营销内容
eventContent: ''
}, },
// 营销内容
previewList: [],
btnList: [
{
id: 1,
name: '表情',
funcName: '',
type: 'expression',
limitSize: 10
},
{
id: 2,
name: '图片',
funcName: '',
type: 'img',
limitSize: 10
},
{
id: 4,
name: '活动',
type: 'acivity',
funName: 'activity'
},
{
id: 5,
name: '模板',
type: 'nickname',
funName: 'message'
}
],
editRule: { editRule: {
sopName: [{ required: true, message: '请输入sop名字', trigger: 'change' }], sopName: [{ required: true, message: '请输入sop名字', trigger: 'change' }],
eventStartDate: [{ required: true, message: '请选择营销日期', trigger: 'change' }], eventStartDate: [{ required: true, message: '请选择营销日期', trigger: 'change' }],
...@@ -209,6 +294,13 @@ export default { ...@@ -209,6 +294,13 @@ export default {
isHide: true isHide: true
} }
], ],
editFormDataContent: [
{
label: '营销内容',
name: 'eventContent',
addHtml: 'eventContent'
}
],
editFormDataChannel: [ editFormDataChannel: [
{ {
label: '营销渠道', label: '营销渠道',
...@@ -265,6 +357,10 @@ export default { ...@@ -265,6 +357,10 @@ export default {
} }
}, },
components: {
ActivityModel
},
watch: { watch: {
editForm: { editForm: {
handler(val) { handler(val) {
...@@ -324,6 +420,46 @@ export default { ...@@ -324,6 +420,46 @@ export default {
// }) // })
}, },
// 营销内容
handleFun(name) {
if (name == 'nickname') {
this.$refs.textContent.addTag('@昵称')
} else if (name == 'activity') {
this.$refs.activity.init()
} else if (name == 'message') {
this.$refs.message.init()
}
},
close(index) {
this.previewList.splice(index, 1)
// this.eventBus.$emit('update', this.previewList)
},
selectActivity(val) {
let idx
const hasActivity = this.previewList.some((item, index) => {
if (item.attType == 7) {
idx = index
return item
}
})
if (val) {
if (hasActivity) {
this.$set(this.previewList, idx, {
attContent: val,
attType: ATT_TYPE.ACTIVITY
})
} else {
this.previewList.push({
attContent: val,
attType: ATT_TYPE.ACTIVITY
})
}
}
},
// 营销内容
handleConfirm() { handleConfirm() {
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => { this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (valid) { if (valid) {
...@@ -367,9 +503,91 @@ export default { ...@@ -367,9 +503,91 @@ export default {
} }
} }
</script> </script>
<style scoped> <style lang="scss">
.marketing.edit-gift .select-merchant { .edit-event {
/* width: calc(98% - 140px); */ .content-bg {
width: 98%; background-color: #f7f7f7;
}
.content {
display: inline-block;
vertical-align: text-top;
// width: calc(100% - 103px);
width: 100%;
// margin-left: 12px;
.welcome-file {
display: flex;
align-items: center;
color: #999;
line-height: 20px;
padding: 10px;
margin-bottom: 10px;
border-left: 1px solid #dcdfe6;
border-right: 1px solid #dcdfe6;
img {
width: 20px;
height: 20px;
margin-right: 5px;
}
span {
display: inline-block;
margin-right: 20px;
max-width: 200px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-size: 14px;
}
i {
font-size: 16px;
cursor: pointer;
}
.el-icon-loading {
font-size: 24px;
}
&:last-child {
margin-bottom: 0;
}
}
.btn-group {
padding: 6px 0 6px 20px;
border: 1px solid #dcdfe6;
border-top: 0;
.add-btn {
display: inline-flex;
position: relative;
align-items: center;
padding-right: 25px;
font-size: 16px;
color: #666;
cursor: pointer;
span {
font-size: 14px;
margin-left: 5px;
cursor: pointer;
}
input {
position: absolute;
width: 100%;
cursor: pointer;
font-size: 0;
height: 40px;
}
img {
width: 16px;
height: 16px;
cursor: pointer;
}
.el-link {
position: absolute;
width: 100%;
}
}
}
.date-picker {
margin-top: 10px;
font-size: 14px;
color: #999;
}
}
} }
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!