diff --git a/src/components/Detail.vue b/src/components/Detail.vue
index 0597989..b854bf0 100644
--- a/src/components/Detail.vue
+++ b/src/components/Detail.vue
@@ -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('收藏成功')
})
diff --git a/src/components/History.vue b/src/components/History.vue
index aecf4d3..47c629b 100644
--- a/src/components/History.vue
+++ b/src/components/History.vue
@@ -11,7 +11,7 @@
名字
片源
- 播放至
+ 观看至
diff --git a/src/components/Play.vue b/src/components/Play.vue
index f7bfaa7..c0f9bd1 100644
--- a/src/components/Play.vue
+++ b/src/components/Play.vue
@@ -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
diff --git a/src/components/Star.vue b/src/components/Star.vue
index f063e00..0fe650c 100644
--- a/src/components/Star.vue
+++ b/src/components/Star.vue
@@ -13,6 +13,7 @@
上映
片源
备注
+ 观看至
@@ -29,6 +30,7 @@
{{i.year}}
{{getSiteName(i.key)}}
{{i.note}}
+ {{getHistoryNote(i.index)}}
播放
分享
@@ -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()