diff --git a/src/components/Film.vue b/src/components/Film.vue
index 7a3990f..a03cce1 100644
--- a/src/components/Film.vue
+++ b/src/components/Film.vue
@@ -26,6 +26,9 @@
+
@@ -135,7 +138,8 @@ export default {
infiniteId: +new Date(),
searchList: [],
searchTxt: '',
- searchContents: []
+ searchContents: [],
+ searchAllSites: false
}
},
components: {
@@ -379,7 +383,7 @@ export default {
this.searchList = res.reverse()
})
},
- searchEvent (wd) {
+ searchSingleSiteEvent (wd) {
this.searchTxt = wd
this.searchContents = []
this.pagecount = 0
@@ -417,6 +421,53 @@ export default {
})
}
},
+ searchAllSitesEvent (wd) {
+ this.searchTxt = wd
+ this.searchContents = []
+ this.pagecount = 0
+ this.show.search = false
+ this.show.find = true
+ if (wd) {
+ search.find({ keywords: wd }).then(res => {
+ if (!res) {
+ search.add({ keywords: wd })
+ }
+ this.getAllSearch()
+ })
+ this.sites.forEach(site =>
+ zy.search(site.key, wd).then(res => {
+ const type = Object.prototype.toString.call(res)
+ if (type === '[object Undefined]') {
+ this.$message.info('无搜索结果')
+ }
+ if (type === '[object Array]') {
+ res.forEach(element => {
+ element.site = site.name
+ this.searchContents.push(element)
+ })
+ }
+ if (type === '[object Object]') {
+ res.site = site.name
+ this.searchContents.push(res)
+ }
+ })
+ )
+ } else {
+ this.show.find = false
+ this.getClass().then(res => {
+ if (res) {
+ this.infiniteId += 1
+ }
+ })
+ }
+ },
+ searchEvent (wd) {
+ if (this.searchAllSites) {
+ this.searchAllSitesEvent(wd)
+ } else {
+ this.searchSingleSiteEvent(wd)
+ }
+ },
clearSearch () {
search.clear().then(res => {
this.getAllSearch()