From dd511658a80514fef129800129ba24a5ceb9c878 Mon Sep 17 00:00:00 2001 From: 杨磊 <505174330@qq.com> Date: 星期三, 30 四月 2025 11:02:25 +0800 Subject: [PATCH] 首页搜索 --- src/views/achievements/index.vue | 103 ++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 93 insertions(+), 10 deletions(-) diff --git a/src/views/achievements/index.vue b/src/views/achievements/index.vue index 000af01..9a81e8e 100644 --- a/src/views/achievements/index.vue +++ b/src/views/achievements/index.vue @@ -227,7 +227,9 @@ <p>{{ item.name }}</p> <p> <el-button @click="goPage(item.id)">璇︽儏</el-button> - <el-button>AI鏅鸿兘闃呰</el-button> + <el-button @click="openAiReading(item.AIReading, item.name)" + >AI鏅鸿兘闃呰</el-button + > </p> </li> <li class="main-sources"> @@ -286,6 +288,30 @@ > </el-pagination> </div> + <el-dialog + v-model="dialogVisible" + :title="aIName" + width="60vw" + top="3vh" + bottom="2vh" + :visible.sync="dialogVisible" + class="custom-dialog" + > + <div + class="AIReadingBox" + element-loading-spinner="el-icon-loading" + element-loading-background="rgba(0, 0, 0, 0)" + > + <div + class="richTextInitBox" + v-if="AIReading" + v-html="AIReading" + ></div> + <div class="richTextInitError" v-else> + 缃戠粶绻佸繖锛岃绋嶅悗鍐嶈瘯銆� + </div> + </div> + </el-dialog> <el-empty v-if="!loading && !resultList.length"></el-empty> </div> </div> @@ -308,6 +334,9 @@ }, data() { return { + dialogVisible: false, + aIName: "", + AIReading: "", relatedList: [], // 杈撳叆妗嗙殑鍐呭 inputValue: "", @@ -562,6 +591,9 @@ }; }, mounted() { + console.log(this.$route.query, "query"); + this.inputType = this.$route.query.type; + this.inputValue = this.$route.query.value; this.getSelectData(); }, @@ -713,7 +745,10 @@ // 璇锋眰鏁版嵁 getItemList() { this.loading = true; + console.log(this.inputValue, " inputValue"); + console.log(this.inputType, " inputType"); let searchData = {}; // 鍒濆鍖栦竴涓┖瀵硅薄鏉ュ瓨鍌ㄦ悳绱㈡暟鎹� + debugger; if (this.inputValue) { // 濡傛灉杈撳叆鍊煎瓨鍦� if (this.inputType != "all") { @@ -725,6 +760,8 @@ // 閬嶅巻杈撳叆閫夐」 for (let index = 0; index < this.inputOptions.length; index++) { const item = this.inputOptions[index]; // 鑾峰彇褰撳墠閫夐」 + + debugger; if (item.value !== "all") { // 濡傛灉褰撳墠閫夐」鐨勫�间笉鏄�"all" if (!Object.keys(searchData).length) { @@ -741,20 +778,26 @@ } } } + + console.log(this.associationList, "searchData11111"); + if (this.associationList && this.associationList.length) { this.associationList.forEach((item) => { - if (item.value == "year") { - const endDate = item.content.split("/")[0] + "/12/31 23:59:59"; - const startDate = item.content.split("/")[0] + "/01/01 00:00:00"; - searchData[item.value + ">="] = startDate; - searchData[item.value + "<="] = endDate; - } else if (item.value) { - searchData[item.value + "*"] = item.content; - } else { - searchData["||" + item.value + "*"] = item.content; + if (item.value !== "all") { + if (item.value == "year") { + const endDate = item.content.split("/")[0] + "/12/31 23:59:59"; + const startDate = item.content.split("/")[0] + "/01/01 00:00:00"; + searchData[item.value + ">="] = startDate; + searchData[item.value + "<="] = endDate; + } else if (item.value) { + searchData[item.value + "*"] = item.content; + } else { + searchData["||" + item.value + "*"] = item.content; + } } }); } + console.log(searchData, "searchData"); MG.resource .getItem({ @@ -861,6 +904,12 @@ default: return "other-color"; } + }, + + openAiReading(text, name) { + this.AIReading = text; + this.aIName = name; + this.dialogVisible = true; }, }, }; @@ -1287,18 +1336,23 @@ .journal-color { background-color: #87a8b9; } + .books-color { background-color: #c48787; } + .video-color { background-color: #6f8f5a; } + .audio-color { background-color: #937950; } + .newspaper-color { background-color: #8d77b3; } + .other-color { background-color: #009f9f; } @@ -1399,6 +1453,23 @@ } } +.AIReadingBox { + height: 85vh; + min-height: 600px; + padding: 20px 10px; +} + +.richTextInitBox { + height: 100%; + overflow: auto; +} +.richTextInitError { + height: 100%; + display: flex; + align-items: center; + justify-content: center; +} + .pagination { display: flex; justify-content: center; @@ -1446,6 +1517,18 @@ :deep.el-pagination.is-background .el-pager li:not(.disabled):hover { color: #937950; } + +:deep.el-button--primary { + background-color: #937950; + color: #937950; + border: 1px solid #937950; + cursor: pointer; + + &:hover { + background-color: #937950; + color: #fffdf8; + } +} </style> <style> -- Gitblit v1.9.1