shortVideo.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <template>
  2. <view class="shortVideo" :style="{paddingLeft:prConfig+'rpx',paddingRight:prConfig+'rpx',marginTop:mbCongfig+'rpx',background:bgColor}" v-show="!isSortType" v-if="videoList.length">
  3. <view class="nav acea-row row-between-wrapper">
  4. <view class="title skeleton-radius">短视频</view>
  5. <view class="more skeleton-radius" @click="more">更多<text class="iconfont icon-you"></text></view>
  6. </view>
  7. <view class="list on" v-if="itemStyle">
  8. <scroll-view scroll-x="true" class="scroll" show-scrollbar="false">
  9. <view class="item skeleton-radius" v-for="(item,index) in videoList" :key="index" @click="more">
  10. <view class="pictrue">
  11. <image :src="item.image"></image>
  12. <view class="like">
  13. <text class="iconfont icon-shipindianzan-weidian1"></text>{{item.like_num}}
  14. </view>
  15. </view>
  16. </view>
  17. </scroll-view>
  18. </view>
  19. <view class="list" v-else>
  20. <view class="item acea-row row-between" v-for="(item,index) in videoList" :key="index">
  21. <view class="pictrue skeleton-radius" @click="more">
  22. <image :src="item.image"></image>
  23. <view class="like">
  24. <text class="iconfont icon-shipindianzan-weidian1"></text>{{item.like_num}}
  25. </view>
  26. </view>
  27. <view class="text">
  28. <view class="conter">
  29. <view class="header acea-row row-middle skeleton-radius">
  30. <image :src="item.type_image"></image>
  31. <view class="name line1">{{item.type_name}}</view>
  32. </view>
  33. <view class="info line2 skeleton-radius">{{item.desc}}</view>
  34. </view>
  35. <view class="goodsList acea-row row-middle">
  36. <view class="pictrue skeleton-radius" v-for="(j,jindex) in item.product_info" :key="jindex" v-if="jindex<3">
  37. <image :src="j.image"></image>
  38. <view class="money" v-if="jindex<2">¥{{j.price}}</view>
  39. <view class="num" v-else>+{{item.product_num-2}}</view>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. import {
  49. diyVideoList
  50. } from '@/api/short-video.js';
  51. export default {
  52. name: 'shortVideo',
  53. props: {
  54. dataConfig: {
  55. type: Object,
  56. default: () => {}
  57. },
  58. isSortType: {
  59. type: String | Number,
  60. default: 0
  61. }
  62. },
  63. data() {
  64. return {
  65. videoList: [],
  66. bgColor: this.dataConfig.bgColor.color[0].item,
  67. mbCongfig: this.dataConfig.mbCongfig.val*2,
  68. prConfig: this.dataConfig.prConfig.val*2, //背景边距
  69. itemStyle: this.dataConfig.itemStyle.type,
  70. numConfig: this.dataConfig.numConfig.val
  71. }
  72. },
  73. created() {},
  74. mounted() {
  75. this.getVideoList();
  76. },
  77. methods: {
  78. getVideoList: function() {
  79. let that = this;
  80. let limit = this.$config.LIMIT;
  81. diyVideoList({
  82. page: 1,
  83. limit: this.numConfig >= limit ? limit : this.numConfig
  84. }).then(res => {
  85. that.videoList = res.data;
  86. });
  87. },
  88. more(){
  89. uni.navigateTo({
  90. //#ifdef APP
  91. url: '/pages/short_video/appSwiper/index',
  92. //#endif
  93. //#ifndef APP
  94. url: '/pages/short_video/nvueSwiper/index',
  95. //#endif
  96. })
  97. }
  98. }
  99. }
  100. </script>
  101. <style lang="scss">
  102. .shortVideo {
  103. .scroll {
  104. white-space: nowrap;
  105. display: flex;
  106. }
  107. .nav {
  108. width: 100%;
  109. height: 90rpx;
  110. .title {
  111. font-weight: 600;
  112. color: #333333;
  113. font-size: 30rpx;
  114. }
  115. .more {
  116. font-weight: 400;
  117. color: #999999;
  118. font-size: 24rpx;
  119. .iconfont {
  120. font-size: 24rpx;
  121. }
  122. }
  123. }
  124. .list {
  125. padding-bottom: 1rpx;
  126. &.on {
  127. flex-wrap: nowrap;
  128. overflow: hidden;
  129. padding-bottom: 20rpx;
  130. .item {
  131. margin-right: 24rpx;
  132. margin-bottom: 0;
  133. display: inline-block;
  134. &:last-of-type{
  135. margin-right: 0;
  136. }
  137. .pictrue {
  138. margin-right: 0;
  139. }
  140. }
  141. }
  142. .item {
  143. margin-bottom: 40rpx;
  144. .pictrue {
  145. width: 226rpx;
  146. height: 300rpx;
  147. border-radius: 8rpx;
  148. position: relative;
  149. margin-right: 30rpx;
  150. image {
  151. width: 100%;
  152. height: 100%;
  153. border-radius: 8rpx;
  154. }
  155. .like {
  156. position: absolute;
  157. bottom: 8rpx;
  158. left: 14rpx;
  159. font-size: 20rpx;
  160. font-weight: 400;
  161. color: #FFFFFF;
  162. .iconfont {
  163. font-size: 24rpx;
  164. margin-right: 6rpx;
  165. }
  166. }
  167. }
  168. .text {
  169. flex: 1;
  170. .goodsList {
  171. margin-top: 34rpx;
  172. overflow: hidden;
  173. .pictrue {
  174. width: 128rpx;
  175. height: 128rpx;
  176. border-radius: 6rpx;
  177. position: relative;
  178. margin-right: 24rpx;
  179. &:nth-of-type(3n) {
  180. margin-right: 0;
  181. }
  182. image {
  183. width: 100%;
  184. height: 100%;
  185. display: block;
  186. border-radius: 6rpx;
  187. }
  188. .num{
  189. position: absolute;
  190. top:50%;
  191. left:50%;
  192. margin-left: -22rpx;
  193. margin-top: -22rpx;
  194. color: #fff;
  195. font-size: 30rpx;
  196. font-weight: 400;
  197. }
  198. .money {
  199. position: absolute;
  200. color: #fff;
  201. font-size: 22rpx;
  202. bottom: 8rpx;
  203. left: 50%;
  204. margin-left: -40rpx;
  205. }
  206. }
  207. }
  208. .conter {
  209. height: 134rpx;
  210. .header {
  211. .name {
  212. flex: 1;
  213. width: 300rpx;
  214. }
  215. image {
  216. width: 36rpx;
  217. height: 36rpx;
  218. border: 1px solid #FFFFFF;
  219. display: block;
  220. margin-right: 10rpx;
  221. border-radius: 50%;
  222. }
  223. font-weight: 500;
  224. color: #333333;
  225. font-size: 28rpx;
  226. }
  227. .info {
  228. font-weight: 400;
  229. color: #666666;
  230. font-size: 24rpx;
  231. margin-top: 20rpx;
  232. }
  233. }
  234. }
  235. }
  236. }
  237. }
  238. </style>