Sfoglia il codice sorgente

主题色跟随课件类型变化

natasha 1 settimana fa
parent
commit
08a0b9d3bf
1 ha cambiato i file con 46 aggiunte e 16 eliminazioni
  1. 46 16
      src/views/courseList.vue

+ 46 - 16
src/views/courseList.vue

@@ -337,16 +337,6 @@
             >所有用户可见</el-radio
           >
         </el-form-item> -->
-        <el-form-item label="主题颜色" label-width="90px" prop="theme_color">
-          <el-radio
-            v-for="(item, index) in themeColorList"
-            :key="'themeColor' + index"
-            v-model="formDialog.theme_color"
-            :label="item.value"
-          >
-            {{ item.name }}
-          </el-radio>
-        </el-form-item>
         <el-form-item
           label="课件模板"
           label-width="90px"
@@ -358,6 +348,17 @@
             v-model="formDialog.courseware_category"
             :label="item.value"
             :disabled="titleEdit === '编辑教材'"
+            @change="handleChangeTheme"
+          >
+            {{ item.name }}
+          </el-radio>
+        </el-form-item>
+        <el-form-item label="主题颜色" label-width="90px" prop="theme_color">
+          <el-radio
+            v-for="(item, index) in themeColorList"
+            :key="'themeColor' + index"
+            v-model="formDialog.theme_color"
+            :label="item.value"
           >
             {{ item.name }}
           </el-radio>
@@ -423,10 +424,24 @@ export default {
     };
     return {
       themeColorList: [],
+      npcThemeColorList: [
+        {
+          value: "red",
+          name: "红色",
+        },
+        {
+          value: "green",
+          name: "绿色",
+        },
+        {
+          value: "brown",
+          name: "棕色",
+        },
+      ],
       coursewareList: [
         {
           value: "NPC",
-          name: "新标准汉语",
+          name: "通用",
         },
         {
           value: "RLC",
@@ -472,7 +487,7 @@ export default {
         type_id: "",
         courseware_category: "NPC",
         create_time: "",
-        courseware_category_name: "新标准汉语",
+        courseware_category_name: "通用",
       },
       agencyList: [
         {
@@ -547,7 +562,8 @@ export default {
     };
   },
   mounted() {
-    this.themeColorList = commonjs.themeColorList;
+    // this.themeColorList = commonjs.themeColorList;
+    this.themeColorList = this.npcThemeColorList;
     this.getList();
     this.getTypeList();
     this.getMyOrgList();
@@ -720,8 +736,9 @@ export default {
         type_name_list: [],
         courseware_category: "NPC",
         create_time: "",
-        courseware_category_name: "新标准汉语",
+        courseware_category_name: "通用",
       };
+      this.themeColorList = this.npcThemeColorList;
       this.agency = "";
       this.fileList = [];
       this.dialogFlag = true;
@@ -857,7 +874,6 @@ export default {
       let data = {
         audited_status: -1,
       };
-      console.log("MethodName");
       getContentFile(MethodName, data).then((res) => {
         if (res && res.org_list.length > 0) {
           this.myOrgList = this.myOrgList.concat(res.org_list);
@@ -871,7 +887,6 @@ export default {
       let data = {
         audited_status: 1,
       };
-      console.log("MethodName");
       getContentFile(MethodName, data).then((res) => {
         if (res && res.org_list.length > 0) {
           this.diaMyOrgList = res.org_list;
@@ -953,6 +968,7 @@ export default {
       this.fileListDoc = [];
       this.formDialog.description = "";
       this.formDialog.type_name_list = [];
+      this.themeColorList = this.npcThemeColorList;
     },
     // 编辑书籍信息
     handleEdit(row, index) {
@@ -970,6 +986,11 @@ export default {
       };
       getContent(MethodName, data)
         .then((res) => {
+          if (res.courseware_category === "NPC") {
+            this.themeColorList = this.npcThemeColorList;
+          } else {
+            this.themeColorList = commonjs.themeColorList;
+          }
           if (res.type_name && res.type_name_list.length === 0) {
             res.type_name_list = [res.type_name];
           }
@@ -1075,6 +1096,7 @@ export default {
       this.fileListDoc = [];
       this.formDialog.description = "";
       this.formDialog.type_name_list = [];
+      this.themeColorList = this.npcThemeColorList;
       done();
     },
     handleSort(value) {
@@ -1086,6 +1108,14 @@ export default {
       localStorage.setItem("dataSort", JSON.stringify(dataSort));
       this.getList();
     },
+    // 切换课件类型
+    handleChangeTheme(val) {
+      if (val === "NPC") {
+        this.themeColorList = this.npcThemeColorList;
+      } else {
+        this.themeColorList = commonjs.themeColorList;
+      }
+    },
   },
 };
 </script>