From a7453eea26785a3100b35b9c10000dc202671221 Mon Sep 17 00:00:00 2001 From: YM <479443481@qq.com> Date: 星期三, 12 六月 2024 18:42:58 +0800 Subject: [PATCH] 1 --- src/pages/knowledgeBase/knowledgeBase.vue | 89 ++++++++++++++++++++++++++++++++++++-------- 1 files changed, 73 insertions(+), 16 deletions(-) diff --git a/src/pages/knowledgeBase/knowledgeBase.vue b/src/pages/knowledgeBase/knowledgeBase.vue index 638d85e..c5520e8 100644 --- a/src/pages/knowledgeBase/knowledgeBase.vue +++ b/src/pages/knowledgeBase/knowledgeBase.vue @@ -7,7 +7,7 @@ <!-- <luanqing-search class="search_bar" @onSearch="onSearch"></luanqing-search> --> <advancedSearch @onSearch="onSearch" - placehold="杈撳叆濮撳悕/鍒悕/鏈濅唬/浼犱富鑱屼笟鎼滅储" + placehold="杈撳叆濮撳悕/鍒悕/鏃舵湡/浼犱富鑱屼笟鎼滅储" :isAvancedTrue="false" :keyword="keywords" /> @@ -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> @@ -203,7 +207,7 @@ label="鎬у埆" width="70" ></el-table-column> - <el-table-column prop="period" label="鏃朵唬"></el-table-column> + <el-table-column prop="period" label="鏃舵湡"></el-table-column> <el-table-column prop="birthYear" label="鐢熷勾" @@ -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, // 楂樼骇鎼滅储 @@ -331,15 +337,15 @@ }, { type: "input", - label: "鏃堕棿", + label: "鏃舵湡", name: "dynasty", value: "" }, { - type: "input", + type: "select", label: "鏈烘瀯", name: "institution", - value: "" + options: [] } ] }, @@ -359,7 +365,7 @@ activeBox: null, // 鏃舵湡 dynasty: { - title: "鏃朵唬", + title: "鏃舵湡", id: "", index: "", list: [] @@ -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