|
|
@@ -1,12 +1,15 @@
|
|
|
<script setup lang="ts">
|
|
|
import { message, type SelectProps } from "ant-design-vue";
|
|
|
-import { ref, watch } from "vue";
|
|
|
+import { ref, watch, onMounted } from "vue";
|
|
|
import { routeToSearch } from "@/router";
|
|
|
+import * as searchHistoryService from "@/services/searchHistory.service"
|
|
|
|
|
|
const keyword = ref("");
|
|
|
|
|
|
const field = ref("TP");
|
|
|
-const placeholder = ref("请输入文献主题")
|
|
|
+const placeholder = ref("请输入文献主题")
|
|
|
+
|
|
|
+const hotWords = ref(['建筑工程','工程设计','BIM'])
|
|
|
|
|
|
const onSearch = () => {
|
|
|
const kwd = keyword.value.trim();
|
|
|
@@ -42,6 +45,27 @@ watch(field, (newValue) => {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+onMounted(() => {
|
|
|
+ searchHistoryService.getHoyKeyword(5).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);
|
|
|
+
|
|
|
+ if (hotWords.value.length == 5) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (index == -1) {
|
|
|
+ hotWords.value.push(RegExp.$1)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+})
|
|
|
+
|
|
|
|
|
|
</script>
|
|
|
|
|
|
@@ -69,6 +93,13 @@ watch(field, (newValue) => {
|
|
|
/>
|
|
|
</a-col>
|
|
|
</a-row>
|
|
|
+ <a-row class="search-hotword">
|
|
|
+ 热门关键词:
|
|
|
+ <span v-for="item in hotWords">
|
|
|
+ {{item}}
|
|
|
+ </span>
|
|
|
+
|
|
|
+ </a-row>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -83,5 +114,11 @@ watch(field, (newValue) => {
|
|
|
text-align: center;
|
|
|
}
|
|
|
|
|
|
+ .search-hotword{
|
|
|
+ margin-top: 30px;
|
|
|
+ > sapn{
|
|
|
+ magin-left: 20px;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|