Explorar el Código

文章查询增加分类条件;替换logo。

dygapp hace 2 años
padre
commit
7fd3f89a19
Se han modificado 5 ficheros con 42 adiciones y 10 borrados
  1. BIN
      public/errorImg.jpg
  2. BIN
      public/favicon.ico
  3. BIN
      src/assets/logo/logo.png
  4. 41 9
      src/views/cms/blog/index.vue
  5. 1 1
      vue.config.js

BIN
public/errorImg.jpg


BIN
public/favicon.ico


BIN
src/assets/logo/logo.png


+ 41 - 9
src/views/cms/blog/index.vue

@@ -1,6 +1,16 @@
 <template>
   <div class="app-container">
     <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="分类" prop="types">
+        <el-cascader
+          :options="treeOptions"
+          placeholder="请选择分类" 
+          v-model="queryParams.catalog"
+          :props="{ label: 'typeName', value: 'typeId', emitPath: false }"
+          clearable
+          size="small">
+        </el-cascader>
+      </el-form-item>
       <el-form-item label="标题" prop="title">
         <el-input v-model="queryParams.title" placeholder="请输入标题" clearable size="small"
           @keyup.enter.native="handleQuery" />
@@ -124,10 +134,18 @@
         <el-row>
           <el-col :span="7">
             <el-form-item label="分类">
-              <el-select v-model="form.typeIds" multiple placeholder="请选择" filterable clearable>
+              <!-- <el-select v-model="form.typeIds" multiple placeholder="请选择" filterable clearable>
                 <el-option v-for="item in typeOptions" :key="item.typeId" :label="item.typeName" :value="item.typeId">
                 </el-option>
-              </el-select>
+              </el-select> -->
+              <el-cascader
+                :options="treeOptions"
+                placeholder="请选择分类" 
+                v-model="form.typeIds"
+                :props="{ label: 'typeName', value: 'typeId', emitPath: false, multiple: true }"
+                clearable
+                size="small">
+              </el-cascader>
             </el-form-item>
           </el-col>
           <el-col :span="17">
@@ -263,6 +281,12 @@
     created() {
       this.getList();
     },
+    mounted() {
+      getBlog().then(res => {
+        this.typeOptions = res.types;
+        this.tagOptions = res.tags;
+      })
+    },
     methods: {
       /** 查询文章管理列表 */
       getList() {
@@ -339,13 +363,9 @@
       },
       /** 新增按钮操作 */
       handleAdd() {
-        getBlog().then(response => {
-          this.typeOptions = response.types;
-          this.tagOptions = response.tags;
-          this.reset();
-          this.open = true;
-          this.title = "添加文章";
-        });
+        this.reset();
+        this.open = true;
+        this.title = "添加文章";
       },
       /** 修改按钮操作 */
       handleUpdate(row) {
@@ -520,6 +540,18 @@
         }
         return '';
       },
+    },
+    computed: {
+      treeOptions() {
+        console.log('typeOptions:', this.typeOptions);
+        this.typeOptions?.forEach((p, _, a) => { 
+          p.children = a?.filter(c => c.parentId == p.typeId);
+          if (p.children?.length == 0) p.children = null;
+        })
+        const ret = this.typeOptions?.filter(p => p.parentId == 0);
+        console.log(ret);
+        return ret;
+      }
     }
   };
 </script>

+ 1 - 1
vue.config.js

@@ -37,7 +37,7 @@ module.exports = {
     proxy: {
       // detail: https://cli.vuejs.org/config/#devserver-proxy
       [process.env.VUE_APP_BASE_API]: {
-        target: `http://192.168.0.71:8080`,
+        target: `http://192.168.0.70:8080/`,
         changeOrigin: true,
         pathRewrite: {
           ['^' + process.env.VUE_APP_BASE_API]: ''