123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- <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">
- </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>
|