growthCommunity.vue 7.5 KB

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