优化收藏页面和详情页面

This commit is contained in:
hunlongyu
2020-01-08 11:15:53 +08:00
parent 188035c4a1
commit f4becc4645
6 changed files with 72 additions and 134 deletions

View File

@@ -8,7 +8,7 @@
</div>
</template>
<script>
import haku from '@/lib/util.666zy'
import zy from '@/lib/util.zy'
import { mapMutations } from 'vuex'
export default {
name: 'detail',
@@ -40,7 +40,7 @@ export default {
async getDetail () {
this.box = false
let url = this.video.detail
this.data = await haku.getDetail(url)
this.data = await zy.detail(url)
this.video.urls = this.data.urls
this.video.check = true
this.box = true

View File

@@ -10,7 +10,8 @@
<script>
import 'xgplayer'
import Hls from 'xgplayer-hls.js'
import haku from '@/lib/util.666zy'
import zy from '@/lib/util.zy'
// import haku from '@/lib/util.666zy'
export default {
name: 'player',
data () {
@@ -56,7 +57,7 @@ export default {
async getDetail () {
let d = this.video.detail
let index = this.video.index
this.data = await haku.getDetail(d)
this.data = await zy.detail(d)
let urls = this.data.urls
this.video.urls = urls
this.video.check = true
@@ -73,6 +74,7 @@ export default {
playBtn (i, j, e) {
this.video.index = j
let url = this.video.urls[this.video.index].split('$')[1]
this.info = this.video.urls[this.video.index].split('$')[0]
this.xg.src = url
}
},

View File

@@ -37,18 +37,19 @@ export default {
columns: [
{
title: 'Name',
key: 'name'
key: 'name',
minWidth: 240
},
{
title: 'Category',
key: 'category',
width: 120,
width: 100,
align: 'center'
},
{
title: 'Time',
key: 'time',
width: 180,
width: 110,
align: 'center'
},
{
@@ -109,37 +110,35 @@ export default {
this.$router.push({ name: 'play' })
},
async collection (e) {
console.log(e)
// let d = await haku.getDetail(e.detail)
// let d = {}
// let data = {
// category: e.category,
// detail: e.detail,
// name: e.name,
// time: e.time,
// type: 'single',
// index: 0,
// urls: [],
// check: false
// }
// data.urls = d.urls
// data.check = true
// this.$store.commit('SET_VIDEO', data)
// db.find({ detail: data.detail }).then(res => {
// if (res.length >= 1) {
// this.$Notice.warning({
// title: '资源已存在',
// backgroud: true
// })
// } else {
// db.add(data).then(res => {
// this.$Notice.success({
// title: '收藏成功',
// backgroud: true
// })
// })
// }
// })
let d = await zy.detail(e.detail)
let data = {
category: e.category,
detail: e.detail,
name: e.name,
time: e.time,
type: 'single',
index: 0,
urls: [],
check: false
}
data.urls = d.urls
data.check = true
this.$store.commit('SET_VIDEO', data)
db.find({ detail: data.detail }).then(res => {
if (res.length >= 1) {
this.$Notice.warning({
title: '资源已存在',
backgroud: true
})
} else {
db.add(data).then(res => {
this.$Notice.success({
title: '收藏成功',
backgroud: true
})
})
}
})
},
detail (e) {
this.$store.commit('SET_VIDEO', e)