Browse Source

add:添加app发文本和语音

ct 1 week ago
parent
commit
987af541bd

+ 25 - 0
src/views/course/courseWatchLog/index.vue

@@ -148,6 +148,21 @@
       </el-autocomplete>
     </el-form-item>
 
+      <el-form-item label="看课类型" prop="watchType">
+        <el-select
+          filterable
+          v-model="queryParams.watchType"
+          placeholder="请选择看课类型"
+          clearable size="small">
+          <el-option
+            v-for="dict in watchTypeList"
+            :key="dict.dictValue"
+            :label="dict.dictLabel"
+            :value="dict.dictValue"
+          />
+        </el-select>
+      </el-form-item>
+
       <!-- 营期时间 -->
       <!-- <el-form-item label="营期时间" prop="scheduleTime">
         <el-input
@@ -381,6 +396,11 @@
 <!--      <el-table-column label="所属公司" align="center" prop="companyName" />-->
       <el-table-column label="所属企微" align="center" prop="qwUserName" v-if="queryParams.sendType==2" />
 <!--      <el-table-column label="所属发送方式" align="center" prop="sendType" />-->
+      <el-table-column label="看课类型" align="center">
+        <template slot-scope="{ row }">
+          {{ row.watchType === 1 ? 'APP' : row.watchType === 2 ? '小程序' : '-' }}
+        </template>
+      </el-table-column>
       <el-table-column label="创建时间" align="center" prop="createTime" />
       <el-table-column label="更新时间" align="center" prop="updateTime" />
       <el-table-column label="完课时间" align="center" prop="finishTime" />
