From 22aa1b322e3b451a993fb3c1163d66d663181c18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BB=93=E5=8F=91=E5=8F=97=E9=95=BF=E7=94=9F?= Date: Wed, 10 Jul 2019 23:42:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A8=E6=96=87=E6=A3=80=E7=B4=A2=E5=85=A5?= =?UTF-8?q?=E5=8F=A3=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/yilia/layout/_partial/live2d.ejs | 1 + themes/yilia/layout/_partial/search.ejs | 7 ++--- themes/yilia/layout/_partial/tools.ejs | 2 +- themes/yilia/source-src/config/waifu-tip.json | 1 + themes/yilia/source-src/css/waifu.scss | 2 +- themes/yilia/source-src/js/slider.js | 31 ++++++++++++------- 6 files changed, 27 insertions(+), 17 deletions(-) diff --git a/themes/yilia/layout/_partial/live2d.ejs b/themes/yilia/layout/_partial/live2d.ejs index 9523cf0..bae93c9 100644 --- a/themes/yilia/layout/_partial/live2d.ejs +++ b/themes/yilia/layout/_partial/live2d.ejs @@ -4,6 +4,7 @@
+ diff --git a/themes/yilia/layout/_partial/search.ejs b/themes/yilia/layout/_partial/search.ejs index 051899a..92ee9d0 100644 --- a/themes/yilia/layout/_partial/search.ejs +++ b/themes/yilia/layout/_partial/search.ejs @@ -10,16 +10,15 @@
-
-
+
-
+
\ No newline at end of file diff --git a/themes/yilia/layout/_partial/tools.ejs b/themes/yilia/layout/_partial/tools.ejs index 7f7e1bb..2d559f2 100644 --- a/themes/yilia/layout/_partial/tools.ejs +++ b/themes/yilia/layout/_partial/tools.ejs @@ -26,7 +26,7 @@ - +
diff --git a/themes/yilia/source-src/config/waifu-tip.json b/themes/yilia/source-src/config/waifu-tip.json index 5dd7cc5..ac3477a 100644 --- a/themes/yilia/source-src/config/waifu-tip.json +++ b/themes/yilia/source-src/config/waifu-tip.json @@ -9,6 +9,7 @@ "weibo": "发现主人出没地点!", "rss": "订阅就可以看到最新的文章啦", "mail": "这里是主人的联系方式", + "tools.search": "在这里搜索所有文章", "tools.eye": "深夜时要爱护眼睛呀", "tools.chart": "猜猜我要说些什么", "tools.photo": "你要给我拍照呀,一二三~茄子~~", diff --git a/themes/yilia/source-src/css/waifu.scss b/themes/yilia/source-src/css/waifu.scss index 399a486..8e6ce0a 100644 --- a/themes/yilia/source-src/css/waifu.scss +++ b/themes/yilia/source-src/css/waifu.scss @@ -56,7 +56,7 @@ } .waifu-tool { color: $colorA; - top: 100px; + top: 80px; right: 60px; font-size: 14px; position: absolute; diff --git a/themes/yilia/source-src/js/slider.js b/themes/yilia/source-src/js/slider.js index 9e0c65e..e6dfbf5 100644 --- a/themes/yilia/source-src/js/slider.js +++ b/themes/yilia/source-src/js/slider.js @@ -15,7 +15,7 @@ function setScrollZero() { }) } var waifuTipTimer = null, fullTextSearchTimer = null -new Vue({ +const vm = new Vue({ el: '#container', data: { isCtnShow: false, @@ -31,10 +31,12 @@ new Vue({ fullTextSearch: { pageNum: 1, limit: 10, + isLoading: false, + tip: undefined, + hasMore: false }, fullTextSearchWords: null, fullTextSearchItems: [], - fullTextSearchTip: undefined, waifu: { tip: null, // 提示语文字 tipOpacity: 0, // 提示语框透明度 @@ -96,23 +98,26 @@ new Vue({ }, loadSearchResult() { this.fullTextSearch.pageNum ++ - this.fullTextSearchItems.isLoading = true - this.fullTextSearchTip = undefined - let params = Object.assign({}, this.fullTextSearch) - params.words = this.fullTextSearchWords + this.fullTextSearch.isLoading = true + this.fullTextSearch.tip = undefined + let params = { + pageNum: this.fullTextSearch.pageNum, + limit: this.fullTextSearch.limit, + words: this.fullTextSearchWords + } axios.get(window.themeConfig.root + 'api/common/search', {params}).then(res => { - this.fullTextSearchItems.isLoading = false + this.fullTextSearch.isLoading = false fullTextSearchTimer = null let result = res.data if(!Array.isArray(result.data) || !result.data.length) { - this.fullTextSearchTip = '未搜索到匹配文章' + this.fullTextSearch.tip = '未搜索到匹配文章' } else { this.fullTextSearchItems.push(...result.data) } this.fullTextSearchItems.hasMore = (result.total > this.fullTextSearch.pageNum * this.fullTextSearch.limit) }).catch(err => { - this.fullTextSearchTip = '加载失败, 请刷新重试' - this.fullTextSearchItems.isLoading = false + this.fullTextSearch.tip = '加载失败, 请刷新重试' + this.fullTextSearch.isLoading = false throw err }) }, @@ -156,7 +161,7 @@ new Vue({ fullTextSearchWords (newVal, oldVal) { this.fullTextSearchItems.hasMore = false this.fullTextSearchItems.isLoading = false - this.fullTextSearchTip = undefined + this.fullTextSearch.tip = undefined this.fullTextSearchItems.splice(0, this.fullTextSearchItems.length) if(fullTextSearchTimer) { clearTimeout(fullTextSearchTimer) @@ -274,6 +279,10 @@ const waifuTools = { 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}`:'')) }) + }, + 'tools.search'() { + // 打开全文检索Modal + vm.openFullTextSearch() } }