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 |   87 ++++++++++++++++++++++++++++++-------------
 1 files changed, 61 insertions(+), 26 deletions(-)

diff --git a/src/views/achievements/index.vue b/src/views/achievements/index.vue
index c5fd0fa..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 @click="openAiReading(item.AIReading, item.name)">AI鏅鸿兘闃呰</el-button>
+                  <el-button @click="openAiReading(item.AIReading, item.name)"
+                    >AI鏅鸿兘闃呰</el-button
+                  >
                 </p>
               </li>
               <li class="main-sources">
@@ -247,7 +249,10 @@
                 v-if="item.abstract"
               >
                 <span>鎽樿: </span>
-                <span class="page-main-abstract" v-html="item.cleanAbstract"></span>
+                <span
+                  class="page-main-abstract"
+                  v-html="item.cleanAbstract"
+                ></span>
               </li>
               <li
                 class="main-keyword"
@@ -283,12 +288,28 @@
               >
               </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>
+            <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>
@@ -570,6 +591,9 @@
     };
   },
   mounted() {
+    console.log(this.$route.query, "query");
+    this.inputType = this.$route.query.type;
+    this.inputValue = this.$route.query.value;
     this.getSelectData();
   },
 
@@ -721,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") {
@@ -733,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) {
@@ -749,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({
@@ -872,10 +907,10 @@
     },
 
     openAiReading(text, name) {
-        this.AIReading = text;
-        this.aIName = name;
-        this.dialogVisible = true;
-    }
+      this.AIReading = text;
+      this.aIName = name;
+      this.dialogVisible = true;
+    },
   },
 };
 </script>
@@ -1428,11 +1463,11 @@
   height: 100%;
   overflow: auto;
 }
-.richTextInitError{
-    height: 100%;
-    display: flex;
-    align-items: center;
-    justify-content: center;
+.richTextInitError {
+  height: 100%;
+  display: flex;
+  align-items: center;
+  justify-content: center;
 }
 
 .pagination {

--
Gitblit v1.9.1