growthCommunity.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  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'"
  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="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'"
  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">{{ item.content.match(/[\u4e00-\u9fa5]/g).join('') }}</view>
  59. </view>
  60. </view>
  61. </scroll-view>
  62. </view>
  63. </view>
  64. <view class="item-dots"><page-dots :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. handlerTramp($event) {
  108. const list = this.community_article_list.filter(e => e.id === $event.id)
  109. let data = list[0].content.replace(/<img/g, '<img style="width: 100%;height: 200px"')
  110. data = data.replace(/\<figure/g, '<div')
  111. data = data.replace(/\<\/figure/g, '<\/div')
  112. uni.setStorageSync('artForm', data)
  113. uni.navigateTo({
  114. url: '/pages/login/supplier_information'
  115. })
  116. },
  117. scrollHandler($event) {
  118. const data = Math.floor($event.detail.scrollLeft / 192)
  119. this.isArtical = data
  120. },
  121. scrollVideoHandler($event) {
  122. const data = Math.floor($event.detail.scrollLeft / 192)
  123. this.isVideo = data
  124. },
  125. // 点击导航
  126. hanlderClick($event) {
  127. this.isArtical = $event
  128. this.activeMenu = `item${$event}`
  129. },
  130. hanlderVideoClick($event) {
  131. this.isVideo = $event
  132. this.activeVideoMenu = `item${$event}`
  133. },
  134. handlerMore ($event) {
  135. if ($event === 1) return uni.navigateTo({ url: '/pages/login/supplier_more?active=' + $event})
  136. else return uni.navigateTo({ url: '/pages/login/supplier_more?active=' + $event })
  137. }
  138. }
  139. }
  140. </script>
  141. <style scoped lang="scss">
  142. .img {
  143. width: 100%;
  144. height: 100%;
  145. }
  146. .growthcommunity {
  147. padding: 1px;
  148. box-sizing: border-box;
  149. background-color: #fff;
  150. .negotiation {
  151. padding-left: 72rpx;
  152. }
  153. }
  154. .enterprise {
  155. position: relative;
  156. margin-bottom: 50rpx;
  157. .more {
  158. position: absolute;
  159. right: 100rpx;
  160. top: 4rpx;
  161. font-size: 24rpx;
  162. }
  163. }
  164. .title {
  165. color: #333333;
  166. font-size: 32rpx;
  167. margin-bottom: 34rpx;
  168. }
  169. .scroll-view {
  170. white-space: nowrap;
  171. }
  172. .video-item {
  173. width: 384rpx;
  174. height: 376rpx;
  175. background: #ffffff;
  176. border: 1px solid #eaeaea;
  177. display: inline-flex;
  178. margin-right: 32rpx;
  179. box-sizing: border-box;
  180. flex-direction: column;
  181. overflow-wrap: break-word;
  182. white-space: normal;
  183. position: relative;
  184. .player {
  185. height: calc(100% - 159rpx);
  186. width: 100%;
  187. position: absolute;
  188. top: 0;
  189. left: 0;
  190. display: flex;
  191. align-items: center;
  192. justify-content: center;
  193. background-color: rgba(0, 0, 0, 0.3);
  194. .player-img {
  195. width: 60rpx;
  196. height: 60rpx;
  197. }
  198. }
  199. .img-item {
  200. height: calc(100% - 159rpx);
  201. width: 100%;
  202. }
  203. .videotitle {
  204. width: 100%;
  205. height: 159rpx;
  206. font-size: 28rpx;
  207. color: #333333;
  208. padding: 40rpx 40rpx;
  209. overflow: hidden;
  210. display: flex;
  211. justify-content: center;
  212. align-items: center;
  213. box-sizing: border-box;
  214. .text {
  215. width: 336rpx;
  216. height: 90rpx;
  217. overflow: hidden;
  218. line-height: 48rpx;
  219. -webkit-box-orient: vertical;
  220. -webkit-line-clamp: 2;
  221. overflow-wrap: break-word;
  222. text-overflow: ellipsis;
  223. display: -webkit-box;
  224. }
  225. }
  226. .articleContent {
  227. .text {
  228. margin-top: 24rpx;
  229. box-sizing: border-box;
  230. padding-left: 24rpx;
  231. color: #333333;
  232. font-size: 32rpx;
  233. border-left: 2px solid #ff5b00;
  234. }
  235. .article-con {
  236. margin-top: 18rpx;
  237. width: 100%;
  238. height: 62rpx;
  239. box-sizing: border-box;
  240. padding: 0 24rpx;
  241. color: #666666;
  242. font-size: 24rpx;
  243. overflow: hidden;
  244. -webkit-box-orient: vertical;
  245. -webkit-line-clamp: 2;
  246. overflow-wrap: break-word;
  247. text-overflow: ellipsis;
  248. display: -webkit-box;
  249. }
  250. }
  251. }
  252. .item-dots {
  253. height: 160rpx;
  254. display: flex;
  255. justify-content: center;
  256. align-items: center;
  257. margin-left: -20rpx;
  258. }
  259. </style>