| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- <template>
- <view class="open-class bgf" v-if="cardList&&cardList.length>0">
- <view class="title-box bgf">
- <text class="title">健康大讲堂</text>
- <view class="more" @click="goClassList()">
- <text>查看全部</text>
- <u-icon name="arrow-right" size='12'></u-icon>
- </view>
- </view>
- <swiper class="class-swiper" style="height: 250rpx;" :autoplay="true" circular interval="3000" duration="1000" display-multiple-items='2' next-margin="20px">
- <swiper-item class="class-swiper-item" v-for="(item, index) in cardList" :key="index" @click="goClass(item.courseId)">
- <view class="class-item">
- <view class="img-box">
- <image :src="item.imgUrl || 'https://cos.his.cdwjyyh.com/fs/20250807/1eebee6c3bff4fd68d1d3dde090bdf89.png'" mode="widthFix"></image>
- </view>
- <view class="one-t" style="max-width: 280rpx;display: block;">{{item.courseName}}</view>
- </view>
- </swiper-item>
- </swiper>
- </view>
- </template>
- <script>
- import {
- getAppletCourse
- } from '@/api/course.js'
- export default {
- data() {
- return {
- cardList: [],
- }
- },
- mounted() {
- this.getCourseList()
- },
- methods: {
- goClassList() {
- uni.navigateTo({
- url: '/pages_course/teacherClassroom'
- })
- },
- goClass(courseId) {
- uni.navigateTo({
- url: '/pages_course/learn?courseId='+courseId
- })
- },
- getCourseList() {
- getAppletCourse().then(res => {
- if (res.code == 200) {
- this.cardList = res.data.splice(0, 6)
- } else {
- uni.hideLoading();
- uni.showToast({
- title: res.msg,
- icon: 'none'
- });
- }
- })
- },
- }
- }
- </script>
- <style scoped lang="scss">
- .class-swiper {
- margin-top: 20rpx;
- }
- .class-swiper-item {
- width: 100%;
- height: 100%;
- overflow: hidden;
- }
- .open-class {
- .title-box {
- display: flex;
- justify-content: space-between;
- align-items: center;
- .title {
- font-size: 32rpx;
- font-weight: bold;
- }
- .more {
- font-size: 24rpx;
- padding-left: 30rpx;
- color: #999999;
- display: flex;
- align-items: center;
- image {
- width: 24rpx;
- height: 24rpx;
- }
- }
- }
- .class-item {
- display: inline-block;
- font-size: 24rpx;
- background-color: #fff;
- border-radius: 16rpx;
- padding: 16rpx;
- box-sizing: border-box;
- font-size: 26rpx;
- font-weight: 500;
- .img-box {
- border-radius: 16rpx;
- overflow: hidden;
- margin-bottom: 12rpx;
- width: 280rpx;
- height: 157.5rpx;
- image {
- width: 280rpx;
- height: 157.5rpx;
- }
- }
- &:last-child {
- margin-right: 0rpx;
- }
- }
- }
- </style>
|