lex 1 year ago
parent
commit
5341ec9314
2 changed files with 120 additions and 81 deletions
  1. 2 1
      package.json
  2. 118 80
      src/views/liveClassManager/createLiveClass.vue

+ 2 - 1
package.json

@@ -11,7 +11,8 @@
     "lint": "eslint --ext .js,.vue src",
     "test:unit": "jest --clearCache && vue-cli-service test:unit",
     "test:ci": "npm run lint && npm run test:unit",
-    "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml"
+    "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml",
+    "postinstall": "patch-package"
   },
   "dependencies": {
     "@babel/plugin-proposal-optional-chaining": "^7.11.0",

+ 118 - 80
src/views/liveClassManager/createLiveClass.vue

@@ -194,8 +194,8 @@
                 {
                   required: true,
                   validator: validStock,
-                  trigger: 'blur',
-                },
+                  trigger: 'blur'
+                }
               ]"
             >
               <el-input
@@ -203,7 +203,7 @@
                 placeholder="请输入课时数"
                 maxlength="2"
                 @input="
-                  (val) => {
+                  val => {
                     form.onlineClassesNum = val.replace(/[^\d]/g, '');
                   }
                 "
@@ -249,8 +249,8 @@
                   required: true,
                   message: '请输入正确的现单价',
                   trigger: 'blur',
-                  pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
-                },
+                  pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/
+                }
               ]"
             >
               <el-input
@@ -270,8 +270,8 @@
                   required: true,
                   message: '请输入正确的原单价',
                   trigger: 'blur',
-                  pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
-                },
+                  pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/
+                }
               ]"
             >
               <el-input
@@ -316,7 +316,9 @@
           :data="form.timeTable"
         >
           <el-table-column align="center" label="课时">
-            <template slot-scope="scope"> 第{{ scope.$index + 1 }}课 </template>
+            <template slot-scope="scope">
+              第{{ scope.$index + 1 }}课
+            </template>
           </el-table-column>
           <el-table-column
             align="center"
@@ -415,8 +417,12 @@
             >
               <el-radio-group v-model="form.os" :disabled="isDisabled">
                 <!-- 根据不同的模式,显示不同的直播设备 -->
-                <el-radio v-if="serviceProvider === 'rongCloud'" label="pc">web</el-radio>
-                <el-radio v-if="serviceProvider === 'tencentCloud'" label="client"
+                <el-radio v-if="serviceProvider === 'rongCloud'" label="pc"
+                  >web</el-radio
+                >
+                <el-radio
+                  v-if="serviceProvider === 'tencentCloud'"
+                  label="client"
                   >乐直播</el-radio
                 >
                 <el-radio label="mobile">手机</el-radio>
@@ -481,7 +487,7 @@
                       class="dotWrap"
                       :class="[
                         form.preTemplate == 1 ? 'checked' : '',
-                        isDisabled ? 'disabled' : '',
+                        isDisabled ? 'disabled' : ''
                       ]"
                     ></i>
                   </div>
@@ -491,7 +497,7 @@
                       class="dotWrap"
                       :class="[
                         form.preTemplate == 2 ? 'checked' : '',
-                        isDisabled ? 'disabled' : '',
+                        isDisabled ? 'disabled' : ''
                       ]"
                     ></i>
                   </div>
@@ -501,7 +507,7 @@
                       class="dotWrap"
                       :class="[
                         form.preTemplate == 3 ? 'checked' : '',
-                        isDisabled ? 'disabled' : '',
+                        isDisabled ? 'disabled' : ''
                       ]"
                     ></i>
                   </div>
@@ -513,7 +519,10 @@
 
         <el-row>
           <el-col :span="24">
-            <el-button type="primary" @click="onReset" v-if="[0, 1].includes(status)"
+            <el-button
+              type="primary"
+              @click="onReset"
+              v-if="[0, 1].includes(status)"
               >重置</el-button
             >
             <el-button type="primary" @click="onSubmit">确定</el-button>
@@ -570,7 +579,7 @@
             format="HH:mm"
             value-format="HH:mm"
             :picker-options="{
