lex-xin 4 年之前
父節點
當前提交
da6381c58f

File diff suppressed because it is too large
+ 0 - 0
dist/static/js/app.d787c0ec.js


+ 8 - 0
src/api/contentManager.js

@@ -43,3 +43,11 @@ export function newsDel(data) {
     })
 }
 
+// 查询子分类
+export function newsTypeList(data) {
+    return request({
+        url: api + '/news/typeList',
+        method: 'get',
+        params: data
+    })
+}

+ 36 - 5
src/views/contentManager/components/information.vue

@@ -19,6 +19,13 @@
                      value="2"></el-option>
         </el-select>
       </el-form-item>
+      <el-form-item prop="subType">
+        <el-select v-model="searchForm.subType"
+                   clearable
+                   placeholder="请选择资讯类别">
+          <el-option v-for="item in typeList" :key="item.id" :label="item.name" :value="item.id"></el-option>
+        </el-select>
+      </el-form-item>
       <el-form-item>
         <el-button native-type="submit" type="danger">搜索</el-button>
       </el-form-item>
@@ -47,6 +54,13 @@
           </template>
         </el-table-column>
         <el-table-column align='center'
+                         prop="subType"
+                         label="资讯类别">
+          <template slot-scope="scope">
+            {{ formatSubType(scope.row.subType) }}
+          </template>
+        </el-table-column>
+        <el-table-column align='center'
                          prop="remark"
                          label="是否使用">
           <template slot-scope="scope">
@@ -92,7 +106,7 @@
   </div>
 </template>
 <script>
-import { newsList, newsUpdate, newsDel } from '@/api/contentManager'
+import { newsList, newsUpdate, newsDel, newsTypeList } from '@/api/contentManager'
 import pagination from '@/components/Pagination/index'
 export default {
   name: 'information',
@@ -102,7 +116,8 @@ export default {
   data () {
     return {
       searchForm: {
-        tenantId: '1'
+        tenantId: '1',
+        subType: null,
       },
       tableList: [],
       organId: null,
@@ -113,10 +128,16 @@ export default {
         page: 1, // 当前页
         total: 1, // 总条数
         page_size: [10, 20, 40, 50] // 选择限制显示条数
-      }
+      },
+      typeList: [], // 子分类
     }
   },
-  mounted () {
+  async mounted () {
+    await newsTypeList({ parentId: 2 }).then(res => {
+      if(res.code == 200) {
+        this.typeList = res.data
+      }
+    })
     this.getList()
   },
   methods: {
@@ -128,6 +149,7 @@ export default {
       let params = {
         clientName: 'manage',
         tenantId: this.searchForm.tenantId,
+        subType: this.searchForm.subType,
         rows: this.pageInfo.limit,
         page: this.pageInfo.page,
         type: 2
@@ -182,7 +204,16 @@ export default {
           this.$message.error(res.msg)
         }
       })
-    }
+    },
+    formatSubType(val) {
+      let tempName = null
+      this.typeList.forEach(item => {
+        if(item.id == val) {
+          tempName = item.name
+        }
+      })
+      return tempName
+    },
   }
 }
 </script>

+ 34 - 16
src/views/contentManager/components/knowledge.vue

@@ -23,14 +23,15 @@
         <el-select v-model="searchForm.subType"
                    clearable
                    placeholder="请选择知识类别">
-          <el-option label="演奏小技巧"
+          <el-option v-for="item in typeList" :key="item.id" :label="item.name" :value="item.id"></el-option>
+          <!-- <el-option label="演奏小技巧"
                      :value="1"></el-option>
           <el-option label="乐理基础"
                      :value="2"></el-option>
           <el-option label="乐器保养"
                      :value="3"></el-option>
           <el-option label="乐曲演奏展示"
-                     :value="4"></el-option>
+                     :value="4"></el-option> -->
         </el-select>
       </el-form-item>
       <el-form-item prop="subjectId">
@@ -83,7 +84,7 @@
                          prop="subType"
                          label="知识类别">
           <template slot-scope="scope">
-            {{ scope.row.subType | formatSubType }}
+            {{ formatSubType(scope.row.subType) }}
           </template>
         </el-table-column>
         <el-table-column align='center'
