home.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  1. <template>
  2. <page-layout class="home-container">
  3. <!-- <u-loading :loading="loading"></u-loading>-->
  4. <nav-bar :show-title="false">
  5. <view class="top-container">
  6. <image class="logo" :src="logo" mode="aspectFit"/>
  7. <view class="countdown">
  8. 距开幕
  9. <view class="days"> {{ time }}</view>
  10. </view>
  11. </view>
  12. </nav-bar>
  13. <u-swiper :items="images" useComponentName='topSwiper' indicato-dots-style="morphing" :height="387"/>
  14. <view class="main-container">
  15. <u-search v-model="searchKeyword" placeholder="搜索关键词" @search="onClickSearch"/>
  16. <view class="nav-icons">
  17. <template v-for="(item, index) in navIcons">
  18. <view class="nav-icon-wrapper" :key="index" v-if="!item.is_hide">
  19. <view class="nav-icon" @click="onClickNavIcon(item)">
  20. <view v-if="item.icon.indexOf('.svg') !== -1" :style="'background-image:url(' + item.icon + ')'"></view>
  21. <view v-else-if="item.icon.indexOf('icon-') !== -1" :class="'iconfont ' + item.icon"></view>
  22. </view>
  23. <view class="nav-text" :class="item.name ? 'show' : ''">
  24. {{ item.name }}
  25. </view>
  26. </view>
  27. </template>
  28. </view>
  29. <view class="panel-group panel-group-1">
  30. <!-- <u-panel title="精彩视频" link="/pages/video/index">
  31. <u-swiper :items="videos" useComponentName="videoSwiper" :height="360" :autoplay="false" :border-radius="10"
  32. :image-width="508" :image-height="286" next-margin="100rpx"/>
  33. </u-panel>-->
  34. <u-panel title="精彩图集"
  35. link="https://www.productronicachina.com.cn/data-facts-impressions-impressions-videos">
  36. <u-swiper :items="albumPics" useComponentName="imageSwiper" :height="360" :border-radius="10"
  37. :image-width="508" :image-height="286" next-margin="100rpx"/>
  38. <!-- <view class="album">
  39. <template v-for="(item, index) in albumPics">
  40. <view class="album-pic" :key="index" @click="onClickAlbum(index)">
  41. <image :src="String(item)" mode="aspectFill" />
  42. </view>
  43. </template>
  44. </view> -->
  45. </u-panel>
  46. </view>
  47. <view class="panel-group">
  48. <u-panel title="新闻" link="/pages/news/index">
  49. <news-recommend recommend-type="home" news-type="exhibition"/>
  50. </u-panel>
  51. </view>
  52. <view class="panel-group logo-group">
  53. <u-panel title="战略合作方" m-title="*排名不分先后" v-if="!part1_ishide">
  54. <u-swiper :items="part1" useComponentName="logoSwiper" image-mode="aspectFit" key="logoSwiper"
  55. :autoplay="false" :height="getPartHeight(part1)">
  56. <template v-slot="{ scope }">
  57. <view class="partners">
  58. <template v-for="(item, index) in scope">
  59. <view class="partner" :key="index" @tap="onLogoClick(item)">
  60. <image mode="aspectFit" :src="item.url"/>
  61. </view>
  62. </template>
  63. </view>
  64. </template>
  65. </u-swiper>
  66. </u-panel>
  67. <u-panel title="推荐展商" link="/pages/exhibitor/index" m-title="*排名不分先后" v-if="!part3_ishide">
  68. <u-swiper :items="part3" useComponentName="logoSwiper" image-mode="aspectFit" key="logoSwiper"
  69. :autoplay="false" :height="getPartHeight(part3)">
  70. <template v-slot="{ scope }">
  71. <view class="partners">
  72. <template v-for="(item, index) in scope">
  73. <view class="partner" :key="index" @tap="onLogoClick(item)">
  74. <image mode="aspectFit" :src="item.url"/>
  75. </view>
  76. </template>
  77. </view>
  78. </template>
  79. </u-swiper>
  80. </u-panel>
  81. <u-panel title="合作媒体" link="https://www.productronicachina.com.cn/partners" m-title="*排名不分先后"
  82. v-if="!part2_ishide">
  83. <u-swiper :items="part2" key="logoSwiper2" image-mode="aspectFit" useComponentName="logoSwiper"
  84. :autoplay="false" :height="getPartHeight(part2)">
  85. <template v-slot="{ scope }">
  86. <view class="partners">
  87. <template v-for="(item, index) in scope">
  88. <view class="partner" :key="index" @tap="onLogoClick(item)">
  89. <image mode="aspectFit" :src="item.url"/>
  90. </view>
  91. </template>
  92. </view>
  93. </template>
  94. </u-swiper>
  95. </u-panel>
  96. </view>
  97. </view>
  98. <float-button></float-button>
  99. <van-overlay :show="isShow">
  100. <view class="ad-wrapper">
  101. <view class="img-btn-box">
  102. <view class="ad-space" v-if="adInfo && adInfo.ad_file" @tap="navigateToAdLink(adInfo.ad_link)">
  103. <image show-menu-by-longpress :src="adInfo.ad_file" mode="widthFix" class="ad-img"/>
  104. </view>
  105. <view class="home-ad-close" @click="closeAd()">
  106. <van-icon name="close"/>
  107. </view>
  108. </view>
  109. </view>
  110. </van-overlay>
  111. </page-layout>
  112. </template>
  113. <script>
  114. import NavBar from '@/components/layout/nav-bar'
  115. import UScrollView from '@/components/common/u-scroll-view'
  116. import ULoading from '@/components/common/u-loading'
  117. import USwiper from '@/components/common/u-swiper'
  118. import USearch from '@/components/common/u-search'
  119. import UPanel from '@/components/common/u-panel'
  120. import NewsRecommend from '@/pages/news/components/news-recommend.vue'
  121. import ContactUs from '@/pages/index/components/contact-us.vue'
  122. import PopupAd from '@/pages/index/components/popup-ad.vue'
  123. import floatButton from "@/components/layout/float-button"
  124. import VanOverlay from '@/wxcomponents/vant/overlay/index'
  125. import {
  126. getDashboardInfo,
  127. getAdInfo
  128. } from '@/api'
  129. import PageLayout from "@/components/layout/page-layout";
  130. import {exhibitorsList} from "@/api/exhibitor";
  131. export default {
  132. options: {
  133. styleIsolation: 'shared'
  134. },
  135. components: {
  136. PageLayout,
  137. floatButton,
  138. NavBar,
  139. UScrollView,
  140. USwiper,
  141. USearch,
  142. UPanel,
  143. NewsRecommend,
  144. ContactUs,
  145. PopupAd,
  146. ULoading,
  147. VanOverlay
  148. },
  149. data() {
  150. return {
  151. loading: true,
  152. logo: '',
  153. searchKeyword: '',
  154. showPopupAd: false,
  155. navIcons: [{
  156. icon: 'icon-xiaochengxu-guanyuzhanhuiicon',
  157. name: '',
  158. is_hide: false,
  159. link: 'https://www.productronicachina.com.cn/zh-cn/productronica-china-2025'
  160. }, {
  161. icon: 'icon-xiaochengxu-zhanshangmingluicon',
  162. name: '',
  163. is_hide: false,
  164. link: '/pages/exhibitor/index'
  165. }, {
  166. icon: 'icon-zhanpinziliaoicon',
  167. name: '',
  168. is_hide: false,
  169. link: '/pages/exhibitor/exhibit'
  170. }, {
  171. icon: 'icon-zhantaihuodongicon',
  172. name: '',
  173. is_hide: false,
  174. link: '/pages/activity/index'
  175. }, {
  176. icon: 'icon-zhanshangxinwenicon',
  177. name: '',
  178. is_hide: false,
  179. link: '/pages/news/index?type=exhibitor'
  180. }, {
  181. icon: 'icon-xiaochengxu-zhanguanpingmiantuicon',
  182. name: '',
  183. is_hide: false,
  184. link: 'https://www.productronicachina.com.cn/for-visitors-fairgrounds-map'
  185. }, {
  186. icon: 'icon-xiaochengxu-guanzhongzhinanicon',
  187. name: '',
  188. is_hide: false,
  189. link: '/pages/files/index'
  190. }, {
  191. icon: 'icon-xiaochengxu-jiaotongzhinanicon',
  192. name: '',
  193. is_hide: false,
  194. link: 'https://www.productronicachina.com.cn/travel-stay-getting-there'
  195. }],
  196. images: [],
  197. videos: [],
  198. albumPics: [],
  199. // 合作方列表
  200. part1: [],
  201. part2: [],
  202. part3: [],
  203. part1_ishide: false,
  204. part2_ishide: false,
  205. part3_ishide: false,
  206. adInfo: {
  207. ad_file: ''
  208. },
  209. isShow: false,
  210. time: 160
  211. }
  212. },
  213. computed: {},
  214. created() {
  215. this.getDashboardData()
  216. this.getAdData()
  217. this.time = this.getCountdown(2025,3,27,0,0,0).days
  218. },
  219. mounted() {
  220. },
  221. methods: {
  222. getCountdown(targetYear, targetMonth, targetDay, targetHour = 0, targetMinute = 0, targetSecond = 0) {
  223. const targetDate = new Date(targetYear, targetMonth - 1, targetDay, targetHour, targetMinute, targetSecond);
  224. const now = new Date();
  225. const timeDifference = targetDate - now;
  226. if (timeDifference <= 0) {
  227. return {
  228. days: 0,
  229. hours: 0,
  230. minutes: 0,
  231. seconds: 0,
  232. finished: true
  233. };
  234. }
  235. const days = Math.floor(timeDifference / (1000 * 60 * 60 * 24));
  236. const hours = Math.floor((timeDifference % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
  237. const minutes = Math.floor((timeDifference % (1000 * 60 * 60)) / (1000 * 60));
  238. const seconds = Math.floor((timeDifference % (1000 * 60)) / 1000);
  239. return {
  240. days: days,
  241. hours: hours,
  242. minutes: minutes,
  243. seconds: seconds,
  244. finished: false
  245. };
  246. },
  247. getPartHeight(part) {
  248. let height = 0
  249. if (part.length > 3) {
  250. height = 250
  251. } else if (part.length <= 3) {
  252. height = 120
  253. }
  254. return height
  255. },
  256. closeAd() {
  257. this.$store.commit('HIDE_AD')
  258. this.isShow = false
  259. },
  260. onClickNavIcon(item) {
  261. // this.navigateTo(item.link)
  262. if (item.link === '/pages/exhibitor/index') {
  263. this.$emit('switch-tab', 'exhibitor')
  264. this.$store.commit('SET_PAGE', 'exhibitor');
  265. } else if (item.link === '/pages/activity/index') {
  266. this.$emit('switch-tab', 'activity')
  267. this.$store.commit('SET_PAGE', 'activity');
  268. } else if (item.link === '/pages/exhibitor/exhibit') {
  269. this.$emit('switch-tab', 'product')
  270. this.$store.commit('SET_PAGE', 'product');
  271. } else {
  272. this.navigateTo(item.link)
  273. }
  274. },
  275. onClickSearch() {
  276. this.navigateTo('/pages/index/search?query=' + this.searchKeyword)
  277. },
  278. onClickAlbum(index) {
  279. const pics = this.albumPics.map(v => {
  280. return v
  281. })
  282. uni.previewImage({
  283. current: index,
  284. urls: pics
  285. })
  286. },
  287. getDashboardData() {
  288. this.loading = true
  289. getDashboardInfo('', process.env.CONFERENCE_WEBSITE).then(res => {
  290. this.logo = res.data.module0.url
  291. this.images = res.data.module1
  292. let module2 = res.data.module2
  293. for (var i = 0; i < module2.length; i++) {
  294. this.navIcons[i].name = module2[i].name
  295. this.navIcons[i].is_hide = module2[i].is_hide
  296. }
  297. this.videos = res.data.module3.video
  298. this.albumPics = res.data.module3.image
  299. this.part1 = res.data.module4.part1.logo
  300. this.part2 = res.data.module4.part2.logo
  301. this.part3 = res.data.module4.part3.logo
  302. this.part1_ishide = res.data.module4.part1.is_hide
  303. this.part2_ishide = res.data.module4.part2.is_hide
  304. this.part3_ishide = res.data.module4.part3.is_hide
  305. setTimeout(()=>{
  306. this.loading = false
  307. },1000)
  308. })
  309. },
  310. onLogoClick(item) {
  311. if (item.id) {
  312. this.navigateTo('/pages/exhibitor/detail?id=' + item.id)
  313. } else if (item.url) {
  314. this.navigateTo(item.href)
  315. }
  316. },
  317. getAdData() {
  318. getAdInfo({
  319. number: "IndexPopUp001"
  320. }).then(res => {
  321. this.adInfo = res.data[0]
  322. if (this.adInfo && this.adInfo.ad_file) {
  323. this.isShow = this.$store.state.app.adIsShow
  324. } else {
  325. this.isShow = false
  326. }
  327. })
  328. },
  329. navigateToAdLink(href) {
  330. this.navigateTo(href)
  331. }
  332. // onVisitClick() {
  333. // getBuoyInfo().then(res => {
  334. // let jump_url = res.data.visit_jump_url
  335. // this.navigateTo(jump_url)
  336. // })
  337. // },
  338. }
  339. }
  340. </script>
  341. <style lang="scss">
  342. .ad-wrapper {
  343. display: flex;
  344. justify-content: center;
  345. align-items: center;
  346. height: 100%;
  347. .img-btn-box {
  348. display: flex;
  349. justify-content: center;
  350. width: 600rpx;
  351. position: relative;
  352. .ad-space {
  353. width: 100%;
  354. .ad-img {
  355. width: 100%;
  356. }
  357. }
  358. }
  359. .home-ad-close {
  360. position: absolute;
  361. bottom: -118rpx;
  362. .van-icon-close {
  363. font-size: 68rpx;
  364. color: #FFFFFF;
  365. cursor: pointer;
  366. }
  367. }
  368. }
  369. .logo {
  370. width: 150rpx;
  371. height: 37rpx;
  372. }
  373. .panel-group {
  374. margin-top: 43rpx;
  375. background-color: #FFFFFF;
  376. &.logo-group {
  377. padding-bottom: 30rpx;
  378. }
  379. &.panel-group-1 {
  380. margin-top: 0;
  381. }
  382. }
  383. .top-container {
  384. display: flex;
  385. align-items: center;
  386. .countdown {
  387. display: flex;
  388. align-items: center;
  389. margin-left: 27rpx;
  390. font-size: $fontSize3;
  391. .days {
  392. color: #F97316;
  393. font-size: $fontSize6;
  394. font-weight: bold;
  395. padding: 0 4rpx;
  396. }
  397. }
  398. }
  399. .search-container {
  400. .search-input {
  401. height: 64rpx;
  402. border-radius: 50rpx;
  403. background-color: #FFFFFF;
  404. box-shadow: 0 4rpx 4rpx 0 rgba(0, 0, 0, 0.15);
  405. border: 2rpx solid #D9D9D9;
  406. padding: 4rpx;
  407. overflow: hidden;
  408. .van-field__placeholder {
  409. font-size: $fontSize2;
  410. }
  411. .van-cell__left-icon-wrap {
  412. height: 50rpx;
  413. }
  414. .van-field__control {
  415. font-size: $fontSize2;
  416. height: 50rpx;
  417. }
  418. }
  419. .van-search {
  420. --search-padding: 0rpx;
  421. --search-input-height: 34rpx;
  422. --search-background-color: #FFFFFF;
  423. padding-right: 24rpx;
  424. font-size: $fontSize2;
  425. }
  426. .search-text {
  427. font-size: $fontSize2;
  428. }
  429. .van-search__action {
  430. color: #333333;
  431. }
  432. .van-icon {
  433. color: #D4D4D6;
  434. }
  435. .van-cell {
  436. padding: 2rpx 0rpx 2rpx !important;
  437. }
  438. }
  439. .nav-icons {
  440. display: grid;
  441. grid-template-columns: 1fr 1fr 1fr 1fr;
  442. grid-row-gap: 53rpx;
  443. margin-top: 47rpx;
  444. margin-bottom: 41rpx;
  445. .nav-icon-wrapper {
  446. @include display-flex-center;
  447. flex-direction: column;
  448. cursor: pointer;
  449. }
  450. .nav-text {
  451. height: 20rpx;
  452. margin-top: 20rpx;
  453. font-size: $fontSize3;
  454. color: #555555;
  455. /*opacity: 0;
  456. transition: .1s ease-in-out;
  457. transform: translateY(10rpx);
  458. &.show {
  459. opacity: 1;
  460. transform: translateY(0);
  461. }*/
  462. }
  463. .nav-icon {
  464. @include display-flex-center;
  465. width: 73rpx;
  466. height: 73rpx;
  467. border-radius: 50%;
  468. overflow: hidden;
  469. background-color: $buttonPrimaryColor;
  470. .iconfont {
  471. font-size: 46rpx;
  472. color: #FFFFFF;
  473. }
  474. & > view {
  475. width: 46rpx;
  476. height: 46rpx;
  477. background-size: 46rpx 46rpx;
  478. }
  479. }
  480. }
  481. .album {
  482. display: grid;
  483. grid-auto-flow: row;
  484. grid-gap: 15rpx;
  485. height: 500rpx;
  486. width: fit-content;
  487. grid-template-areas: "a b b" "c d f" "c e f";
  488. .album-pic {
  489. width: 196rpx;
  490. height: 155rpx;
  491. border-radius: 10rpx;
  492. overflow: hidden;
  493. &:nth-child(1) {
  494. grid-area: a;
  495. }
  496. &:nth-child(2) {
  497. width: 418rpx;
  498. height: 155rpx;
  499. grid-area: b;
  500. }
  501. &:nth-child(3) {
  502. grid-area: c;
  503. }
  504. &:nth-child(4) {
  505. grid-area: d;
  506. }
  507. &:nth-child(5) {
  508. grid-area: e;
  509. }
  510. &:nth-child(6) {
  511. grid-area: f;
  512. }
  513. &:nth-child(3),
  514. &:nth-child(6) {
  515. width: 196rpx;
  516. height: 324rpx;
  517. }
  518. }
  519. image {
  520. width: 100%;
  521. height: 100%;
  522. }
  523. }
  524. .partners {
  525. display: grid;
  526. grid-template-columns: repeat(3, 1fr);
  527. grid-column-gap: 9rpx;
  528. grid-row-gap: 13rpx;
  529. .partner {
  530. @include display-flex-center;
  531. width: 100%;
  532. height: 120rpx;
  533. padding: 16rpx;
  534. border-radius: 5rpx;
  535. border: 1rpx solid #D9D9D9;
  536. overflow: hidden;
  537. }
  538. image {
  539. object-fit: contain;
  540. }
  541. }
  542. </style>