-              selectableRange: `${nowTime} - 23:30:00`,
+              selectableRange: `${nowTime} - 23:30:00`
             }"
           ></el-time-picker>
         </el-form-item>
@@ -602,7 +611,7 @@ import {
   sysTenantConfigAll,
   findTeacherByTenantId,
   liveGroupDetail,
-  updateLiveGroup,
+  updateLiveGroup
 } from "./api";
 import { getSubject, getOrganRole } from "@/api/buildTeam";
 import { vipGroupCategory, createVip } from "@/api/vipSeting";
@@ -640,10 +649,10 @@ export default {
           whether_chat: 0,
           whether_video: 0,
           whether_mic: 0,
-          whether_view_shop_cart: 1,
+          whether_view_shop_cart: 1
         },
         timeTable: [], // 排课
-        clientType: "TEACHER", // 主讲人身份 默认[老师]
+        clientType: "TEACHER" // 主讲人身份 默认[老师]
       },
       status: 0, // 直播课状态
       auditStatus: null, // 审核状态
@@ -661,16 +670,16 @@ export default {
         startTime: "",
         endTime: "",
         id: "",
-        teachMode: "",
+        teachMode: ""
       },
       maskRules: {
-        date: [{ required: true, message: "请选择上课时间", trigger: "blur" }],
+        date: [{ required: true, message: "请选择上课时间", trigger: "blur" }]
       },
       courseVisible: false,
       startTime: "",
       courseTime: "",
       studentRefKey: "12321321",
