|
@@ -4,12 +4,13 @@
|
|
<div style="margin: 30px;" v-if="this.form.sendType == 1 && formType==1 "> sop规则【修改企微接口】模板</div>
|
|
<div style="margin: 30px;" v-if="this.form.sendType == 1 && formType==1 "> sop规则【修改企微接口】模板</div>
|
|
<div style="margin: 30px;" v-if="this.form.sendType == 1 && formType==2 "> sop规则【复制企微接口】模板</div>
|
|
<div style="margin: 30px;" v-if="this.form.sendType == 1 && formType==2 "> sop规则【复制企微接口】模板</div>
|
|
<div style="margin: 30px;" v-if="this.form.sendType == 1 && formType==3 "> sop规则【查看企微接口】模板</div>
|
|
<div style="margin: 30px;" v-if="this.form.sendType == 1 && formType==3 "> sop规则【查看企微接口】模板</div>
|
|
- <div style="margin: 30px;" v-if="this.form.sendType == 2 && formType==1 "> sop规则【修改AI插件】模板</div>
|
|
|
|
- <div style="margin: 30px;" v-if="this.form.sendType == 2 && formType==2 "> sop规则【复制AI插件】模板</div>
|
|
|
|
- <div style="margin: 30px;" v-if="this.form.sendType == 2 && formType==3 "> sop规则【查看AI插件】模板</div>
|
|
|
|
|
|
+ <div style="margin: 30px;" v-if="this.form.sendType == 2 && formType==1 "> sop规则【修改群发助手】模板</div>
|
|
|
|
+ <div style="margin: 30px;" v-if="this.form.sendType == 2 && formType==2 "> sop规则【复制群发助手】模板</div>
|
|
|
|
+ <div style="margin: 30px;" v-if="this.form.sendType == 2 && formType==3 "> sop规则【查看群发助手】模板</div>
|
|
|
|
+ <div style="margin: 30px;">模板编号:【{{this.form.id}}】</div>
|
|
|
|
|
|
<div style="margin-top: 10px;margin-left: 50px;margin-right: 100px;margin-bottom: 60px;">
|
|
<div style="margin-top: 10px;margin-left: 50px;margin-right: 100px;margin-bottom: 60px;">
|
|
- <el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
|
|
|
+ <el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
|
<el-form-item label="名称" prop="name">
|
|
<el-form-item label="名称" prop="name">
|
|
{{ form.name }}
|
|
{{ form.name }}
|
|
</el-form-item>
|
|
</el-form-item>
|
|
@@ -47,7 +48,7 @@
|
|
style="background-color: #fbfbfb;padding: 15px; border: 1px solid #e6e6e6; margin-bottom: 20px;">
|
|
style="background-color: #fbfbfb;padding: 15px; border: 1px solid #e6e6e6; margin-bottom: 20px;">
|
|
<el-form :model="item" label-width="80px">
|
|
<el-form :model="item" label-width="80px">
|
|
<el-form-item v-if="form.sendType != 4" label="内容名称" style="height: 50px;">
|
|
<el-form-item v-if="form.sendType != 4" label="内容名称" style="height: 50px;">
|
|
- <el-input :disabled="formType == 3" @change="updateChange" v-model="item.name"
|
|
|
|
|
|
+ <el-input :disabled="formType == 3" v-model="item.name"
|
|
placeholder="内容名称,仅内部可见"/>
|
|
placeholder="内容名称,仅内部可见"/>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="规则">
|
|
<el-form-item label="规则">
|
|
@@ -83,20 +84,29 @@
|
|
</el-time-picker>
|
|
</el-time-picker>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</div>
|
|
</div>
|
|
|
|
+ <el-form-item label="官方群发" v-if="contentIndex==0 && content.type==2">
|
|
|
|
+ <el-switch
|
|
|
|
+ v-model="content.isOfficial"
|
|
|
|
+ active-color="#13ce66"
|
|
|
|
+ inactive-color="#DCDFE6"
|
|
|
|
+ active-value="1"
|
|
|
|
+ inactive-value="0">
|
|
|
|
+ </el-switch>
|
|
|
|
+ </el-form-item>
|
|
|
|
|
|
<el-form-item label="消息类别" v-if="form.sendType != 4">
|
|
<el-form-item label="消息类别" v-if="form.sendType != 4">
|
|
- <el-radio-group v-model="content.type" :disabled="formType == 3"
|
|
|
|
|
|
+ <el-radio-group v-model="content.type" :disabled="formType == 3 || content.isOfficial === '1'"
|
|
@change="updateHtml(() => content.contentType = '1')">
|
|
@change="updateHtml(() => content.contentType = '1')">
|
|
<el-radio :label="1">普通</el-radio>
|
|
<el-radio :label="1">普通</el-radio>
|
|
<el-radio :label="2">课程</el-radio>
|
|
<el-radio :label="2">课程</el-radio>
|
|
<el-radio :label="3">订单</el-radio>
|
|
<el-radio :label="3">订单</el-radio>
|
|
<el-radio :label="4">AI触达</el-radio>
|
|
<el-radio :label="4">AI触达</el-radio>
|
|
- <el-radio :label="5">打标签</el-radio>
|
|
|
|
|
|
+ <el-radio :label="5">打标签</el-radio>
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="课程" v-if="content.type == 2 " required>
|
|
<el-form-item label="课程" v-if="content.type == 2 " required>
|
|
<el-select :disabled="formType == 3" v-model="content.courseId"
|
|
<el-select :disabled="formType == 3" v-model="content.courseId"
|
|
- placeholder="请选择课程" style=" margin-right: 10px;" size="mini"
|
|
|
|
|
|
+ placeholder="请选择课程" style=" margin-right: 10px;" size="mini" remote filterable
|
|
@change="courseChangeUpdate(content,index,contentIndex)">
|
|
@change="courseChangeUpdate(content,index,contentIndex)">
|
|
<el-option
|
|
<el-option
|
|
v-for="dict in courseList"
|
|
v-for="dict in courseList"
|
|
@@ -106,7 +116,7 @@
|
|
/>
|
|
/>
|
|
</el-select>
|
|
</el-select>
|
|
<el-select :disabled="formType == 3" v-model="content.videoId"
|
|
<el-select :disabled="formType == 3" v-model="content.videoId"
|
|
- placeholder="请选择小节" size="mini" style=" margin-right: 10px;"
|
|
|
|
|
|
+ placeholder="请选择小节" size="mini" style=" margin-right: 10px;" remote filterable
|
|
@change="videoIdChange(content,index,contentIndex)">
|
|
@change="videoIdChange(content,index,contentIndex)">
|
|
<el-option
|
|
<el-option
|
|
v-for="dict in videoList[contentIndex]"
|
|
v-for="dict in videoList[contentIndex]"
|
|
@@ -117,7 +127,7 @@
|
|
</el-select>
|
|
</el-select>
|
|
<el-select :disabled="formType == 3" v-model="content.courseType"
|
|
<el-select :disabled="formType == 3" v-model="content.courseType"
|
|
placeholder="请选择消息类型" size="mini"
|
|
placeholder="请选择消息类型" size="mini"
|
|
- style=" margin-right: 10px;" v-if="content.type != 4 " @change="update">
|
|
|
|
|
|
+ style=" margin-right: 10px;" v-if="content.type != 4 ">
|
|
<el-option
|
|
<el-option
|
|
v-for="dict in sysFsSopWatchStatus"
|
|
v-for="dict in sysFsSopWatchStatus"
|
|
:key="dict.dictValue"
|
|
:key="dict.dictValue"
|
|
@@ -202,7 +212,7 @@
|
|
v-for="item in sysQwSopContentType"
|
|
v-for="item in sysQwSopContentType"
|
|
:key="item.dictValue"
|
|
:key="item.dictValue"
|
|
:label="item.dictValue"
|
|
:label="item.dictValue"
|
|
- :disabled="item.dictValue === '1' && content.setting.some(s => s.contentType == '1')">
|
|
|
|
|
|
+ :disabled="item.dictValue === '1' && content.setting.some(s => s.contentType == '1') ">
|
|
{{ item.dictLabel }}
|
|
{{ item.dictLabel }}
|
|
</el-radio>
|
|
</el-radio>
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
@@ -214,6 +224,7 @@
|
|
<el-radio
|
|
<el-radio
|
|
:key="item.dictValue"
|
|
:key="item.dictValue"
|
|
:label="item.dictValue"
|
|
:label="item.dictValue"
|
|
|
|
+ :disabled="(content.type!=2 && item.dictValue === '9') || (content.isOfficial==1 && ['5','6','7','8','9'].includes(item.dictValue))"
|
|
v-for="item in sysQwSopAiContentType">{{ item.dictLabel }}
|
|
v-for="item in sysQwSopAiContentType">{{ item.dictLabel }}
|
|
</el-radio>
|
|
</el-radio>
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
@@ -223,12 +234,26 @@
|
|
<el-input :disabled="formType == 3" v-if="setList.contentType == 1 "
|
|
<el-input :disabled="formType == 3" v-if="setList.contentType == 1 "
|
|
v-model="setList.value"
|
|
v-model="setList.value"
|
|
type="textarea" :rows="3" placeholder="内容"
|
|
type="textarea" :rows="3" placeholder="内容"
|
|
- @change="updateChange"
|
|
|
|
- style="width: 90%;margin-top: 10px;"/>
|
|
|
|
|
|
+ style="width: 90%;margin-top: 10px;"
|
|
|
|
+ @keydown.native="handleKeydown($event, index, contentIndex, setIndex)"
|
|
|
|
+ :ref="`textarea-${index}-${contentIndex}-${setIndex}`"
|
|
|
|
+ />
|
|
|
|
+
|
|
|
|
+ <!-- 修改按钮部分 -->
|
|
|
|
+ <el-link
|
|
|
|
+ v-if="setList.contentType == 1"
|
|
|
|
+ type="primary"
|
|
|
|
+ @click="toggleSalesCall(index, contentIndex, setIndex)"
|
|
|
|
+ style="margin-top: 10px;"
|
|
|
|
+ >
|
|
|
|
+ {{ setList.isSalesCallAdded ? '移除#销售称呼#' : '添加#销售称呼#' }}
|
|
|
|
+ </el-link>
|
|
|
|
+
|
|
<ImageUpload :disabled="formType == 3" v-if="setList.contentType == 2 "
|
|
<ImageUpload :disabled="formType == 3" v-if="setList.contentType == 2 "
|
|
v-model="setList.imgUrl"
|
|
v-model="setList.imgUrl"
|
|
type="image" :num="1" :width="150" :height="150"/>
|
|
type="image" :num="1" :width="150" :height="150"/>
|
|
- <div v-if="setList.contentType == 3 ">
|
|
|
|
|
|
+
|
|
|
|
+ <div v-if="setList.contentType == 3 || (setList.contentType == 9 && content.type==2 )">
|
|
<el-card class="box-card">
|
|
<el-card class="box-card">
|
|
<el-form-item label="链接标题:" label-width="100px" required>
|
|
<el-form-item label="链接标题:" label-width="100px" required>
|
|
<el-input :disabled="formType == 3" v-model="setList.linkTitle"
|
|
<el-input :disabled="formType == 3" v-model="setList.linkTitle"
|
|
@@ -263,6 +288,25 @@
|
|
</div>
|
|
</div>
|
|
</el-card>
|
|
</el-card>
|
|
</div>
|
|
</div>
|
|
|
|
+
|
|
|
|
+ <div v-if="setList.contentType == 4">
|
|
|
|
+ <el-card class="box-card">
|
|
|
|
+ <el-form-item label="标题" prop="miniprogramTitle">
|
|
|
|
+ <el-input v-model="setList.miniprogramTitle" placeholder="请输入小程序消息标题,最长为64字节" :rows="2" maxlength="64" type="textarea" @input="checkByteLength(content,setList.contentType,content.isOfficial)" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="封面" prop="miniprogramPicUrl">
|
|
|
|
+ <ImageUpload v-if="content.isOfficial !== '1'" v-model="setList.miniprogramPicUrl" type="image" :num="10" :width="150" :height="150" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="appid" prop="miniprogramAppid" v-show="false">
|
|
|
|
+ <el-input v-model="setList.miniprogramAppid='wx73f85f8d62769119' " disabled />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="page路径" prop="miniprogramPage" v-show="false" label-width="100px" style="margin-left: -30px">
|
|
|
|
+ <el-input v-model="setList.miniprogramPage" placeholder="小程序消息打开后的路径" disabled />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-card>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+
|
|
<div v-if="setList.contentType == 5 ">
|
|
<div v-if="setList.contentType == 5 ">
|
|
|
|
|
|
<el-form-item label="上传文件:" prop="fileUrl" label-width="100px">
|
|
<el-form-item label="上传文件:" prop="fileUrl" label-width="100px">
|
|
@@ -395,7 +439,7 @@
|
|
v-model="setList.intervalTime"
|
|
v-model="setList.intervalTime"
|
|
:min="1"
|
|
:min="1"
|
|
:max="1440"
|
|
:max="1440"
|
|
- style="width:100;margin-top: 10px;"
|
|
|
|
|
|
+ style="width:100px;margin-top: 10px;"
|
|
>
|
|
>
|
|
</el-input-number>
|
|
</el-input-number>
|
|
<span class="tip">单位:分钟,最大1440分钟(24小时)</span>
|
|
<span class="tip">单位:分钟,最大1440分钟(24小时)</span>
|
|
@@ -698,6 +742,47 @@ export default {
|
|
this.addTag[index].inputValue = '';
|
|
this.addTag[index].inputValue = '';
|
|
},
|
|
},
|
|
|
|
|
|
|
|
+ // 检查字节长度
|
|
|
|
+ checkByteLength(content,type,isOfficial) {
|
|
|
|
+
|
|
|
|
+ if (type == 4 && isOfficial=='1')
|
|
|
|
+ for (let i = 0; i < content.setting.length; i++) {
|
|
|
|
+ const text = content.setting[i].miniprogramTitle;
|
|
|
|
+ const byteLength = this.getByteLength(text); // 获取当前字节数
|
|
|
|
+ // 如果字节数超过64,截断输入内容
|
|
|
|
+ if (byteLength > 64) {
|
|
|
|
+ this.$set(content.setting[i], 'miniprogramTitle', this.truncateTextByByteLength(text, 60));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ // 计算字符串的字节数
|
|
|
|
+ getByteLength(text) {
|
|
|
|
+ return new Blob([text]).size; // 使用 Blob 计算字节数
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ // 根据字节数截断字符串
|
|
|
|
+ truncateTextByByteLength(text, maxByteLength) {
|
|
|
|
+ let byteLength = 0;
|
|
|
|
+ let result = "";
|
|
|
|
+
|
|
|
|
+ for (let i = 0; i < text.length; i++) {
|
|
|
|
+ const char = text[i];
|
|
|
|
+ const charByteLength = this.getByteLength(char); // 获取当前字符的字节数
|
|
|
|
+
|
|
|
|
+ // 如果加上当前字符的字节数后不超过限制,则添加到结果中
|
|
|
|
+ if (byteLength + charByteLength <= maxByteLength) {
|
|
|
|
+ result += char;
|
|
|
|
+ byteLength += charByteLength;
|
|
|
|
+ } else {
|
|
|
|
+ break; // 超过限制时停止
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return result;
|
|
|
|
+ },
|
|
|
|
|
|
handleCloseDel(index,tag,content) {
|
|
handleCloseDel(index,tag,content) {
|
|
content.delTag.splice(content.delTag.indexOf(tag), 1);
|
|
content.delTag.splice(content.delTag.indexOf(tag), 1);
|
|
@@ -709,7 +794,7 @@ export default {
|
|
handleInputConfirmDel(index,content) {
|
|
handleInputConfirmDel(index,content) {
|
|
|
|
|
|
let delTagValue = this.addTag[index].delTagValue;
|
|
let delTagValue = this.addTag[index].delTagValue;
|
|
- console.log(delTagValue)
|
|
|
|
|
|
+
|
|
if (delTagValue) {
|
|
if (delTagValue) {
|
|
if (!content.hasOwnProperty('delTag')) {
|
|
if (!content.hasOwnProperty('delTag')) {
|
|
this.$set(content, 'delTag', []);
|
|
this.$set(content, 'delTag', []);
|
|
@@ -789,7 +874,7 @@ export default {
|
|
});
|
|
});
|
|
|
|
|
|
for (let j = 0; j < this.setting[index].content.length; j++) {
|
|
for (let j = 0; j < this.setting[index].content.length; j++) {
|
|
- console.log(this.setting[index].content[j])
|
|
|
|
|
|
+
|
|
if (this.setting[index].content[j].addTag != null) {
|
|
if (this.setting[index].content[j].addTag != null) {
|
|
this.setting[index].content[j].addTag = JSON.parse(this.setting[index].content[j].addTag)
|
|
this.setting[index].content[j].addTag = JSON.parse(this.setting[index].content[j].addTag)
|
|
}
|
|
}
|
|
@@ -822,6 +907,16 @@ export default {
|
|
if (!check) {
|
|
if (!check) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ for (let j = 0; j < data.content.length; j++) {
|
|
|
|
+ if (data.content[j].type != 4 && data.content[j].type != 5) {
|
|
|
|
+ for (let k = 0; k < data.content[j].setting.length; k++) {
|
|
|
|
+ if (data.content[j].setting[k].contentType == 4 && (data.content[j].setting[k].miniprogramTitle != null || data.content[j].setting[k].miniprogramTitle != "")) {
|
|
|
|
+ data.content[j].setting[k].miniprogramTitle=this.truncateTextByByteLength(data.content[j].setting[k].miniprogramTitle,60)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
let index = 0;
|
|
let index = 0;
|
|
const dataList = data.content.map(e => {
|
|
const dataList = data.content.map(e => {
|
|
e.name = data.name;
|
|
e.name = data.name;
|
|
@@ -864,7 +959,7 @@ export default {
|
|
},
|
|
},
|
|
checkData(data) {
|
|
checkData(data) {
|
|
if (this.form.sendType != 4) {
|
|
if (this.form.sendType != 4) {
|
|
- console.log("data",data)
|
|
|
|
|
|
+
|
|
for (let j = 0; j < data.content.length; j++) {
|
|
for (let j = 0; j < data.content.length; j++) {
|
|
if (data.name == null || data.name == "") {
|
|
if (data.name == null || data.name == "") {
|
|
this.$message.error("内容名称不能为空")
|
|
this.$message.error("内容名称不能为空")
|
|
@@ -899,15 +994,15 @@ export default {
|
|
this.$message.error("图片不能为空")
|
|
this.$message.error("图片不能为空")
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
- if (data.content[j].setting[k].contentType == 3 && (data.content[j].setting[k].linkTitle == null || data.content[j].setting[k].linkTitle == "")) {
|
|
|
|
|
|
+ if ((data.content[j].setting[k].contentType == 3 ||data.content[j].setting[k].contentType == 9) && (data.content[j].setting[k].linkTitle == null || data.content[j].setting[k].linkTitle == "")) {
|
|
this.$message.error("链接标题不能为空")
|
|
this.$message.error("链接标题不能为空")
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
- if (data.content[j].setting[k].contentType == 3 && (data.content[j].setting[k].linkDescribe == null || data.content[j].setting[k].linkDescribe == "")) {
|
|
|
|
|
|
+ if ((data.content[j].setting[k].contentType == 3 ||data.content[j].setting[k].contentType == 9 ) && (data.content[j].setting[k].linkDescribe == null || data.content[j].setting[k].linkDescribe == "")) {
|
|
this.$message.error("链接描述不能为空")
|
|
this.$message.error("链接描述不能为空")
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
- if (data.content[j].setting[k].contentType == 3 && (data.content[j].setting[k].linkImageUrl == null || data.content[j].setting[k].linkImageUrl == "")) {
|
|
|
|
|
|
+ if ((data.content[j].setting[k].contentType == 3 ||data.content[j].setting[k].contentType == 9 ) && (data.content[j].setting[k].linkImageUrl == null || data.content[j].setting[k].linkImageUrl == "")) {
|
|
this.$message.error("链接图片不能为空")
|
|
this.$message.error("链接图片不能为空")
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
@@ -915,6 +1010,16 @@ export default {
|
|
this.$message.error("链接地址不能为空")
|
|
this.$message.error("链接地址不能为空")
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if (data.content[j].setting[k].contentType == 4 && (data.content[j].setting[k].miniprogramTitle == null || data.content[j].setting[k].miniprogramTitle == "")) {
|
|
|
|
+ this.$message.error("小程序消息标题不能为空")
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ if (data.content[j].setting[k].contentType == 4 && data.content[j].isOfficial !== '1' && (data.content[j].setting[k].miniprogramPicUrl == null || data.content[j].setting[k].miniprogramPicUrl == "")) {
|
|
|
|
+ this.$message.error("小程序封面地址不能为空")
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
if (data.content[j].setting[k].contentType == 5 && (data.content[j].setting[k].fileUrl == null || data.content[j].setting[k].fileUrl == "")) {
|
|
if (data.content[j].setting[k].contentType == 5 && (data.content[j].setting[k].fileUrl == null || data.content[j].setting[k].fileUrl == "")) {
|
|
this.$message.error("文件不能为空")
|
|
this.$message.error("文件不能为空")
|
|
return false;
|
|
return false;
|
|
@@ -1101,22 +1206,32 @@ export default {
|
|
|
|
|
|
//修改
|
|
//修改
|
|
courseChangeUpdate(content, index, countIndex) {
|
|
courseChangeUpdate(content, index, countIndex) {
|
|
|
|
+
|
|
this.$set(content, 'videoId', null);
|
|
this.$set(content, 'videoId', null);
|
|
// 查找选中的课程对应的 label
|
|
// 查找选中的课程对应的 label
|
|
const selectedCourse = this.courseList.find(course => parseInt(course.dictValue) === content.courseId);
|
|
const selectedCourse = this.courseList.find(course => parseInt(course.dictValue) === content.courseId);
|
|
- for (let i = 0; i < content.setting; i++) {
|
|
|
|
|
|
+ for (let i = 0; i < content.setting.length; i++) {
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
this.$set(content.setting[i], 'linkTitle', null);
|
|
this.$set(content.setting[i], 'linkTitle', null);
|
|
this.$set(content.setting[i], 'linkDescribe', null);
|
|
this.$set(content.setting[i], 'linkDescribe', null);
|
|
this.$set(content.setting[i], 'linkImageUrl', null);
|
|
this.$set(content.setting[i], 'linkImageUrl', null);
|
|
|
|
|
|
- //如果是链接的才上
|
|
|
|
- if (content.setting[i].contentType == 3 && content.type == 2 && content.courseId != null) {
|
|
|
|
|
|
|
|
|
|
+ //如果是链接的才上
|
|
|
|
+ if (selectedCourse && content.type == 2 && content.courseId != null) {
|
|
//响应式直接给链接的标题/封面上值
|
|
//响应式直接给链接的标题/封面上值
|
|
- if (selectedCourse) {
|
|
|
|
|
|
+
|
|
|
|
+ if (content.setting[i].contentType == 3 || content.setting[i].contentType == 9 ){
|
|
this.$set(content.setting[i], 'linkTitle', selectedCourse.dictLabel);
|
|
this.$set(content.setting[i], 'linkTitle', selectedCourse.dictLabel);
|
|
this.$set(content.setting[i], 'linkImageUrl', selectedCourse.dictImgUrl);
|
|
this.$set(content.setting[i], 'linkImageUrl', selectedCourse.dictImgUrl);
|
|
}
|
|
}
|
|
|
|
+ if (content.setting[i].contentType == 4){
|
|
|
|
+ this.$set(content.setting[i], 'miniprogramPicUrl', selectedCourse.dictImgUrl);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1141,15 +1256,94 @@ export default {
|
|
});
|
|
});
|
|
|
|
|
|
},
|
|
},
|
|
|
|
+ toggleSalesCall(itemIndex, contentIndex, setIndex) {
|
|
|
|
+ // 获取目标对象
|
|
|
|
+ const setItem = this.setting[itemIndex].content[contentIndex].setting[setIndex];
|
|
|
|
+ const salesCall = '#销售称呼#';
|
|
|
|
+ const refKey = `textarea-${itemIndex}-${contentIndex}-${setIndex}`;
|
|
|
|
+ const textarea = this.$refs[refKey][0]?.$refs?.textarea;
|
|
|
|
+
|
|
|
|
+ if (!textarea) return;
|
|
|
|
+
|
|
|
|
+ // 获取光标位置
|
|
|
|
+ const cursorPosition = textarea.selectionStart;
|
|
|
|
+
|
|
|
|
+ if (setItem.isSalesCallAdded) {
|
|
|
|
+ // 移除所有标签
|
|
|
|
+ setItem.value = setItem.value.replace(new RegExp(salesCall, 'g'), '');
|
|
|
|
+ } else {
|
|
|
|
+ // 插入到光标位置
|
|
|
|
+ setItem.value =
|
|
|
|
+ setItem.value.slice(0, cursorPosition) +
|
|
|
|
+ salesCall +
|
|
|
|
+ setItem.value.slice(cursorPosition);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 切换状态
|
|
|
|
+ setItem.isSalesCallAdded = !setItem.isSalesCallAdded;
|
|
|
|
+
|
|
|
|
+ // 保持光标位置
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ const newCursorPos = cursorPosition + (setItem.isSalesCallAdded ? salesCall.length : 0);
|
|
|
|
+ textarea.setSelectionRange(newCursorPos, newCursorPos);
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ handleKeydown(event, itemIndex, contentIndex, setIndex) {
|
|
|
|
+
|
|
|
|
+ const setItem = this.setting[itemIndex].content[contentIndex].setting[setIndex];
|
|
|
|
+ const refKey = `textarea-${itemIndex}-${contentIndex}-${setIndex}`;
|
|
|
|
+ const textarea = this.$refs[refKey][0]?.$refs?.textarea;
|
|
|
|
+
|
|
|
|
+ if (!textarea) return;
|
|
|
|
+
|
|
|
|
+ const tags = ['#销售称呼#', '#客户称呼#'];
|
|
|
|
+ const key = event.key;
|
|
|
|
+ const value = setItem.value;
|
|
|
|
+ const cursorPosition = textarea.selectionStart;
|
|
|
|
+
|
|
|
|
+ if (key === 'Backspace' || key === 'Delete') {
|
|
|
|
+ tags.forEach(tag => {
|
|
|
|
+ let start, end;
|
|
|
|
+
|
|
|
|
+ // Backspace 处理
|
|
|
|
+ if (key === 'Backspace' && cursorPosition >= tag.length) {
|
|
|
|
+ start = cursorPosition - tag.length;
|
|
|
|
+ if (value.slice(start, cursorPosition) === tag) {
|
|
|
|
+ event.preventDefault();
|
|
|
|
+ setItem.value = value.slice(0, start) + value.slice(cursorPosition);
|
|
|
|
+ if (tag === '#销售称呼#') setItem.isSalesCallAdded = false;
|
|
|
|
+ this.$nextTick(() => textarea.setSelectionRange(start, start));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // Delete 处理
|
|
|
|
+ if (key === 'Delete') {
|
|
|
|
+ end = cursorPosition + tag.length;
|
|
|
|
+ if (value.slice(cursorPosition, end) === tag) {
|
|
|
|
+ event.preventDefault();
|
|
|
|
+ setItem.value = value.slice(0, cursorPosition) + value.slice(end);
|
|
|
|
+ if (tag === '#销售称呼#') setItem.isSalesCallAdded = false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ },
|
|
handleContentTypeChange(content, index, countIndex) {
|
|
handleContentTypeChange(content, index, countIndex) {
|
|
//如果是链接的才上
|
|
//如果是链接的才上
|
|
if (content.courseId != null && content.type == 2) {
|
|
if (content.courseId != null && content.type == 2) {
|
|
const selectedCourse = this.courseList.find(course => parseInt(course.dictValue) === content.courseId);
|
|
const selectedCourse = this.courseList.find(course => parseInt(course.dictValue) === content.courseId);
|
|
for (let i = 0; i < content.setting.length; i++) {
|
|
for (let i = 0; i < content.setting.length; i++) {
|
|
//响应式直接给链接的标题/封面上值
|
|
//响应式直接给链接的标题/封面上值
|
|
- if (selectedCourse && content.setting[i].contentType == 3 && content.type == 2 && content.courseId != null) {
|
|
|
|
- this.$set(content.setting[i], 'linkTitle', selectedCourse.dictLabel);
|
|
|
|
- this.$set(content.setting[i], 'linkImageUrl', selectedCourse.dictImgUrl);
|
|
|
|
|
|
+ if (selectedCourse && content.type == 2 && content.courseId != null) {
|
|
|
|
+ if (content.setting[i].contentType == 3 || content.setting[i].contentType == 9){
|
|
|
|
+ this.$set(content.setting[i], 'linkTitle', selectedCourse.dictLabel);
|
|
|
|
+ this.$set(content.setting[i], 'linkImageUrl', selectedCourse.dictImgUrl);
|
|
|
|
+ }
|
|
|
|
+ if (content.setting[i].contentType == 4 && (content.isOfficial == '0' || content.isOfficial == null)){
|
|
|
|
+ console.log(content.isOfficial);
|
|
|
|
+ this.$set(content.setting[i], 'miniprogramPicUrl', selectedCourse.dictImgUrl);
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
@@ -1161,8 +1355,14 @@ export default {
|
|
|
|
|
|
for (let i = 0; i < content.setting.length; i++) {
|
|
for (let i = 0; i < content.setting.length; i++) {
|
|
//响应式直接给链接的描述上值
|
|
//响应式直接给链接的描述上值
|
|
- if (selectedVideo && content.setting[i].contentType == 3 && content.type == 2 && content.videoId != null) {
|
|
|
|
- this.$set(content.setting[i], 'linkDescribe', selectedVideo.dictLabel);
|
|
|
|
|
|
+ if (selectedVideo && content.type == 2 && content.videoId != null) {
|
|
|
|
+
|
|
|
|
+ if (content.setting[i].contentType == 3 || content.setting[i].contentType == 9){
|
|
|
|
+ this.$set(content.setting[i], 'linkDescribe', selectedVideo.dictLabel);
|
|
|
|
+ }
|
|
|
|
+ if (content.setting[i].contentType == 4){
|
|
|
|
+ this.$set(content.setting[i], 'miniprogramTitle', this.truncateTextByByteLength(selectedVideo.dictLabel,60));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1182,12 +1382,16 @@ export default {
|
|
this.$set(content.setting[i], 'isBindUrl', '1');
|
|
this.$set(content.setting[i], 'isBindUrl', '1');
|
|
}
|
|
}
|
|
//如果是链接的才上
|
|
//如果是链接的才上
|
|
- if (content.setting[i].contentType == 3 && content.type == 2 && content.videoId != null) {
|
|
|
|
|
|
+ if (selectedVideo && content.type == 2 && content.videoId != null) {
|
|
|
|
|
|
- //响应式直接给链接的描述上值
|
|
|
|
- if (selectedVideo) {
|
|
|
|
|
|
+ if (content.setting[i].contentType == 3 || content.setting[i].contentType == 9 ){
|
|
this.$set(content.setting[i], 'linkDescribe', selectedVideo.dictLabel);
|
|
this.$set(content.setting[i], 'linkDescribe', selectedVideo.dictLabel);
|
|
}
|
|
}
|
|
|
|
+ if (content.setting[i].contentType == 4){
|
|
|
|
+ this.$set(content.setting[i], 'miniprogramTitle', this.truncateTextByByteLength(selectedVideo.dictLabel,60));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1340,7 +1544,23 @@ export default {
|
|
getSopTemp(id).then(response => {
|
|
getSopTemp(id).then(response => {
|
|
this.videoList = []
|
|
this.videoList = []
|
|
this.form = response.data;
|
|
this.form = response.data;
|
|
- this.setting = this.form.list;
|
|
|
|
|
|
+ this.setting = this.form.list || [];
|
|
|
|
+
|
|
|
|
+ if (Array.isArray(this.setting)) {
|
|
|
|
+ this.setting.forEach(item => {
|
|
|
|
+ if (item && Array.isArray(item.content)) {
|
|
|
|
+ item.content.forEach(content => {
|
|
|
|
+ if (content && Array.isArray(content.setting)) {
|
|
|
|
+ content.setting.forEach(setList => {
|
|
|
|
+ if (setList && !Object.hasOwn(setList, 'isSalesCallAdded')) {
|
|
|
|
+ this.$set(setList, 'isSalesCallAdded', false);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
this.form.list.forEach(e => e.newDay = e.dayNum)
|
|
this.form.list.forEach(e => e.newDay = e.dayNum)
|
|
this.dayList = JSON.parse(JSON.stringify(this.form.list));
|
|
this.dayList = JSON.parse(JSON.stringify(this.form.list));
|
|
this.videoList.push([]);
|
|
this.videoList.push([]);
|
|
@@ -1395,9 +1615,9 @@ export default {
|
|
val || val();
|
|
val || val();
|
|
|
|
|
|
},
|
|
},
|
|
- updateChange(val) {
|
|
|
|
- console.log(val)
|
|
|
|
- }
|
|
|
|
|
|
+ // updateChange(val) {
|
|
|
|
+ // console.log(val)
|
|
|
|
+ // }
|
|
}
|
|
}
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|