收藏页面添加观看至第几集的信息

This commit is contained in:
haiyangcui
2020-09-07 23:36:55 +02:00
parent 595136c799
commit a1458cf8bf
4 changed files with 44 additions and 37 deletions

View File

@@ -134,20 +134,18 @@ export default {
},
starEvent () {
star.find({ key: this.detail.key, ids: this.info.id }).then(res => {
const docs = {
key: this.detail.key,
ids: this.info.id,
name: this.info.name,
type: this.info.type,
year: this.info.year,
last: this.info.last,
note: this.info.note
}
if (res) {
star.update(res.id, docs).then(res => {
this.$message.success('已存在,更新成功')
})
this.$message.info('该影片已被收藏')
} else {
const docs = {
key: this.detail.key,
ids: this.info.id,
name: this.info.name,
type: this.info.type,
year: this.info.year,
last: this.info.last,
note: this.info.note
}
star.add(docs).then(res => {
this.$message.success('收藏成功')
})

View File

@@ -11,7 +11,7 @@
<li v-show="this.history.length > 0">
<span class="name">名字</span>
<span class="site">片源</span>
<span class="note">播放</span>
<span class="note">观看</span>
<span class="operate">
<span class="btn"></span>
<span class="btn"></span>

View File

@@ -407,6 +407,7 @@ export default {
history.add(doc)
}
})
this.updateStar()
this.timerEvent()
},
changeVideo () {
@@ -465,21 +466,33 @@ export default {
this.right.history = res.reverse()
})
},
starEvent () {
updateStar () {
const info = this.video.info
star.find({ key: this.video.key, ids: info.id }).then(res => {
if (res) {
this.$message.info('已存在')
res.index = info.index
star.update(res.id, res)
}
}).catch(() => {
this.$message.warning('检查收藏失败')
})
},
starEvent () {
const info = this.video.info
star.find({ key: this.video.key, ids: info.id }).then(res => {
const doc = {
key: this.video.key,
ids: info.id,
name: info.name,
type: info.type,
year: info.year,
last: info.last,
note: info.note,
index: info.index
}
if (res) {
star.update(res.id, doc)
} else {
const doc = {
key: this.video.key,
ids: info.id,
name: info.name,
type: info.type,
year: info.year,
last: info.last,
note: info.note
}
star.add(doc).then(starRes => {
this.$message.success('收藏成功')
this.isStar = true

View File

@@ -13,6 +13,7 @@
<span class="time">上映</span>
<span class="site">片源</span>
<span class="note">备注</span>
<span class="note">观看至</span>
<span class="operate">
<span class="btn"></span>
<span class="btn"></span>
@@ -29,6 +30,7 @@
<span class="time">{{i.year}}</span>
<span class="site">{{getSiteName(i.key)}}</span>
<span class="note">{{i.note}}</span>
<span class="note">{{getHistoryNote(i.index)}}</span>
<span class="operate">
<span class="btn" @click.stop="playEvent(i)">播放</span>
<span class="btn" @click.stop="shareEvent(i)">分享</span>
@@ -96,19 +98,6 @@ export default {
this.SET_SHARE(val)
}
}
// draggableList: {
// get () {
// return this.list
// },
// set (value) {
// star.clear().then(res1 => {
// star.bulkAdd(value).then(res2 => {
// this.$message.success('排序成功')
// this.list = value
// })
// })
// }
// }
},
watch: {
view () {
@@ -263,6 +252,13 @@ export default {
return site.name
}
},
getHistoryNote (index) {
if (index !== null && index !== undefined) {
return `${index + 1}`
} else {
return ''
}
},
getStarList () {
star.all().then(res => {
this.list = res.reverse()