对接后端 hgmjapi.mfcg.me: - 接口解密 key 更新为 resKey360 - 登录 sysType 使用原生 getDevType(后端已放开 pc/android) - 修正榜单接口路径 /vid/rangking → /vid/ranking,方法改为 GET Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
170 lines
3.9 KiB
Vue
170 lines
3.9 KiB
Vue
|
|
<template>
|
|
<div class="likes">
|
|
<h1 class="title">
|
|
<span>我的收藏</span>
|
|
<span class="edit-btn" v-if="!state.isEdit" @click="state.isEdit = true">编辑</span>
|
|
<div class="list-btn" v-else>
|
|
<span class="btn1" @click="state.isEdit = false">取消</span>
|
|
<span class="edit-btn btn2" @click="cancelCollection">取消收藏</span>
|
|
</div>
|
|
</h1>
|
|
<div class="movie-list">
|
|
<div class="all-select" v-if="state.isEdit" @click="allSelectFn">
|
|
<img v-if="!state.allSelect" src="@/assets/images/pc/select1.png" alt="">
|
|
<img v-else src="@/assets/images/pc/select2.png" alt="">
|
|
全选
|
|
</div>
|
|
<div class="item-wrap" v-for="(item, index) in likesList" :key="index">
|
|
<movieCard :itemData="item" />
|
|
<div class="mask" v-if="state.isEdit" @click="item.check = !item.check">
|
|
<img v-if="!item.check" src="@/assets/images/pc/select1.png" alt="">
|
|
<img v-else src="@/assets/images/pc/select2.png" alt="">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts" name="mine-likes">
|
|
import { ref, computed, reactive } from 'vue'
|
|
import MineApi from '@/service/mine'
|
|
const userInfo = computed(() => {
|
|
const data = localStorage.getItem('userInfo')
|
|
if (data) {
|
|
return JSON.parse(data)
|
|
}
|
|
return data
|
|
})
|
|
const likesList = ref([])
|
|
const geLikeList = async () => {
|
|
const res: any = await MineApi.queryCollectionList({
|
|
pageNumber: 1,
|
|
pageSize: 10,
|
|
type: 'video',
|
|
uid: userInfo.value.uid
|
|
})
|
|
const list = res.list
|
|
list.forEach((item: any) => {
|
|
item.check = false
|
|
})
|
|
likesList.value = list
|
|
};
|
|
geLikeList()
|
|
|
|
const state = reactive({
|
|
isEdit: false,
|
|
select: false,
|
|
allSelect: false
|
|
})
|
|
|
|
const allSelectFn = () => {
|
|
state.allSelect = !state.allSelect
|
|
likesList.value.forEach(item => {
|
|
item.check = state.allSelect
|
|
})
|
|
}
|
|
|
|
const cancelCollection = async () => {
|
|
// 选中删除
|
|
const filterDeleteData = likesList.value.filter(item => item.check)
|
|
const objIds = filterDeleteData.map(item => item.id)
|
|
|
|
await MineApi.batchUnCollect({
|
|
isCollect: true,
|
|
objIds,
|
|
type: "video"
|
|
})
|
|
|
|
setTimeout(() => {
|
|
geLikeList()
|
|
}, 300)
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.likes {
|
|
margin: 70px 0 0 250px;
|
|
width: 1120px;
|
|
.title {
|
|
font-size: 30px;
|
|
font-weight: 600;
|
|
line-height: 61px;
|
|
border-bottom: 1px solid #fff2;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
.edit-btn {
|
|
@include flexCenter;
|
|
width: 72px;
|
|
height: 30px;
|
|
border-radius: 4px;
|
|
background: linear-gradient(270deg, #FFC303 0%, #FFDD01 100%);
|
|
color: #FFF;
|
|
font-size: 14px;
|
|
font-weight: 400;
|
|
cursor: pointer;
|
|
}
|
|
.list-btn {
|
|
@include flexCenter;
|
|
gap: 16px;
|
|
.btn1 {
|
|
@include flexCenter;
|
|
width: 72px;
|
|
height: 30px;
|
|
border-radius: 4px;
|
|
border: 1px solid #FFC303;
|
|
color: #FFC303;
|
|
font-size: 14px;
|
|
font-weight: 400;
|
|
cursor: pointer;
|
|
}
|
|
}
|
|
}
|
|
.movie-list {
|
|
padding-top: 50px;
|
|
display: flex;
|
|
gap: 20px;
|
|
flex-wrap: wrap;
|
|
.all-select {
|
|
height: 52px;
|
|
display: flex;
|
|
align-items: center;
|
|
position: absolute;
|
|
top: 0;
|
|
right: 0;
|
|
img {
|
|
width: 24px;
|
|
height: 24px;
|
|
cursor: pointer;
|
|
margin-right: 8px;
|
|
}
|
|
}
|
|
.item-wrap {
|
|
width: 360px;
|
|
height: 320px;
|
|
border-radius: 8px;
|
|
position: relative;
|
|
.mask {
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
z-index: 2;
|
|
width: 100%;
|
|
height: 100%;
|
|
background: rgba(26, 28, 34, 0.5);
|
|
cursor: pointer;
|
|
img {
|
|
width: 24px;
|
|
height: 24px;
|
|
position: absolute;
|
|
top: 10px;
|
|
right: 10px;
|
|
z-index: 11;
|
|
cursor: pointer;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style> |