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

205 lines
3.8 KiB

5 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 spotListWord" :key="index"
  8. >
  9. <view class="image" @click="showVideo(item, index)">
  10. <image :src="item.spotImage && item.spotImage.split(',')[0]" mode="aspectFill">
  11. </image>
  12. </view>
  13. <view class="bottom">
  14. <view class="headImage">
  15. {{ item.spotName }}
  16. </view>
  17. <view class="like">
  18. <view class="">
  19. 查看详情
  20. </view>
  21. <view class=""
  22. style="margin-top: 10rpx;">
  23. <uv-icon size="30rpx"
  24. name="arrow-right"></uv-icon>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. </scroll-view>
  31. </template>
  32. <script>
  33. import { mapState } from 'vuex'
  34. export default {
  35. props : {
  36. height : {
  37. default : 'auto'
  38. },
  39. roleId : {
  40. }
  41. },
  42. data() {
  43. return {
  44. queryParams: {
  45. pageNo: 1,
  46. pageSize: 10,
  47. },
  48. total : 0,
  49. list : [],
  50. }
  51. },
  52. computed : {
  53. ...mapState(['spotList']),
  54. spotListWord(){
  55. return this.spotList.filter(n => n.categoryId == 0)
  56. },
  57. },
  58. methods: {
  59. showVideo(item, current){
  60. // this.$utils.hanldePreview
  61. // uni.previewMedia({
  62. // current : item.videoContent
  63. // })
  64. this.$utils.navigateTo(`/pages_order/service/articleDetail?id=${item.id}&type=Inheritance`)
  65. return
  66. let sources = []
  67. this.list.forEach(n => {
  68. sources.push({
  69. url : n.travelVideo.videoContent,
  70. type : 'video'
  71. })
  72. })
  73. wx.previewMedia({
  74. sources, // 需要预览的资源列表
  75. current, // 当前显示的资源序号
  76. // url: url // 当前预览资源的url链接
  77. })
  78. },
  79. queryVideoList(){
  80. if(this.roleId){
  81. this.queryParams.roleInfoId = this.roleId
  82. }
  83. if(uni.getStorageSync('token')){
  84. this.queryParams.token = uni.getStorageSync('token')
  85. }
  86. this.$api('queryVedioById', this.queryParams, res => {
  87. if(res.code == 200){
  88. this.list = res.result
  89. // this.total = res.result.total
  90. }
  91. })
  92. },
  93. loadMoreData(){
  94. if(this.queryParams.pageSize <= this.list.length){
  95. this.queryParams.pageSize += 10
  96. this.queryVideoList()
  97. }
  98. },
  99. addThumpup(videoId){
  100. this.$api('addThumpup', {
  101. videoId
  102. }, res => {
  103. if(res.code == 200){
  104. this.queryVideoList()
  105. uni.showToast({
  106. title: res.message,
  107. icon: 'none'
  108. })
  109. }
  110. })
  111. },
  112. }
  113. }
  114. </script>
  115. <style scoped lang="scss">
  116. .videoList {
  117. .video-item {
  118. margin: 20rpx;
  119. background-color: #fff;
  120. position: relative;
  121. .image {
  122. position: relative;
  123. width: 100%;
  124. height: 420rpx;
  125. overflow: hidden;
  126. image {
  127. width: 100%;
  128. height: 420rpx;
  129. border-radius: 30rpx;
  130. }
  131. .icon {
  132. position: absolute;
  133. right: 30rpx;
  134. top: 30rpx;
  135. width: 60rpx;
  136. height: 60rpx;
  137. background-color: #ffffffaa;
  138. border-radius: 50%;
  139. display: flex;
  140. justify-content: center;
  141. align-items: center;
  142. }
  143. }
  144. .bottom {
  145. font-size: 30rpx;
  146. display: flex;
  147. justify-content: space-between;
  148. position: absolute;
  149. bottom: 0;
  150. left: 0;
  151. background-color: #ffffffaa;
  152. width: calc(100% - 40rpx);
  153. padding: 30rpx;
  154. font-weight: 900;
  155. align-items: center;
  156. .headImage {
  157. display: flex;
  158. align-items: center;
  159. image {
  160. width: 50rpx;
  161. height: 50rpx;
  162. border-radius: 50%;
  163. margin-right: 6rpx;
  164. }
  165. }
  166. .like {
  167. display: flex;
  168. align-items: center;
  169. justify-content: center;
  170. font-weight: 500;
  171. font-size: 26rpx;
  172. }
  173. }
  174. }
  175. .showVideo{
  176. display: flex;
  177. justify-content: center;
  178. align-items: center;
  179. height: 100%;
  180. width: 1000%;
  181. video{
  182. // width: 100%;
  183. // height: 100%;
  184. }
  185. }
  186. }
  187. </style>