list.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <template>
  2. <view class="wrap" :style="vuex_skin">
  3. <!-- #ifdef MP-WEIXIN -->
  4. <u-navbar title-color="#000000" :is-back="fasle" title="视频列表"></u-navbar>
  5. <!-- #endif -->
  6. <view style="padding: 30rpx 30rpx 10rpx;">
  7. <u-swiper :list="swiperList" border-radius="12" name="url" mode="rect" height="300" @click="handleSwiper"></u-swiper>
  8. </view>
  9. <view>
  10. <mescroll-body height="80%" ref="mescrollRef" @init="mescrollInit" :down="downOption" :up="upOption" @down="downCallback" @up="upCallback">
  11. <u-card :show-head="false" margin="20rpx" padding="20" v-for="(item,index) in studyList" :key="index" @click="$jump('/pages/study/detail?id='+item.id)">
  12. <view class="container-wrap" slot="body">
  13. <image :src="item.imageUrl" mode="aspectFill"></image>
  14. <view class="right">
  15. <view class="title text-cut-1">{{item.title}}</view>
  16. <view class="cu-tag bg-tag radius margin-right-10" style="font-weight: 400; margin-top: 10rpx;">{{item.type === 'IMAGE_TEXT' ? '图文类型' : '视频类型'}}</view>
  17. <view class="cu-btn round sm line-base btn">
  18. 去学习
  19. </view>
  20. </view>
  21. </view>
  22. </u-card>
  23. </mescroll-body>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  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. activeSetting: '', //平台活动数据
  34. swiperList: [], //轮播图列表
  35. downOption: {
  36. auto: false
  37. },
  38. upOption: {
  39. auto: true,
  40. empty: {
  41. use: false
  42. }
  43. },
  44. studyList: [], //学习图文视频列表
  45. }
  46. },
  47. onReady() {
  48. this.getActivityParams();
  49. },
  50. methods: {
  51. handleSwiper(index){
  52. let url = this.swiperList[index].path;
  53. if(!!url && (url.indexOf('http://') > -1 || url.indexOf('https://') > -1) ){
  54. window.location.href = url;
  55. }
  56. },
  57. /**
  58. * 获取活动参数
  59. */
  60. getActivityParams() {
  61. let params = {
  62. activeId: this.vuex_active_setting.defaultActiveId,
  63. platformSettingEnum: 'ACTIVE_SETTING'
  64. }
  65. this.$api.platform.getPlatformValue(params).then(res => {
  66. this.activeSetting = JSON.parse(res.data.data);
  67. this.swiperList = this.activeSetting.learnVideos.learnVideosBanner;
  68. uni.setNavigationBarTitle({
  69. title: this.activeSetting.learnVideos.learnVideosTitle
  70. })
  71. })
  72. },
  73. upCallback(mescroll) {
  74. let params = {
  75. current: mescroll.num,
  76. size: mescroll.size,
  77. activeId: this.vuex_active_setting.defaultActiveId
  78. }
  79. this.$api.activity.getStudyList(params).then(res => {
  80. // console.log(res.data.data.records);
  81. let data = res.data.data.records
  82. let total = res.data.data.total
  83. mescroll.endBySize(data.length, total);
  84. if (mescroll.num == 1) this.studyList = []; //如果是第一页需手动制空列表
  85. this.studyList = this.studyList.concat(data); //追加新数据
  86. })
  87. },
  88. }
  89. }
  90. </script>
  91. <style lang="scss" scoped>
  92. page{
  93. padding-bottom: 50rpx;
  94. }
  95. .container-wrap{
  96. display: flex;
  97. image{
  98. width: 230rpx;
  99. height: 230rpx;
  100. min-height: 230rpx;
  101. min-width: 230rpx;
  102. border-radius: 10rpx;
  103. margin-right: 20rpx;
  104. }
  105. .right{
  106. // display: flex;
  107. // flex-direction: column;
  108. // justify-content: space-between;
  109. position: relative;
  110. width: 100%;
  111. .title {
  112. font-weight: 800;
  113. color: #353535;
  114. font-size: 32rpx;
  115. }
  116. .btn{
  117. position: absolute;
  118. bottom: 0;
  119. right: 0;
  120. }
  121. }
  122. }
  123. </style>