From 00dab782e865af698e9915e02c281426b5bff3d5 Mon Sep 17 00:00:00 2001 From: haiyangcui Date: Sun, 27 Sep 2020 14:55:56 +0200 Subject: [PATCH] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E7=9A=84=E6=97=B6=E5=80=99?= =?UTF-8?q?=E8=AE=BE=E7=BD=AEtimeout,=E8=A7=A3=E5=86=B3=E5=85=A8=E5=B1=80?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E7=BB=93=E6=9E=9C=E6=97=A0=E6=B3=95=E6=89=93?= =?UTF-8?q?=E5=BC=80=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Film.vue | 4 ++-- src/lib/site/tools.js | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/components/Film.vue b/src/components/Film.vue index cadbe1e..ac19d6e 100644 --- a/src/components/Film.vue +++ b/src/components/Film.vue @@ -422,7 +422,7 @@ export default { } this.getAllSearch() }) - sites.forEach(site => + sites.forEach(site => { zy.search(site.key, wd).then(res => { const type = Object.prototype.toString.call(res) if (type === '[object Array]') { @@ -436,7 +436,7 @@ export default { this.searchContents.push(res) } }) - ) + }) } else { this.show.find = false this.getClass().then(res => { diff --git a/src/lib/site/tools.js b/src/lib/site/tools.js index baa4a27..9f9f33b 100644 --- a/src/lib/site/tools.js +++ b/src/lib/site/tools.js @@ -130,14 +130,18 @@ const zy = { this.getSite(key).then(res => { const site = res wd = encodeURI(wd) - axios.post(`http://localhost:${this.ports}/api`, { url: site.api + '?wd=' + wd }).then(res => { + axios.post(`http://localhost:${this.ports}/api`, { url: site.api + '?wd=' + wd }, { timeout: 2000 }).then(res => { const data = res.data.info const json = parser.parse(data, this.xmlConfig) - const videoList = json.rss.list.video - resolve(videoList) + if (json && json.rss && json.rss.list) { + const videoList = json.rss.list.video + resolve(videoList) + } }).catch(err => { reject(err) }) + }).catch(err => { + reject(err) }) }) },