@@ -638,6 +658,10 @@ export default {
   components: {Treeselect },
   data() {
     return {
+      watchTypeList: [
+        { dictLabel: 'app', dictValue: 1 },
+        { dictLabel: '小程序', dictValue: 2 }
+      ],
       companyUserFirstLoad: true, // 首次加载标志
       qwUserFirstLoad: true,     // 首次加载标志
       companyUserDropdownVisible: false, // 下拉框显示状态
@@ -806,6 +830,7 @@ export default {
         sendType:process.env.VUE_APP_COURSE_DEFAULT,
         isVip: null,
         sopId: null, // sopId
+        watchType:null,
       },
       // 表单参数
       form: {},

+ 24 - 0
src/views/course/courseWatchLog/watchLog.vue

@@ -121,6 +121,20 @@
           </template>
         </el-autocomplete>
       </el-form-item>
+      <el-form-item label="看课类型" prop="watchType">
+        <el-select
+          filterable
+          v-model="queryParams.watchType"
+          placeholder="请选择看课类型"
+          clearable size="small">
+          <el-option
+            v-for="dict in watchTypeList"
+            :key="dict.dictValue"
+            :label="dict.dictLabel"
+            :value="dict.dictValue"
+          />
+        </el-select>
+      </el-form-item>
       <!-- 营期时间 -->
       <!-- <el-form-item label="营期时间" prop="scheduleTime">
         <el-input
@@ -390,6 +404,11 @@
         </template>
       </el-table-column>
       <el-table-column label="播放时长" align="center" prop="duration"/>
+      <el-table-column label="看课类型" align="center">
+        <template slot-scope="{ row }">
+          {{ row.watchType === 1 ? 'APP' : row.watchType === 2 ? '小程序' : '-' }}
+        </template>
+      </el-table-column>
 <!--      <el-table-column label="所属销售" align="center" prop="companyUserName"/>-->
 <!--      <el-table-column label="所属公司" align="center" prop="companyName"/>-->
 <!--      <el-table-column label="企微员工名称" align="center" prop="qwUserName"/>-->
@@ -698,6 +717,10 @@ export default {
   name: "CourseWatchLog",
   data() {
     return {
+      watchTypeList: [
+        { dictLabel: 'app', dictValue: 1 },
+        { dictLabel: '小程序', dictValue: 2 }
+      ],
       tableKey: 0,
       // 日历 key 控制刷新
       scheduleCalendarKey: 0,
@@ -861,6 +884,7 @@ export default {
         sendType:process.env.VUE_APP_COURSE_DEFAULT,
         isVip: null,
         sopId: null, // sopId
+        watchType:null,
       },
       // 表单参数
       form: {},

+ 112 - 27
src/views/qw/sopUserLogsInfo/sendMsgOpenTool.vue

@@ -57,7 +57,7 @@
                       </el-radio-group>
                     </el-form-item>
                     <el-form-item label="内容" style="margin-bottom: 2%" >
-                      <div v-if="item.contentType == 12">
+                      <div v-if="item.contentType == 10">
                         <!--                                           <div >-->
                         <el-card class="box-card">
                           <el-form-item label="直播间" >
@@ -89,7 +89,7 @@
                         </el-card>
                       </div>
                       <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"
@@ -100,7 +100,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;"
@@ -108,7 +108,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%"
@@ -187,7 +187,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
@@ -239,7 +239,7 @@
 
                     </el-form-item>
 
-                    <el-form-item label="添加短链" v-if="item.contentType == 1 "  >
+                    <el-form-item label="添加短链" v-if="item.contentType == 1 || item.contentType == 11"  >
                       <el-tooltip content="请先根据课程选定课程小节之后再添加" effect="dark" :disabled="!!msgForm.videoId">
                         <el-switch
                           v-model="item.isBindUrl"
@@ -792,19 +792,52 @@ export default {
       this.single = selection.length!==1
       this.multiple = !selection.length
     },
+// 修改后的方法:在原有的基础上增加一条消息
+    processContentType13(settings) {
+      const result = [];
+      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){
 
+            // 处理 contentType 13 的拆分逻辑
+            const processedSetting = this.processContentType13(this.setting);
             this.msgForm.setting=JSON.stringify(this.setting)
 
-            if (this.setting.length <= 0) {
+            if (processedSetting.length <= 0) {
               return this.$message.error("请添加规则")
             }
+
+            // if (this.setting.length <= 0) {
+            //   return this.$message.error("请添加规则")
+            // }
             if (this.msgForm.courseId===null || this.msgForm.courseId===''){
               return this.$message.error("课程不能为空")
             }
@@ -817,46 +850,97 @@ export default {
               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 == "")) {
+            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("福袋不能为空")
+              }
+
+              // 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("语音不能为空")
+              // }
             }
           }
 
@@ -874,10 +958,11 @@ export default {
           sendMsgSopType(this.msgForm).then(response => {
             this.msgSuccess("一键群发成功");
             loading.close();
-            this.setting=[];
+            this.setting = [{ contentType: '1', value: '' }];
             this.resetSendMsgSop();
           }).finally(()=>{
             loading.close();
+            this.msgError("发送失败:" + (error.message || '未知错误'));
           });
 
         }

+ 178 - 51
src/views/qw/sopUserLogsInfo/sendMsgSopOpenTool.vue

@@ -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();
+            });
 
+          }
         }
       });
     },

+ 142 - 21
src/views/qw/sopUserLogsInfo/sopUserLogsInfoDetails.vue

@@ -279,7 +279,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"
@@ -290,7 +290,7 @@
                     >
                     </el-input>
                     <el-link
-                      v-if="item.contentType == 1"
+                      v-if="item.contentType == 1 || item.contentType == 11"
                       type="primary"
                       @click="toggleSalesCall(index)"
                       style="margin-top: 10px;"
@@ -298,7 +298,7 @@
                       {{ item.isSalesCallAdded ? '移除#客服称呼#' : '添加#客服称呼#' }}
                     </el-link>
                     <el-link
-                      v-if="item.contentType == 1"
+                      v-if="item.contentType == 1 ||item.contentType == 11"
                       type="primary"
                       @click="toggleSalesCallCustomer(index)"
                       style="margin-top: 10px;margin-left: 2%"
