123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- <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>
|