list.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <template>
  2. <view :style="vuex_skin">
  3. <mescroll-body ref="mescrollRef" @init="mescrollInit" :down="downOption" :up="upOption" @down="downCallback"
  4. @up="upCallback">
  5. <view class="card" @click="jump(item)" v-for="(item,index) in list" :key="index">
  6. <view class="center">
  7. <image :src="item.imgUrl" mode="aspectFill"></image>
  8. </view>
  9. <view class="content" style="padding: 6rpx 0;">
  10. <view class="">
  11. <view class="text-bold text-cut-2" style="font-size: 28rpx;">{{content(item.content)}}</view>
  12. </view>
  13. <view class="">
  14. <view style="margin-top: 8rpx;color: #828282;font-weight: 300;font-size: 26rpx;margin-bottom: 15rpx;">
  15. 参赛时间:
  16. <text>{{formatTime(item.startTime)}} 至 {{formatTime(item.endTime)}}</text>
  17. </view>
  18. <view class="flex">
  19. <image style="width: 30rpx;height: 30rpx;" src="/static/icon/remen.png" mode=""></image>
  20. <text style="margin-left: -6rpx;">{{numberNull(item.viewCount)}}</text>
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. </mescroll-body>
  26. </view>
  27. </template>
  28. <script>
  29. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  30. export default {
  31. mixins: [MescrollMixin],
  32. data() {
  33. return {
  34. list: [],
  35. downOption:{
  36. auto:false
  37. },
  38. }
  39. },
  40. onLoad() {
  41. },
  42. computed:{
  43. content(){
  44. return data=>{
  45. return this.$util.formatHtml(data)
  46. }
  47. },
  48. },
  49. methods: {
  50. async jump(item){
  51. let params={
  52. activeId:item.id,
  53. platformSettingEnum:'ACTIVE_SETTING'
  54. }
  55. let res= (await this.$api.platform.getPlatformValue(params)).data.data;
  56. console.log(JSON.parse(res));
  57. },
  58. downCallback() {
  59. setTimeout(() => {
  60. this.mescroll.resetUpScroll();
  61. }, 800)
  62. },
  63. upCallback(mescroll) {
  64. let params = {
  65. current:mescroll.num,
  66. size:mescroll.size,
  67. }
  68. try {
  69. this.$api.activerecord.list(params).then(res => {
  70. let data = res.data.data.records
  71. let total = res.data.data.total
  72. mescroll.endBySize(data.length, total);
  73. if (mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
  74. this.list = this.list.concat(data); //追加新数据
  75. })
  76. } catch (e) {
  77. this.mescroll.endErr()
  78. }
  79. },
  80. }
  81. }
  82. </script>
  83. <style lang="scss">
  84. .card{
  85. margin: 20rpx;
  86. padding: 20rpx;
  87. border-radius: 12rpx;
  88. background-color: #FFFFFF;
  89. display: flex;
  90. image{
  91. width: 200rpx;
  92. height: 200rpx;
  93. margin-right: 20rpx;
  94. border-radius: 8rpx;
  95. }
  96. .content{
  97. display: flex;
  98. flex-direction: column;
  99. justify-content: space-between;
  100. }
  101. }
  102. </style>