mo 3 rokov pred
rodič
commit
ae18cb1cf0
1 zmenil súbory, kde vykonal 34 pridanie a 27 odobranie
  1. 34 27
      src/views/liveClassManager/newLiveClass.vue

+ 34 - 27
src/views/liveClassManager/newLiveClass.vue

@@ -219,9 +219,8 @@
               filterable
               clearable
               multiple
-
             >
-            <!--   @change="changeSchool" -->
+              <!--   @change="changeSchool" -->
               <el-option
                 v-for="(item, index) in cooperationList"
                 :key="index"
@@ -393,7 +392,12 @@ export default {
     if (this.$route.query.id) {
       this.name = "修改直播间";
       // console.log()
-      this.form = { ...this.$route.query, organIds: [], schoolIds: [],teamIds:[] };
+      this.form = {
+        ...this.$route.query,
+        organIds: [],
+        schoolIds: [],
+        teamIds: [],
+      };
       this.form.roomConfig = JSON.parse(this.$route.query.roomConfig);
 
       if (this.$route.query.popularizeOrgIds) {
@@ -403,7 +407,7 @@ export default {
             return item * 1;
           });
       }
-               this.changeSection(this.form.organIds);
+      this.changeSection(this.form.organIds);
       if (this.$route.query.popularizeSchoolIds) {
         this.form.schoolIds = this.$route.query.popularizeSchoolIds
           .split(",")
@@ -522,27 +526,30 @@ export default {
       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 {
-          const res = await resetLiveBroadcastRoomList(this.form);
-          this.$message.success("修改成功");
-          this.$store.dispatch("delVisitedViews", this.$route);
-          this.$router.push("/liveClassManager");
-        } catch (e) {
-          console.log(e);
-        }
-      } else {
-        try {
-          const res = await createLiveBroadcast(this.form);
-          this.$message.success("创建成功");
-          this.$store.dispatch("delVisitedViews", this.$route);
-          this.$router.push("/liveClassManager");
-        } catch (e) {
-          console.log(e);
+      this.$refs.form.validate(async(flag) => {
+        if (!flag) return;
+        if (this.$route.query.id) {
+          // 修改
+          try {
+            const res = await resetLiveBroadcastRoomList(this.form);
+            this.$message.success("修改成功");
+            this.$store.dispatch("delVisitedViews", this.$route);
+            this.$router.push("/liveClassManager");
+          } catch (e) {
+            console.log(e);
+          }
+        } else {
+          try {
+            const res = await createLiveBroadcast(this.form);
+            this.$message.success("创建成功");
+            this.$store.dispatch("delVisitedViews", this.$route);
+            this.$router.push("/liveClassManager");
+          } catch (e) {
+            console.log(e);
+          }
         }
-      }
+      });
+
       // createLiveBroadcast
     },
     changeType() {
@@ -552,8 +559,8 @@ export default {
     },
     async changeSection(val) {
       // if (!this.isinit) {
-        this.form.schoolIds = [];
-        this.form.teamIds = [];
+      this.form.schoolIds = [];
+      this.form.teamIds = [];
       // }
       if (this.form.popularizeType == "SCHOOL" && val && val.length > 0) {
         let organId = val.join(",");
@@ -567,7 +574,7 @@ export default {
           console.log(e);
         }
       }
-      if (this.form.popularizeType == "TEAM" && (val && val.length > 0)) {
+      if (this.form.popularizeType == "TEAM" && val && val.length > 0) {
         let organId = val.join(",");
         try {
           await getTeamList({ organId, page: 1, rows: 9999 }).then((res) => {