growthCommunity.vue 8.4 KB

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