Browse Source

修改分类显示功能

zengyicheng 2 years ago
parent
commit
4d336cb1e1
1 changed files with 24 additions and 0 deletions
  1. 24 0
      src/components/index.vue

+ 24 - 0
src/components/index.vue

@@ -420,6 +420,30 @@ export default {
               }
             }
           }
+          this.selectTypeByOid();
+        })
+        .catch((err) => {
+          console.error(err);
+        });
+    },
+    selectTypeByOid() {
+      let params = {
+        oid: this.oid,
+      };
+      this.ajax
+        .get(this.$store.state.api + "selectTypeByOid", params)
+        .then((res) => {
+          for (var i = 0; i < res.data[0].length; i++) {
+            for (var j = 0; j < res.data[1].length; j++) {
+              if (res.data[0][i].id == res.data[1][j].pid) {
+                if (!this.CourseTypeJson[res.data[0][i].id]) {
+                  this.CourseTypeJson[res.data[0][i].id] = [];
+                }
+                this.CourseTypeJson[res.data[0][i].id].push(res.data[1][j]);
+              }
+            }
+          }
+          this.$forceUpdate();
         })
         .catch((err) => {
           console.error(err);