myVideo.vue
1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<template>
<div class="">
<template v-for="item in kgProdList" :key="item" style="height: 3rem;">
<b-video-card :item="item"></b-video-card>
</template>
<div style="height: 2rem;"></div>
</div>
<van-empty v-if="emptyStatus"
class="custom-image"
:image="no_image"
description="暂无视频"
/>
</template>
<script setup>
import no_image from '@images/que-shuju@2x.png'
import BVideoCard from '@/components/BVideoCard/index.vue'
import { ref, reactive, onMounted } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import axios from '@/utils/axios';
import _ from 'lodash'
import { Toast } from 'vant';
const $route = useRoute();
const $router = useRouter();
// 处理书籍下作品列表
const kgProdList = ref([])
// 因为不能让空图标提前出来的写法
const emptyStatus = ref(false);
axios.get('/srv/?a=kg_prod_list')
.then(res => {
if (res.data.code === 1) {
_.each(res.data.data.prod, item => {
item.status = item.status.toUpperCase()
})
kgProdList.value = res.data.data.prod;
if (!kgProdList.value.length) {
emptyStatus.value = true;
}
} else {
console.warn(res);
if (!res.data.show) return false;
Toast({
icon: 'close',
message: res.data.msg
});
}
})
.catch(err => {
console.error(err);
});
</script>
<style lang="less" scoped>
</style>