Files
tra-app/src/pages/preview/components/previewCourse.vue
T

140 lines
3.0 KiB
Vue

<template>
<z-paging
ref="pagingRef"
v-model="data_list"
@query="queryList"
:auto="false"
empty-view-text="暂无数据"
paging-class="pagingClass"
>
<view class="item" v-for="item in data_list" @click="goto_course_detail(item)">
<view class="img_div">
<image-preview class="img" :imgId="item.imgId"></image-preview>
</view>
<view class="right_div">
<view class="title ellipsis-text">{{ item.crsName }}</view>
<view class="tag_div">
<view class="tag" v-for="tag in item.tagCataList">{{ tag.tagName }}</view>
</view>
<view class="time_and_num"></view>
</view>
</view>
</z-paging>
</template>
<script setup>
import common from '@/common/common';
import { ref, reactive, onMounted, nextTick, watch } from 'vue';
import { queryTraStdyInfoPreviewPaging } from '@/api/preview.js';
import useZpaging from '@/composables/useZpaging';
const { pagingRef, queryList, data_list, reload, total } = useZpaging({
fetchFunction: queryTraStdyInfoPreviewPaging
});
const props = defineProps(['tabIndex', 'currentIndex']);
const goto_course_detail = (item) => {
common.navigateTo('/pages/courseDetail/index?isPreview=preview&crsId=' + item.crsId);
};
onMounted(() => {
watch(
() => props.currentIndex,
(v) => v === props.tabIndex && total.value === -1 && reload(),
{ immediate: true }
);
});
</script>
<style scoped lang="scss">
.pagingClass {
width: calc(100% - 44rpx);
margin: 22rpx auto;
background-color: #fff;
border-radius: 16rpx;
}
.item {
// height: 170rpx;
margin: 22rpx 22rpx;
display: flex;
.img_div {
position: relative;
width: 256rpx;
height: 144rpx;
overflow: hidden;
border-radius: 16rpx;
.img {
// width: 224rpx;
// height: 168rpx;
width: 256rpx;
height: 144rpx;
}
.subscript {
position: absolute;
right: 0;
top: 0;
width: 78rpx;
height: 46rpx;
border-radius: 0px 0px 0px 22rpx;
font-family: PingFangSC;
font-weight: 400;
font-size: 22rpx;
display: flex;
align-items: center;
justify-content: center;
background-color: #ef5705;
color: #ffffff;
}
}
.right_div {
flex: 1;
overflow: hidden;
margin-left: 24rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
.title {
font-family: PingFangSC;
font-size: 30rpx;
font-weight: 600;
color: #333333;
}
.tag_div {
display: flex;
flex-wrap: wrap;
height: 38rpx;
overflow: hidden;
.tag {
height: 38rpx;
padding: 0 10rpx;
margin-right: 14rpx;
border-radius: 8rpx;
border: 2rpx solid #ffa150;
font-family: PingFangSC;
font-weight: 500;
font-size: 23rpx;
color: #ffa150;
display: flex;
justify-content: center;
align-items: center;
}
}
.time_and_num {
display: flex;
font-family: PingFangSC;
font-weight: 400;
font-size: 23rpx;
color: #999999;
margin-bottom: 16rpx;
line-height: 23rpx;
flex-wrap: nowrap;
height: 23rpx;
overflow: hidden;
}
}
}
</style>