list.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <view class="container">
  3. <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption"
  4. :up="upOption">
  5. <view class="box">
  6. <view class="list-item" v-for="(item,index) in dataList" :key="index" @click="handleDetail(item)">
  7. <view class="list-con border-line">
  8. <view class="list-itemtxt">
  9. <text class="list-title textOne">{{item.courseName}}</text>
  10. <text class="list-desc textTwo">{{item.title}}</text>
  11. </view>
  12. <image :src="item.courseUrl" mode="aspectFill"></image>
  13. </view>
  14. <view class="list-footer">
  15. <view style="flex: 1;overflow: hidden;">
  16. <!-- <image :src="item.imageUrl" mode="aspectFill"></image> -->
  17. <text class="list-time textOne">{{item.qwUserName}}</text>
  18. </view>
  19. <text class="list-time">过期时间:{{item.updateTime}}</text>
  20. </view>
  21. </view>
  22. </view>
  23. </mescroll-body>
  24. </view>
  25. </template>
  26. <script>
  27. import { getSopCourseStudyList } from "@/api/courseAnswer.js"
  28. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  29. export default {
  30. mixins: [MescrollMixin],
  31. data() {
  32. return {
  33. mescroll:null,
  34. downOption: { //下拉刷新
  35. use:true,
  36. auto: false // 不自动加载 (mixin已处理第一个tab触发downCallback)
  37. },
  38. upOption: {
  39. onScroll:false,
  40. use: true, // 是否启用上拉加载; 默认true
  41. page: {
  42. pae: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  43. size: 10 // 每页数据的数量,默认10
  44. },
  45. noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  46. textNoMore:"已经到底了",
  47. empty: {
  48. icon:'https://cos.his.cdwjyyh.com/fs/20240423/cf4a86b913a04341bb44e34bb4d37aa2.png',
  49. tip: '暂无数据'
  50. }
  51. },
  52. dataList: []
  53. }
  54. },
  55. methods: {
  56. mescrollInit(mescroll) {
  57. this.mescroll = mescroll;
  58. },
  59. /*下拉刷新的回调 */
  60. downCallback(mescroll) {
  61. mescroll.resetUpScroll()
  62. },
  63. upCallback(page) {
  64. //联网加载数据
  65. let that = this;
  66. let data = {
  67. pageNum: page.num,
  68. pageSize: page.size
  69. };
  70. getSopCourseStudyList(data).then(res => {
  71. if(res.code==200){
  72. //设置列表数据
  73. if (page.num == 1) {
  74. that.dataList = res.data.list;
  75. } else {
  76. that.dataList = that.dataList.concat(res.data.list);
  77. }
  78. that.mescroll.endBySize(res.data.list.length, res.data.total);
  79. }else{
  80. uni.showToast({
  81. icon:'none',
  82. title: "请求失败",
  83. });
  84. that.dataList = null;
  85. that.mescroll.endErr();
  86. }
  87. });
  88. },
  89. handleDetail(item) {
  90. if(item.appRealLink) {
  91. uni.navigateTo({
  92. url: item.appRealLink
  93. })
  94. }else {
  95. uni.showToast({
  96. icon:'none',
  97. title: "暂无看课链接",
  98. });
  99. }
  100. }
  101. }
  102. }
  103. </script>
  104. <style lang="scss" scoped>
  105. @mixin u-flex($flexD, $alignI, $justifyC) {
  106. display: flex;
  107. flex-direction: $flexD;
  108. align-items: $alignI;
  109. justify-content: $justifyC;
  110. }
  111. .container {
  112. padding: 24rpx;
  113. }
  114. .list {
  115. &-con {
  116. width: 100%;
  117. padding: 24rpx;
  118. box-sizing: border-box;
  119. @include u-flex(row, flex-start, space-between);
  120. }
  121. &-item {
  122. background: #FFFFFF;
  123. border-radius: 16rpx 16rpx 16rpx 16rpx;
  124. margin-bottom: 20rpx;
  125. box-sizing: border-box;
  126. font-family: PingFang SC, PingFang SC;
  127. font-weight: 400;
  128. font-size: 32rpx;
  129. color: #333333;
  130. line-height: 38rpx;
  131. image {
  132. flex-shrink: 0;
  133. width: 180rpx;
  134. height: 136rpx;
  135. margin-left: 16rpx;
  136. background: #F5F6F6;
  137. border-radius: 10rpx 10rpx 10rpx 10rpx;
  138. overflow: hidden;
  139. }
  140. }
  141. &-itemtxt {
  142. flex: 1;
  143. overflow: hidden;
  144. word-break: break-all;
  145. display: block;
  146. }
  147. &-title {
  148. word-break: break-all;
  149. display: block;
  150. }
  151. &-desc {
  152. margin-top: 16rpx;
  153. font-size: 26rpx;
  154. color: #999999;
  155. }
  156. &-time {
  157. font-size: 22rpx;
  158. color: #999999;
  159. }
  160. &-footer {
  161. padding: 20rpx 24rpx;
  162. box-sizing: border-box;
  163. @include u-flex(row, center, space-between);
  164. position: relative;
  165. view {
  166. @include u-flex(row, center, flex-start);
  167. }
  168. image {
  169. height: 50rpx;
  170. width: 50rpx;
  171. border-radius: 50%;
  172. margin: 0 10rpx 0 0;
  173. }
  174. }
  175. }
  176. </style>