-      showTable: true,
+      showTable: true
     };
   },
   async mounted() {
@@ -682,7 +691,7 @@ export default {
       try {
         // 判断声部,如果为MUSIC_THEORY则为乐理,显示普通
         let subjectItem = {};
-        this.subjectList.forEach((item) => {
+        this.subjectList.forEach(item => {
           if (val == item.id) {
             subjectItem = item;
           }
@@ -696,8 +705,8 @@ export default {
         this.form.teacher = ""; // 重置指导老师
         // 根据科目id获取相应的老师
         await findTeacherByTenantId({
-          subjectIds: subjectItem.code == "MUSIC_THEORY" ? null : val,
-        }).then((res) => {
+          subjectIds: subjectItem.code == "MUSIC_THEORY" ? null : val
+        }).then(res => {
           this.teacherList = res.data;
         });
       } catch {}
@@ -710,9 +719,9 @@ export default {
       let self = this;
       return {
         firstDayOfWeek: 1,
-        disabledDate: (time) => {
+        disabledDate: time => {
           return time.getTime() + 86400000 <= new Date().getTime();
-        },
+        }
       };
     },
     pickerOptions(dateStr) {
@@ -720,7 +729,7 @@ export default {
         firstDayOfWeek: 1,
         disabledDate(time) {
           return time.getTime() + 86400000 <= new Date().getTime();
-        },
+        }
       };
     },
     resetCourse(row, index) {
@@ -750,7 +759,7 @@ export default {
         endTime: "",
         id: "",
         address: "",
-        teachMode: "",
+        teachMode: ""
       };
       this.actvieRow = null;
       this.actvieIndex = 0;
@@ -764,14 +773,22 @@ export default {
         this.actvieIndex
       ].actualTeacherId = this.activeRow.actualTeacherId;
       this.form.timeTable[this.actvieIndex].classDate = this.maskForm.date;
-      this.form.timeTable[this.actvieIndex].endClassTimeStr = this.maskForm.endTime;
-      this.form.timeTable[this.actvieIndex].singleClassMinutes = this.courseTime;
+      this.form.timeTable[
+        this.actvieIndex
+      ].endClassTimeStr = this.maskForm.endTime;
+      this.form.timeTable[
+        this.actvieIndex
+      ].singleClassMinutes = this.courseTime;
       this.form.timeTable[this.actvieIndex].startClassTimeStr = this.startTime;
-      this.form.timeTable[this.actvieIndex].teachMode = this.activeRow.teachMode;
+      this.form.timeTable[
+        this.actvieIndex
+      ].teachMode = this.activeRow.teachMode;
       this.form.timeTable[
         this.actvieIndex
       ].teachingContent = this.activeRow.teachingContent;
-      this.form.timeTable[this.actvieIndex].teachingPoint = this.activeRow.teachingPoint;
+      this.form.timeTable[
+        this.actvieIndex
+      ].teachingPoint = this.activeRow.teachingPoint;
 
       console.log(
         " this.form.timeTable[this.actvieIndex]",
@@ -779,10 +796,16 @@ export default {
       );
       this.form.timeTable.sort((a, b) => {
         const aTime = dayjs(
-          dayjs(a.classDate).format("YYYY-MM-DD") + " " + a.startClassTimeStr + ":00"
+          dayjs(a.classDate).format("YYYY-MM-DD") +
+            " " +
+            a.startClassTimeStr +
+            ":00"
         ).valueOf();
         const bTime = dayjs(
-          dayjs(b.classDate).format("YYYY-MM-DD") + " " + b.startClassTimeStr + ":00"
+          dayjs(b.classDate).format("YYYY-MM-DD") +
+            " " +
+            b.startClassTimeStr +
+            ":00"
         ).valueOf();
         return aTime - bTime;
       });
@@ -794,7 +817,7 @@ export default {
       });
     },
     changeStartTime(val) {
-      this.$nextTick((res) => {
+      this.$nextTick(res => {
         if (val) {
           this.$set(
             this.maskForm,
@@ -836,7 +859,7 @@ export default {
       this.form.preTemplate = index;
     },
     async onSubmit() {
-      this.$refs.liveForm.validate(async (flag) => {
+      this.$refs.liveForm.validate(async flag => {
         if (!flag) {
           this.onScrollError();
           return false;
@@ -849,7 +872,7 @@ export default {
             return;
           }
           const timeTable = [];
-          form.timeTable.forEach((item) => {
+          form.timeTable.forEach(item => {
             timeTable.push({
               classDate: item.classDate,
               actualTeacherId: form.teacher,
@@ -858,7 +881,7 @@ export default {
               teachMode: item.teachMode,
               id: item.id,
               teachingContent: item.teachingContent,
-              teachingPoint: item.teachingPoint,
+              teachingPoint: item.teachingPoint
             });
           });
 
@@ -874,7 +897,9 @@ export default {
               onlineClassesNum: form.onlineClassesNum || 0,
               offlineClassesUnitPrice: form.offlineClassesUnitPrice || 0,
               onlineClassesUnitPrice: form.onlineClassesUnitPrice || 0,
-              registrationStartTime: dayjs(form.signUpStart).format("YYYY-MM-DD"),
+              registrationStartTime: dayjs(form.signUpStart).format(
+                "YYYY-MM-DD"
+              ),
               paymentExpireDate: dayjs(form.signUpEnd).format("YYYY-MM-DD"),
               singleClassMinutes: form.singleClassMinutes,
               userId: form.teacher,
@@ -886,7 +911,7 @@ export default {
               subjectIdList: form.subjectIdList,
               educationalTeacherId: form.educationalTeacherId,
               organId: -1,
-              organIdList: form.organIds.join(","),
+              organIdList: form.organIds.join(",")
             },
             liveBroadcastRoom: {
               speakerId: form.teacher,
@@ -902,9 +927,9 @@ export default {
               roomConfig: {
                 ...form.roomConfig,
                 subjectId: form.subjectIdList,
-                groupType: "LIVE",
-              },
-            },
+                groupType: "LIVE"
+              }
+            }
           };
           console.log(obj, "obj");
           if (this.type === "update") {
@@ -916,19 +941,19 @@ export default {
             this.$router.push({
               path: "/liveClassManager",
               query: {
-                tabrouter: 2,
-              },
+                tabrouter: 2
+              }
             });
           } else {
-            createVip(obj).then((res) => {
+            createVip(obj).then(res => {
               if (res.code == 200) {
                 this.$message.success("创建成功");
                 this.$store.dispatch("delVisitedViews", this.$route);
                 this.$router.push({
                   path: "/liveClassManager",
                   query: {
-                    tabrouter: 2,
-                  },
+                    tabrouter: 2
+                  }
                 });
               }
             });
@@ -946,7 +971,7 @@ export default {
         let isError = document.getElementsByClassName("el-alert");
         isError[0].scrollIntoView({
           block: "center",
-          behavior: "smooth",
+          behavior: "smooth"
         });
       });
     },
@@ -955,7 +980,7 @@ export default {
       let count = 0;
       this.$refs.liveForm.validateField(
         ["signUpStart", "signUPEnd", "onlineClassesNum", "singleClassMinuteId"],
-        (valid) => {
+        valid => {
           count += 1;
           if (valid) {
             this.onScrollError();
@@ -992,7 +1017,7 @@ export default {
           } else {
             return time.getTime() + 86400000 <= new Date().getTime();
           }
-        },
+        }
       };
     },
     startBigin() {
@@ -1001,7 +1026,7 @@ export default {
         disabledDate(time) {
           // return time.getTime() >= Date.now();
           return time.getTime() + 86400000 <= new Date().getTime();
-        },
+        }
       };
     },
     onScrollError() {
@@ -1009,7 +1034,7 @@ export default {
         let isError = document.getElementsByClassName("is-error");
         isError[0].scrollIntoView({
           block: "center",
-          behavior: "smooth",
+          behavior: "smooth"
         });
       });
     },
@@ -1018,7 +1043,7 @@ export default {
       let onlinePrice = null;
       let offLinePrice = null;
       let minus = null;
-      this.liveGroupList.forEach((item) => {
+      this.liveGroupList.forEach(item => {
         if (item.id === val) {
           onlinePrice = item.onlineClassesUnitPrice;
           offLinePrice = item.offlineClassesUnitPrice;
@@ -1033,7 +1058,7 @@ export default {
     },
     onConfirm(val) {
       let tempVal = deepClone(val || []);
-      tempVal.forEach((item) => {
+      tempVal.forEach(item => {
         item.teachingContent = "";
         item.teachingPoint = "";
         item.singleClassMinutes = this.form.singleClassMinutes;
@@ -1045,36 +1070,37 @@ export default {
     async __init() {
       try {
         const findName = await sysTenantConfigAll({
-          group: "LIVE_CLIENT",
+          group: "LIVE_CLIENT"
         });
         if (findName.data && findName.data.length > 0) {
-          findName.data.forEach((item) => {
+          findName.data.forEach(item => {
             if (item.paramName == "live_client") {
               this.serviceProvider = item.paranValue;
-              this.form.os = this.serviceProvider == "tencentCloud" ? "client" : "pc";
+              this.form.os =
+                this.serviceProvider == "tencentCloud" ? "client" : "pc";
             }
           });
         }
 
         // 获取 指导老师列表
         await getSubject({
-          tenantId: 1,
-        }).then((res) => {
+          tenantId: 1
+        }).then(res => {
           if (res.code == 200) {
             this.subjectList = [...res.data];
           }
         });
 
         // 获取乐团主管
-        await getOrganRole({ all: true }).then((ruselt) => {
+        await getOrganRole({ all: true }).then(ruselt => {
           this.educationList = ruselt?.data?.EDUCATION;
         });
 
         // 获取课时数
         // 获取默认左边参数
         await vipGroupCategory({
-          groupType: "live",
-        }).then((res) => {
+          groupType: "live"
+        }).then(res => {
           if (res.code == 200) {
             this.liveGroupList = res.data;
           }
@@ -1088,17 +1114,17 @@ export default {
           const vipGroupApplyBaseInfo = data.vipGroupApplyBaseInfo || {};
           const courseSchedules = data.courseSchedules || [];
           const tempCourse = [];
-          courseSchedules.forEach((item) => {
+          courseSchedules.forEach(item => {
             tempCourse.push({
               classDate: item.classDate,
               actualTeacherId: item.teacherId,
-              startClassTimeStr: item.startClassTimeStr,
-              endClassTimeStr: item.endClassTimeStr,
+              startClassTimeStr: dayjs(item.startClassTime).format("HH:mm"),
+              endClassTimeStr: dayjs(item.endClassTime).format("HH:mm"),
               teachMode: "ONLINE",
               id: item.id,
               singleClassMinutes: vipGroupApplyBaseInfo.singleClassMinutes,
               teachingContent: item.teachingContent,
-              teachingPoint: item.teachingPoint,
+              teachingPoint: item.teachingPoint
             });
           });
 
@@ -1112,7 +1138,9 @@ export default {
             roomTitle: liveBroadcastRoom.roomTitle, //
             liveRemark: liveBroadcastRoom.liveRemark, // 内容
             organIds: vipGroupApplyBaseInfo.organIdList
-              ? vipGroupApplyBaseInfo.organIdList.split(",").map((item) => Number(item))
+              ? vipGroupApplyBaseInfo.organIdList
+                  .split(",")
+                  .map(item => Number(item))
               : [],
             subjectIdList: subjectId, // 声部
             teacher: liveBroadcastRoom.speakerId, // 指导老师列表
@@ -1127,8 +1155,10 @@ export default {
             onlineClassesNum: vipGroupApplyBaseInfo.onlineClassesNum,
             singleClassMinuteId: vipGroupApplyBaseInfo.vipGroupCategoryId, //时长编号
             singleClassMinutes: vipGroupApplyBaseInfo.singleClassMinutes, // 时长
-            onlineClassesUnitPrice: vipGroupApplyBaseInfo.onlineClassesUnitPrice, // 售价
-            offlineClassesUnitPrice: vipGroupApplyBaseInfo.offlineClassesUnitPrice, // 原价
+            onlineClassesUnitPrice:
+              vipGroupApplyBaseInfo.onlineClassesUnitPrice, // 售价
+            offlineClassesUnitPrice:
+              vipGroupApplyBaseInfo.offlineClassesUnitPrice, // 原价
             os: liveBroadcastRoom.os, // 直播设备
             useScene: liveBroadcastRoom.useScene, // 直播场景
             popularizeType: liveBroadcastRoom.popularizeType, // 观看权限信息
@@ -1138,10 +1168,10 @@ export default {
               whether_chat: 0,
               whether_video: 0,
               whether_mic: 0,
-              whether_view_shop_cart: 0,
+              whether_view_shop_cart: 0
             },
             timeTable: tempCourse, // 排课
-            clientType: "TEACHER", // 主讲人身份 默认[老师]
+            clientType: "TEACHER" // 主讲人身份 默认[老师]
           };
 
           this.status = data.vipGroupApplyBaseInfo.status;
@@ -1152,7 +1182,7 @@ export default {
         //
         console.log(e, "e info");
       }
-    },
+    }
   },
   computed: {
     nowTime() {
@@ -1167,19 +1197,25 @@ export default {
 
     countOnlineClassesUnitPrice() {
       return (
-        Math.ceil(this.form.onlineClassesNum * this.form.onlineClassesUnitPrice) || 0
+        Math.ceil(
+          this.form.onlineClassesNum * this.form.onlineClassesUnitPrice
+        ) || 0
       );
     },
     countOfflineClassesUnitPrice() {
       return (
-        Math.ceil(this.form.onlineClassesNum * this.form.offlineClassesUnitPrice) || 0
+        Math.ceil(
+          this.form.onlineClassesNum * this.form.offlineClassesUnitPrice
+        ) || 0
       );
     },
     isDisabled() {
       console.log(this.status, this.type, "isDisabled");
-      return this.type === "update" && [1, 2].includes(this.status) ? true : false;
-    },
-  },
+      return this.type === "update" && [1, 2].includes(this.status)
+        ? true
+        : false;
+    }
+  }
 };
 </script>
 <style lang="scss" scoped>
@@ -1200,7 +1236,8 @@ export default {
     .dotWrap {
       width: 21px;
       height: 21px;
-      background: url("../../assets/images/icon_checkbox_default.png") no-repeat center;
+      background: url("../../assets/images/icon_checkbox_default.png") no-repeat
+        center;
       background-size: contain;
       display: block;
       position: absolute;
@@ -1209,7 +1246,8 @@ export default {
       overflow: hidden;
 
       &.checked {
-        background: url("../../assets/images/icon_checkbox.png") no-repeat center;
+        background: url("../../assets/images/icon_checkbox.png") no-repeat
+          center;
         background-size: contain;
       }