|
|
@@ -58,7 +58,7 @@
|
|
|
</el-form-item>
|
|
|
<el-form-item label="内容" style="margin-bottom: 2%" >
|
|
|
<el-input
|
|
|
- v-if="item.contentType == 1"
|
|
|
+ v-if="item.contentType == 1 ||item.contentType == 11|| item.contentType == 13"
|
|
|
v-model="item.value"
|
|
|
type="textarea"
|
|
|
:rows="3"
|
|
|
@@ -69,7 +69,7 @@
|
|
|
>
|
|
|
</el-input>
|
|
|
<el-link
|
|
|
- v-if="item.contentType == 1"
|
|
|
+ v-if="item.contentType == 1 ||item.contentType == 11|| item.contentType == 13"
|
|
|
type="primary"
|
|
|
@click="toggleSalesCall(index)"
|
|
|
style="margin-top: 10px;"
|
|
|
@@ -77,7 +77,7 @@
|
|
|
{{ item.isSalesCallAdded ? '移除#销售称呼#' : '添加#销售称呼#' }}
|
|
|
</el-link>
|
|
|
<el-link
|
|
|
- v-if="item.contentType == 1"
|
|
|
+ v-if="item.contentType == 1 ||item.contentType == 11|| item.contentType == 13"
|
|
|
type="primary"
|
|
|
@click="toggleSalesCallCustomer(index)"
|
|
|
style="margin-top: 10px;margin-left: 2%"
|
|
|
@@ -156,7 +156,7 @@
|
|
|
</video>
|
|
|
</el-form-item>
|
|
|
</div>
|
|
|
- <div v-if="item.contentType == 7 ">
|
|
|
+ <div v-if="item.contentType == 7 || item.contentType == 12">
|
|
|
<el-input
|
|
|
v-model="item.value"
|
|
|
type="textarea" :rows="3" maxlength="66" show-word-limit
|
|
|
@@ -745,94 +745,221 @@ export default {
|
|
|
this.single = selection.length!==1
|
|
|
this.multiple = !selection.length
|
|
|
},
|
|
|
+ // 修改后的方法:在原有的基础上增加一条消息
|
|
|
+ processContentType13(settings) {
|
|
|
+ const result = [];
|
|
|
+ console.log(settings);
|
|
|
+ settings.forEach(item => {
|
|
|
+ // 如果 contentType 是 13 且 value 不为空,则额外添加一条 contentType 为 1 的消息
|
|
|
+ if (item.contentType == 13 && item.value && item.value.trim() !== '') {
|
|
|
+ // 按换行符分割内容,取第一部分
|
|
|
+ const contentParts = item.value.split('\n')
|
|
|
+ .map(part => part.trim())
|
|
|
+ .filter(part => part !== '');
|
|
|
+
|
|
|
+ if (contentParts!=null && contentParts.length > 0) {
|
|
|
+ // 创建一条额外的消息,使用第一部分内容
|
|
|
+ const additionalMessage = {
|
|
|
+ ...item,
|
|
|
+ contentType: 1, // 改为文本类型
|
|
|
+ value: contentParts[0]
|
|
|
+ };
|
|
|
+ result.push(additionalMessage);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (item.contentType == 10) {
|
|
|
+ item.miniprogramAppid = 'wx4d225cc86cc7885d'
|
|
|
+ }
|
|
|
+ result.push(item);
|
|
|
+ });
|
|
|
+
|
|
|
+ return result;
|
|
|
+ },
|
|
|
|
|
|
submitMsgForm(){
|
|
|
|
|
|
+ // this.$refs["msgForm"].validate(valid => {
|
|
|
+ // if (valid) {
|
|
|
+ //
|
|
|
+ // if (this.msgForm.draftStrategy==1){
|
|
|
+ //
|
|
|
+ // this.msgForm.setting=JSON.stringify(this.setting)
|
|
|
+ //
|
|
|
+ // if (this.setting.length <= 0) {
|
|
|
+ // return this.$message.error("请添加规则")
|
|
|
+ // }
|
|
|
+ // if (this.msgForm.courseId===null || this.msgForm.courseId===''){
|
|
|
+ // return this.$message.error("课程不能为空")
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // if (this.msgForm.videoId===null || this.msgForm.videoId===''){
|
|
|
+ // return this.$message.error("课节不能为空")
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // if (this.msgForm.courseType===null || this.msgForm.courseType===''){
|
|
|
+ // return this.$message.error("消息类型不能为空")
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // for (let i = 0; i < this.setting.length; i++) {
|
|
|
+ // if (this.setting[i].contentType == 1 && (this.setting[i].value == null || this.setting[i].value == "")) {
|
|
|
+ // return this.$message.error("内容不能为空")
|
|
|
+ // }
|
|
|
+ // if (this.setting[i].contentType == 2 && (this.setting[i].imgUrl == null || this.setting[i].imgUrl == "")) {
|
|
|
+ // return this.$message.error("图片不能为空")
|
|
|
+ // }
|
|
|
+ // if ((this.setting[i].contentType == 3 || this.setting[i].contentType == 9 ) && (this.setting[i].linkTitle == null || this.setting[i].linkTitle == "")) {
|
|
|
+ // return this.$message.error("链接标题不能为空")
|
|
|
+ // }
|
|
|
+ // if ((this.setting[i].contentType == 3 || this.setting[i].contentType == 9 ) && (this.setting[i].linkDescribe == null || this.setting[i].linkDescribe == "")) {
|
|
|
+ // return this.$message.error("链接描述不能为空")
|
|
|
+ // }
|
|
|
+ // if ((this.setting[i].contentType == 3 || this.setting[i].contentType == 9 ) && (this.setting[i].linkImageUrl == null || this.setting[i].linkImageUrl == "")) {
|
|
|
+ // return this.$message.error("链接图片不能为空")
|
|
|
+ // }
|
|
|
+ // if ((this.setting[i].contentType == 3 || this.setting[i].contentType == 9 )&& this.setting[i].type == 1 && (this.setting[i].linkUrl == null || this.setting[i].linkUrl == "")) {
|
|
|
+ // return this.$message.error("链接地址不能为空")
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // if ((this.setting[i].contentType == 4 || this.setting[i].contentType == 10) && (this.setting[i].miniprogramTitle == null || this.setting[i].miniprogramTitle == "")) {
|
|
|
+ // return this.$message.error("小程序消息标题不能为空")
|
|
|
+ // }
|
|
|
+ // if ((this.setting[i].contentType == 4 || this.setting[i].contentType == 10) && (this.setting[i].miniprogramPicUrl == null || this.setting[i].miniprogramPicUrl == "")) {
|
|
|
+ // return this.$message.error("小程序封面地址不能为空")
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // if (this.setting[i].contentType == 10 && (this.setting[i].miniprogramPage == null || this.setting[i].miniprogramPage == "")) {
|
|
|
+ // return this.$message.error("小程序page地址不能为空")
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // if (this.setting[i].contentType == 5 && (this.setting[i].fileUrl == null || this.setting[i].fileUrl == "")) {
|
|
|
+ // return this.$message.error("文件不能为空")
|
|
|
+ // }
|
|
|
+ // if (this.setting[i].contentType == 6 && (this.setting[i].videoUrl == null || this.setting[i].videoUrl == "")) {
|
|
|
+ // return this.$message.error("视频不能为空")
|
|
|
+ // }
|
|
|
+ // if (this.setting[i].contentType == 7 && (this.setting[i].value == null || this.setting[i].value == "")) {
|
|
|
+ // return this.$message.error("语音不能为空")
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ //
|
|
|
+ //
|
|
|
+ // this.sendMsgOpen.open = false;
|
|
|
+ //
|
|
|
+ // const loading = this.$loading({
|
|
|
+ // lock: true,
|
|
|
+ // text: '正在执行中请稍后~~请不要刷新页面!!',
|
|
|
+ // spinner: 'el-icon-loading',
|
|
|
+ // background: 'rgba(0, 0, 0, 0.7)'
|
|
|
+ // });
|
|
|
+ //
|
|
|
+ // sendMsg(this.msgForm).then(response => {
|
|
|
+ // this.msgSuccess("一键群发成功");
|
|
|
+ // loading.close();
|
|
|
+ // this.setting=[];
|
|
|
+ // this.resetSendMsgSop();
|
|
|
+ // }).finally(()=>{
|
|
|
+ // loading.close();
|
|
|
+ // });
|
|
|
+ //
|
|
|
+ // }
|
|
|
+ // });
|
|
|
this.$refs["msgForm"].validate(valid => {
|
|
|
if (valid) {
|
|
|
+ if (this.msgForm.draftStrategy == 1) {
|
|
|
|
|
|
- if (this.msgForm.draftStrategy==1){
|
|
|
-
|
|
|
- this.msgForm.setting=JSON.stringify(this.setting)
|
|
|
+ // 处理 contentType 13 的拆分逻辑
|
|
|
+ const processedSetting = this.processContentType13(this.setting);
|
|
|
+ this.msgForm.setting = JSON.stringify(processedSetting);
|
|
|
|
|
|
- if (this.setting.length <= 0) {
|
|
|
+ if (processedSetting.length <= 0) {
|
|
|
return this.$message.error("请添加规则")
|
|
|
}
|
|
|
- if (this.msgForm.courseId===null || this.msgForm.courseId===''){
|
|
|
+ if (this.msgForm.courseId === null || this.msgForm.courseId === '') {
|
|
|
return this.$message.error("课程不能为空")
|
|
|
}
|
|
|
-
|
|
|
- if (this.msgForm.videoId===null || this.msgForm.videoId===''){
|
|
|
+ if (this.msgForm.videoId === null || this.msgForm.videoId === '') {
|
|
|
return this.$message.error("课节不能为空")
|
|
|
}
|
|
|
-
|
|
|
- if (this.msgForm.courseType===null || this.msgForm.courseType===''){
|
|
|
+ if (this.msgForm.courseType === null || this.msgForm.courseType === '') {
|
|
|
return this.$message.error("消息类型不能为空")
|
|
|
}
|
|
|
|
|
|
- for (let i = 0; i < this.setting.length; i++) {
|
|
|
- if (this.setting[i].contentType == 1 && (this.setting[i].value == null || this.setting[i].value == "")) {
|
|
|
+ // 验证逻辑 - 使用处理后的 setting
|
|
|
+ for (let i = 0; i < processedSetting.length; i++) {
|
|
|
+ const item = processedSetting[i];
|
|
|
+
|
|
|
+
|
|
|
+ if (item.contentType == 1 && (item.value == null || item.value == "")) {
|
|
|
return this.$message.error("内容不能为空")
|
|
|
}
|
|
|
- if (this.setting[i].contentType == 2 && (this.setting[i].imgUrl == null || this.setting[i].imgUrl == "")) {
|
|
|
+ if (item.contentType == 2 && (item.imgUrl == null || item.imgUrl == "")) {
|
|
|
return this.$message.error("图片不能为空")
|
|
|
}
|
|
|
- if ((this.setting[i].contentType == 3 || this.setting[i].contentType == 9 ) && (this.setting[i].linkTitle == null || this.setting[i].linkTitle == "")) {
|
|
|
+ if ((item.contentType == 3 || item.contentType == 9) && (item.linkTitle == null || item.linkTitle == "")) {
|
|
|
return this.$message.error("链接标题不能为空")
|
|
|
}
|
|
|
- if ((this.setting[i].contentType == 3 || this.setting[i].contentType == 9 ) && (this.setting[i].linkDescribe == null || this.setting[i].linkDescribe == "")) {
|
|
|
+ if ((item.contentType == 3 || item.contentType == 9) && (item.linkDescribe == null || item.linkDescribe == "")) {
|
|
|
return this.$message.error("链接描述不能为空")
|
|
|
}
|
|
|
- if ((this.setting[i].contentType == 3 || this.setting[i].contentType == 9 ) && (this.setting[i].linkImageUrl == null || this.setting[i].linkImageUrl == "")) {
|
|
|
+ if ((item.contentType == 3 || item.contentType == 9) && (item.linkImageUrl == null || item.linkImageUrl == "")) {
|
|
|
return this.$message.error("链接图片不能为空")
|
|
|
}
|
|
|
- if ((this.setting[i].contentType == 3 || this.setting[i].contentType == 9 )&& this.setting[i].type == 1 && (this.setting[i].linkUrl == null || this.setting[i].linkUrl == "")) {
|
|
|
+ if ((item.contentType == 3 || item.contentType == 9) && item.type == 1 && (item.linkUrl == null || item.linkUrl == "")) {
|
|
|
return this.$message.error("链接地址不能为空")
|
|
|
}
|
|
|
-
|
|
|
- if ((this.setting[i].contentType == 4 || this.setting[i].contentType == 10) && (this.setting[i].miniprogramTitle == null || this.setting[i].miniprogramTitle == "")) {
|
|
|
+ if (item.contentType == 4 && (item.miniprogramTitle == null || item.miniprogramTitle == "")) {
|
|
|
return this.$message.error("小程序消息标题不能为空")
|
|
|
}
|
|
|
- if ((this.setting[i].contentType == 4 || this.setting[i].contentType == 10) && (this.setting[i].miniprogramPicUrl == null || this.setting[i].miniprogramPicUrl == "")) {
|
|
|
+ if (item.contentType == 4 && (item.miniprogramPicUrl == null || item.miniprogramPicUrl == "")) {
|
|
|
return this.$message.error("小程序封面地址不能为空")
|
|
|
}
|
|
|
-
|
|
|
- if (this.setting[i].contentType == 10 && (this.setting[i].miniprogramPage == null || this.setting[i].miniprogramPage == "")) {
|
|
|
- return this.$message.error("小程序page地址不能为空")
|
|
|
- }
|
|
|
-
|
|
|
- if (this.setting[i].contentType == 5 && (this.setting[i].fileUrl == null || this.setting[i].fileUrl == "")) {
|
|
|
+ if (item.contentType == 5 && (item.fileUrl == null || item.fileUrl == "")) {
|
|
|
return this.$message.error("文件不能为空")
|
|
|
}
|
|
|
- if (this.setting[i].contentType == 6 && (this.setting[i].videoUrl == null || this.setting[i].videoUrl == "")) {
|
|
|
+ if (item.contentType == 6 && (item.videoUrl == null || item.videoUrl == "")) {
|
|
|
return this.$message.error("视频不能为空")
|
|
|
}
|
|
|
- if (this.setting[i].contentType == 7 && (this.setting[i].value == null || this.setting[i].value == "")) {
|
|
|
+ if ((item.contentType == 7 || item.contentType == 12) && (item.value == null || item.value == "")) {
|
|
|
return this.$message.error("语音不能为空")
|
|
|
}
|
|
|
+ if (item.contentType == 10 && (item.liveId == null || item.liveId == "")) {
|
|
|
+ this.$message.error("直播间不能为空")
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (item.contentType == 10 && (item.miniprogramTitle == null || item.miniprogramTitle == "")) {
|
|
|
+ this.$message.error("标题不能为空")
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (item.contentType == 10 && (item.miniprogramPicUrl == null || item.miniprogramPicUrl == "")) {
|
|
|
+ this.$message.error("封面不能为空")
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ // 添加对福袋的验证
|
|
|
+ if (item.contentType == 14 && (item.luckyBagId == null || item.luckyBagId === "")) {
|
|
|
+ return this.$message.error("福袋不能为空")
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
|
|
|
- this.sendMsgOpen.open = false;
|
|
|
-
|
|
|
- const loading = this.$loading({
|
|
|
- lock: true,
|
|
|
- text: '正在执行中请稍后~~请不要刷新页面!!',
|
|
|
- spinner: 'el-icon-loading',
|
|
|
- background: 'rgba(0, 0, 0, 0.7)'
|
|
|
- });
|
|
|
-
|
|
|
- sendMsg(this.msgForm).then(response => {
|
|
|
- this.msgSuccess("一键群发成功");
|
|
|
- loading.close();
|
|
|
- this.setting=[];
|
|
|
- this.resetSendMsgSop();
|
|
|
- }).finally(()=>{
|
|
|
- loading.close();
|
|
|
- });
|
|
|
+ this.sendMsgOpen.open = false;
|
|
|
+
|
|
|
+ const loading = this.$loading({
|
|
|
+ lock: true,
|
|
|
+ text: '正在执行中请稍后~~请不要刷新页面!!',
|
|
|
+ spinner: 'el-icon-loading',
|
|
|
+ background: 'rgba(0, 0, 0, 0.7)'
|
|
|
+ });
|
|
|
+ sendMsg(this.msgForm).then(response => {
|
|
|
+ this.msgSuccess("一键群发成功");
|
|
|
+ loading.close();
|
|
|
+ this.setting = [{ contentType: '1', value: '' }];
|
|
|
+ this.resetSendMsgSop();
|
|
|
+ }).finally(()=>{
|
|
|
+ loading.close();
|
|
|
+ });
|
|
|
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
},
|