|
|
@@ -150,9 +150,15 @@
|
|
|
/>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="规则" prop="setting" v-if="!form.id">
|
|
|
+ <el-form-item prop="setting">
|
|
|
+ <span slot="label" class="finish-rule-label finish-rule-label--watch">
|
|
|
+ <el-tag type="primary" size="mini" effect="dark">私聊</el-tag>
|
|
|
+ <span>看课规则</span>
|
|
|
+ </span>
|
|
|
+ <div class="finish-rule-panel finish-rule-panel--watch">
|
|
|
+ <div class="finish-rule-panel__tip">发给客户本人(私聊),与下方「群聊恭喜」完全独立,请勿混用</div>
|
|
|
<div v-for="(item, index) in setting" :key="index"
|
|
|
- style="background-color: #fdfdfd; border: 1px solid #e6e6e6; margin-bottom: 20px;">
|
|
|
+ class="finish-rule-item finish-rule-item--watch">
|
|
|
<el-row>
|
|
|
<el-col :span="22">
|
|
|
<el-form :model="item" label-width="70px">
|
|
|
@@ -329,12 +335,19 @@
|
|
|
</el-row>
|
|
|
</div>
|
|
|
<el-link type="primary" class="el-icon-plus" :underline="false" @click='addSetList(0)'>
|
|
|
- 添加内容
|
|
|
+ 添加私聊内容
|
|
|
</el-link>
|
|
|
+ </div>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="群聊恭喜规则" prop="setting" v-if="!form.id">
|
|
|
+ <el-form-item prop="chatSetting">
|
|
|
+ <span slot="label" class="finish-rule-label finish-rule-label--chat">
|
|
|
+ <el-tag type="warning" size="mini" effect="dark">群聊</el-tag>
|
|
|
+ <span>群聊恭喜规则</span>
|
|
|
+ </span>
|
|
|
+ <div class="finish-rule-panel finish-rule-panel--chat">
|
|
|
+ <div class="finish-rule-panel__tip">发到客户群(群聊恭喜),与上方「看课私聊」完全独立,请勿混用</div>
|
|
|
<div v-for="(item, index) in chatSetting" :key="index"
|
|
|
- style="background-color: #fdfdfd; border: 1px solid #e6e6e6; margin-bottom: 20px;">
|
|
|
+ class="finish-rule-item finish-rule-item--chat">
|
|
|
<el-row>
|
|
|
<el-col :span="22">
|
|
|
<el-form :model="item" label-width="70px">
|
|
|
@@ -510,9 +523,10 @@
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</div>
|
|
|
- <el-link type="primary" class="el-icon-plus" :underline="false" @click='addSetList(1)'>
|
|
|
- 添加内容
|
|
|
+ <el-link type="warning" class="el-icon-plus" :underline="false" @click='addSetList(1)'>
|
|
|
+ 添加群聊内容
|
|
|
</el-link>
|
|
|
+ </div>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="全选销售" prop="isAllCompanyUser" v-if="!form.id">
|
|
|
<el-switch
|
|
|
@@ -742,6 +756,8 @@ export default {
|
|
|
},
|
|
|
// 表单重置
|
|
|
reset() {
|
|
|
+ this.setting = [];
|
|
|
+ this.chatSetting = [];
|
|
|
this.form = {
|
|
|
id: null,
|
|
|
status: 1,
|
|
|
@@ -812,6 +828,31 @@ export default {
|
|
|
const id = row.id || this.ids
|
|
|
getCourseFinishTempParent(id).then(response => {
|
|
|
this.form = response.data;
|
|
|
+ try {
|
|
|
+ this.setting = response.data.setting ? JSON.parse(response.data.setting) : [];
|
|
|
+ } catch (e) {
|
|
|
+ this.setting = [];
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ this.chatSetting = response.data.chatSetting ? JSON.parse(response.data.chatSetting) : [];
|
|
|
+ } catch (e) {
|
|
|
+ this.chatSetting = [];
|
|
|
+ }
|
|
|
+ if (response.data.companyUserIds != null && response.data.companyUserIds !== '') {
|
|
|
+ this.companyUserIds = String(this.form.companyUserIds).split(",");
|
|
|
+ } else {
|
|
|
+ this.companyUserIds = [];
|
|
|
+ }
|
|
|
+ const allRuleItems = [].concat(this.setting || [], this.chatSetting || []);
|
|
|
+ allRuleItems.forEach(item => {
|
|
|
+ if (item && (item.contentType == 4 || item.contentType == '4') && item.courseId) {
|
|
|
+ this.videoOptions = [];
|
|
|
+ this.videoOptionsLoading = false;
|
|
|
+ videoList(item.courseId).then((videoResponse) => {
|
|
|
+ this.videoOptions = videoResponse.list;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
this.open = true;
|
|
|
this.title = "修改完课模板";
|
|
|
});
|
|
|
@@ -820,6 +861,89 @@ export default {
|
|
|
submitForm() {
|
|
|
this.$refs["form"].validate(valid => {
|
|
|
if (valid) {
|
|
|
+ if (this.form.isAllCompanyUser == null) {
|
|
|
+ this.form.isAllCompanyUser = 2;
|
|
|
+ }
|
|
|
+ if (this.companyUserIds != null) {
|
|
|
+ this.form.companyUserIds = this.companyUserIds.toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ const processedSetting = this.setting.map(item => {
|
|
|
+ const newItem = {...item};
|
|
|
+ if (newItem.videoOptions) {
|
|
|
+ delete newItem.videoOptions;
|
|
|
+ }
|
|
|
+ if (newItem.videoLoading !== undefined) {
|
|
|
+ delete newItem.videoLoading;
|
|
|
+ }
|
|
|
+ return newItem;
|
|
|
+ });
|
|
|
+
|
|
|
+ this.form.setting = JSON.stringify(processedSetting);
|
|
|
+ this.form.chatSetting = JSON.stringify(this.chatSetting);
|
|
|
+
|
|
|
+ if (this.setting.length <= 0) {
|
|
|
+ return this.$message("请添加看课规则")
|
|
|
+ }
|
|
|
+ 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].linkTitle == null || this.setting[i].linkTitle == "")) {
|
|
|
+ return this.$message.error("看课规则:链接标题不能为空")
|
|
|
+ }
|
|
|
+ if (this.setting[i].contentType == 3 && (this.setting[i].linkDescribe == null || this.setting[i].linkDescribe == "")) {
|
|
|
+ return this.$message.error("看课规则:链接描述不能为空")
|
|
|
+ }
|
|
|
+ if (this.setting[i].contentType == 3 && (this.setting[i].linkImageUrl == null || this.setting[i].linkImageUrl == "")) {
|
|
|
+ return this.$message.error("看课规则:链接图片不能为空")
|
|
|
+ }
|
|
|
+ if (this.setting[i].contentType == 3 && this.setting[i].type == 1 && (this.setting[i].linkUrl == null || this.setting[i].linkUrl == "")) {
|
|
|
+ return this.$message.error("看课规则:链接地址不能为空")
|
|
|
+ }
|
|
|
+ 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("看课规则:语音不能为空")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (let i = 0; i < this.chatSetting.length; i++) {
|
|
|
+ if (this.chatSetting[i].contentType == 1 && (this.chatSetting[i].value == null || this.chatSetting[i].value == "")) {
|
|
|
+ return this.$message.error("群聊恭喜规则:内容不能为空")
|
|
|
+ }
|
|
|
+ if (this.chatSetting[i].contentType == 2 && (this.chatSetting[i].imgUrl == null || this.chatSetting[i].imgUrl == "")) {
|
|
|
+ return this.$message.error("群聊恭喜规则:图片不能为空")
|
|
|
+ }
|
|
|
+ if (this.chatSetting[i].contentType == 3 && (this.chatSetting[i].linkTitle == null || this.chatSetting[i].linkTitle == "")) {
|
|
|
+ return this.$message.error("群聊恭喜规则:链接标题不能为空")
|
|
|
+ }
|
|
|
+ if (this.chatSetting[i].contentType == 3 && (this.chatSetting[i].linkDescribe == null || this.chatSetting[i].linkDescribe == "")) {
|
|
|
+ return this.$message.error("群聊恭喜规则:链接描述不能为空")
|
|
|
+ }
|
|
|
+ if (this.chatSetting[i].contentType == 3 && (this.chatSetting[i].linkImageUrl == null || this.chatSetting[i].linkImageUrl == "")) {
|
|
|
+ return this.$message.error("群聊恭喜规则:链接图片不能为空")
|
|
|
+ }
|
|
|
+ if (this.chatSetting[i].contentType == 3 && this.chatSetting[i].type == 1 && (this.chatSetting[i].linkUrl == null || this.chatSetting[i].linkUrl == "")) {
|
|
|
+ return this.$message.error("群聊恭喜规则:链接地址不能为空")
|
|
|
+ }
|
|
|
+ if (this.chatSetting[i].contentType == 5 && (this.chatSetting[i].fileUrl == null || this.chatSetting[i].fileUrl == "")) {
|
|
|
+ return this.$message.error("群聊恭喜规则:文件不能为空")
|
|
|
+ }
|
|
|
+ if (this.chatSetting[i].contentType == 6 && (this.chatSetting[i].videoUrl == null || this.chatSetting[i].videoUrl == "")) {
|
|
|
+ return this.$message.error("群聊恭喜规则:视频不能为空")
|
|
|
+ }
|
|
|
+ if (this.chatSetting[i].contentType == 7 && (this.chatSetting[i].value == null || this.chatSetting[i].value == "")) {
|
|
|
+ return this.$message.error("群聊恭喜规则:语音不能为空")
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (this.form.id != null) {
|
|
|
updateCourseFinishTempParent(this.form).then(response => {
|
|
|
this.msgSuccess("修改成功");
|
|
|
@@ -827,60 +951,7 @@ export default {
|
|
|
this.getList();
|
|
|
});
|
|
|
} else {
|
|
|
- if (this.form.isAllCompanyUser == null) {
|
|
|
- this.form.isAllCompanyUser = 2;
|
|
|
- }
|
|
|
- this.form.companyUserIds = this.companyUserIds.toString()
|
|
|
-
|
|
|
-
|
|
|
- const processedSetting = this.setting.map(item => {
|
|
|
- const newItem = {...item};
|
|
|
- if (newItem.videoOptions) {
|
|
|
- delete newItem.videoOptions;
|
|
|
- }
|
|
|
- if (newItem.videoLoading !== undefined) {
|
|
|
- delete newItem.videoLoading;
|
|
|
- }
|
|
|
- return newItem;
|
|
|
- });
|
|
|
-
|
|
|
- this.form.setting = JSON.stringify(processedSetting);
|
|
|
- this.form.chatSetting = JSON.stringify(this.chatSetting)
|
|
|
-
|
|
|
- if (this.setting.length <= 0) {
|
|
|
- return this.$message("请添加规则")
|
|
|
- }
|
|
|
- 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].linkTitle == null || this.setting[i].linkTitle == "")) {
|
|
|
- return this.$message.error("链接标题不能为空")
|
|
|
- }
|
|
|
- if (this.setting[i].contentType == 3 && (this.setting[i].linkDescribe == null || this.setting[i].linkDescribe == "")) {
|
|
|
- return this.$message.error("链接描述不能为空")
|
|
|
- }
|
|
|
- if (this.setting[i].contentType == 3 && (this.setting[i].linkImageUrl == null || this.setting[i].linkImageUrl == "")) {
|
|
|
- return this.$message.error("链接图片不能为空")
|
|
|
- }
|
|
|
- if (this.setting[i].contentType == 3 && this.setting[i].type == 1 && (this.setting[i].linkUrl == null || this.setting[i].linkUrl == "")) {
|
|
|
- return this.$message.error("链接地址不能为空")
|
|
|
- }
|
|
|
- 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("语音不能为空")
|
|
|
- }
|
|
|
- }
|
|
|
addCourseFinishTempParent(this.form).then(response => {
|
|
|
- // this.loading = true
|
|
|
this.msgSuccess("新增成功");
|
|
|
this.open = false;
|
|
|
this.getList();
|
|
|
@@ -1002,3 +1073,54 @@ export default {
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+.finish-rule-label {
|
|
|
+ display: inline-flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: flex-start;
|
|
|
+ line-height: 1.4;
|
|
|
+ gap: 4px;
|
|
|
+}
|
|
|
+.finish-rule-label span:last-child {
|
|
|
+ font-weight: 600;
|
|
|
+}
|
|
|
+.finish-rule-panel {
|
|
|
+ width: 100%;
|
|
|
+ box-sizing: border-box;
|
|
|
+ border-radius: 4px;
|
|
|
+ padding: 12px;
|
|
|
+}
|
|
|
+.finish-rule-panel--watch {
|
|
|
+ background: #ecf5ff;
|
|
|
+ border: 1px solid #b3d8ff;
|
|
|
+ border-left: 4px solid #409eff;
|
|
|
+}
|
|
|
+.finish-rule-panel--chat {
|
|
|
+ background: #fdf6ec;
|
|
|
+ border: 1px solid #f5dab1;
|
|
|
+ border-left: 4px solid #e6a23c;
|
|
|
+}
|
|
|
+.finish-rule-panel__tip {
|
|
|
+ font-size: 12px;
|
|
|
+ margin-bottom: 10px;
|
|
|
+ line-height: 1.5;
|
|
|
+}
|
|
|
+.finish-rule-panel--watch .finish-rule-panel__tip {
|
|
|
+ color: #337ecc;
|
|
|
+}
|
|
|
+.finish-rule-panel--chat .finish-rule-panel__tip {
|
|
|
+ color: #b88230;
|
|
|
+}
|
|
|
+.finish-rule-item {
|
|
|
+ margin-bottom: 16px;
|
|
|
+ border-radius: 4px;
|
|
|
+ background: #fff;
|
|
|
+}
|
|
|
+.finish-rule-item--watch {
|
|
|
+ border: 1px solid #b3d8ff;
|
|
|
+}
|
|
|
+.finish-rule-item--chat {
|
|
|
+ border: 1px solid #f5dab1;
|
|
|
+}
|
|
|
+</style>
|