From d68e00411b11ba411ec855b7023e9223bdd211fe Mon Sep 17 00:00:00 2001 From: YM <479443481@qq.com> Date: 星期五, 19 七月 2024 11:26:08 +0800 Subject: [PATCH] 1 --- src/pages/knowledgeBase/knowledgeBase.vue | 117 +++++++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 87 insertions(+), 30 deletions(-) diff --git a/src/pages/knowledgeBase/knowledgeBase.vue b/src/pages/knowledgeBase/knowledgeBase.vue index 638d85e..2c40043 100644 --- a/src/pages/knowledgeBase/knowledgeBase.vue +++ b/src/pages/knowledgeBase/knowledgeBase.vue @@ -1,13 +1,13 @@ <template> <view> <!-- 椤堕儴 --> - <headNav idIndex="0" text="涓浗鍖诲浜虹墿鐭ヨ瘑搴�" /> + <headNav idIndex="0" text="涓浗鍘嗕唬鍖诲浜虹墿鐭ヨ瘑搴�" /> <!-- 鎼滅储 --> <view class="flex flex-center Search"> <!-- <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, // 楂樼骇鎼滅储 @@ -303,12 +309,12 @@ } ] }, - { - type: "input", - label: "鑱屽畼", - name: "official", - value: "" - }, + // { + // type: "input", + // label: "鑱屽畼", + // name: "official", + // value: "" + // }, { type: "select", label: "鎬у埆", @@ -331,16 +337,16 @@ }, { type: "input", - label: "鏃堕棿", + label: "鏃舵湡", name: "dynasty", value: "" }, - { - type: "input", - label: "鏈烘瀯", - name: "institution", - value: "" - } + // { + // type: "select", + // label: "鏈烘瀯", + // name: "institution", + // 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: "", //濮撳悕 @@ -691,21 +744,21 @@ CurrentChange(val) { if (this.CurrentPage != val) { this.CurrentPage = val; - this.onSearch(""); + this.onSearch({ text: this.keywords }); } }, // 涓婁竴椤� PrevClick(val) { if (this.CurrentPage != val) { this.CurrentPage = val; - this.onSearch(""); + this.onSearch({ text: this.keywords }); } }, // 涓嬩竴椤� NextClick(val) { if (this.CurrentPage != val) { this.CurrentPage = val; - this.onSearch(""); + this.onSearch({ text: this.keywords }); } } } @@ -1209,6 +1262,10 @@ li { font-size: 0.12rem; margin: 0 0.1rem; + &.active { + color: #027edc !important; + font-weight: bold; + } } } -- Gitblit v1.9.1