|
|
@@ -77,7 +77,7 @@
|
|
|
</v-btn>
|
|
|
</v-col>
|
|
|
<v-col cols="2">
|
|
|
- <v-btn icon @click="collectVideo">
|
|
|
+ <v-btn icon @click="collectVideoWrapper">
|
|
|
<v-icon>mdi-bookmark</v-icon>
|
|
|
<span>收藏(10000)</span>
|
|
|
</v-btn>
|
|
|
@@ -292,11 +292,29 @@
|
|
|
</v-col>
|
|
|
</v-row>
|
|
|
</v-container>
|
|
|
+ <v-snackbar
|
|
|
+ v-model="showMessage"
|
|
|
+ :top="true"
|
|
|
+ :timeout="1000"
|
|
|
+ >
|
|
|
+ {{ message }}
|
|
|
+ <template v-slot:action="{ attrs }">
|
|
|
+ <v-btn
|
|
|
+ color="pink"
|
|
|
+ text
|
|
|
+ v-bind="attrs"
|
|
|
+ @click="showMessage = false"
|
|
|
+ >
|
|
|
+ 关闭
|
|
|
+ </v-btn>
|
|
|
+ </template>
|
|
|
+ </v-snackbar>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import { similarVideo, videoInfo } from '@/api/media/video'
|
|
|
+import { collectVideo } from '@/api/media/collection'
|
|
|
import ItemCard from '@/components/card/item-card.vue'
|
|
|
import CommentCard from '@/components/card/comment-card.vue'
|
|
|
import VideoPlayer from '@/components/player/player.vue'
|
|
|
@@ -331,7 +349,9 @@ export default {
|
|
|
},
|
|
|
showComment: true,
|
|
|
vidProp: null,
|
|
|
- benched: 0
|
|
|
+ benched: 0,
|
|
|
+ showMessage: false,
|
|
|
+ message: ''
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -404,8 +424,22 @@ export default {
|
|
|
thumbsupVideo() {
|
|
|
console.log('点赞 ' + this.videoId)
|
|
|
},
|
|
|
- collectVideo() {
|
|
|
- console.log('收藏 ' + this.videoId)
|
|
|
+ collectVideoWrapper() {
|
|
|
+ const obj = {}
|
|
|
+ obj.videoId = this.videoId
|
|
|
+ collectVideo(obj)
|
|
|
+ .then(res => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ this.showMessage = true
|
|
|
+ this.message = '已收藏'
|
|
|
+ } else {
|
|
|
+ this.showMessage = true
|
|
|
+ this.message = res.msg
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ console.error(error.message)
|
|
|
+ })
|
|
|
},
|
|
|
jumpToTagPage(value) {
|
|
|
console.log('跳转到标签页: ' + value)
|