@@ -377,14 +377,14 @@
                         </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
                         placeholder="输入要转为语音的内容" style="width: 90%;margin-top: 10px;"
                         @input="handleInputVideoText(item.value,item)"/>
                     </div>
-                    <div v-if="item.contentType == 12">
+                    <div v-if="item.contentType == 10">
                       <!--                                           <div >-->
                       <el-card class="box-card">
                         <el-form-item label="直播间" >
@@ -1319,11 +1319,133 @@ export default {
     handleUpdate() {
       this.updateOpen= true;
     },
+    // 修改后的方法:在原有的基础上增加一条消息
+    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) {
+      //
+      //     this.msgForm.setting=JSON.stringify(this.setting)
+      //     this.msgForm.ids=this.ids;
+      //     this.msgForm.sopId=this.queryParams.sopId;
+      //     this.msgForm.userIdParam=this.queryParams.userIdParam;
+      //     this.msgForm.startTime=this.queryParams.startTimeParam;
+      //     this.msgForm.corpId=this.queryParams.corpIdParam;
+      //     this.msgForm.filterMode=this.queryParams.filterMode;
+      //
+      //     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].miniprogramTitle == null || this.setting[i].miniprogramTitle == "")) {
+      //         return this.$message.error("小程序消息标题不能为空")
+      //       }
+      //       if (this.setting[i].contentType == 4 && (this.setting[i].miniprogramPicUrl == null || this.setting[i].miniprogramPicUrl == "")) {
+      //         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("语音不能为空")
+      //       }
+      //     }
+      //
+      //     this.sendMsgOpen.open = false;
+      //
+      //     const loading = this.$loading({
+      //       lock: true,
+      //       text: '正在执行中请稍后~~请不要刷新页面!!',
+      //       spinner: 'el-icon-loading',
+      //       background: 'rgba(0, 0, 0, 0.7)'
+      //     });
+      //
+      //     sendMsgSop(this.msgForm).then(response => {
+      //       this.msgSuccess("一键群发成功");
+      //       loading.close();
+      //       this.setting=[];
+      //       this.msgForm = {
+      //         videoId:null,
+      //         courseId:null,
+      //         courseType:null,
+      //         setting:null,
+      //       }
+      //       this.getList();
+      //     }).finally(()=>{
+      //       loading.close();
+      //     });
+      //
+      //   }
+      // });
       this.$refs["msgForm"].validate(valid => {
         if (valid) {
 
-          this.msgForm.setting=JSON.stringify(this.setting)
+          // 处理 contentType 13 的拆分逻辑
+          const processedSetting = this.processContentType13(this.setting);
+          console.log(processedSetting)
+          this.msgForm.setting = JSON.stringify(processedSetting);
           this.msgForm.ids=this.ids;
           this.msgForm.sopId=this.queryParams.sopId;
           this.msgForm.userIdParam=this.queryParams.userIdParam;
@@ -1331,7 +1453,7 @@ export default {
           this.msgForm.corpId=this.queryParams.corpIdParam;
           this.msgForm.filterMode=this.queryParams.filterMode;
 
-          if (this.setting.length <= 0) {
+          if (processedSetting.length <= 0) {
             return this.$message.error("请添加规则")
           }
           if (this.msgForm.courseId===null || this.msgForm.courseId===''){
@@ -1346,39 +1468,39 @@ export default {
             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 == "")) {
+          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].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].miniprogramPicUrl == null || this.setting[i].miniprogramPicUrl == "")) {
+            if (item.contentType == 4 && (item.miniprogramPicUrl == null || item.miniprogramPicUrl == "")) {
               return this.$message.error("小程序封面地址不能为空")
             }
-            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("语音不能为空")
             }
           }
@@ -1391,7 +1513,6 @@ export default {
             spinner: 'el-icon-loading',
             background: 'rgba(0, 0, 0, 0.7)'
           });
-
           sendMsgSop(this.msgForm).then(response => {
             this.msgSuccess("一键群发成功");
             loading.close();