zengyicheng 2 rokov pred
rodič
commit
71b33d222c

+ 43 - 5
src/components/pages/race/addRace/raceDetail.vue

@@ -128,7 +128,7 @@
                           <span>{{ item.name }}</span>
                           <el-checkbox-group
                             v-model="raceDetail.type"
-                            @change="updateTitle"
+                            @change="updateType"
                           >
                             <el-checkbox
                               v-for="item1 in CourseTypeJson[item.id]"
@@ -399,7 +399,7 @@
               <div class="secondTop">
                 <el-input
                   type="textarea"
-                  style="font-family: '微软雅黑';"
+                  style="font-family: '微软雅黑'"
                   placeholder="200字以内,介绍项目背景,描述生活中的现象,引出要解决的核心问题,概述解决问题的思路及预期成果等。"
                   v-model="raceDetail.courseText"
                   @input="updateTitle"
@@ -819,7 +819,7 @@ export default {
     addImg(e) {
       var el = e.currentTarget;
       el.getElementsByTagName("input")[0].click();
-      e.target.value = ''
+      e.target.value = "";
     },
     imgChange1(file, fileList, type, itemTaskIndex) {
       if (type == 1) {
@@ -899,12 +899,12 @@ export default {
               a.splice(a.length - 1, a.length);
               _this.$message.error("上传失败");
             } else {
-              if(file.name.indexOf("微信图片") != -1){
+              if (file.name.indexOf("微信图片") != -1) {
                 _this.raceDetail.cover.push({
                   name: "图片.png",
                   url: data.Location,
                 });
-              }else{
+              } else {
                 _this.raceDetail.cover.push({
                   name: file.name,
                   url: data.Location,
@@ -1063,6 +1063,44 @@ export default {
     updateTitle() {
       this.$emit("updateTitle", this.raceDetail);
     },
+    updateType(sid) {
+      debugger;
+      var a = this.raceDetail.type;
+      var b;
+
+      this.CourseType[1].forEach(c => {
+        if (c.id == sid) {
+          b = c.pid;
+        }
+      });
+      // for (var i = 0; i < this.CourseType[1].length; i++) {
+      //   if (this.CourseType[1][i].id == sid) {
+      //     b = this.CourseType[1][i].pid;
+      //   }
+      // }
+
+      if(b == "34629bcc-d02f-11ec-8c78-005056b86db5"){
+        this.CourseTypeJson[b].forEach(d => {
+        if (a.indexOf(d.id) != -1) {
+          this.raceDetail.type.splice(
+            a.indexOf(d.id),
+            1
+          );
+          this.raceDetail.type.push(sid);
+        }
+      });
+      }
+      
+      // for (var j = 0; j < this.CourseTypeJson[b].length; j++) {
+      //   if (a.indexOf(this.CourseTypeJson[b][j].id) != -1) {
+      //     this.raceDetail.type.splice(
+      //       a.indexOf(this.CourseTypeJson[b][j].id),
+      //       1
+      //     );
+      //     this.raceDetail.type.push(sid);
+      //   }
+      // }
+    },
     isAddPPTeacher() {
       if (this.isAutor == true) {
         if (this.sName === "") {