Browse Source

merge feature/1002472 into main

merge "feature/1002472" into "main"
1002472,
1002472

Created-by: lizi
Author-id: 7030146
MR-id: 7067
Commit-by: lizi
Merged-by: Kevin
Description: merge "feature/1002472" into "main"
1002472,
1002472

See merge request: zhcqdn00001/front!45
Kevin 2 years ago
parent
commit
d747a2147b

BIN
src/assets/imgs/login-banner.png


+ 1 - 1
src/types/request.types.ts

@@ -1,6 +1,6 @@
 export interface SearchRequest {
   dataSources?: string[];
-  query: string;
+  query?: string;
   filter?: string;
   from?: number;
   size?: number;

+ 11 - 4
src/views/LoginView.vue

@@ -50,6 +50,9 @@ const onFinishFailed = (errorInfo: any) => {
     <a-row type="flex">
       <a-col class="left" :flex="1">
         <h1 class="login-title">技淘平台智慧产权大脑</h1>
+         <p class="login-banner">
+          <img src="@/assets/imgs/login-banner.png" />
+        </p>
       </a-col>
       <a-col class="right" :flex="1">
         <h1>用户登录</h1>
@@ -93,8 +96,10 @@ const onFinishFailed = (errorInfo: any) => {
   .left {
     text-align: center;
     padding-top: 100px;
-    background: url(@/assets/imgs/login-banner.png) no-repeat;
-    background-size: 100% 100%;  
+    // background: url(@/assets/imgs/login-banner.png) no-repeat;
+    // background-size: 100% 100%;  
+    background: radial-gradient(circle, #0D2148, #00051E);
+    
     .login-title {
       color: #00A09A;
     }
@@ -104,8 +109,10 @@ const onFinishFailed = (errorInfo: any) => {
       width: 300px;
 
       img {
-        margin-top: 50px;
-        width: 100%;
+        width: 180%;
+        position: relative;
+        right: 45%;
+        bottom: 20px;
       }
     }
   }

+ 57 - 10
src/views/search/SearchView.vue

@@ -1,8 +1,11 @@
 <script setup lang="ts">
 import { message, type SelectProps } from "ant-design-vue";
-import { ref, watch, onMounted } from "vue";
+import { ref, watch, onMounted, h } from "vue";
 import { routeToSearch } from "@/router";
 import * as searchHistoryService from "@/services/searchHistory.service"
+import * as searchService from "@/services/search.service"
+import { LoadingOutlined } from '@ant-design/icons-vue';
+import SearchResultItem from "./components/SearchResultItem.vue";
 
 const keyword = ref("");
 
@@ -10,6 +13,8 @@ const field = ref("TP");
 const placeholder = ref("请输入文献主题")
 
 const hotWords = ref(['建筑工程','工程设计','BIM'])
+const spinning = ref(true);
+const searchResult: any = ref(null)
 
 const onSearch = () => {
   const kwd = keyword.value.trim();
@@ -46,27 +51,52 @@ watch(field, (newValue) => {
 });
 
 onMounted(() => {
-  searchHistoryService.getHoyKeyword(5).then((resp) => {
+  getHoyKeyword(5);
+  recommendsearch();
+})
+
+function getHoyKeyword(size: number){
+  searchHistoryService.getHoyKeyword(size).then((resp) => {
     const words: any = resp;
     for (let item of words) {
         var expression = item.expression;
-        var _expression = expression.match(/\((.+)\)/g); 
-        var index = hotWords.value.indexOf(RegExp.$1); 
+        var _expression = expression.match(/\((.+)\)/g);
+        var $1 = RegExp.$1
+        var index = hotWords.value.indexOf($1); 
         
         if (hotWords.value.length == 5) {
             break;
         }
 
         if (index == -1) {
-          hotWords.value.push(RegExp.$1)
+          if ($1.length > 1) {
+            hotWords.value.push($1)
+          }
         }
     }
   })
-  
+}
 
-})
+function recommendsearch() {
+  spinning.value = true;
+  const fullYear =  new Date().getFullYear();
+  let request = {
+    from: 0,
+    size: 10,
+    sort: {cited: "desc"},
+    filter: " PY=("+fullYear+" "+ (fullYear - 2)+ " "+(fullYear - 1)+")"
+  }
 
+  searchService.search(request).then((resp) => {
+    searchResult.value = resp
+    spinning.value = false;
+  })
+}
 
+function search(kwd: string){
+  routeToSearch({ type: 'simple', kw: kwd, field: 'TP' });
+}
+ 
 </script>
 
 <template>
@@ -95,10 +125,17 @@ onMounted(() => {
     </a-row>
     <a-row class="search-hotword">
       热门关键词:
-      <span v-for="item in hotWords">
-        {{item}}&nbsp;&nbsp;
+      <span v-for="item in hotWords" @click="search(item)" style="cursor: pointer;">
+          {{item}}&nbsp;&nbsp;
       </span>
-
+    </a-row>
+    <a-row type="flex" class="search-result">
+        <a-spin :spinning="spinning" :indicator="h(LoadingOutlined, { style: { fontSize: '24px', }, spin: true, })">
+        最新文献推荐
+         <div v-for="(doc, index) in searchResult.docs" :key="index" v-if="searchResult" class="search-result-content">
+          <SearchResultItem :data="doc"/>
+        </div>
+        </a-spin> 
     </a-row>
   </div>
 </template>
@@ -120,5 +157,15 @@ onMounted(() => {
       magin-left: 20px;
     }
   }
+  
+  .search-result{
+    margin-top: 30px;
+  }
+  .search-result-content {
+     > div {
+      border: 1px gray solid;
+      margin-bottom: 8px;
+    }
+  }
 }
 </style>