分享在详情页可选定集数,播放页面分享为当前集,其它页面分享默认首集

This commit is contained in:
buvta
2021-01-01 22:50:33 +08:00
parent c14c78b68f
commit d247a2fa23
3 changed files with 16 additions and 9 deletions

View File

@@ -36,7 +36,7 @@
</div>
</div>
<div class="operate">
<span @click="playEvent(0)">播放</span>
<span @click="playEvent(selectedEpisode)">播放</span>
<span @click="starEvent">收藏</span>
<span @click="downloadEvent">下载</span>
<span @click="shareEvent">分享</span>
@@ -61,7 +61,7 @@
</div>
<div class="m3u8">
<div class="box">
<span v-for="(i, j) in videoList" :key="j" @click="playEvent(j)">{{i | ftName}}</span>
<span v-bind:class="{ selected: j === selectedEpisode }" v-for="(i, j) in videoList" :key="j" @click="playEvent(j)" @mouseenter="() => { selectedEpisode = j }">{{i | ftName}}</span>
</div>
</div>
</div>
@@ -87,6 +87,7 @@ export default {
videoFullList: [],
info: {},
playOnline: false,
selectedEpisode: 0, // 选定集数
selectedOnlineSite: '哔嘀',
onlineSites: ['哔嘀', '素白白', '简影', '极品', '喜欢看', '1080影视']
}
@@ -256,7 +257,8 @@ export default {
this.share = {
show: true,
key: this.detail.key,
info: this.info
info: this.info,
index: this.selectedEpisode
}
},
doubanLinkEvent () {
@@ -276,7 +278,10 @@ export default {
const id = this.detail.info.ids || this.detail.info.id
const cacheKey = this.detail.key + '@' + id
const db = await history.find({ site: this.detail.key, ids: id })
if (db) this.videoFlag = db.videoFlag
if (db) {
this.videoFlag = db.videoFlag
this.selectedEpisode = db.index
}
if (!this.DetailCache[cacheKey]) {
this.DetailCache[cacheKey] = await zy.detail(this.detail.key, id)
}

View File

@@ -910,7 +910,8 @@ export default {
this.share = {
show: true,
key: this.video.key,
info: this.DetailCache[this.video.key + '@' + this.video.info.id]
info: this.DetailCache[this.video.key + '@' + this.video.info.id],
index: this.video.info.index
}
},
issueEvent () {

View File

@@ -76,10 +76,10 @@ export default {
info: {}
}
},
async getUrl (dl) {
async getUrl (dl, index) {
const t = dl.dd._t
if (t) {
return t.split('#')[0].split('$')[1]
return t.split('#')[index].split('$')[1]
} else {
const id = this.share.info.ids || this.share.info.id
const cacheKey = this.share.key + '@' + id
@@ -89,14 +89,15 @@ export default {
this.DetailCache[cacheKey] = res
}
if (res) {
return res.fullList[0].list[0]
return res.fullList[0].list[index]
}
}
},
async getDetail () {
this.loading = true
this.pic = this.share.info.pic
const url = await this.getUrl(this.share.info.dl)
const index = this.share.index || 0
const url = await this.getUrl(this.share.info.dl, index)
this.link = 'http://hunlongyu.gitee.io/zy-player-web?url=' + url + '&name=' + this.share.info.name
this.loading = false
},