景徳镇旅游微信小程序
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.

188 lines
3.6 KiB

8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
  1. <template>
  2. <scroll-view
  3. scroll-y="true"
  4. :style="{height: height}"
  5. @scrolltolower="loadMoreData">
  6. <view class="videoList">
  7. <view class="video-item" v-for="(item, index) in list" :key="index"
  8. >
  9. <view class="image" @click="showVideo(item, index)">
  10. <image :src="item.travelVideo.videoImage" mode="aspectFill">
  11. </image>
  12. <view class="icon">
  13. <uv-icon size="35rpx" name="play-right-fill">
  14. </uv-icon>
  15. </view>
  16. </view>
  17. <view class="bottom">
  18. <view class="headImage">
  19. <!-- <image src="https://img-s-msn-com.akamaized.net/tenant/amp/entityid/BB1msKSi.img" mode="aspectFill">
  20. </image> -->
  21. {{ item.travelVideo.videoTitle }}
  22. </view>
  23. <view class="like"
  24. @click="addThumpup(item.travelVideo.id)">
  25. <uv-icon size="45rpx" color="#FF4340" v-if="item.thumpupFlag" name="heart-fill"></uv-icon>
  26. <uv-icon size="45rpx" v-else name="heart"></uv-icon>
  27. {{ item.travelVideo.videoThumpup }}
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. </scroll-view>
  33. </template>
  34. <script>
  35. import index from '../../uni_modules/uv-ui-tools'
  36. export default {
  37. props : {
  38. height : {
  39. default : 'auto'
  40. },
  41. roleId : {
  42. }
  43. },
  44. data() {
  45. return {
  46. queryParams: {
  47. pageNo: 1,
  48. pageSize: 10,
  49. },
  50. total : 0,
  51. list : [],
  52. }
  53. },
  54. methods: {
  55. showVideo(item, current){
  56. // this.$utils.hanldePreview
  57. // uni.previewMedia({
  58. // current : item.videoContent
  59. // })
  60. let sources = []
  61. this.list.forEach(n => {
  62. sources.push({
  63. url : n.travelVideo.videoContent,
  64. type : 'video'
  65. })
  66. })
  67. wx.previewMedia({
  68. sources, // 需要预览的资源列表
  69. current, // 当前显示的资源序号
  70. // url: url // 当前预览资源的url链接
  71. })
  72. },
  73. queryVideoList(){
  74. if(this.roleId){
  75. this.queryParams.roleInfoId = this.roleId
  76. }
  77. if(uni.getStorageSync('token')){
  78. this.queryParams.token = uni.getStorageSync('token')
  79. }
  80. this.$api('queryVedioById', this.queryParams, res => {
  81. if(res.code == 200){
  82. this.list = res.result
  83. // this.total = res.result.total
  84. }
  85. })
  86. },
  87. loadMoreData(){
  88. if(this.queryParams.pageSize <= this.list.length){
  89. this.queryParams.pageSize += 10
  90. this.queryVideoList()
  91. }
  92. },
  93. addThumpup(videoId){
  94. this.$api('addThumpup', {
  95. videoId
  96. }, res => {
  97. if(res.code == 200){
  98. this.queryVideoList()
  99. uni.showToast({
  100. title: res.message,
  101. icon: 'none'
  102. })
  103. }
  104. })
  105. },
  106. }
  107. }
  108. </script>
  109. <style scoped lang="scss">
  110. .videoList {
  111. display: flex;
  112. flex-wrap: wrap;
  113. .video-item {
  114. margin: 20rpx;
  115. width: 335rpx;
  116. .image {
  117. position: relative;
  118. width: 100%;
  119. height: 420rpx;
  120. border-radius: 30rpx;
  121. overflow: hidden;
  122. image {
  123. width: 100%;
  124. height: 100%;
  125. }
  126. .icon {
  127. position: absolute;
  128. right: 30rpx;
  129. top: 30rpx;
  130. width: 60rpx;
  131. height: 60rpx;
  132. background-color: #ffffffaa;
  133. border-radius: 50%;
  134. display: flex;
  135. justify-content: center;
  136. align-items: center;
  137. }
  138. }
  139. .bottom {
  140. padding: 10rpx 0;
  141. font-size: 22rpx;
  142. display: flex;
  143. justify-content: space-between;
  144. .headImage {
  145. display: flex;
  146. align-items: center;
  147. image {
  148. width: 50rpx;
  149. height: 50rpx;
  150. border-radius: 50%;
  151. margin-right: 6rpx;
  152. }
  153. }
  154. .like {
  155. display: flex;
  156. align-items: center;
  157. }
  158. }
  159. }
  160. .showVideo{
  161. display: flex;
  162. justify-content: center;
  163. align-items: center;
  164. height: 100%;
  165. width: 1000%;
  166. video{
  167. // width: 100%;
  168. // height: 100%;
  169. }
  170. }
  171. }
  172. </style>