新增对接追剧数据

This commit is contained in:
gyq
2025-01-07 11:02:41 +08:00
parent 425673707f
commit 3d387be4eb
3 changed files with 47 additions and 60 deletions

View File

@@ -0,0 +1,26 @@
<template>
<view class="container">
<up-empty :icon="props.icon" :text="props.text"></up-empty>
</view>
</template>
<script setup>
const props = defineProps({
icon: {
type: String,
default: '/static/default/none.png'
},
text: {
type: String,
default: '空空如也~'
}
});
</script>
<style scoped lang="scss">
.container {
width: 100%;
display: flex;
justify-content: center;
}
</style>

View File

@@ -7,57 +7,18 @@
<navigator class="more" url="/pages/watching_history/watching_history?type=3">更多</navigator> <navigator class="more" url="/pages/watching_history/watching_history?type=3">更多</navigator>
</view> </view>
<view class="list"> <view class="list">
<view class="item"> <view class="item" v-for="item in data.list1" :key="item.id">
<view class="cover"> <view class="cover">
<image class="img" src="https://img0.baidu.com/it/u=966333451,3199467079&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=714" mode="aspectFill"></image> <image class="img" :src="item.titleImg" mode="aspectFill"></image>
<view class="num">第三集</view> <view class="num">{{ item.courseDetailsName }}</view>
</view> </view>
<view class="intro-wrap"> <view class="intro-wrap">
<view class="name">我在八十年代当后妈</view> <view class="name">{{ item.title }}</view>
<view class="t">言情</view> <view class="t">{{ item.courseLabel }}</view>
</view>
</view>
<view class="item">
<view class="cover">
<image class="img" src="https://img0.baidu.com/it/u=966333451,3199467079&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=714" mode="aspectFill"></image>
<view class="num">第三集</view>
</view>
<view class="intro-wrap">
<view class="name">我在八十年代当后妈</view>
<view class="t">言情</view>
</view>
</view>
<view class="item">
<view class="cover">
<image class="img" src="https://img0.baidu.com/it/u=966333451,3199467079&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=714" mode="aspectFill"></image>
<view class="num">第三集</view>
</view>
<view class="intro-wrap">
<view class="name">我在八十年代当后妈</view>
<view class="t">言情</view>
</view>
</view>
<view class="item">
<view class="cover">
<image class="img" src="https://img0.baidu.com/it/u=966333451,3199467079&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=714" mode="aspectFill"></image>
<view class="num">第三集</view>
</view>
<view class="intro-wrap">
<view class="name">我在八十年代当后妈</view>
<view class="t">言情</view>
</view>
</view>
<view class="item">
<view class="cover">
<image class="img" src="https://img0.baidu.com/it/u=966333451,3199467079&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=714" mode="aspectFill"></image>
<view class="num">第三集</view>
</view>
<view class="intro-wrap">
<view class="name">我在八十年代当后妈</view>
<view class="t">言情</view>
</view> </view>
</view> </view>
</view> </view>
<emprty-card v-if="!data.list1.length" />
</view> </view>
<view class="list-wrap"> <view class="list-wrap">
<view class="title-wrap"> <view class="title-wrap">
@@ -65,19 +26,20 @@
<navigator class="more" url="/pages/watching_history/watching_history?type=1">更多</navigator> <navigator class="more" url="/pages/watching_history/watching_history?type=1">更多</navigator>
</view> </view>
<view class="list"> <view class="list">
<view class="item"> <view class="item" v-for="item in data.list2" :key="item.id">
<div class="item-content"> <div class="item-content">
<view class="cover"> <view class="cover">
<image class="img" src="https://img0.baidu.com/it/u=966333451,3199467079&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=714" mode="aspectFill"></image> <image class="img" :src="item.titleImg" mode="aspectFill"></image>
<view class="num">第三集</view> <view class="num">{{ item.courseDetailsName }}</view>
</view> </view>
<view class="intro-wrap"> <view class="intro-wrap">
<view class="name">我在八十年代当后妈</view> <view class="name">{{ item.title }}</view>
<view class="t">言情</view> <view class="t">{{ item.courseLabel }}</view>
</view> </view>
</div> </div>
</view> </view>
</view> </view>
<emprty-card v-if="!data.list2.length" />
</view> </view>
</view> </view>
</template> </template>
@@ -87,12 +49,13 @@ import { reactive } from 'vue';
import { selectByUserId } from '@/api/me/me.js'; import { selectByUserId } from '@/api/me/me.js';
import { onLoad, onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app'; import { onLoad, onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app';
// 获取数据
async function selectByUserIdAjax() { async function selectByUserIdAjax() {
try { try {
const res1 = await selectByUserId({ page: 1, limit: 6, classify: 3 }); const res1 = await selectByUserId({ page: 1, limit: 6, classify: 3 });
const res2 = await selectByUserId({ page: 1, limit: 6, classify: 6 }); const res2 = await selectByUserId({ page: 1, limit: 6, classify: 6 });
console.log(res1); data.list1 = res1.records;
console.log(res2); data.list2 = res2.records;
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }

View File

@@ -19,7 +19,8 @@
</view> </view>
</view> </view>
</view> </view>
<up-divider text="到底了~" v-if="listData.list.length && listData.finish"></up-divider> <emprty-card v-if="!listData.list.length && listData.status == 'nomore'" />
<up-loadmore :status="listData.status" />
</view> </view>
</template> </template>
@@ -45,7 +46,7 @@ const listData = reactive({
list: [], list: [],
page: 1, page: 1,
size: 10, size: 10,
finish: false status: 'loading'
}); });
// 获取数据 // 获取数据
@@ -56,12 +57,9 @@ async function selectByUserIdAjax() {
limit: listData.size, limit: listData.size,
classify: type.value classify: type.value
}); });
console.log(res); listData.list = res.records;
if (res.code === 0) { if (res.currPage >= res.totalPage) {
listData.list = res.data.records; listData.status = 'nomore';
if (res.data.currPage >= res.data.totalPage) {
listData.finish = true;
}
} }
} catch (error) { } catch (error) {
console.log(error); console.log(error);