@@ -138,7 +139,7 @@
   </div>
 </template>
 <script>
-import { newsList, newsUpdate, newsDel } from '@/api/contentManager'
+import { newsList, newsUpdate, newsDel, newsTypeList } from '@/api/contentManager'
 import pagination from '@/components/Pagination/index'
 import store from '@/store'
 import cleanDeep from 'clean-deep'
@@ -164,11 +165,17 @@ export default {
         page: 1, // 当前页
         total: 1, // 总条数
         page_size: [10, 20, 40, 50] // 选择限制显示条数
-      }
+      },
+      typeList: [], // 子分类
     }
   },
-  mounted () {
+  async mounted () {
     this.$store.dispatch('setSubjects')
+    await newsTypeList({ parentId: 7 }).then(res => {
+      if(res.code == 200) {
+        this.typeList = res.data
+      }
+    })
     this.getList()
   },
   methods: {
@@ -240,18 +247,29 @@ export default {
           this.$message.error(res.msg)
         }
       })
-    }
+    },
+
+    formatSubType(val) {
+      let tempName = null
+      this.typeList.forEach(item => {
+        if(item.id == val) {
+          tempName = item.name
+        }
+      })
+      return tempName
+    },
   },
   filters: {
-    formatSubType (val) {
-      const template = {
-        1: '演奏小技巧',
-        2: '乐理基础',
-        3: '乐器保养',
-        4: '乐曲演奏展示'
-      }
-      return template[val]
-    }
+    // formatSubType (val) {
+    //   let template = {
+    //     1: '演奏小技巧',
+    //     2: '乐理基础',
+    //     3: '乐器保养',
+    //     4: '乐曲演奏展示'
+    //   }
+
+    //   return template[val]
+    // }
   }
 }
 </script>

+ 17 - 7
src/views/contentManager/contentOperation.vue

@@ -125,19 +125,20 @@
         </el-form-item>
 
         <!-- 知识库管理才会有类型 -->
-        <el-form-item v-if="type == 7"
-                      label="知识类别"
+        <el-form-item v-if="type == 7 || type == 2"
+                      :label="type == 7 ? '知识类别' : '资讯类别'"
                       prop="subType"
-                      :rules="[{ required: true, message: '请选择知识类别', trigger: 'change' }]">
+                      :rules="[{ required: true, message: (type == 7 ? '请选择知识类别' : '请选择资讯类别'), trigger: 'change' }]">
           <el-select v-model="form.subType" style="width: 400px !important">
-            <el-option label="演奏小技巧"
+            <el-option v-for="item in typeList" :key="item.id" :label="item.name" :value="item.id"></el-option>
+            <!-- <el-option label="演奏小技巧"
                        :value="1"></el-option>
             <el-option label="乐理基础"
                        :value="2"></el-option>
             <el-option label="乐器保养"
                        :value="3"></el-option>
             <el-option label="乐曲演奏展示"
-                       :value="4"></el-option>
+                       :value="4"></el-option> -->
           </el-select>
         </el-form-item>
         <!-- 闪页管理 BANNER管理 APP按钮管理 广告管理 -->
@@ -269,7 +270,7 @@
   </div>
 </template>
 <script>
-import { newsQueryId, newsAdd, newsUpdate } from "@/api/contentManager";
+import { newsQueryId, newsAdd, newsUpdate, newsTypeList } from "@/api/contentManager";
 import store from "@/store";
 import { getToken } from "@/utils/auth";
 import { vaildStudentUrl } from "@/utils/validate";
@@ -444,6 +445,7 @@ export default {
         tenantId: [{ required: true, message: "请选择适用范围", trigger: "change" }],
       },
       imageSize: null,
+      typeList: [], //子分类列表
     };
   },
   created () { },
@@ -719,7 +721,15 @@ export default {
       }, 500);
       this.lookVisible = true
     },
-    getList () {
+    async getList () {
+      if(this.type == 7 || this.type == 2) {
+        await newsTypeList({ parentId: this.type }).then(res => {
+          console.log(res)
+          if(res.code ==200) {
+            this.typeList = res.data
+          }
+        })
+      }
       if (this.pageType == "create") {
         return;
       } else {

Some files were not shown because too many files changed in this diff