From 188035c4a1ca9c4e9a39442822dce59651ef7d6e Mon Sep 17 00:00:00 2001 From: hunlongyu Date: Tue, 7 Jan 2020 17:18:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=9B=B4=E5=A4=9A=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E7=BD=91=E7=AB=99,=20=E4=BC=98=E5=8C=96=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E7=BB=93=E6=9E=9C.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/assets/theme/light.scss | 8 +-- src/lib/sites.js | 29 ++++++++ src/{util => lib}/util.666zy.js | 0 src/lib/util.zy.js | 63 ++++++++++++++++ src/plugin/iview/index.js | 8 ++- src/store.js | 12 ++++ src/views/Detail.vue | 2 +- src/views/Player.vue | 2 +- src/views/Search.vue | 123 +++++++++++++++++++------------- 10 files changed, 187 insertions(+), 62 deletions(-) create mode 100644 src/lib/sites.js rename src/{util => lib}/util.666zy.js (100%) create mode 100644 src/lib/util.zy.js diff --git a/package.json b/package.json index bdcdeb8..716f754 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "zy-player", - "version": "0.5.1", + "version": "0.5.2", "private": true, "scripts": { "serve": "vue-cli-service serve", diff --git a/src/assets/theme/light.scss b/src/assets/theme/light.scss index a489ebe..692b644 100644 --- a/src/assets/theme/light.scss +++ b/src/assets/theme/light.scss @@ -43,13 +43,7 @@ } } .search-bottom{ - border-top: 1px solid #dcdee2; - .ivu-progress-bg{ - background-color: #dcdee2; - } - span{ - color: #808695; - } + border-top: 1px solid #f0f0f0; } } .collection{ diff --git a/src/lib/sites.js b/src/lib/sites.js new file mode 100644 index 0000000..bf93585 --- /dev/null +++ b/src/lib/sites.js @@ -0,0 +1,29 @@ +const sites = [ + { + id: 'okzy', + name: 'OK资源网', + url: 'https://www.okzy.co' + }, + { + id: 'zuidazy', + name: '最大资源网', + url: 'http://www.zuidazy1.com' + }, + { + id: 'subo', + name: '速播资源站', + url: 'https://www.subo988.com' + }, + { + id: 'zuixinzy', + name: '最新资源网', + url: 'http://www.zuixinzy.cc' + }, + { + id: '123ku', + name: '123资源网', + url: 'https://www.123ku.com' + } +] + +export default sites diff --git a/src/util/util.666zy.js b/src/lib/util.666zy.js similarity index 100% rename from src/util/util.666zy.js rename to src/lib/util.666zy.js diff --git a/src/lib/util.zy.js b/src/lib/util.zy.js new file mode 100644 index 0000000..acd92b6 --- /dev/null +++ b/src/lib/util.zy.js @@ -0,0 +1,63 @@ +import axios from 'axios' +import sites from './sites' +const zy = { + num: 0, + page: 1, + key: '', + site: {}, + list: [], + getInfoRequire () { + return new Promise((resolve, reject) => { + const key = encodeURI(this.key) + const params = `${this.site.url}/index.php?m=vod-search-pg-${this.page}-wd-${key}.html` + axios.get(params).then(res => { + this.getInfoHtml(res.data).then(res => { + resolve(res) + }) + }).catch(err => { + reject(err) + }) + }) + }, + getInfoHtml (txt) { + return new Promise((resolve, reject) => { + const parser = new DOMParser() + const html = parser.parseFromString(txt, 'text/html') + const list = html.querySelectorAll('.xing_vb li') + let d = { + list: [], + num: 0 + } + for (let i = 1; i < list.length - 1; i++) { + let info = { + name: list[i].childNodes[1].innerText, + detail: this.site.url + list[i].childNodes[1].childNodes[0].getAttribute('href'), + category: list[i].childNodes[3].innerText, + time: list[i].childNodes[5].innerText, + index: 0, + urls: [], + check: false + } + d.list.push(info) + } + let num = html.querySelectorAll('.nvc dd span')[1].innerText + num = parseInt(num) + d.num = num + resolve(d) + }) + }, + info (n = 0, p = 1, k = null) { + return new Promise((resolve, reject) => { + this.page = p + this.key = k + this.num = n + this.site = sites[this.num] + this.getInfoRequire().then(res => { + resolve(res) + }) + }) + }, + detail () {} +} + +export default zy diff --git a/src/plugin/iview/index.js b/src/plugin/iview/index.js index edeac87..7e5cd35 100644 --- a/src/plugin/iview/index.js +++ b/src/plugin/iview/index.js @@ -2,8 +2,8 @@ import Vue from 'vue' import 'view-design/dist/styles/iview.css' import { Layout, Sider, Header, Content, Row, Col, - Icon, Button, Input, Progress, Table, - Message, Notice + Icon, Button, Input, Select, Option, Table, + Message, Notice, Page } from 'view-design' Vue.component('Layout', Layout) @@ -15,8 +15,10 @@ Vue.component('Col', Col) Vue.component('Icon', Icon) Vue.component('Button', Button) Vue.component('Input', Input) -Vue.component('Progress', Progress) +Vue.component('Select', Select) +Vue.component('Option', Option) Vue.component('Table', Table) +Vue.component('Page', Page) Vue.prototype.$Message = Message Vue.prototype.$Notice = Notice diff --git a/src/store.js b/src/store.js index 08d5d2a..af1e5e1 100644 --- a/src/store.js +++ b/src/store.js @@ -6,6 +6,7 @@ Vue.use(Vuex) export default new Vuex.Store({ state: { + site: 0, theme: { id: '', color: 'light' @@ -14,6 +15,9 @@ export default new Vuex.Store({ video: {} }, getters: { + getSite: state => { + return state.site + }, getTheme: state => { return state.theme }, @@ -25,6 +29,9 @@ export default new Vuex.Store({ } }, mutations: { + SET_SITE: (state, payload) => { + state.site = payload + }, SET_THEME: (state, payload) => { state.theme = payload }, @@ -40,6 +47,11 @@ export default new Vuex.Store({ setting.update(payload.id, { theme: payload.color }).then(res => { commit('SET_THEME', payload) }) + }, + changeSite: ({ commit }, payload) => { + setting.update(payload.id, { site: payload.site }).then(res => { + commit('SET_SITE', payload) + }) } } }) diff --git a/src/views/Detail.vue b/src/views/Detail.vue index 5f401c7..32e14c8 100644 --- a/src/views/Detail.vue +++ b/src/views/Detail.vue @@ -8,7 +8,7 @@ @@ -161,7 +193,7 @@ export default { position: absolute; top: 60px; width: 100%; - height: calc(100% - 80px); + height: calc(100% - 120px); padding: 10px; overflow: scroll; &::-webkit-scrollbar { display: none } @@ -180,18 +212,11 @@ export default { bottom: 0; left: 0; width: 100%; - height: 20px; + height: 60px; display: flex; align-items: center; justify-content: space-around; padding: 0 10px; - .progress-txt{ - font-size: 10px; - margin-left: 4px; - } - .progress{ - width: 100%; - } } }