perf: 优化标签页的搜索

This commit is contained in:
jmal 2025-04-27 17:30:26 +08:00
parent 4de190a106
commit a0993eaf0f
2 changed files with 14 additions and 8 deletions

View File

@ -3,7 +3,7 @@
<div class="search-option-wrapper">
<div class="search-option-result">
<div>
<span>搜索:</span>
<span>搜索 <span class="search-scope">{{searchScope}}</span>:</span>
<span>{{ keyword }}</span>
</div>
<div>
@ -122,7 +122,7 @@
</div>
<!-- 搜索条件标签 -->
<div class="search-tags">
<div v-if="searchPath.length > 1 && !searchOverall">
<div v-if="searchPath !== 'undefined' && searchPath.length > 1 && !searchOverall">
<el-tag
@close="resetSearchPath">
路径: {{ searchPath }}
@ -210,6 +210,14 @@ export default {
}
},
computed: {
searchScope() {
const queryTagId = this.$route.query.tagId
const path = this.$route.query.path;
if (queryTagId && path === '/') {
return '(当前标签)'
}
return ''
},
hasSearchConditions() {
return this.fileType !== 'all' || this.timeRange || this.hasSizeRange || this.searchMount || this.searchOverall
},
@ -255,7 +263,6 @@ export default {
},
watch: {
filterOption(newValue) {
console.log('filterOption changed', newValue)
}
},
methods: {
@ -279,7 +286,6 @@ export default {
clearFilterOption() {
this.filterOption = this.emptyFilterOption
console.log('clearFilterOption')
this.setFilterOption(this.filterOption)
},
@ -311,7 +317,6 @@ export default {
this.searchOverall = !!filterOption.searchOverall
// 更新过滤条件
console.log('setFilterOption')
this.updateFilterOption()
},

View File

@ -90,7 +90,7 @@
<div class="search-class">
<el-popover
v-if="showUploadButton"
v-show="!(pathList.length < 2 && homeHidden)"
v-show="!(isRootPath && homeHidden)"
v-model="isShowNewFolder"
placement="bottom"
trigger="hover"
@ -1222,6 +1222,9 @@ export default {
cmdKey() {
return navigator.platform.startsWith('Mac') ? '⌘' : 'Ctrl'
},
isRootPath() {
return !this.$route.query.path || this.$route.query.path.length < 2
},
fileClipboard() {
return store.getters.fileClipboard
},
@ -2963,7 +2966,6 @@ export default {
this.vmode
}&path=${path}${keyword}${searchOpenFolder}${queryTagId}${basePath}${folder}`
)
console.log('this.filterOption', this.filterOption)
api.searchFile({
userId: this.$store.state.user.userId,
username: this.$store.state.user.name,
@ -4547,7 +4549,6 @@ export default {
}
api.recentlySearchHistory({keyword: queryString}).then(res => {
this.searchHistoryList = res.data || []
console.log('clearSearchHistory1', this.searchHistoryList)
cb(this.searchHistoryList)
}).catch(error => {
console.error("Error fetching search history:", error)