video.wxml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <!--pages/video/video.wxml-->
  2. <view class="container">
  3. <!-- 顶部导航栏 -->
  4. <view class="nav-container">
  5. <scroll-view scroll-x class="nav-category-scroll" show-scrollbar="{{false}}">
  6. <view class="nav-category-list">
  7. <view
  8. wx:for="{{ categoryList }}"
  9. wx:key="id"
  10. class="nav-category-item {{ currentCategoryId === item.id ? 'active' : '' }}"
  11. bindtap="switchCategory"
  12. data-id="{{ item.id }}"
  13. >
  14. {{ item.name }}
  15. </view>
  16. </view>
  17. </scroll-view>
  18. </view>
  19. <!-- 视频列表 -->
  20. <scroll-view
  21. scroll-y
  22. class="list-container"
  23. bindscrolltolower="loadMore"
  24. enable-back-to-top
  25. enhanced="{{ true }}"
  26. show-scrollbar="{{ false }}"
  27. bounces="{{ true }}"
  28. fast-deceleration="{{ true }}"
  29. >
  30. <view class="list">
  31. <block wx:for="{{ videoList }}" wx:key="id" wx:for-index="idx">
  32. <!-- 视频广告 -->
  33. <view wx:if="{{item.adType === 'videoAd' && hasLoadAdConfig}}" class="ad-custom-card">
  34. <ad unit-id="{{templateAdId}}" ad-type="video" ad-theme="white" data-field="videoError"
  35. data-name="首页-视频1" data-adId="{{templateAdId}}" bindload="appletsAdLoad"
  36. binderror="appletsAdError" bindclose="appletsAdClose" style="height: 100%;margin-bottom: 20rpx;"></ad>
  37. </view>
  38. <view wx:if="{{ item.adType === 'video' }}">
  39. <!-- 视频卡片 -->
  40. <view class="video-item" bindtap="onVideoTap" data-info="{{ item }}" data-id="{{ item.id }}" data-index="{{idx}}">
  41. <view class="video-cover-container">
  42. <image
  43. class="video-cover"
  44. src="{{ item.cover_image }}"
  45. mode="aspectFill"
  46. />
  47. <view class="play-button-container">
  48. <view class="play-button" wx:if="{{ !item.lock }}">
  49. <image
  50. class="play-icon"
  51. src="/assets/images/icon-video-play.png"
  52. ></image>
  53. </view>
  54. <view class="play-button-lock" wx:else>
  55. <image
  56. class="play-icon"
  57. src="/assets/images/icon-lock.png"
  58. ></image>
  59. <view class="play-button-lock-title">观看广告解锁完整内容</view>
  60. </view>
  61. </view>
  62. </view>
  63. <view class="video-title">{{ item.title }}</view>
  64. <view class="video-play-count">{{ item.views }}w+人播放</view>
  65. <view class="share-button" catchtap="onShareTap">
  66. <image
  67. class="share-icon"
  68. src="/assets/images/icons/icon-wechat.png"
  69. catchtap="onShareTap"
  70. ></image>
  71. <text>分享</text>
  72. <button class="share-cover-button" open-type="share" data-video="{{ item }}" catchtap></button>
  73. </view>
  74. </view>
  75. </view>
  76. <!-- 卡片原生广告 -->
  77. <view wx:if="{{item.adType === 'templateAd' && hasLoadAdConfig }}" class="ad-custom-card-1">
  78. <ad-custom unit-id="{{templateAdId}}" data-field="templateError" data-name="首页页-卡片原生"
  79. data-adId="{{templateAdId}}" capture-bind:tap="appletsAdClick" bindload="appletsAdLoad"
  80. binderror="appletsAdError" style="height: 100%;margin-bottom: 20rpx;"></ad-custom>
  81. </view>
  82. </block>
  83. </view>
  84. <!-- 加载状态 -->
  85. <view class="loading-status">
  86. <!-- loading 提示 -->
  87. <view class="loading" wx:if="{{ loading }}">
  88. <view class="loading-spinner"></view>
  89. <text>加载中...</text>
  90. </view>
  91. <!-- 没有更多 -->
  92. <view
  93. class="finished"
  94. wx:if="{{ !loading && videoList.length > 0 && !hasMore }}"
  95. >
  96. <text>没有更多视频了</text>
  97. </view>
  98. <!-- 空状态 -->
  99. <view class="empty" wx:if="{{ !loading && videoList.length === 0 }}">
  100. <image class="empty-icon" src="/assets/images/empty.png"></image>
  101. <text>暂无视频内容</text>
  102. </view>
  103. </view>
  104. </scroll-view>
  105. <!-- 刷新按钮 -->
  106. <view class="refresh-container" bindtap="refreshList">
  107. <image class="refresh-bg" src="/assets/images/icons/refresh-bg.png"></image>
  108. <image class="refresh-btn" src="/assets/images/icons/refresh.png"></image>
  109. </view>
  110. </view>