From 38d751d4c012c3ffc35fe224d3f774671d6e16f2 Mon Sep 17 00:00:00 2001 From: Hunlongyu Date: Wed, 4 Dec 2019 18:33:31 +0800 Subject: [PATCH] do search page --- src/assets/theme/light.scss | 26 ++++++-- src/plugin/iview/index.js | 5 +- src/store.js | 2 +- src/util/util.video.js | 41 ++++++++---- src/views/Search.vue | 130 ++++++++++++++++++++++++++++++++++-- 5 files changed, 179 insertions(+), 25 deletions(-) diff --git a/src/assets/theme/light.scss b/src/assets/theme/light.scss index 8e70957..6881084 100644 --- a/src/assets/theme/light.scss +++ b/src/assets/theme/light.scss @@ -4,25 +4,22 @@ color: #515a6e; } .sider{ - border-right: 1px solid #dcdee2; .sider-box{ color: #808695; i{ &:hover{ color: #515a6e; background-color: #efefef; - border-right: 1px solid #808695; } &.active{ color: #515a6e; background-color: #efefef; - border-left: 2px solid #515a6e; + border-left: 4px solid #515a6e; } } } } .header{ - border-bottom: 1px solid #dcdee2; .header-box{ color: #808695; i{ @@ -34,4 +31,25 @@ } } } + .content{ + border: 1px solid #dcdee2; + } + .search{ + .search-middle{ + .ivu-table-cell{ + button{ + margin: 0 4px; + } + } + } + .search-bottom{ + border-top: 1px solid #dcdee2; + .ivu-progress-bg{ + background-color: #dcdee2; + } + span{ + color: #808695; + } + } + } } \ No newline at end of file diff --git a/src/plugin/iview/index.js b/src/plugin/iview/index.js index f35b357..447029f 100644 --- a/src/plugin/iview/index.js +++ b/src/plugin/iview/index.js @@ -2,7 +2,7 @@ import Vue from 'vue' import 'view-design/dist/styles/iview.css' import { Layout, Sider, Header, Content, Row, Col, - Icon, Button + Icon, Button, Input, Progress, Table } from 'view-design' Vue.component('Layout', Layout) @@ -13,3 +13,6 @@ Vue.component('Row', Row) Vue.component('Col', Col) Vue.component('Icon', Icon) Vue.component('Button', Button) +Vue.component('Input', Input) +Vue.component('Progress', Progress) +Vue.component('Table', Table) diff --git a/src/store.js b/src/store.js index 7977246..f1ef914 100644 --- a/src/store.js +++ b/src/store.js @@ -6,7 +6,7 @@ Vue.use(Vuex) export default new Vuex.Store({ state: { theme: 'light', - iconActive: 'list' + iconActive: 'search' }, getters: { getTheme: state => { diff --git a/src/util/util.video.js b/src/util/util.video.js index 5334b22..7342f13 100644 --- a/src/util/util.video.js +++ b/src/util/util.video.js @@ -2,12 +2,7 @@ import axios from 'axios' const video = { url: 'http://www.666zy.com/', - init () { - console.log('init') - this.post(this.url, '冰雪奇缘') - }, - getList () {}, - post (url, txt) { + getList (url, txt) { const t = encodeURI(txt) const d = `wd=${t}&submit=search` axios({ @@ -21,14 +16,34 @@ const video = { }, parser (txt) { const parser = new DOMParser() - const html = parser.parseFromString(txt, 'text/html') - console.log(html) - const list = html.querySelectorAll('.xing_vb4 a') - console.log(list) - for (let i = 0; i < list.length; i++) { - console.log(i, list[i].innerHTML, 'innerHTML') - console.log(i, list[i].getAttribute('href'), 'href') + let html = parser.parseFromString(txt, 'text/html') + let data = [] + let name = [] + let detail = [] + let type = [] + let time = [] + let nameList = html.querySelectorAll('.xing_vb4 a') + for (let i = 0; i < nameList.length; i++) { + name.push(nameList[i].innerText) + detail.push('http://www.666zy.com' + nameList[i].getAttribute('href')) } + let typeList = html.querySelectorAll('.xing_vb5 a') + for (let i = 0; i < typeList.length; i++) { + type.push(typeList[i].innerText) + } + let timeList = html.querySelectorAll('.xing_vb6') + for (let i = 0; i < timeList.length; i++) { + time.push(timeList[i].innerText) + } + for (let i = 0; i < name.length; i++) { + let d = {} + d.name = name[i] + d.detail = detail[i] + d.type = type[i] + d.time = time[i] + data.push(d) + } + return data } } diff --git a/src/views/Search.vue b/src/views/Search.vue index da12b77..0838004 100644 --- a/src/views/Search.vue +++ b/src/views/Search.vue @@ -1,13 +1,131 @@ +