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

206 lines
3.9 KiB

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