与牧同行-小程序用户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

173 lines
6.4 KiB

  1. <view class="video-detail-container">
  2. <!-- 导航栏 -->
  3. <view class="nav-bar" wx:if="{{!fullScreen}}">
  4. <view class="nav-title">{{video.title}}</view>
  5. </view>
  6. <!-- 视频播放器区域 -->
  7. <view class="video-player-section" style="{{fullScreen ? 'height: 100vh;' : ''}}">
  8. <!-- 视频播放器 -->
  9. <video
  10. id="videoPlayer"
  11. src="{{videoUrl}}"
  12. poster="{{video.coverImage ? baseUrl + video.coverImage : ''}}"
  13. initial-time="0"
  14. autoplay="{{autoplay}}"
  15. loop="{{loop}}"
  16. muted="{{isMuted}}"
  17. controls="{{!fullScreen}}"
  18. show-fullscreen-btn="{{!fullScreen}}"
  19. show-play-btn="true"
  20. show-center-play-btn="true"
  21. enable-progress-gesture="true"
  22. enable-play-gesture="{{fullScreen}}"
  23. object-fit="contain"
  24. direction="0"
  25. bindplay="onVideoPlay"
  26. bindpause="onVideoPause"
  27. bindended="onVideoEnded"
  28. bindtimeupdate="onTimeUpdate"
  29. bindfullscreenchange="onFullScreenChange"
  30. bindloadedmetadata="onVideoLoaded"
  31. binderror="onVideoError"
  32. class="video-player"
  33. ></video>
  34. <!-- 视频封面 -->
  35. <view class="video-cover" wx:if="{{video.coverImage && !isPlaying && !fullScreen}}">
  36. <image
  37. src="{{baseUrl + video.coverImage}}"
  38. mode="aspectFill"
  39. class="cover-image"
  40. ></image>
  41. <view class="cover-play-btn" catchtap="togglePlay">
  42. <image class="play-icon" src="/pagesB/images/bo.png"></image>
  43. </view>
  44. </view>
  45. <!-- 全屏时的自定义控制栏 -->
  46. <view class="fullscreen-controls" wx:if="{{fullScreen}}" catchtouchmove="onTouchMove">
  47. <!-- 顶部控制栏 -->
  48. <view class="fullscreen-top-bar">
  49. <view class="top-bar-left" catchtap="exitFullScreen">
  50. <image class="back-icon" src="/pagesB/images/left.png"></image>
  51. <text class="back-text">返回</text>
  52. </view>
  53. <view class="top-bar-title">{{video.title}}</view>
  54. <view class="top-bar-right"></view>
  55. </view>
  56. <!-- 播放按钮(中间) -->
  57. <view class="center-play-btn" wx:if="{{!isPlaying}}" catchtap="togglePlay">
  58. <image class="play-large-icon" src="/pagesB/images/play.png"></image>
  59. <view class="play-ripple"></view>
  60. </view>
  61. <!-- 底部控制栏 -->
  62. <view class="fullscreen-bottom-bar">
  63. <!-- 进度条 -->
  64. <view class="fullscreen-progress">
  65. <view class="progress-time">{{formatTime(currentTime)}}</view>
  66. <view class="progress-slider-container">
  67. <view class="progress-bg">
  68. <view class="progress-current" style="width: {{duration ? (currentTime / duration * 100) + '%' : '0%'}}"></view>
  69. </view>
  70. <view
  71. class="progress-thumb"
  72. style="left: {{duration ? (currentTime / duration * 100) + '%' : '0%'}}"
  73. ></view>
  74. </view>
  75. <view class="progress-time">{{formatTime(duration)}}</view>
  76. </view>
  77. <view class="bottom-controls">
  78. <view class="control-item" catchtap="togglePlay">
  79. <image class="control-icon" src="{{isPlaying ? '/pagesB/images/pause.png' : '/pagesB/images/play.png'}}"></image>
  80. </view>
  81. <view class="control-item" catchtap="toggleMute">
  82. <image class="control-icon" src="{{isMuted ? '/pagesB/images/volume_mute.png' : '/pagesB/images/volume.png'}}"></image>
  83. </view>
  84. <view class="control-item" catchtap="toggleLoop">
  85. <image class="control-icon" src="{{loop ? '/pagesB/images/loop_on.png' : '/pagesB/images/loop.png'}}"></image>
  86. </view>
  87. <view class="control-item" catchtap="toggleSpeed">
  88. <text class="speed-text">{{playbackRate}}x</text>
  89. </view>
  90. <view class="control-item" catchtap="enterFullScreen">
  91. <image class="control-icon" src="/pagesB/images/fullscreen.png"></image>
  92. </view>
  93. </view>
  94. </view>
  95. <!-- 触摸控制区域 -->
  96. <view class="touch-control-left" catchtap="onTouchControl" data-type="backward"></view>
  97. <view class="touch-control-center" catchtap="togglePlay"></view>
  98. <view class="touch-control-right" catchtap="onTouchControl" data-type="forward"></view>
  99. </view>
  100. <!-- 非全屏播放按钮 -->
  101. <view class="normal-play-btn" wx:if="{{!fullScreen && !isPlaying && !video.coverImage}}" catchtap="togglePlay">
  102. <image class="play-icon" src="/pagesB/images/bo.png"></image>
  103. </view>
  104. </view>
  105. <!-- 视频信息区域 -->
  106. <scroll-view
  107. class="video-info-section"
  108. scroll-y
  109. wx:if="{{!fullScreen}}"
  110. scroll-with-animation
  111. >
  112. <!-- 视频标题和描述 -->
  113. <view class="video-header">
  114. <view class="video-title">{{video.title}}</view>
  115. <view class="video-description">{{video.description}}</view>
  116. <!-- 视频统计数据 -->
  117. <view class="video-stats">
  118. <view class="stat-item">
  119. <text>{{video.viewCount}} 播放</text>
  120. </view>
  121. <view class="stat-item">
  122. <text>{{video.publishTime}}</text>
  123. </view>
  124. <view class="stat-item">
  125. <text>{{video.category}}</text>
  126. </view>
  127. </view>
  128. </view>
  129. <!-- 发布者信息 -->
  130. <view class="publisher-section" wx:if="{{video.publisherName}}">
  131. <image class="publisher-avatar" src="{{video.publisherAvatar ? baseUrl + video.publisherAvatar : '/pagesB/images/default_avatar.png'}}"></image>
  132. <view class="publisher-info">
  133. <view class="publisher-name">{{video.publisherName}}</view>
  134. <view class="publisher-desc">{{video.publisherDesc || '视频发布者'}}</view>
  135. </view>
  136. </view>
  137. <!-- 视频标签 -->
  138. <view class="tags-section" wx:if="{{videoTags.length > 0}}">
  139. <view class="section-title">标签</view>
  140. <view class="tags-container">
  141. <view class="tag-item" wx:for="{{videoTags}}" wx:key="index">
  142. {{item}}
  143. </view>
  144. </view>
  145. </view>
  146. </scroll-view>
  147. <!-- 加载中 -->
  148. <view class="loading-container" wx:if="{{loading}}">
  149. <view class="loading-spinner">
  150. <view class="spinner-circle"></view>
  151. </view>
  152. <text class="loading-text">加载中...</text>
  153. </view>
  154. <!-- 错误提示 -->
  155. <view class="error-container" wx:if="{{videoError}}">
  156. <image class="error-icon" src="/pagesB/images/error.png"></image>
  157. <text class="error-text">视频加载失败</text>
  158. <view class="retry-btn" catchtap="retryVideo">重试</view>
  159. </view>
  160. </view>