<template> <view class="container"> <!-- 设置圆角 --> <view style="padding: 10px 30px 10px 30px;"> <uni-search-bar :radius="100" @input="search" placeholder="搜索课程"></uni-search-bar> </view> <view style="background: #f5f5f5"> <uni-segmented-control :current="current" :values="tabs" @clickItem="changeTab" styleType="text" activeColor="#007aff"> </uni-segmented-control> </view> <yf-more-list url="/api/course/course/user-paging" :params="queryParams" ref="moreList"> <template v-slot:item="{ data }"> <uni-list-item :show-arrow="true" :title="data.title" :note="'类型:'+data.catId_dictText" link="navigateTo" :to="'/pages/course/detail?id='+data.id"> <template v-slot:body> <view class="" style="width: 100%;"> {{data.title}} </view> <view class="" style="width: 100%;display: flex; flex-direction: column;"> <view class="" style="font-size: 14px;"> 类型:{{data.catId_dictText}} </view> <view class="" style="display: flex;align-items: center;font-size: 14px;"> 学习进度:<progress show-info style="width: 200px;" :percent="Number(data.proportion * 100).toFixed(0)" activeColor="#10AEFF" stroke-width="6" /> </view> </view> </template> </uni-list-item> </template> </yf-more-list> </view> </template> <script> export default { name: 'CourseList', props: { onlyLearn: Boolean }, data() { return { current: 0, tabs: ['全部', '未学习', '学习中', '已学完'], queryParams: { title: '', learnState: "0", onlyLearn: false }, breakShow: false, breakId: '' } }, onPullDownRefresh() { if (this.$refs.moreList) { this.$refs.moreList.initData() } }, onReachBottom() { // 加载数据 this.$refs.moreList.loadData() }, onShow() { if (this.$refs.moreList) { this.$refs.moreList.initData() } }, mounted() { if (this.onlyLearn != null) { this.queryParams.onlyLearn = this.onlyLearn } }, methods: { // 搜索课程 search(e) { this.queryParams.title = e }, // 继续考试 continueExam() { uni.redirectTo({ url: '/pages/exam/exam?id=' + this.breakId }); }, changeTab(e) { if (this.current != e.currentIndex) { this.current = e.currentIndex; } this.queryParams.learnState = e.currentIndex } } } </script> <style> .container { font-size: 14rpx; } .exam-item { display: flex; align-items: center; line-height: 25px; } .exam-item .left { text-align: left; flex-grow: 1; } .exam-item .left .desc { color: #888; } .exam-item .left .icons { font-size: 10px; display: flex; align-items: center; color: #666; } .exam-item .right { text-align: right; } .pass { color: #007AFF !important; margin-right: 5px; } .fail { color: #ff0000 !important; margin-right: 5px; } </style> <style scoped> ::v-deep .uni-list-item__container { flex-direction: column; } ::v-deep .uni-progress-inner-bar { background-color: unset; background-image: linear-gradient(to right, #3587d8, #6855ff); } ::v-deep .uni-progress-info{ font-size: 14px; } ::v-deep .uni-progress-bar,::v-deep .uni-progress-inner-bar{ border-radius: 6px; } </style>