growthCommunity.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. <template>
  2. <view class="growthcommunity">
  3. <slot name="supplier-title"></slot>
  4. <view class="negotiation">
  5. <view class="enterprise">
  6. <view class="title">美业企谈</view>
  7. <view class="container">
  8. <scroll-view
  9. scroll-x="true"
  10. class="scroll-view"
  11. @scroll="scrollVideoHandler"
  12. :scroll-into-view="activeVideoMenu"
  13. scroll-with-animation="true"
  14. >
  15. <view
  16. class="video-item"
  17. v-for="item in videoList"
  18. :key="item.id"
  19. @click="$emit('playVideo', item)"
  20. :id="`item${index}`"
  21. >
  22. <view class="player">
  23. <image src="https://static.caimei365.com/app/img/supplier-login/player.png" class="player-img" mode=""></image>
  24. </view>
  25. <view class="img-item"><image :src="item.headAppBanner" mode="" class="img"></image></view>
  26. <view class="videotitle">
  27. <view class="text">{{ item.title }}</view>
  28. </view>
  29. </view>
  30. </scroll-view>
  31. </view>
  32. </view>
  33. <view class="item-dots"><page-dots :pageAll="videoList.length" :isActive="isVideo" @hanlder-click="hanlderVideoClick" /></view>
  34. <view class="enterprise">
  35. <view class="title">采美资讯</view>
  36. <view class="container">
  37. <scroll-view
  38. scroll-x="true"
  39. class="scroll-view"
  40. @scroll="scrollHandler"
  41. :scroll-into-view="activeMenu"
  42. scroll-with-animation="true"
  43. >
  44. <view
  45. class="video-item"
  46. v-for="(item, index) in articelList"
  47. :key="item.id"
  48. @click="handlerTramp(item)"
  49. :id="`item${index}`"
  50. >
  51. <view class="img-item"><image :src="item.headAppBanner" mode="" class="img"></image></view>
  52. <view class="articleContent">
  53. <view class="text">{{ item.title }}</view>
  54. <view class="article-con">{{ item.content.match(/[\u4e00-\u9fa5]/g).join('') }}</view>
  55. </view>
  56. </view>
  57. </scroll-view>
  58. </view>
  59. </view>
  60. <view class="item-dots"><page-dots :pageAll="articelList.length" :isActive="isArtical" @hanlder-click="hanlderClick" /></view>
  61. </view>
  62. </view>
  63. </template>
  64. <script>
  65. import PageDots from './swiper-dots.vue'
  66. export default {
  67. props: {
  68. videoList: {
  69. type: Array,
  70. default: () => []
  71. },
  72. articelList: {
  73. type: Array,
  74. default: () => []
  75. }
  76. },
  77. components: {
  78. PageDots
  79. },
  80. data() {
  81. return {
  82. isVideo: 0,
  83. isArtical: 0,
  84. activeMenu: 'item0',
  85. activeVideoMenu: 'item0'
  86. }
  87. },
  88. watch: {
  89. videoList: {
  90. handler(val) {
  91. this.community_video_list = val
  92. },
  93. deep: true
  94. },
  95. articelList: {
  96. handler(val) {
  97. this.community_article_list = val
  98. },
  99. deep: true
  100. }
  101. },
  102. methods: {
  103. handlerTramp($event) {
  104. const list = this.community_article_list.filter(e => e.id === $event.id)
  105. let data = list[0].content.replace(/<img/g, '<img style="width: 100%;height: 200px"')
  106. data = data.replace(/\<figure/g, '<div')
  107. data = data.replace(/\<\/figure/g, '<\/div')
  108. uni.setStorageSync('artForm', data)
  109. uni.navigateTo({
  110. url: '/pages/login/supplier_information'
  111. })
  112. },
  113. scrollHandler($event) {
  114. const data = Math.floor($event.detail.scrollLeft / 192)
  115. this.isArtical = data
  116. },
  117. scrollVideoHandler($event) {
  118. const data = Math.floor($event.detail.scrollLeft / 192)
  119. this.isVideo = data
  120. },
  121. // 点击导航
  122. hanlderClick($event) {
  123. this.isArtical = $event
  124. this.activeMenu = `item${$event}`
  125. },
  126. hanlderVideoClick($event) {
  127. this.isVideo = $event
  128. this.activeVideoMenu = `item${$event}`
  129. }
  130. }
  131. }
  132. </script>
  133. <style scoped lang="scss">
  134. .img {
  135. width: 100%;
  136. height: 100%;
  137. }
  138. .growthcommunity {
  139. padding: 1px;
  140. box-sizing: border-box;
  141. background-color: #fff;
  142. .negotiation {
  143. padding-left: 72rpx;
  144. }
  145. }
  146. .enterprise {
  147. position: relative;
  148. margin-bottom: 50rpx;
  149. }
  150. .title {
  151. color: #333333;
  152. font-size: 32rpx;
  153. margin-bottom: 34rpx;
  154. }
  155. .scroll-view {
  156. white-space: nowrap;
  157. }
  158. .video-item {
  159. width: 384rpx;
  160. height: 376rpx;
  161. background: #ffffff;
  162. border: 1px solid #eaeaea;
  163. display: inline-flex;
  164. margin-right: 32rpx;
  165. box-sizing: border-box;
  166. flex-direction: column;
  167. overflow-wrap: break-word;
  168. white-space: normal;
  169. position: relative;
  170. .player {
  171. height: calc(100% - 159rpx);
  172. width: 100%;
  173. position: absolute;
  174. top: 0;
  175. left: 0;
  176. display: flex;
  177. align-items: center;
  178. justify-content: center;
  179. background-color: rgba(0, 0, 0, 0.3);
  180. .player-img {
  181. width: 60rpx;
  182. height: 60rpx;
  183. }
  184. }
  185. .img-item {
  186. height: calc(100% - 159rpx);
  187. width: 100%;
  188. }
  189. .videotitle {
  190. width: 100%;
  191. height: 159rpx;
  192. font-size: 28rpx;
  193. color: #333333;
  194. padding: 40rpx 40rpx;
  195. overflow: hidden;
  196. display: flex;
  197. justify-content: center;
  198. align-items: center;
  199. box-sizing: border-box;
  200. .text {
  201. width: 336rpx;
  202. height: 90rpx;
  203. overflow: hidden;
  204. line-height: 48rpx;
  205. -webkit-box-orient: vertical;
  206. -webkit-line-clamp: 2;
  207. overflow-wrap: break-word;
  208. text-overflow: ellipsis;
  209. display: -webkit-box;
  210. }
  211. }
  212. .articleContent {
  213. .text {
  214. margin-top: 24rpx;
  215. box-sizing: border-box;
  216. padding-left: 24rpx;
  217. color: #333333;
  218. font-size: 32rpx;
  219. border-left: 2px solid #ff5b00;
  220. }
  221. .article-con {
  222. margin-top: 18rpx;
  223. width: 100%;
  224. height: 62rpx;
  225. box-sizing: border-box;
  226. padding: 0 24rpx;
  227. color: #666666;
  228. font-size: 24rpx;
  229. overflow: hidden;
  230. -webkit-box-orient: vertical;
  231. -webkit-line-clamp: 2;
  232. overflow-wrap: break-word;
  233. text-overflow: ellipsis;
  234. display: -webkit-box;
  235. }
  236. }
  237. }
  238. .item-dots {
  239. height: 160rpx;
  240. display: flex;
  241. justify-content: center;
  242. align-items: center;
  243. margin-left: -20rpx;
  244. }
  245. </style>