index.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <template>
  2. <view class="container">
  3. <!-- 设置圆角 -->
  4. <view style="padding: 10px 30px 10px 30px;">
  5. <uni-search-bar :radius="100" @input="search" placeholder="搜索课程"></uni-search-bar>
  6. </view>
  7. <view style="background: #f5f5f5">
  8. <uni-segmented-control :current="current" :values="tabs" @clickItem="changeTab" styleType="text"
  9. activeColor="#007aff">
  10. </uni-segmented-control>
  11. </view>
  12. <yf-more-list url="/api/course/course/user-paging" :params="queryParams" ref="moreList">
  13. <template v-slot:item="{ data }">
  14. <uni-list-item :show-arrow="true" :title="data.title" :note="'类型:'+data.catId_dictText"
  15. link="navigateTo" :to="'/pages/course/detail?id='+data.id">
  16. <template v-slot:body>
  17. <view class="" style="width: 100%;">
  18. {{data.title}}
  19. </view>
  20. <view class="" style="width: 100%;display: flex; flex-direction: column;">
  21. <view class="" style="font-size: 14px;">
  22. 类型:{{data.catId_dictText}}
  23. </view>
  24. <view class="" style="display: flex;align-items: center;font-size: 14px;">
  25. 学习进度:<progress show-info style="width: 200px;"
  26. :percent="Number(data.proportion * 100).toFixed(0)"
  27. activeColor="#10AEFF" stroke-width="6" />
  28. </view>
  29. </view>
  30. </template>
  31. </uni-list-item>
  32. </template>
  33. </yf-more-list>
  34. </view>
  35. </template>
  36. <script>
  37. export default {
  38. name: 'CourseList',
  39. props: {
  40. onlyLearn: Boolean
  41. },
  42. data() {
  43. return {
  44. current: 0,
  45. tabs: ['全部', '未学习', '学习中', '已学完'],
  46. queryParams: {
  47. title: '',
  48. learnState: "0",
  49. onlyLearn: false
  50. },
  51. breakShow: false,
  52. breakId: ''
  53. }
  54. },
  55. onPullDownRefresh() {
  56. if (this.$refs.moreList) {
  57. this.$refs.moreList.initData()
  58. }
  59. },
  60. onReachBottom() {
  61. // 加载数据
  62. this.$refs.moreList.loadData()
  63. },
  64. onShow() {
  65. if (this.$refs.moreList) {
  66. this.$refs.moreList.initData()
  67. }
  68. },
  69. mounted() {
  70. if (this.onlyLearn != null) {
  71. this.queryParams.onlyLearn = this.onlyLearn
  72. }
  73. },
  74. methods: {
  75. // 搜索课程
  76. search(e) {
  77. this.queryParams.title = e
  78. },
  79. // 继续考试
  80. continueExam() {
  81. uni.redirectTo({
  82. url: '/pages/exam/exam?id=' + this.breakId
  83. });
  84. },
  85. changeTab(e) {
  86. if (this.current != e.currentIndex) {
  87. this.current = e.currentIndex;
  88. }
  89. this.queryParams.learnState = e.currentIndex
  90. }
  91. }
  92. }
  93. </script>
  94. <style>
  95. .container {
  96. font-size: 14rpx;
  97. }
  98. .exam-item {
  99. display: flex;
  100. align-items: center;
  101. line-height: 25px;
  102. }
  103. .exam-item .left {
  104. text-align: left;
  105. flex-grow: 1;
  106. }
  107. .exam-item .left .desc {
  108. color: #888;
  109. }
  110. .exam-item .left .icons {
  111. font-size: 10px;
  112. display: flex;
  113. align-items: center;
  114. color: #666;
  115. }
  116. .exam-item .right {
  117. text-align: right;
  118. }
  119. .pass {
  120. color: #007AFF !important;
  121. margin-right: 5px;
  122. }
  123. .fail {
  124. color: #ff0000 !important;
  125. margin-right: 5px;
  126. }
  127. </style>
  128. <style scoped>
  129. ::v-deep .uni-list-item__container {
  130. flex-direction: column;
  131. }
  132. ::v-deep .uni-progress-inner-bar {
  133. background-color: unset;
  134. background-image: linear-gradient(to right, #3587d8, #6855ff);
  135. }
  136. ::v-deep .uni-progress-info{
  137. font-size: 14px;
  138. }
  139. ::v-deep .uni-progress-bar,::v-deep .uni-progress-inner-bar{
  140. border-radius: 6px;
  141. }
  142. </style>