From a971d0c13ab9cd5107152f6eba5e1e724a37fa0b Mon Sep 17 00:00:00 2001
From: 杨磊 <505174330@qq.com>
Date: 星期五, 07 六月 2024 17:20:31 +0800
Subject: [PATCH] Merge branch 'master' of http://182.92.203.7:2001/r/TCM_CharacterLibrary

---
 src/pages/knowledgeBase/knowledgeBase.vue |   81 ++++++++++++++++++++++++++++++++++------
 1 files changed, 69 insertions(+), 12 deletions(-)

diff --git a/src/pages/knowledgeBase/knowledgeBase.vue b/src/pages/knowledgeBase/knowledgeBase.vue
index 638d85e..0562beb 100644
--- a/src/pages/knowledgeBase/knowledgeBase.vue
+++ b/src/pages/knowledgeBase/knowledgeBase.vue
@@ -26,11 +26,11 @@
       鐑棬鎼滅储锛�
       <ul class="flex" style="margin-right: 10rpx">
         <li
-          v-for="item in hot"
-          @click="hotSearchClick(item)"
+          v-for="(item, index) in hot"
+          @click="hotSearchClick(item, index)"
           :key="item.id"
-          class="cursor"
-          style="color: #5879a4"
+          :class="{ cursor: true, active: hotAciveIndex === index }"
+          style="color: #244a7b"
         >
           {{ item.name }}
         </li>
@@ -194,7 +194,11 @@
           <el-table-column prop="id" label="搴忓彿" width="110"></el-table-column>
           <el-table-column prop="personName" label="濮撳悕">
             <template slot-scope="scope">
-              <a style="cursor: pointer;color: #027EDC;" @click="gotoDetail(scope.row.id)">{{ scope.row.personName }}</a>
+              <a
+                style="cursor: pointer; color: #027edc"
+                @click="gotoDetail(scope.row.id)"
+                >{{ scope.row.personName }}</a
+              >
             </template>
           </el-table-column>
           <el-table-column prop="personAlias" label="鍒悕"></el-table-column>
@@ -255,7 +259,8 @@
   getPDownload,
   getPList,
   getHotSearch,
-  getPersonList
+  getPersonList,
+  getInstitutionList
 } from "@/api/index.js";
 export default {
   components: {
@@ -264,6 +269,7 @@
   },
   data() {
     return {
+      hotAciveIndex: "",
       // 楂樼骇鎼滅储鏄剧ず
       isAdvancedSearch: false,
       // 楂樼骇鎼滅储
@@ -336,10 +342,10 @@
             value: ""
           },
           {
-            type: "input",
+            type: "select",
             label: "鏈烘瀯",
             name: "institution",
-            value: ""
+            options: []
           }
         ]
       },
@@ -395,12 +401,53 @@
     };
   },
   onLoad(options) {
-    this.onSearch({ text: options.keyword });
+    if (options.isAdvancedSearch && options.isAdvancedSearch == "1") {
+      this.isAdvancedSearch = true;
+    }
+    if (options.official) {
+      if (options.official) {
+        this.from.from[
+          this.from.from.findIndex((item) => item.name == "official")
+        ].value = options.official;
+      }
+
+      const result = this.from.from.reduce((obj, item) => {
+        obj[item.name] = item.value;
+        return obj;
+      }, {});
+      // 鎻愪氦閫昏緫
+      this.onSubmit(result);
+    } else {
+      if (options.dynasty) {
+        this.dynasty.index = Number(options.dynasty);
+        this.dynasty.id = Number(options.dynasty);
+      }
+      this.onSearch({ text: options.keyword });
+    }
   },
   mounted() {
     this.getStatistics();
+    this.institutionList();
   },
   methods: {
+    institutionList() {
+      getInstitutionList().then((res) => {
+        this.$set(
+          this.from.from[
+            this.from.from.findIndex((item) => item.name == "institution")
+          ],
+          "options",
+          res.list.map((item) => {
+            return {
+              label: item.name,
+              value: item.id
+            };
+          })
+        );
+
+        console.log(this.from.from);
+      });
+    },
     //閲嶇疆鎼滅储缁撴灉
     resetForm() {
       this.onSearch("");
@@ -559,8 +606,8 @@
       });
     },
     // 鐑棬鎼滅储
-    hotSearchClick(item) {
-      this.onSearch({ text: item.name });
+    hotSearchClick(item, index) {
+      this.onSearch({ text: item.name }, index);
     },
     // 宸︿晶鐨勬満鏋勭粺璁$瓑绛夋寜閽�
     handInstitCLick(item, name) {
@@ -632,8 +679,14 @@
       });
     },
     // 鍩虹鎼滅储
-    async onSearch(val) {
+    async onSearch(val, index) {
       this.keywords = val.text;
+      if (index !== undefined) {
+        this.keywords = "";
+        this.hotAciveIndex = index;
+      } else {
+        this.hotAciveIndex = "";
+      }
       let Obj = {
         keywords: val.text, //鎼滅储妗嗘绱�
         name: "", //濮撳悕
@@ -1209,6 +1262,10 @@
   li {
     font-size: 0.12rem;
     margin: 0 0.1rem;
+    &.active {
+      color: #027edc !important;
+      font-weight: bold;
+    }
   }
 }
 

--
Gitblit v1.9.1