|
|
@@ -56,7 +56,7 @@
|
|
|
|
|
|
<script>
|
|
|
import VideoCard from '@/components/card/VideoCard'
|
|
|
-import { getUserCollection } from "@/api/collect";
|
|
|
+import { getUserCollection, deleteVideoCollection, eraseVideoCollection } from "@/api/collect";
|
|
|
|
|
|
export default {
|
|
|
name: 'Collection',
|
|
|
@@ -99,21 +99,14 @@ export default {
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning'
|
|
|
}).then(() => {
|
|
|
- console.log('从收藏夹中删除 ' + videoId)
|
|
|
- // 确认
|
|
|
- /* removeCollection(this.uid, video.vid).then(res => {
|
|
|
- // console.log(res);
|
|
|
- // 将要删除的当前video对象移除数组
|
|
|
- // 获取下标
|
|
|
- const index = this.dataList.indexOf(video)
|
|
|
- if (index > -1) {
|
|
|
- this.dataList.splice(index, 1)
|
|
|
+ deleteVideoCollection(videoId).then(res => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '移除成功!'
|
|
|
+ })
|
|
|
+ this.$router.go(0)
|
|
|
}
|
|
|
- })*/
|
|
|
-
|
|
|
- this.$message({
|
|
|
- type: 'success',
|
|
|
- message: '移除成功!'
|
|
|
})
|
|
|
}).catch(() => {
|
|
|
this.$message({
|
|
|
@@ -129,22 +122,15 @@ export default {
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning'
|
|
|
}).then(() => {
|
|
|
- console.log('清空收藏夹')
|
|
|
-
|
|
|
- const arr = []
|
|
|
- for (const i of this.dataList) {
|
|
|
- arr.push(i.vid)
|
|
|
- }
|
|
|
- // const vidStr = arr.join(',')
|
|
|
- // console.log(vidStr);
|
|
|
- // 确认
|
|
|
- /* removeCollection(this.uid, vidStr).then(res => {
|
|
|
- this.dataList = []
|
|
|
- })*/
|
|
|
+ eraseVideoCollection().then(res => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '收藏夹已清空!'
|
|
|
+ })
|
|
|
|
|
|
- this.$message({
|
|
|
- type: 'success',
|
|
|
- message: '移除成功!'
|
|
|
+ this.$router.go(0)
|
|
|
+ }
|
|
|
})
|
|
|
}).catch(() => {
|
|
|
this.$message({
|