home.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597
  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. {
  197. icon: 'icon-xiaochengxu-jiaotongzhinanicon',
  198. name: '打卡',
  199. is_hide: false,
  200. link: '/pages/checkIn/index'
  201. }],
  202. images: [],
  203. videos: [],
  204. albumPics: [],
  205. // 合作方列表
  206. part1: [],
  207. part2: [],
  208. part3: [],
  209. part1_ishide: false,
  210. part2_ishide: false,
  211. part3_ishide: false,
  212. adInfo: {
  213. ad_file: ''
  214. },
  215. isShow: false,
  216. time: 160
  217. }
  218. },
  219. computed: {},
  220. created() {
  221. this.getDashboardData()
  222. this.getAdData()
  223. this.time = this.getCountdown(2025,3,27,0,0,0).days
  224. },
  225. mounted() {
  226. },
  227. methods: {
  228. getCountdown(targetYear, targetMonth, targetDay, targetHour = 0, targetMinute = 0, targetSecond = 0) {
  229. const targetDate = new Date(targetYear, targetMonth - 1, targetDay, targetHour, targetMinute, targetSecond);
  230. const now = new Date();
  231. const timeDifference = targetDate - now;
  232. if (timeDifference <= 0) {
  233. return {
  234. days: 0,
  235. hours: 0,
  236. minutes: 0,
  237. seconds: 0,
  238. finished: true
  239. };
  240. }
  241. const days = Math.floor(timeDifference / (1000 * 60 * 60 * 24));
  242. const hours = Math.floor((timeDifference % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
  243. const minutes = Math.floor((timeDifference % (1000 * 60 * 60)) / (1000 * 60));
  244. const seconds = Math.floor((timeDifference % (1000 * 60)) / 1000);
  245. return {
  246. days: days,
  247. hours: hours,
  248. minutes: minutes,
  249. seconds: seconds,
  250. finished: false
  251. };
  252. },
  253. getPartHeight(part) {
  254. let height = 0
  255. if (part.length > 3) {
  256. height = 250
  257. } else if (part.length <= 3) {
  258. height = 120
  259. }
  260. return height
  261. },
  262. closeAd() {
  263. this.$store.commit('HIDE_AD')
  264. this.isShow = false
  265. },
  266. onClickNavIcon(item) {
  267. // this.navigateTo(item.link)
  268. if (item.link === '/pages/exhibitor/index') {
  269. this.$emit('switch-tab', 'exhibitor')
  270. this.$store.commit('SET_PAGE', 'exhibitor');
  271. } else if (item.link === '/pages/activity/index') {
  272. this.$emit('switch-tab', 'activity')
  273. this.$store.commit('SET_PAGE', 'activity');
  274. } else if (item.link === '/pages/exhibitor/exhibit') {
  275. this.$emit('switch-tab', 'product')
  276. this.$store.commit('SET_PAGE', 'product');
  277. } else {
  278. this.navigateTo(item.link)
  279. }
  280. },
  281. onClickSearch() {
  282. this.navigateTo('/pages/index/search?query=' + this.searchKeyword)
  283. },
  284. onClickAlbum(index) {
  285. const pics = this.albumPics.map(v => {
  286. return v
  287. })
  288. uni.previewImage({
  289. current: index,
  290. urls: pics
  291. })
  292. },
  293. getDashboardData() {
  294. this.loading = true
  295. getDashboardInfo('', process.env.CONFERENCE_WEBSITE).then(res => {
  296. this.logo = res.data.module0.url
  297. this.images = res.data.module1
  298. let module2 = res.data.module2
  299. for (var i = 0; i < module2.length; i++) {
  300. this.navIcons[i].name = module2[i].name
  301. this.navIcons[i].is_hide = module2[i].is_hide
  302. }
  303. this.videos = res.data.module3.video
  304. this.albumPics = res.data.module3.image
  305. this.part1 = res.data.module4.part1.logo
  306. this.part2 = res.data.module4.part2.logo
  307. this.part3 = res.data.module4.part3.logo
  308. this.part1_ishide = res.data.module4.part1.is_hide
  309. this.part2_ishide = res.data.module4.part2.is_hide
  310. this.part3_ishide = res.data.module4.part3.is_hide
  311. setTimeout(()=>{
  312. this.loading = false
  313. },1000)
  314. })
  315. },
  316. onLogoClick(item) {
  317. if (item.id) {
  318. this.navigateTo('/pages/exhibitor/detail?id=' + item.id)
  319. } else if (item.url) {
  320. this.navigateTo(item.href)
  321. }
  322. },
  323. getAdData() {
  324. getAdInfo({
  325. number: "IndexPopUp001"
  326. }).then(res => {
  327. this.adInfo = res.data[0]
  328. if (this.adInfo && this.adInfo.ad_file) {
  329. this.isShow = this.$store.state.app.adIsShow
  330. } else {
  331. this.isShow = false
  332. }
  333. })
  334. },
  335. navigateToAdLink(href) {
  336. this.navigateTo(href)
  337. }
  338. // onVisitClick() {
  339. // getBuoyInfo().then(res => {
  340. // let jump_url = res.data.visit_jump_url
  341. // this.navigateTo(jump_url)
  342. // })
  343. // },
  344. }
  345. }
  346. </script>
  347. <style lang="scss">
  348. .ad-wrapper {
  349. display: flex;
  350. justify-content: center;
  351. align-items: center;
  352. height: 100%;
  353. .img-btn-box {
  354. display: flex;
  355. justify-content: center;
  356. width: 600rpx;
  357. position: relative;
  358. .ad-space {
  359. width: 100%;
  360. .ad-img {
  361. width: 100%;
  362. }
  363. }
  364. }
  365. .home-ad-close {
  366. position: absolute;
  367. bottom: -118rpx;
  368. .van-icon-close {
  369. font-size: 68rpx;
  370. color: #FFFFFF;
  371. cursor: pointer;
  372. }
  373. }
  374. }
  375. .logo {
  376. width: 150rpx;
  377. height: 37rpx;
  378. }
  379. .panel-group {
  380. margin-top: 43rpx;
  381. background-color: #FFFFFF;
  382. &.logo-group {
  383. padding-bottom: 30rpx;
  384. }
  385. &.panel-group-1 {
  386. margin-top: 0;
  387. }
  388. }
  389. .top-container {
  390. display: flex;
  391. align-items: center;
  392. .countdown {
  393. display: flex;
  394. align-items: center;
  395. margin-left: 27rpx;
  396. font-size: $fontSize3;
  397. .days {
  398. color: #F97316;
  399. font-size: $fontSize6;
  400. font-weight: bold;
  401. padding: 0 4rpx;
  402. }
  403. }
  404. }
  405. .search-container {
  406. .search-input {
  407. height: 64rpx;
  408. border-radius: 50rpx;
  409. background-color: #FFFFFF;
  410. box-shadow: 0 4rpx 4rpx 0 rgba(0, 0, 0, 0.15);
  411. border: 2rpx solid #D9D9D9;
  412. padding: 4rpx;
  413. overflow: hidden;
  414. .van-field__placeholder {
  415. font-size: $fontSize2;
  416. }
  417. .van-cell__left-icon-wrap {
  418. height: 50rpx;
  419. }
  420. .van-field__control {
  421. font-size: $fontSize2;
  422. height: 50rpx;
  423. }
  424. }
  425. .van-search {
  426. --search-padding: 0rpx;
  427. --search-input-height: 34rpx;
  428. --search-background-color: #FFFFFF;
  429. padding-right: 24rpx;
  430. font-size: $fontSize2;
  431. }
  432. .search-text {
  433. font-size: $fontSize2;
  434. }
  435. .van-search__action {
  436. color: #333333;
  437. }
  438. .van-icon {
  439. color: #D4D4D6;
  440. }
  441. .van-cell {
  442. padding: 2rpx 0rpx 2rpx !important;
  443. }
  444. }
  445. .nav-icons {
  446. display: grid;
  447. grid-template-columns: 1fr 1fr 1fr 1fr;
  448. grid-row-gap: 53rpx;
  449. margin-top: 47rpx;
  450. margin-bottom: 41rpx;
  451. .nav-icon-wrapper {
  452. @include display-flex-center;
  453. flex-direction: column;
  454. cursor: pointer;
  455. }
  456. .nav-text {
  457. height: 20rpx;
  458. margin-top: 20rpx;
  459. font-size: $fontSize3;
  460. color: #555555;
  461. /*opacity: 0;
  462. transition: .1s ease-in-out;
  463. transform: translateY(10rpx);
  464. &.show {
  465. opacity: 1;
  466. transform: translateY(0);
  467. }*/
  468. }
  469. .nav-icon {
  470. @include display-flex-center;
  471. width: 73rpx;
  472. height: 73rpx;
  473. border-radius: 50%;
  474. overflow: hidden;
  475. background-color: $buttonPrimaryColor;
  476. .iconfont {
  477. font-size: 46rpx;
  478. color: #FFFFFF;
  479. }
  480. & > view {
  481. width: 46rpx;
  482. height: 46rpx;
  483. background-size: 46rpx 46rpx;
  484. }
  485. }
  486. }
  487. .album {
  488. display: grid;
  489. grid-auto-flow: row;
  490. grid-gap: 15rpx;
  491. height: 500rpx;
  492. width: fit-content;
  493. grid-template-areas: "a b b" "c d f" "c e f";
  494. .album-pic {
  495. width: 196rpx;
  496. height: 155rpx;
  497. border-radius: 10rpx;
  498. overflow: hidden;
  499. &:nth-child(1) {
  500. grid-area: a;
  501. }
  502. &:nth-child(2) {
  503. width: 418rpx;
  504. height: 155rpx;
  505. grid-area: b;
  506. }
  507. &:nth-child(3) {
  508. grid-area: c;
  509. }
  510. &:nth-child(4) {
  511. grid-area: d;
  512. }
  513. &:nth-child(5) {
  514. grid-area: e;
  515. }
  516. &:nth-child(6) {
  517. grid-area: f;
  518. }
  519. &:nth-child(3),
  520. &:nth-child(6) {
  521. width: 196rpx;
  522. height: 324rpx;
  523. }
  524. }
  525. image {
  526. width: 100%;
  527. height: 100%;
  528. }
  529. }
  530. .partners {
  531. display: grid;
  532. grid-template-columns: repeat(3, 1fr);
  533. grid-column-gap: 9rpx;
  534. grid-row-gap: 13rpx;
  535. .partner {
  536. @include display-flex-center;
  537. width: 100%;
  538. height: 120rpx;
  539. padding: 16rpx;
  540. border-radius: 5rpx;
  541. border: 1rpx solid #D9D9D9;
  542. overflow: hidden;
  543. }
  544. image {
  545. object-fit: contain;
  546. }
  547. }
  548. </style>