全文检索入口调整
This commit is contained in:
parent
3439b8d34b
commit
22aa1b322e
@ -4,6 +4,7 @@
|
|||||||
<canvas id="live2d" width="520" height="480" @mouseover="linkMouseover('waifu')" style="width: 260px;height: 240px;"></canvas>
|
<canvas id="live2d" width="520" height="480" @mouseover="linkMouseover('waifu')" style="width: 260px;height: 240px;"></canvas>
|
||||||
</div>
|
</div>
|
||||||
<div class="waifu-tool" v-show="waifu.showTools">
|
<div class="waifu-tool" v-show="waifu.showTools">
|
||||||
|
<span class="icon icon-search" @mouseover="linkMouseover('tools.search')" @click="toolsClick('tools.search')"></span>
|
||||||
<span class="icon icon-eye" @mouseover="linkMouseover('tools.eye')" @click="toolsClick('tools.eye')"></span>
|
<span class="icon icon-eye" @mouseover="linkMouseover('tools.eye')" @click="toolsClick('tools.eye')"></span>
|
||||||
<span class="icon icon-comment-o" @mouseover="linkMouseover('tools.chart')" @click="toolsClick('tools.chart')"></span>
|
<span class="icon icon-comment-o" @mouseover="linkMouseover('tools.chart')" @click="toolsClick('tools.chart')"></span>
|
||||||
<span class="icon icon-camera" @mouseover="linkMouseover('tools.photo')" @click="toolsClick('tools.photo')"></span>
|
<span class="icon icon-camera" @mouseover="linkMouseover('tools.photo')" @click="toolsClick('tools.photo')"></span>
|
||||||
|
|||||||
@ -10,16 +10,15 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="search-result">
|
<div class="search-result">
|
||||||
|
|
||||||
<div class="search-result-item" v-for="(item,index) in fullTextSearchItems" :key="index">
|
<div class="search-result-item" v-for="(item,index) in fullTextSearchItems" :key="index">
|
||||||
<a v-text="item.title" :href="themeConfig.root + item.path"></a>
|
<a v-text="item.title" :href="themeConfig.root + item.path"></a>
|
||||||
<div v-html="item.content"></div>
|
<div v-html="item.content"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="more-item tip" v-show="fullTextSearchItems.hasMore" @click="loadSearchResult">
|
<div class="more-item tip" v-show="fullTextSearch.hasMore" @click="loadSearchResult">
|
||||||
<i class="icon icon-chevron-up"></i>
|
<i class="icon icon-chevron-up"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="tip" v-show="fullTextSearchItems.isLoading || fullTextSearchTip"
|
<div class="tip" v-show="fullTextSearch.isLoading || fullTextSearch.tip"
|
||||||
v-text="fullTextSearchTip || '正在搜索...'"></div>
|
v-text="fullTextSearch.tip || '正在搜索...'"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -26,7 +26,7 @@
|
|||||||
<i class="icon icon-close" @click="searchItems.splice(index,1)"></i>
|
<i class="icon icon-close" @click="searchItems.splice(index,1)"></i>
|
||||||
</span>
|
</span>
|
||||||
<input class="search-ipt" v-model="search" @blur="addSearchItem(search)" @keydown="searchKeydown" type="text" placeholder="<%=__('search') %>…">
|
<input class="search-ipt" v-model="search" @blur="addSearchItem(search)" @keydown="searchKeydown" type="text" placeholder="<%=__('search') %>…">
|
||||||
<i class="icon icon-search" @click="openFullTextSearch"></i>
|
<i class="icon icon-search" @click="addSearchItem(search)"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="widget tagcloud search-tag">
|
<div class="widget tagcloud search-tag">
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@ -9,6 +9,7 @@
|
|||||||
"weibo": "发现主人出没地点!",
|
"weibo": "发现主人出没地点!",
|
||||||
"rss": "订阅就可以看到最新的文章啦",
|
"rss": "订阅就可以看到最新的文章啦",
|
||||||
"mail": "这里是主人的联系方式",
|
"mail": "这里是主人的联系方式",
|
||||||
|
"tools.search": "在这里搜索所有文章",
|
||||||
"tools.eye": "深夜时要爱护眼睛呀",
|
"tools.eye": "深夜时要爱护眼睛呀",
|
||||||
"tools.chart": "猜猜我要说些什么",
|
"tools.chart": "猜猜我要说些什么",
|
||||||
"tools.photo": "你要给我拍照呀,一二三~茄子~~",
|
"tools.photo": "你要给我拍照呀,一二三~茄子~~",
|
||||||
|
|||||||
@ -56,7 +56,7 @@
|
|||||||
}
|
}
|
||||||
.waifu-tool {
|
.waifu-tool {
|
||||||
color: $colorA;
|
color: $colorA;
|
||||||
top: 100px;
|
top: 80px;
|
||||||
right: 60px;
|
right: 60px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|||||||
@ -15,7 +15,7 @@ function setScrollZero() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
var waifuTipTimer = null, fullTextSearchTimer = null
|
var waifuTipTimer = null, fullTextSearchTimer = null
|
||||||
new Vue({
|
const vm = new Vue({
|
||||||
el: '#container',
|
el: '#container',
|
||||||
data: {
|
data: {
|
||||||
isCtnShow: false,
|
isCtnShow: false,
|
||||||
@ -31,10 +31,12 @@ new Vue({
|
|||||||
fullTextSearch: {
|
fullTextSearch: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
limit: 10,
|
limit: 10,
|
||||||
|
isLoading: false,
|
||||||
|
tip: undefined,
|
||||||
|
hasMore: false
|
||||||
},
|
},
|
||||||
fullTextSearchWords: null,
|
fullTextSearchWords: null,
|
||||||
fullTextSearchItems: [],
|
fullTextSearchItems: [],
|
||||||
fullTextSearchTip: undefined,
|
|
||||||
waifu: {
|
waifu: {
|
||||||
tip: null, // 提示语文字
|
tip: null, // 提示语文字
|
||||||
tipOpacity: 0, // 提示语框透明度
|
tipOpacity: 0, // 提示语框透明度
|
||||||
@ -96,23 +98,26 @@ new Vue({
|
|||||||
},
|
},
|
||||||
loadSearchResult() {
|
loadSearchResult() {
|
||||||
this.fullTextSearch.pageNum ++
|
this.fullTextSearch.pageNum ++
|
||||||
this.fullTextSearchItems.isLoading = true
|
this.fullTextSearch.isLoading = true
|
||||||
this.fullTextSearchTip = undefined
|
this.fullTextSearch.tip = undefined
|
||||||
let params = Object.assign({}, this.fullTextSearch)
|
let params = {
|
||||||
params.words = this.fullTextSearchWords
|
pageNum: this.fullTextSearch.pageNum,
|
||||||
|
limit: this.fullTextSearch.limit,
|
||||||
|
words: this.fullTextSearchWords
|
||||||
|
}
|
||||||
axios.get(window.themeConfig.root + 'api/common/search', {params}).then(res => {
|
axios.get(window.themeConfig.root + 'api/common/search', {params}).then(res => {
|
||||||
this.fullTextSearchItems.isLoading = false
|
this.fullTextSearch.isLoading = false
|
||||||
fullTextSearchTimer = null
|
fullTextSearchTimer = null
|
||||||
let result = res.data
|
let result = res.data
|
||||||
if(!Array.isArray(result.data) || !result.data.length) {
|
if(!Array.isArray(result.data) || !result.data.length) {
|
||||||
this.fullTextSearchTip = '未搜索到匹配文章'
|
this.fullTextSearch.tip = '未搜索到匹配文章'
|
||||||
} else {
|
} else {
|
||||||
this.fullTextSearchItems.push(...result.data)
|
this.fullTextSearchItems.push(...result.data)
|
||||||
}
|
}
|
||||||
this.fullTextSearchItems.hasMore = (result.total > this.fullTextSearch.pageNum * this.fullTextSearch.limit)
|
this.fullTextSearchItems.hasMore = (result.total > this.fullTextSearch.pageNum * this.fullTextSearch.limit)
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
this.fullTextSearchTip = '加载失败, 请刷新重试'
|
this.fullTextSearch.tip = '加载失败, 请刷新重试'
|
||||||
this.fullTextSearchItems.isLoading = false
|
this.fullTextSearch.isLoading = false
|
||||||
throw err
|
throw err
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -156,7 +161,7 @@ new Vue({
|
|||||||
fullTextSearchWords (newVal, oldVal) {
|
fullTextSearchWords (newVal, oldVal) {
|
||||||
this.fullTextSearchItems.hasMore = false
|
this.fullTextSearchItems.hasMore = false
|
||||||
this.fullTextSearchItems.isLoading = false
|
this.fullTextSearchItems.isLoading = false
|
||||||
this.fullTextSearchTip = undefined
|
this.fullTextSearch.tip = undefined
|
||||||
this.fullTextSearchItems.splice(0, this.fullTextSearchItems.length)
|
this.fullTextSearchItems.splice(0, this.fullTextSearchItems.length)
|
||||||
if(fullTextSearchTimer) {
|
if(fullTextSearchTimer) {
|
||||||
clearTimeout(fullTextSearchTimer)
|
clearTimeout(fullTextSearchTimer)
|
||||||
@ -274,6 +279,10 @@ const waifuTools = {
|
|||||||
axios.get(`${window.themeConfig.root}api/common/hitokoto?length=40&format=json`).then(res => {
|
axios.get(`${window.themeConfig.root}api/common/hitokoto?length=40&format=json`).then(res => {
|
||||||
this.showMessage(res.data.hitokoto + (res.data.from?` ——${res.data.from}`:''))
|
this.showMessage(res.data.hitokoto + (res.data.from?` ——${res.data.from}`:''))
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
'tools.search'() {
|
||||||
|
// 打开全文检索Modal
|
||||||
|
vm.openFullTextSearch()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user