feat: 搜索选项新增精准搜索
This commit is contained in:
parent
51e051923d
commit
a2307bd3c2
@ -153,6 +153,14 @@ export default {
|
|||||||
params
|
params
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
// 删除所有搜索记录🔍
|
||||||
|
removeAllSearchHistory: function(params) {
|
||||||
|
return request({
|
||||||
|
url: '/search/deleteAllSearchHistory',
|
||||||
|
method: 'delete',
|
||||||
|
params
|
||||||
|
})
|
||||||
|
},
|
||||||
// 搜索文件🔍
|
// 搜索文件🔍
|
||||||
searchFile: function(params) {
|
searchFile: function(params) {
|
||||||
return request({
|
return request({
|
||||||
|
|||||||
@ -18,15 +18,57 @@
|
|||||||
<span>个结果</span>
|
<span>个结果</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="search-option-scope">
|
||||||
|
<div class="search-option-scope-title">
|
||||||
|
查找范围:
|
||||||
|
</div>
|
||||||
|
<div class="content-scope">
|
||||||
|
<div>
|
||||||
|
<el-checkbox
|
||||||
|
v-model="includeTagName"
|
||||||
|
class="search-option-checkbox"
|
||||||
|
@change="handleCommonChange"
|
||||||
|
>标签名称
|
||||||
|
</el-checkbox>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<el-checkbox
|
||||||
|
v-model="includeFileName"
|
||||||
|
class="search-option-checkbox"
|
||||||
|
@change="handleCommonChange"
|
||||||
|
>文件名称
|
||||||
|
</el-checkbox>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<el-checkbox
|
||||||
|
v-model="includeFileContent"
|
||||||
|
class="search-option-checkbox"
|
||||||
|
@change="handleCommonChange"
|
||||||
|
>文件内容
|
||||||
|
</el-checkbox>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="file-search-option">
|
<div class="file-search-option">
|
||||||
<div class="search-bar">
|
<div class="search-bar">
|
||||||
<div class="search-input-wrapper">
|
<div class="search-input-wrapper">
|
||||||
<div class="search-filters">
|
<div class="search-filters">
|
||||||
|
<div>
|
||||||
|
<el-checkbox
|
||||||
|
v-if="showExactSearch"
|
||||||
|
v-model="exactSearch"
|
||||||
|
class="search-option-checkbox"
|
||||||
|
@change="handleCommonChange"
|
||||||
|
>精准搜索
|
||||||
|
</el-checkbox>
|
||||||
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<el-checkbox
|
<el-checkbox
|
||||||
v-model="searchOverall"
|
v-model="searchOverall"
|
||||||
class="search-option-checkbox"
|
class="search-option-checkbox"
|
||||||
@change="handleSearchOverallChange"
|
@change="handleCommonChange"
|
||||||
>全盘搜索
|
>全盘搜索
|
||||||
</el-checkbox>
|
</el-checkbox>
|
||||||
</div>
|
</div>
|
||||||
@ -34,7 +76,7 @@
|
|||||||
<el-checkbox
|
<el-checkbox
|
||||||
v-model="searchMount"
|
v-model="searchMount"
|
||||||
class="search-option-checkbox"
|
class="search-option-checkbox"
|
||||||
@change="handleSearchMountChange"
|
@change="handleCommonChange"
|
||||||
>挂载目录
|
>挂载目录
|
||||||
</el-checkbox>
|
</el-checkbox>
|
||||||
</div>
|
</div>
|
||||||
@ -142,6 +184,13 @@
|
|||||||
全盘搜索
|
全盘搜索
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-if="exactSearch">
|
||||||
|
<el-tag
|
||||||
|
closable
|
||||||
|
@close="resetExactSearch">
|
||||||
|
精准搜索
|
||||||
|
</el-tag>
|
||||||
|
</div>
|
||||||
<div v-if="searchMount">
|
<div v-if="searchMount">
|
||||||
<el-tag
|
<el-tag
|
||||||
closable
|
closable
|
||||||
@ -217,10 +266,18 @@ export default {
|
|||||||
fileTypeText: '全部文件',
|
fileTypeText: '全部文件',
|
||||||
searchMount: false,
|
searchMount: false,
|
||||||
searchOverall: false,
|
searchOverall: false,
|
||||||
filterOption: this.emptyFilterOption
|
exactSearch: false,
|
||||||
|
filterOption: this.emptyFilterOption,
|
||||||
|
checkList: ['标签名称', '文件名称', '文件内容'],
|
||||||
|
includeTagName: true,
|
||||||
|
includeFileName: true,
|
||||||
|
includeFileContent: true,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
showExactSearch() {
|
||||||
|
return this.$store.getters.exactSearch
|
||||||
|
},
|
||||||
searchScope() {
|
searchScope() {
|
||||||
const queryTagId = this.$route.query.tagId
|
const queryTagId = this.$route.query.tagId
|
||||||
const isRootPath = this.$route.query.path === '/';
|
const isRootPath = this.$route.query.path === '/';
|
||||||
@ -251,7 +308,7 @@ export default {
|
|||||||
return ''
|
return ''
|
||||||
},
|
},
|
||||||
hasSearchConditions() {
|
hasSearchConditions() {
|
||||||
return this.fileType !== 'all' || this.timeRange || this.hasSizeRange || this.searchMount || this.searchOverall
|
return this.fileType !== 'all' || this.timeRange || this.hasSizeRange || this.searchMount || this.searchOverall || this.exactSearch
|
||||||
},
|
},
|
||||||
emptyFilterOption() {
|
emptyFilterOption() {
|
||||||
return {
|
return {
|
||||||
@ -260,8 +317,12 @@ export default {
|
|||||||
modifyEnd: null,
|
modifyEnd: null,
|
||||||
sizeMin: null,
|
sizeMin: null,
|
||||||
sizeMax: null,
|
sizeMax: null,
|
||||||
searchMount: false,
|
searchMount: null,
|
||||||
searchOverall: false,
|
searchOverall: null,
|
||||||
|
exactSearch: null,
|
||||||
|
includeTagName: true,
|
||||||
|
includeFileName: true,
|
||||||
|
includeFileContent: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
hasSizeRange () {
|
hasSizeRange () {
|
||||||
@ -306,13 +367,18 @@ export default {
|
|||||||
modifyEnd: this.timeRange ? new Date(this.timeRange[1]).getTime() : null,
|
modifyEnd: this.timeRange ? new Date(this.timeRange[1]).getTime() : null,
|
||||||
sizeMin: this.hasSizeRange ? this.sizeRange[0] : null,
|
sizeMin: this.hasSizeRange ? this.sizeRange[0] : null,
|
||||||
sizeMax: this.hasSizeRange ? this.sizeRange[1] : null,
|
sizeMax: this.hasSizeRange ? this.sizeRange[1] : null,
|
||||||
searchMount: this.searchMount,
|
searchMount: this.searchMount ? true : null,
|
||||||
searchOverall: this.searchOverall
|
searchOverall: this.searchOverall ? true : null,
|
||||||
|
exactSearch: this.exactSearch ? true : null,
|
||||||
|
includeTagName: this.includeTagName,
|
||||||
|
includeFileName: this.includeFileName,
|
||||||
|
includeFileContent: this.includeFileContent,
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$emit('filter-change')
|
this.$emit('filter-change')
|
||||||
this.$emit('update:filter-option-param', this.filterOption)
|
this.$emit('update:filter-option-param', this.filterOption)
|
||||||
this.$emit('update:has-search-conditions-param', this.hasSearchConditions)
|
this.$emit('update:has-search-conditions-param', this.hasSearchConditions)
|
||||||
|
|
||||||
localStorage.setItem('searchFilterOption', JSON.stringify(this.filterOption))
|
localStorage.setItem('searchFilterOption', JSON.stringify(this.filterOption))
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -347,6 +413,10 @@ export default {
|
|||||||
// 设置搜索选项
|
// 设置搜索选项
|
||||||
this.searchMount = !!filterOption.searchMount
|
this.searchMount = !!filterOption.searchMount
|
||||||
this.searchOverall = !!filterOption.searchOverall
|
this.searchOverall = !!filterOption.searchOverall
|
||||||
|
this.exactSearch = !!filterOption.exactSearch
|
||||||
|
this.includeTagName = filterOption.includeTagName === undefined ? true : filterOption.includeTagName
|
||||||
|
this.includeFileName = filterOption.includeFileName === undefined ? true : filterOption.includeTagName
|
||||||
|
this.includeFileContent = filterOption.includeFileName === undefined ? true : filterOption.includeTagName
|
||||||
|
|
||||||
// 更新过滤条件
|
// 更新过滤条件
|
||||||
this.updateFilterOption()
|
this.updateFilterOption()
|
||||||
@ -406,6 +476,11 @@ export default {
|
|||||||
this.updateFilterOption()
|
this.updateFilterOption()
|
||||||
},
|
},
|
||||||
|
|
||||||
|
resetExactSearch() {
|
||||||
|
this.exactSearch = false
|
||||||
|
this.updateFilterOption()
|
||||||
|
},
|
||||||
|
|
||||||
resetFileType() {
|
resetFileType() {
|
||||||
this.handleFileType('all')
|
this.handleFileType('all')
|
||||||
},
|
},
|
||||||
@ -475,11 +550,7 @@ export default {
|
|||||||
this.timeRange = [start, end]
|
this.timeRange = [start, end]
|
||||||
this.updateFilterOption()
|
this.updateFilterOption()
|
||||||
},
|
},
|
||||||
|
handleCommonChange() {
|
||||||
handleSearchMountChange() {
|
|
||||||
this.updateFilterOption()
|
|
||||||
},
|
|
||||||
handleSearchOverallChange() {
|
|
||||||
this.updateFilterOption()
|
this.updateFilterOption()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -529,6 +600,33 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.search-option-scope {
|
||||||
|
margin-top: 20px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-around;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
.search-option-scope-title {
|
||||||
|
flex: 1 1;
|
||||||
|
padding: 0 25px;
|
||||||
|
color: #303133;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-scope {
|
||||||
|
flex: 1 1;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
width: 100%;
|
||||||
|
.search-option-checkbox {
|
||||||
|
padding: 8px 12px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
.file-search-option {
|
.file-search-option {
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@ -161,16 +161,15 @@
|
|||||||
ref="searchInput"
|
ref="searchInput"
|
||||||
:class="searchInputClass"
|
:class="searchInputClass"
|
||||||
v-show="showSearchButton"
|
v-show="showSearchButton"
|
||||||
:fetch-suggestions="queryRecentlySearchHistory"
|
:fetch-suggestions="fetchDynamicSuggestions"
|
||||||
hide-loading
|
hide-loading
|
||||||
:debounce="300"
|
|
||||||
:popper-append-to-body="false"
|
:popper-append-to-body="false"
|
||||||
:placeholder="`搜索 ${cmdKey} P`"
|
:placeholder="`搜索 ${cmdKey} P`"
|
||||||
v-model="searchFileName"
|
v-model="searchFileName"
|
||||||
@keyup.enter.native="searchFileEnter(searchFileName)"
|
@keyup.enter.native="searchFileEnter"
|
||||||
@focus="searchInputFocus"
|
@focus="searchInputFocus"
|
||||||
@blur="searchInputBlur"
|
@blur="searchInputBlur"
|
||||||
@select="handleSelectSearchHistory"
|
@select="handleSelectSuggestion"
|
||||||
>
|
>
|
||||||
<template v-slot:suffix>
|
<template v-slot:suffix>
|
||||||
<div>
|
<div>
|
||||||
@ -201,15 +200,62 @@
|
|||||||
|
|
||||||
<!-- 自定义提示项 -->
|
<!-- 自定义提示项 -->
|
||||||
<template #default="{ item }" class="autocomplete-suggestion-custom">
|
<template #default="{ item }" class="autocomplete-suggestion-custom">
|
||||||
<div class="suggestion-item">
|
|
||||||
|
<!-- 固定操作项:当前路径搜索 -->
|
||||||
|
<div v-if="item.sugType === 'action_current_path_search'" class="suggestion-item action-item">
|
||||||
|
<div class="suggestion-action-item-title">
|
||||||
|
<i class="el-icon-search"></i>
|
||||||
|
<div class="suggestion-action-item-text">
|
||||||
|
<span class="suggestion-item-keyword">{{ item.keyword }}</span>
|
||||||
|
<span class="suggestion-item-hint">当前路径 或按 Enter</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 固定操作项:全盘搜索 -->
|
||||||
|
<div v-else-if="item.sugType === 'action_global_search'" class="suggestion-item action-item">
|
||||||
|
<div class="suggestion-action-item-title">
|
||||||
|
<i class="el-icon-search"></i>
|
||||||
|
<div class="suggestion-action-item-text">
|
||||||
|
<span class="suggestion-item-keyword">{{ item.keyword }}</span>
|
||||||
|
<span class="suggestion-item-hint">全盘搜索</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else-if="item.sugType === 'clearAllHistory'" class="suggestion-item recently-item">
|
||||||
|
<span class="suggestion-item-text">最近搜索</span>
|
||||||
|
<div>
|
||||||
|
<el-button
|
||||||
|
round
|
||||||
|
type="text"
|
||||||
|
class="clear-search-history-btn"
|
||||||
|
@click.stop.prevent="clearAllSearchHistory($event)"
|
||||||
|
>清除所有</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 历史记录项 -->
|
||||||
|
<div v-else-if="item.sugType === 'history'" class="suggestion-item history-item">
|
||||||
<div class="suggestion-item-title">
|
<div class="suggestion-item-title">
|
||||||
<i class="el-icon-time"></i>
|
<i class="el-icon-time"></i>
|
||||||
<span class="suggestion-item-text">{{ item.keyword }}</span>
|
<span class="suggestion-item-text">{{ item.keyword }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<el-button round type="text" icon="el-icon-close" class="clear-search-history-btn" @click.native.prevent="clearSearchHistory(item, $event)"></el-button>
|
<el-button
|
||||||
|
round
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-close"
|
||||||
|
class="clear-search-history-btn"
|
||||||
|
@click.stop.prevent="clearSearchHistoryForItem(item, $event)"
|
||||||
|
></el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- 默认显示 -->
|
||||||
|
<div v-else class="suggestion-item">
|
||||||
|
<span class="suggestion-item-text">{{ item.value }}</span>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
</el-autocomplete>
|
</el-autocomplete>
|
||||||
@ -1178,7 +1224,9 @@ export default {
|
|||||||
debounceSearch: null,// 搜索防抖
|
debounceSearch: null,// 搜索防抖
|
||||||
debounceGetFileList: null,// 获取文件列表防抖
|
debounceGetFileList: null,// 获取文件列表防抖
|
||||||
filterOption: {}, // 搜索选项
|
filterOption: {}, // 搜索选项
|
||||||
searchHistoryList: [],// 搜索历史列表
|
searchSuggestions: [],// 搜索历史列表
|
||||||
|
_isSuggestionHandledBySelect: false,
|
||||||
|
_originalSearchFileNameBeforeSelect: '',
|
||||||
hasSearchFilterOption: false, // 是否有搜索选项
|
hasSearchFilterOption: false, // 是否有搜索选项
|
||||||
fileUsername: '', // 一般用于挂载文件
|
fileUsername: '', // 一般用于挂载文件
|
||||||
searchInputClass: 'search-input' // 搜索输入框样式
|
searchInputClass: 'search-input' // 搜索输入框样式
|
||||||
@ -2959,8 +3007,12 @@ export default {
|
|||||||
getFileListEnter(onLoad) {
|
getFileListEnter(onLoad) {
|
||||||
this.debounceGetFileList(onLoad)
|
this.debounceGetFileList(onLoad)
|
||||||
},
|
},
|
||||||
searchFileEnter(key, onLoad) {
|
searchFileEnter() {
|
||||||
this.debounceSearch(key, onLoad)
|
if (this._isSuggestionHandledBySelect) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.debounceSearch(this.searchFileName)
|
||||||
|
this.$refs.searchInput.close()
|
||||||
},
|
},
|
||||||
searchFile(key, onLoad) {
|
searchFile(key, onLoad) {
|
||||||
if (key) {
|
if (key) {
|
||||||
@ -3021,6 +3073,10 @@ export default {
|
|||||||
searchMount: this.filterOption.searchMount,
|
searchMount: this.filterOption.searchMount,
|
||||||
isMount: this.queryCondition.isMount,
|
isMount: this.queryCondition.isMount,
|
||||||
searchOverall: this.filterOption.searchOverall,
|
searchOverall: this.filterOption.searchOverall,
|
||||||
|
exactSearch: this.filterOption.exactSearch,
|
||||||
|
includeTagName: this.filterOption.includeTagName,
|
||||||
|
includeFileName: this.filterOption.includeFileName,
|
||||||
|
includeFileContent: this.filterOption.includeFileContent,
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
this.loadData(res, onLoad)
|
this.loadData(res, onLoad)
|
||||||
this.listModeSearch = true
|
this.listModeSearch = true
|
||||||
@ -4582,33 +4638,110 @@ export default {
|
|||||||
},
|
},
|
||||||
showSearchOption() {
|
showSearchOption() {
|
||||||
},
|
},
|
||||||
queryRecentlySearchHistory(queryString, cb) {
|
async fetchDynamicSuggestions(queryString, cb) {
|
||||||
if (this.searchFileName) {
|
this._originalSearchFileNameBeforeSelect = queryString
|
||||||
cb([])
|
this.searchSuggestions = []
|
||||||
return
|
const recentlySearch =
|
||||||
|
{
|
||||||
|
sugType: 'clearAllHistory',
|
||||||
|
keyword: '',
|
||||||
|
value: `__READONLY_DIVIDER_${Date.now()}__`,
|
||||||
|
id: 'recently_search_id'
|
||||||
|
}
|
||||||
|
if (!queryString) {
|
||||||
|
await this.pushSearchHistory(queryString, recentlySearch)
|
||||||
|
} else {
|
||||||
|
// 用户已输入关键字
|
||||||
|
// 1. 固定操作项
|
||||||
|
const fixedActionItems = [
|
||||||
|
{
|
||||||
|
sugType: 'action_current_path_search',
|
||||||
|
keyword: queryString,
|
||||||
|
value: queryString,
|
||||||
|
id: 'action_current_path_search_id'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sugType: 'action_global_search',
|
||||||
|
keyword: queryString,
|
||||||
|
value: queryString,
|
||||||
|
id: 'action_global_search_id'
|
||||||
|
},
|
||||||
|
]
|
||||||
|
this.searchSuggestions.push(...fixedActionItems)
|
||||||
|
await this.pushSearchHistory(queryString, recentlySearch)
|
||||||
}
|
}
|
||||||
api.getRecentlySearchHistory({keyword: queryString}).then(res => {
|
cb(this.searchSuggestions)
|
||||||
this.searchHistoryList = res.data || []
|
},
|
||||||
cb(this.searchHistoryList)
|
async pushSearchHistory(queryString, recentlySearch) {
|
||||||
}).catch(error => {
|
const historyItems = await this.queryRecentlySearchHistory(queryString)
|
||||||
console.error("Error fetching search history:", error)
|
if (historyItems.length > 0) {
|
||||||
this.searchHistoryList = []
|
this.searchSuggestions.push(recentlySearch)
|
||||||
cb([])
|
}
|
||||||
|
this.searchSuggestions.push(...historyItems)
|
||||||
|
},
|
||||||
|
async queryRecentlySearchHistory(queryString = '') {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
setTimeout(() => {
|
||||||
|
api.getRecentlySearchHistory({keyword: queryString}).then(res => {
|
||||||
|
const filteredHistory = res.data.map(item => ({
|
||||||
|
...item,
|
||||||
|
value: item.keyword,
|
||||||
|
sugType: 'history'
|
||||||
|
}))
|
||||||
|
resolve(filteredHistory)
|
||||||
|
}).catch(error => {
|
||||||
|
console.error("Error fetching search history:", error)
|
||||||
|
})
|
||||||
|
}, 50)
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleSelectSearchHistory(item) {
|
handleSelectSuggestion(item) {
|
||||||
this.searchFileName = item.keyword
|
this._isSuggestionHandledBySelect = true
|
||||||
this.filterOption = item
|
if (item.id === "recently_search_id") {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
if (this.searchFileName !== this._originalSearchFileNameBeforeSelect) {
|
||||||
|
this.searchFileName = this._originalSearchFileNameBeforeSelect
|
||||||
|
}
|
||||||
|
this._isSuggestionHandledBySelect = false
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if ( item.sugType === 'history') {
|
||||||
|
this.searchFileName = item.keyword
|
||||||
|
}
|
||||||
|
if ( item.sugType === 'action_global_search') {
|
||||||
|
item.searchOverall = true
|
||||||
|
}
|
||||||
|
if ( item.sugType === 'action_current_path_search') {
|
||||||
|
item.searchOverall = false
|
||||||
|
}
|
||||||
this.debounceSearch(this.searchFileName, false)
|
this.debounceSearch(this.searchFileName, false)
|
||||||
this.$refs.searchOption.setFilterOption(item)
|
this.$refs.searchOption.setFilterOption(item)
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this._isSuggestionHandledBySelect = false
|
||||||
|
})
|
||||||
},
|
},
|
||||||
clearSearchHistory(itemToDelete, event) {
|
clearSearchHistoryForItem(itemToDelete, event) {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
const idToDelete = itemToDelete.id
|
const idToDelete = itemToDelete.id
|
||||||
api.removeSearchHistory({id: idToDelete}).then(() => {
|
api.removeSearchHistory({id: idToDelete}).then(() => {
|
||||||
const index = this.searchHistoryList.findIndex(item => item.id === idToDelete)
|
const index = this.searchSuggestions.findIndex(item => item.id === idToDelete)
|
||||||
this.searchHistoryList.splice(index, 1)
|
this.searchSuggestions.splice(index, 1)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
clearAllSearchHistory(event) {
|
||||||
|
event.stopPropagation();
|
||||||
|
event.preventDefault();
|
||||||
|
this.$confirm('确定要清除所有搜索记录吗', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
api.removeAllSearchHistory({userId: this.$store.getters.userId}).then(() => {
|
||||||
|
this.searchSuggestions.splice(2, this.searchSuggestions.length - 2)
|
||||||
|
})
|
||||||
|
}).catch(() => {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
checkPreviewVisible() {
|
checkPreviewVisible() {
|
||||||
@ -4879,7 +5012,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.search-input {
|
.search-input {
|
||||||
width: 230px;
|
width: 250px;
|
||||||
transition: width 0.3s ease-in-out;
|
transition: width 0.3s ease-in-out;
|
||||||
>>> .el-input--suffix .el-input__inner {
|
>>> .el-input--suffix .el-input__inner {
|
||||||
padding-right: 60px;
|
padding-right: 60px;
|
||||||
@ -4887,7 +5020,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.search-input-focus {
|
.search-input-focus {
|
||||||
width: 230px;
|
width: 250px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-close-btn {
|
.search-close-btn {
|
||||||
@ -4915,37 +5048,80 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
>>> .el-autocomplete-suggestion li {
|
>>> .el-autocomplete-suggestion {
|
||||||
padding: 0 5px 0 15px;
|
margin-top: 0 !important;
|
||||||
}
|
|
||||||
|
|
||||||
.suggestion-item {
|
.popper__arrow {
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
.suggestion-item-title {
|
|
||||||
display: flex;
|
|
||||||
gap: 10px;
|
|
||||||
justify-content: flex-start;
|
|
||||||
flex-direction: row;
|
|
||||||
align-items: center;
|
|
||||||
.suggestion-item-text {
|
|
||||||
width: 152px;
|
|
||||||
white-space: nowrap;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.clear-search-history-btn {
|
|
||||||
padding: 8px;
|
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover {
|
|
||||||
|
li {
|
||||||
|
padding: 0 5px 0 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.suggestion-item {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.suggestion-item-title {
|
||||||
|
display: flex;
|
||||||
|
gap: 15px;
|
||||||
|
justify-content: flex-start;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
.suggestion-item-text {
|
||||||
|
width: 168px;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.clear-search-history-btn {
|
.clear-search-history-btn {
|
||||||
display: block;
|
padding: 8px;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
.clear-search-history-btn {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.suggestion-item.action-item {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.suggestion-action-item-title {
|
||||||
|
display: flex;
|
||||||
|
gap: 15px;
|
||||||
|
justify-content: flex-start;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
height: 40px;
|
||||||
|
line-height: 40px;
|
||||||
|
|
||||||
|
.suggestion-action-item-text {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.suggestion-item-keyword {
|
||||||
|
line-height: normal;
|
||||||
|
color: #303133;
|
||||||
|
font-weight: 500;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.suggestion-item-hint {
|
||||||
|
color: #c8c9cc;
|
||||||
|
line-height: normal;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,11 +54,11 @@
|
|||||||
<el-form-item label="名称:">
|
<el-form-item label="名称:">
|
||||||
<span>{{ file.name }}</span>
|
<span>{{ file.name }}</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- <el-form-item label="类型:">-->
|
<el-form-item label="类型:">
|
||||||
<!-- <span>{{-->
|
<span>{{
|
||||||
<!-- file.isFolder ? '文件夹' : file.contentType-->
|
file.isFolder ? '文件夹' : file.contentType
|
||||||
<!-- }}</span>-->
|
}}</span>
|
||||||
<!-- </el-form-item>-->
|
</el-form-item>
|
||||||
<div v-if="file.music">
|
<div v-if="file.music">
|
||||||
<el-form-item label="🎵 歌手:">
|
<el-form-item label="🎵 歌手:">
|
||||||
<span>{{ file.music.singer }}</span>
|
<span>{{ file.music.singer }}</span>
|
||||||
|
|||||||
@ -13,6 +13,7 @@ const getters = {
|
|||||||
userId: state => state.user.userId,
|
userId: state => state.user.userId,
|
||||||
userInfo: state => state.user.userInfo,
|
userInfo: state => state.user.userInfo,
|
||||||
menuList: state => state.user.menuList,
|
menuList: state => state.user.menuList,
|
||||||
fileClipboard: state => state.fileClipboard
|
fileClipboard: state => state.fileClipboard,
|
||||||
|
exactSearch: state => state.user.exactSearch
|
||||||
}
|
}
|
||||||
export default getters
|
export default getters
|
||||||
|
|||||||
@ -34,6 +34,7 @@ const getDefaultState = () => {
|
|||||||
menuList: [],
|
menuList: [],
|
||||||
netdiskName: store ? store.netdiskName : '',
|
netdiskName: store ? store.netdiskName : '',
|
||||||
netdiskLogo: store ? store.netdiskLogo : '',
|
netdiskLogo: store ? store.netdiskLogo : '',
|
||||||
|
exactSearch: store ? store.exactSearch : false,
|
||||||
newVersion: store ? store.newVersion : '',
|
newVersion: store ? store.newVersion : '',
|
||||||
iframePreviewConfig: {}
|
iframePreviewConfig: {}
|
||||||
}
|
}
|
||||||
@ -78,6 +79,9 @@ const mutations = {
|
|||||||
SET_NETDISK_LOGO:(state,netdiskLogo) => {
|
SET_NETDISK_LOGO:(state,netdiskLogo) => {
|
||||||
state.netdiskLogo = netdiskLogo;
|
state.netdiskLogo = netdiskLogo;
|
||||||
},
|
},
|
||||||
|
SET_EXACT_SEARCH:(state,exactSearch) => {
|
||||||
|
state.exactSearch = exactSearch;
|
||||||
|
},
|
||||||
SET_NEW_VERSION:(state,newVersion) => {
|
SET_NEW_VERSION:(state,newVersion) => {
|
||||||
state.newVersion = newVersion;
|
state.newVersion = newVersion;
|
||||||
},
|
},
|
||||||
@ -156,7 +160,7 @@ const actions = {
|
|||||||
// reject('Verification failed, please Login again.')
|
// reject('Verification failed, please Login again.')
|
||||||
}
|
}
|
||||||
|
|
||||||
const { id, username, showName, avatar, netdiskName, netdiskLogo, newVersion, iframe} = data
|
const { id, username, showName, avatar, netdiskName, exactSearch, netdiskLogo, newVersion, iframe} = data
|
||||||
|
|
||||||
commit('SET_NAME', username)
|
commit('SET_NAME', username)
|
||||||
commit('SET_SHOW_NAME', showName)
|
commit('SET_SHOW_NAME', showName)
|
||||||
@ -165,6 +169,7 @@ const actions = {
|
|||||||
commit('SET_USER_INFO', data)
|
commit('SET_USER_INFO', data)
|
||||||
commit('SET_NETDISK_NAME', netdiskName)
|
commit('SET_NETDISK_NAME', netdiskName)
|
||||||
commit('SET_NETDISK_LOGO', netdiskLogo)
|
commit('SET_NETDISK_LOGO', netdiskLogo)
|
||||||
|
commit('SET_EXACT_SEARCH', exactSearch)
|
||||||
if (iframe) {
|
if (iframe) {
|
||||||
commit('SET_IFRAME_PREVIEW', JSON.parse(iframe))
|
commit('SET_IFRAME_PREVIEW', JSON.parse(iframe))
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -29,6 +29,9 @@ body {
|
|||||||
|
|
||||||
.el-message-box {
|
.el-message-box {
|
||||||
border-radius: $popperBorderRadius;
|
border-radius: $popperBorderRadius;
|
||||||
|
.el-button {
|
||||||
|
border-radius: 20px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-message, .el-notification, .el-popover, .el-tooltip__popper, .el-dropdown-menu, .el-select-dropdown, .el-picker-panel, .el-picker-panel__body, .el-picker-panel__sidebar {
|
.el-message, .el-notification, .el-popover, .el-tooltip__popper, .el-dropdown-menu, .el-select-dropdown, .el-picker-panel, .el-picker-panel__body, .el-picker-panel__sidebar {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user