Jelajahi Sumber

还原新建

1
mo 3 tahun lalu
induk
melakukan
b4e3df38fd
2 mengubah file dengan 225 tambahan dan 333 penghapusan
  1. 3 1
      src/views/liveClassManager/index.vue
  2. 222 332
      src/views/liveClassManager/newLiveClass.vue

+ 3 - 1
src/views/liveClassManager/index.vue

@@ -317,6 +317,7 @@ export default {
         path: "/business/liveClassDetail",
         query: { roomUid: row.roomUid },
       });
+      //
     },
     shareLive(row) {
       this.activeRow = row;
@@ -325,8 +326,9 @@ export default {
     resetLive(row) {
       let params = {
         path: "/business/createLiveClass",
-        query: { id:row.id,roomUid:row.roomUid},
+      query: { ...row},
       };
+      //   query: { id:row.id,roomUid:row.roomUid},
       this.$router.push(params, (route) => {
         route.meta.title = "修改直播课";
       });

+ 222 - 332
src/views/liveClassManager/newLiveClass.vue

@@ -3,7 +3,7 @@
     <h2>
       <el-page-header @back="onCancel" :content="name"></el-page-header>
     </h2>
-    <div class="m-core first" v-show="activeType == 1">
+    <div class="m-core">
       <el-form
         :model="form"
         ref="form"
@@ -176,12 +176,83 @@
               <el-radio label="ORGAN">分部</el-radio>
               <el-radio label="SCHOOL">合作单位</el-radio>
               <el-radio label="TEAM">乐团</el-radio>
-              <el-radio label="GROUP">群聊</el-radio>
-              <el-radio label="STUDENT">学生</el-radio>
             </el-radio-group>
           </el-form-item>
         </el-row>
-
+        <el-row class="row">
+          <el-form-item
+            v-if="
+              form.popularizeType == 'SCHOOL' ||
+              form.popularizeType == 'ORGAN' ||
+              form.popularizeType == 'TEAM'
+            "
+            label="分部"
+            prop="organIds"
+            :rules="[{ required: true, message: '请选择分部' }]"
+          >
+            <select-all
+              v-model.trim="form.organIds"
+              filterable
+              clearable
+              placeholder="请选择分部"
+              @change="changeSection"
+            >
+              <el-option
+                v-for="(item, index) in selects.branchs"
+                :key="index"
+                :label="item.name"
+                :value="item.id"
+              ></el-option>
+            </select-all>
+          </el-form-item>
+        </el-row>
+        <el-row class="row">
+          <el-form-item
+            v-if="form.popularizeType == 'SCHOOL'"
+            label="合作单位"
+            prop="schoolIds"
+            :rules="[{ required: true, message: '请选择合作单位' }]"
+          >
+            <select-all
+              v-model.trim="form.schoolIds"
+              :disabled="form.organIds.length <= 0"
+              filterable
+              clearable
+              multiple
+              @change="changeSchool"
+            >
+              <el-option
+                v-for="(item, index) in cooperationList"
+                :key="index"
+                :label="item.name"
+                :value="item.id"
+              ></el-option>
+            </select-all>
+          </el-form-item>
+        </el-row>
+        <el-row class="row">
+          <el-form-item
+            v-if="form.popularizeType == 'TEAM'"
+            label="乐团"
+            prop="teamIds"
+            :rules="[{ required: true, message: '请选择乐团' }]"
+          >
+            <select-all
+              v-model.trim="form.teamIds"
+              :disabled="form.organIds.length <= 0"
+              filterable
+              clearable
+              multiple
+            >
+              <el-option
+                v-for="(item, index) in teamList"
+                :key="index"
+                :label="item.name"
+                :value="item.id"
+              ></el-option>
+            </select-all>
+          </el-form-item>
+        </el-row>
         <el-alert
           title="直播间信息"
           type="info"
@@ -264,120 +335,7 @@
         <el-button type="primary" @click="submit">提交</el-button>
       </el-row>
     </div>
-    <div class="m-core" v-show="activeType == 2">
-      <el-alert
-        title="观看权限详情"
-        type="info"
-        :closable="false"
-        style="margin-bottom: 20px"
-      ></el-alert>
-      <el-form
-        :model="form"
-        ref="form"
-        label-width="300px"
-        :inline="true"
-        label-position="left"
-      >
-        <el-row class="row">
-          <el-form-item
-            v-if="
-              form.popularizeType == 'SCHOOL' ||
-              form.popularizeType == 'ORGAN' ||
-              form.popularizeType == 'TEAM'
-            "
-            label="分部"
-            prop="organIds"
-            :rules="[{ required: true, message: '请选择分部' }]"
-          >
-            <select-all
-              v-model.trim="form.organIds"
-              filterable
-              clearable
-              :isCollapseTags="false"
-              placeholder="请选择分部"
-              @change="changeSection"
-              @clearable="clearSection"
-              @removeTag="removetagSection"
-            >
-              <el-option
-                v-for="(item, index) in selects.branchs"
-                :key="index"
-                :label="item.name"
-                :value="item.id"
-              ></el-option>
-            </select-all>
-          </el-form-item>
-        </el-row>
-        <el-row class="row">
-          <el-form-item
-            v-if="form.popularizeType == 'SCHOOL'"
-            label="合作单位"
-            prop="schoolIds"
-            :rules="[{ required: true, message: '请选择合作单位' }]"
-          >
-            <select-all
-              v-model.trim="form.schoolIds"
-              :disabled="form.organIds.length <= 0"
-              :isCollapseTags="false"
-              filterable
-              clearable
-              multiple
-            >
-              <el-option
-                v-for="(item, index) in cooperationList"
-                :key="index"
-                :label="item.name"
-                :value="item.id"
-              ></el-option>
-            </select-all>
-          </el-form-item>
-        </el-row>
-        <el-row class="row">
-          <el-form-item
-            v-if="form.popularizeType == 'TEAM'"
-            label="乐团"
-            prop="teamIds"
-            :rules="[{ required: true, message: '请选择乐团' }]"
-          >
-            <select-all
-              v-model.trim="form.teamIds"
-              :disabled="form.organIds.length <= 0"
-              :isCollapseTags="false"
-              filterable
-              clearable
-              multiple
-            >
-              <el-option
-                v-for="(item, index) in teamList"
-                :key="index"
-                :label="item.name"
-                :value="item.id"
-              ></el-option>
-            </select-all>
-          </el-form-item>
-        </el-row>
 
-        <el-row class="row" v-if="form.popularizeType == 'GROUP'">
-          <catGroup />
-        </el-row>
-        <el-row class="row" v-if="form.popularizeType == 'STUDENT'">
-          <addStudentList />
-        </el-row>
-
-      </el-form>
-      <el-row class="row">
-        <el-button
-          type="primary"
-          @click="
-            () => {
-              activeType--;
-            }
-          "
-          >上一页</el-button
-        >
-        <el-button type="primary" @click="submit">提交</el-button>
-      </el-row>
-    </div>
     <el-dialog
       title="预览"
       width="415px"
@@ -393,17 +351,11 @@
 import preview from "./modals/preview.vue";
 import axios from "axios";
 import { getToken, getTenantId } from "@/utils/auth";
-import {
-  createLiveBroadcast,
-  resetLiveBroadcastRoomList,
-  getRoomInfo,
-} from "./api";
+import { createLiveBroadcast, resetLiveBroadcastRoomList } from "./api";
 import { queryByOrganId } from "@/api/systemManage";
 import { getTeamList } from "@/api/teamServer";
-import addStudentList from "./modals/addStudentList";
-import catGroup from "./modals/catGroup";
 export default {
-  components: { preview, addStudentList, catGroup },
+  components: { preview },
   data() {
     return {
       name: "新建直播课",
@@ -412,8 +364,6 @@ export default {
         organIds: [],
         schoolIds: [],
         teamIds: [],
-        catIds: [],
-        studentIds: [],
         roomTitle: "",
         speakerId: "",
         liveStartTime: "",
@@ -435,61 +385,46 @@ export default {
       cooperationList: [],
       teamList: [],
       isinit: true,
-      activeType: 1,
     };
   },
   mounted() {
     this.$store.dispatch("setBranchs");
     if (this.$route.query.id) {
-      this.getDetail();
-    }
-  },
-  methods: {
-    async getDetail() {
-      try {
-        const res = await getRoomInfo({ roomUid: this.$route.query.roomUid });
-        this.name = "修改直播间";
-        // console.log()
-        this.form = {
-          ...res.data,
-          organIds: [],
-          schoolIds: [],
-          teamIds: [],
-          catIds: [],
-          studentIds: [],
-        };
-        this.form.roomConfig = JSON.parse(res.data.roomConfig);
-        if (res.data.popularizeOrgIds) {
-          this.form.organIds = res.data.popularizeOrgIds
-            .split(",")
-            .map((item) => {
-              return item * 1;
-            });
-        }
+      this.name = "修改直播间";
+      // console.log()
+      this.form = { ...this.$route.query, organIds: [], schoolIds: [],teamIds:[] };
+      this.form.roomConfig = JSON.parse(this.$route.query.roomConfig);
+      if (this.$route.query.popularizeOrgIds) {
+        this.form.organIds = this.$route.query.popularizeOrgIds
+          .split(",")
+          .map((item) => {
+            return item * 1;
+          });
+      }
 
-        if (res.data.popularizeSchoolIds) {
-          this.form.schoolIds = res.data.popularizeSchoolIds
-            .split(",")
-            .map((item) => {
-              return item * 1;
-            });
-        }
+      if (this.$route.query.popularizeSchoolIds) {
+        this.form.schoolIds = this.$route.query.popularizeSchoolIds
+          .split(",")
+          .map((item) => {
+            return item * 1;
+          });
+      }
 
-        if (res.data.popularizeTeamIds) {
-          let arr = res.data.popularizeTeamIds.split(",");
-          this.$set(this.form, "teamIds", arr);
-        }
+      if (this.$route.query.popularizeTeamIds) {
+        let arr = this.$route.query.popularizeTeamIds.split(",");
+        this.$set(this.form, "teamIds", arr);
+        console.log(this.form.teamIds);
+      }
 
-        // this.form.popularizeType = "SCHOOL";
-        this.changeSection(this.form.organIds);
-        this.remoteMethod(res.data.speakerName);
+      // this.form.popularizeType = "SCHOOL";
+      this.changeSection(this.form.organIds);
+      this.remoteMethod(this.$route.query.speakerName);
 
-        this.checkList.push(this.form.preTemplate * 1);
-        this.isinit = false;
-      } catch (e) {
-        console.log(e);
-      }
-    },
+      this.checkList.push(this.form.preTemplate * 1);
+      this.isinit = false;
+    }
+  },
+  methods: {
     onCancel() {
       this.$store.dispatch("delVisitedViews", this.$route);
       this.$router.push("/liveClassManager");
@@ -582,22 +517,17 @@ export default {
       this.$set(this.form, "preTemplate", this.checkList[0] || null);
     },
     async submit() {
-      // this.form.popularizeOrgIds = this.form.organIds.join(",");
-      // this.form.popularizeSchoolIds = this.form.schoolIds.join(",");
-      // this.form.popularizeTeamIds = this.form.teamIds.join(",");
+      this.form.popularizeOrgIds = this.form.organIds.join(",");
+      this.form.popularizeSchoolIds = this.form.schoolIds.join(",");
+      this.form.popularizeTeamIds = this.form.teamIds.join(",");
 
       if (this.$route.query.id) {
         // 修改
-
         try {
-          if (this.form.popularizeType == "ALL") {
-            const res = await resetLiveBroadcastRoomList(this.form);
-            this.$message.success("修改成功");
-            this.$store.dispatch("delVisitedViews", this.$route);
-            this.$router.push("/liveClassManager");
-          } else {
-            this.activeType++;
-          }
+          const res = await resetLiveBroadcastRoomList(this.form);
+          this.$message.success("修改成功");
+          this.$store.dispatch("delVisitedViews", this.$route);
+          this.$router.push("/liveClassManager");
         } catch (e) {
           console.log(e);
         }
@@ -605,12 +535,8 @@ export default {
         try {
           const res = await createLiveBroadcast(this.form);
           this.$message.success("创建成功");
-          if (this.form.popularizeType == "ALL") {
-            this.$store.dispatch("delVisitedViews", this.$route);
-            this.$router.push("/liveClassManager");
-          } else {
-            this.activeType++;
-          }
+          this.$store.dispatch("delVisitedViews", this.$route);
+          this.$router.push("/liveClassManager");
         } catch (e) {
           console.log(e);
         }
@@ -622,69 +548,35 @@ export default {
       this.$set(this.form, "schoolIds", []);
       this.$set(this.form, "teamIds", []);
     },
-    clearSection() {
-      this.form.schoolIds = [];
-      this.form.teamIds = [];
-    },
-    removetagSection(val) {
-      console.log("removetagSection");
-      if (this.form.popularizeType == "SCHOOL") {
-        let arr = [];
-        let chioseIdArr = [];
-        this.cooperationList.forEach((item) => {
-          if (item.organId == val) {
-            arr.push(item.id);
-          }
-        });
-        this.form.schoolIds.forEach((item) => {
-          if (arr.indexOf(item) == -1) {
-            chioseIdArr.push(item);
-          }
-        });
-        this.$set(this.form, "schoolIds", chioseIdArr);
-      } else if (this.form.popularizeType == "TEAM") {
-        let arr = [];
-        let chioseIdArr = [];
-        this.teamList.forEach((item) => {
-          if (item.organId == val) {
-            arr.push(item.id);
-          }
-        });
-        this.form.teamIds.forEach((item) => {
-          if (arr.indexOf(item) == -1) {
-            chioseIdArr.push(item);
-          }
-        });
-        this.$set(this.form, "teamIds", chioseIdArr);
-      }
-    },
     async changeSection(val) {
-      this.$nextTick(async () => {
-        if (this.form.popularizeType == "SCHOOL" && val && val.length > 0) {
-          let organId = val.join(",");
-          try {
-            await queryByOrganId({ organId }).then((res) => {
-              if (res.code == 200) {
-                this.cooperationList = res.data;
-              }
-            });
-          } catch (e) {
-            console.log(e);
-          }
+      if (!this.isinit) {
+        this.form.schoolIds = [];
+        this.form.teamIds = [];
+      }
+      if (this.form.popularizeType == "SCHOOL" || (val && val.length > 0)) {
+        let organId = val.join(",");
+        try {
+          await queryByOrganId({ organId }).then((res) => {
+            if (res.code == 200) {
+              this.cooperationList = res.data;
+            }
+          });
+        } catch (e) {
+          console.log(e);
         }
-        if (this.form.popularizeType == "TEAM" && val && val.length > 0) {
-          let organId = val.join(",");
-          try {
-            await getTeamList({ organId, page: 1, rows: 9999 }).then((res) => {
-              if (res.code == 200) {
-                this.teamList = res.data.rows;
-              }
-            });
-          } catch (e) {
-            console.log(e);
-          }
+      }
+      if (this.form.popularizeType == "TEAM" || (val && val.length > 0)) {
+        let organId = val.join(",");
+        try {
+          await getTeamList({ organId, page: 1, rows: 9999 }).then((res) => {
+            if (res.code == 200) {
+              this.teamList = res.data.rows;
+            }
+          });
+        } catch (e) {
+          console.log(e);
         }
-      });
+      }
     },
   },
 };
@@ -698,93 +590,91 @@ export default {
     display: inline-block !important;
   }
 }
-.first {
-  /deep/.el-form--inline {
-    .el-form-item__content {
-      display: block;
-    }
-  }
-  /deep/.el-select {
-    width: 300px !important;
-  }
-  /deep/.el-date-editor {
-    width: 300px !important;
-  }
-  /deep/.el-checkbox {
-    margin-left: 15px !important;
+/deep/.el-form--inline {
+  .el-form-item__content {
+    display: block;
   }
-  /deep/.el-input {
+}
+/deep/.el-select {
+  width: 300px !important;
+}
+/deep/.el-date-editor {
+  width: 300px !important;
+}
+/deep/.el-checkbox {
+  margin-left: 15px !important;
+}
+/deep/.el-input {
+  position: relative;
+  font-size: 14px;
+  display: inline-block;
+  width: 300px;
+}
+.row {
+  padding-left: 24px;
+}
+/deep/.el-textarea__inner {
+  width: 600px;
+}
+.chioseWrap {
+  display: flex;
+  flex-direction: row;
+  justify-content: flex-start;
+  .chioseItem {
+    border-radius: 4px;
+    overflow: hidden;
     position: relative;
-    font-size: 14px;
-    display: inline-block;
-    width: 300px;
-  }
-  .row {
-    padding-left: 24px;
-  }
-  /deep/.el-textarea__inner {
-    width: 600px;
-  }
-  .chioseWrap {
-    display: flex;
-    flex-direction: row;
-    justify-content: flex-start;
-    .chioseItem {
-      border-radius: 4px;
-      overflow: hidden;
-      position: relative;
-      margin-right: 10px;
-      width: 188px;
-      height: 188px;
-      cursor: pointer;
-      .remberBox {
-        .wrap {
-          width: 100px;
-          height: 100px;
-          z-index: 100;
-          position: absolute;
-          // background-color: red;
-        }
-        display: flex;
-        flex-direction: row;
-        justify-content: flex-start;
-        margin-bottom: 30px;
-        padding-top: 10px;
-        align-items: center;
-        position: relative;
-        color: #6d7278;
-        font-size: 16px;
+    margin-right: 10px;
+    width: 188px;
+    height: 188px;
+    cursor: pointer;
+    .remberBox {
+      .wrap {
+        width: 100px;
+        height: 100px;
+        z-index: 100;
         position: absolute;
-        top: 1px;
-        right: 1px;
-        .chioseBox {
-          /deep/.el-checkbox__inner {
-            width: 20px;
-            height: 20px;
-            border-radius: 50%;
-            &::after {
-              height: 8px;
-              left: 6px;
-              position: absolute;
-              top: 3px;
-              width: 4px;
-            }
+        // background-color: red;
+      }
+      display: flex;
+      flex-direction: row;
+      justify-content: flex-start;
+      margin-bottom: 30px;
+      padding-top: 10px;
+      align-items: center;
+      position: relative;
+      color: #6d7278;
+      font-size: 16px;
+      position: absolute;
+      top: 1px;
+      right: 1px;
+      .chioseBox {
+        /deep/.el-checkbox__inner {
+          width: 20px;
+          height: 20px;
+          border-radius: 50%;
+          &::after {
+            height: 8px;
+            left: 6px;
+            position: absolute;
+            top: 3px;
+            width: 4px;
           }
         }
-        .dotWrap {
-          width: 21px;
-          height: 21px;
-          background: url("../../assets/images/icon_checkbox_default.png")
-            no-repeat center;
+      }
+      .dotWrap {
+        width: 21px;
+        height: 21px;
+        background: url("../../assets/images/icon_checkbox_default.png")
+          no-repeat center;
+        background-size: contain;
+        margin-right: 8px;
+        position: relative;
+        overflow: hidden;
+        &.checked {
+          background: url("../../assets/images/icon_checkbox.png") no-repeat
+            center;
           background-size: contain;
-          margin-right: 8px;
-          position: relative;
-          overflow: hidden;
-          &.checked {
-            background: url("../../assets/images/icon_checkbox.png") no-repeat
-              center;
-            background-size: contain;
-          }
         }
       }
     }