shortVideo.vue 6.5 KB

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