videoList.vue 1.45 KB
<template>
  <div class="book-video-list">
    <template v-for="item in prodList" :key="item" style="height: 3rem;">
      <audit-video-card :item="item"></audit-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 AuditVideoCard from '@/components/AuditVideoCard/index.vue'

import { ref } from 'vue'
import axios from '@/utils/axios';
import { Toast } from 'vant';

// 处理书籍下作品列表
const prodList = ref([])
// 因为不能让空图标提前出来的写法
const emptyStatus = ref(false);
axios.get('/srv/?a=my_prod')
.then(res => {
  if (res.data.code === 1) {
    res.data.data.prod.forEach(v => {
      v.status = v.status.toUpperCase();
      v.path = 'myVideoList'
    })
    prodList.value = res.data.data.prod;
    if (!res.data.data.prod.length) {
      emptyStatus.value = true;
    } else {
      emptyStatus.value = false;
    }
  } else {
    console.warn(res);
    if (!res.data.show) return false;
    Toast({
      icon: 'close',
      message: res.data.msg
    });
  }
})
.catch(err => {
  console.error(err); 
})
</script>

<script>
import mixin from 'common/mixin';

export default {
  mixins: [mixin.init],
  data () {
    return {
    }
  },
  mounted () {

  },
  methods: {

  }
}
</script>

<style lang="less" scoped>

</style>