index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  1. <template>
  2. <view class="home-page">
  3. <erp-nav-bar title="华晟型材" :show-back="false" />
  4. <scroll-view class="main-scroll" scroll-y :show-scrollbar="false" :enhanced="true">
  5. <!-- 1. 灵动大屏轮播 (无缝全屏感) -->
  6. <view class="hero-section">
  7. <swiper class="hero-swiper" circular autoplay interval="5000" duration="800"
  8. @change="handleBannerChange">
  9. <swiper-item v-for="(item, index) in banners" :key="index">
  10. <view class="hero-card">
  11. <image :src="item.url" mode="aspectFill" class="hero-img"></image>
  12. <view class="hero-overlay"></view>
  13. <view class="hero-text-content">
  14. <text class="hero-tag">{{ item.tag }}</text>
  15. <text class="hero-main-title">{{ item.title }}</text>
  16. <text class="hero-sub-title">{{ item.subTitle }}</text>
  17. </view>
  18. </view>
  19. </swiper-item>
  20. </swiper>
  21. <!-- 胶囊样式指示器 -->
  22. <view class="hero-indicators">
  23. <view v-for="(item, index) in banners" :key="index" class="indicator-pill"
  24. :class="{ active: currentBanner === index }"></view>
  25. </view>
  26. </view>
  27. <!-- 2. 精英咨询入口 (悬浮毛玻璃效果) -->
  28. <view class="contact-card" @click="callService">
  29. <view class="contact-info">
  30. <view class="contact-icon-box">
  31. <image src="https://img.icons8.com/ios-filled/50/C1001C/phone.png" mode="aspectFit"></image>
  32. </view>
  33. <view class="contact-texts">
  34. <text class="main-txt">尊享 VIP 咨询服务</text>
  35. <text class="sub-txt">15年行业专家 为您定制型材解决方案</text>
  36. </view>
  37. </view>
  38. <view class="call-btn-circle">
  39. <image src="https://img.icons8.com/ios-glyphs/30/ffffff/phone--v1.png" mode="aspectFit"></image>
  40. </view>
  41. </view>
  42. <!-- 3. 魔幻型材空间 (2x2 魔方布局) -->
  43. <view class="cube-section">
  44. <view class="section-header">
  45. <view class="title-with-line">
  46. <text class="zh">精选分类</text>
  47. <text class="en">CATEGORIES</text>
  48. </view>
  49. </view>
  50. <view class="cube-container">
  51. <view class="cube-grid">
  52. <view class="cube-card" v-for="(item, index) in cubeProducts" :key="index" @click="goToOrder">
  53. <image :src="item.image" mode="aspectFill" class="cube-bg"></image>
  54. <view class="cube-mask"></view>
  55. <view class="cube-content">
  56. <text class="cube-title">{{ item.name }}</text>
  57. <view class="cube-line"></view>
  58. <text class="cube-desc">{{ item.desc }}</text>
  59. </view>
  60. <view class="cube-arrow">→</view>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. <!-- 4. 品牌硬实力 (深色大气卡片) -->
  66. <view class="brand-strength">
  67. <view class="strength-card">
  68. <view class="s-header">
  69. <text class="s-title">华晟 · 硬核实力</text>
  70. <text class="s-subtitle">Reliable Quality & Professional Service</text>
  71. </view>
  72. <view class="s-stats">
  73. <view class="stat-box">
  74. <text class="num">15<text class="unit">年</text></text>
  75. <text class="label">专注型材研发</text>
  76. </view>
  77. <view class="stat-divider"></view>
  78. <view class="stat-box">
  79. <text class="num">3<text class="unit">大</text></text>
  80. <text class="label">现代生产基地</text>
  81. </view>
  82. <view class="stat-divider"></view>
  83. <view class="stat-box">
  84. <text class="num">500<text class="unit">+</text></text>
  85. <text class="label">合作伙伴认可</text>
  86. </view>
  87. </view>
  88. <view class="s-footer">
  89. <text>品质铸就品牌 · 服务创造价值</text>
  90. </view>
  91. </view>
  92. </view>
  93. <!-- 底部占位 -->
  94. <view class="safe-bottom-gap"></view>
  95. </scroll-view>
  96. <!-- 底部通用导航 -->
  97. <erp-tab-bar active="home"></erp-tab-bar>
  98. </view>
  99. </template>
  100. <script>
  101. import ErpTabBar from '@/components/erp-tab-bar.vue';
  102. import ErpNavBar from '@/components/erp-nav-bar.vue';
  103. import assets from '@/utils/assets.js';
  104. import { getPhone } from '@/api/system/phone.js';
  105. import { listSlideshow } from '@/api/system/applet/slideshow.js';
  106. import { listCategories } from '@/api/system/applet/categories.js';
  107. export default {
  108. components: { ErpTabBar, ErpNavBar },
  109. data() {
  110. return {
  111. assets,
  112. statusBarHeight: 0,
  113. currentBanner: 0,
  114. expertPhone: '13888888888',
  115. banners: [],
  116. cubeProducts: []
  117. }
  118. },
  119. onLoad() {
  120. this.loadData();
  121. },
  122. methods: {
  123. async loadData() {
  124. await Promise.all([this.loadSlideshow(), this.loadCategories(), this.loadPhone()]);
  125. },
  126. async loadSlideshow() {
  127. try {
  128. const res = await listSlideshow();
  129. this.banners = (res.data || []).map(item => ({
  130. url: item.ossUrl || '',
  131. tag: '',
  132. title: '',
  133. subTitle: ''
  134. }));
  135. } catch (e) {
  136. console.error('加载轮播图失败', e);
  137. }
  138. },
  139. async loadCategories() {
  140. try {
  141. const res = await listCategories();
  142. this.cubeProducts = (res.data || []).map(item => ({
  143. name: item.title || '',
  144. desc: item.remark || '',
  145. image: item.backgroundUrl || ''
  146. }));
  147. } catch (e) {
  148. console.error('加载精选分类失败', e);
  149. }
  150. },
  151. async loadPhone() {
  152. try {
  153. const res = await getPhone();
  154. if (res.data && res.data.expertPhone) {
  155. this.expertPhone = res.data.expertPhone;
  156. }
  157. } catch (e) {
  158. console.error('加载联系电话失败', e);
  159. uni.showToast({ title: e || '加载联系电话失败', icon: 'none' });
  160. }
  161. },
  162. handleBannerChange(e) { this.currentBanner = e.detail.current; },
  163. callService() {
  164. uni.showModal({
  165. title: '管家式服务',
  166. content: '即将为您拨打华晟型材专家电话 ' + this.expertPhone,
  167. confirmText: '立即咨询',
  168. confirmColor: '#C1001C',
  169. cancelText: '稍后再说',
  170. cancelColor: '#999',
  171. success: (res) => {
  172. if (res.confirm) {
  173. uni.makePhoneCall({ phoneNumber: this.expertPhone });
  174. }
  175. }
  176. });
  177. },
  178. goToOrder() { uni.reLaunch({ url: '/pages/order/index' }); }
  179. }
  180. }
  181. </script>
  182. <style scoped>
  183. .home-page {
  184. width: 100vw;
  185. height: 100vh;
  186. background-color: #F8FAFC;
  187. display: flex;
  188. flex-direction: column;
  189. }
  190. .main-scroll {
  191. flex: 1;
  192. height: 0;
  193. }
  194. /* 英雄轮播区 */
  195. .hero-section {
  196. position: relative;
  197. width: 100%;
  198. height: 500rpx;
  199. overflow: hidden;
  200. }
  201. .hero-swiper {
  202. height: 100%;
  203. }
  204. .hero-card {
  205. position: relative;
  206. width: 100%;
  207. height: 100%;
  208. }
  209. .hero-img {
  210. width: 100%;
  211. height: 100%;
  212. }
  213. .hero-overlay {
  214. position: absolute;
  215. inset: 0;
  216. background: linear-gradient(to bottom, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.5));
  217. }
  218. .hero-text-content {
  219. position: absolute;
  220. left: 40rpx;
  221. bottom: 80rpx;
  222. color: #fff;
  223. z-index: 2;
  224. }
  225. .hero-tag {
  226. font-size: 20rpx;
  227. background: rgba(193, 0, 28, 0.8);
  228. padding: 4rpx 16rpx;
  229. border-radius: 4rpx;
  230. margin-bottom: 12rpx;
  231. display: inline-block;
  232. }
  233. .hero-main-title {
  234. font-size: 44rpx;
  235. font-weight: bold;
  236. display: block;
  237. margin-bottom: 8rpx;
  238. }
  239. .hero-sub-title {
  240. font-size: 24rpx;
  241. opacity: 0.8;
  242. letter-spacing: 1rpx;
  243. }
  244. .hero-indicators {
  245. position: absolute;
  246. bottom: 40rpx;
  247. right: 40rpx;
  248. display: flex;
  249. gap: 8rpx;
  250. }
  251. .indicator-pill {
  252. width: 12rpx;
  253. height: 6rpx;
  254. background: rgba(255, 255, 255, 0.3);
  255. border-radius: 4rpx;
  256. transition: 0.3s;
  257. }
  258. .indicator-pill.active {
  259. width: 32rpx;
  260. background: #fff;
  261. }
  262. /* 咨询卡片 */
  263. .contact-card {
  264. margin: -40rpx 40rpx 40rpx;
  265. position: relative;
  266. z-index: 10;
  267. background: rgba(255, 255, 255, 0.9);
  268. backdrop-filter: blur(20px);
  269. border-radius: 24rpx;
  270. padding: 32rpx 40rpx;
  271. display: flex;
  272. align-items: center;
  273. justify-content: space-between;
  274. border: 1rpx solid #fff;
  275. box-shadow: 0 12rpx 40rpx rgba(0, 0, 0, 0.06);
  276. }
  277. .contact-info {
  278. display: flex;
  279. align-items: center;
  280. }
  281. .contact-icon-box {
  282. width: 88rpx;
  283. height: 88rpx;
  284. background: #FFF1F2;
  285. border-radius: 50%;
  286. display: flex;
  287. align-items: center;
  288. justify-content: center;
  289. margin-right: 24rpx;
  290. }
  291. .contact-icon-box image {
  292. width: 44rpx;
  293. height: 44rpx;
  294. }
  295. .main-txt {
  296. font-size: 30rpx;
  297. font-weight: bold;
  298. color: #1a1a1a;
  299. display: block;
  300. margin-bottom: 4rpx;
  301. }
  302. .sub-txt {
  303. font-size: 22rpx;
  304. color: #7a7a7a;
  305. }
  306. .call-btn-circle {
  307. width: 72rpx;
  308. height: 72rpx;
  309. background: #C1001C;
  310. border-radius: 50%;
  311. display: flex;
  312. align-items: center;
  313. justify-content: center;
  314. box-shadow: 0 6rpx 12rpx rgba(193, 0, 28, 0.3);
  315. }
  316. .call-btn-circle image {
  317. width: 32rpx;
  318. height: 32rpx;
  319. }
  320. /* 魔方布局 */
  321. .cube-section {
  322. padding: 20rpx 40rpx;
  323. }
  324. .section-header {
  325. margin-bottom: 30rpx;
  326. }
  327. .title-with-line {
  328. display: flex;
  329. align-items: baseline;
  330. gap: 16rpx;
  331. }
  332. .title-with-line .zh {
  333. font-size: 36rpx;
  334. font-weight: 800;
  335. color: #1a1a1a;
  336. }
  337. .title-with-line .en {
  338. font-size: 20rpx;
  339. color: #999;
  340. font-family: 'Georgia';
  341. letter-spacing: 2rpx;
  342. }
  343. .cube-container {
  344. width: 100%;
  345. }
  346. .cube-grid {
  347. display: grid;
  348. grid-template-columns: repeat(2, 1fr);
  349. gap: 20rpx;
  350. }
  351. .cube-card {
  352. position: relative;
  353. height: 320rpx;
  354. border-radius: 20rpx;
  355. overflow: hidden;
  356. background: #eee;
  357. transition: 0.3s;
  358. }
  359. .cube-bg {
  360. width: 100%;
  361. height: 100%;
  362. }
  363. .cube-mask {
  364. position: absolute;
  365. inset: 0;
  366. background: rgba(0, 0, 0, 0.3);
  367. }
  368. .cube-content {
  369. position: absolute;
  370. left: 30rpx;
  371. top: 30rpx;
  372. z-index: 2;
  373. }
  374. .cube-title {
  375. font-size: 32rpx;
  376. font-weight: bold;
  377. color: #fff;
  378. margin-bottom: 12rpx;
  379. display: block;
  380. }
  381. .cube-line {
  382. width: 40rpx;
  383. height: 4rpx;
  384. background: #C1001C;
  385. margin-bottom: 12rpx;
  386. }
  387. .cube-desc {
  388. font-size: 20rpx;
  389. color: rgba(255, 255, 255, 0.8);
  390. max-width: 240rpx;
  391. line-height: 1.4;
  392. display: block;
  393. }
  394. .cube-arrow {
  395. position: absolute;
  396. right: 30rpx;
  397. bottom: 30rpx;
  398. color: #fff;
  399. font-size: 30rpx;
  400. opacity: 0.6;
  401. }
  402. /* 企业实力 */
  403. .brand-strength {
  404. padding: 40rpx;
  405. margin-bottom: 40rpx;
  406. }
  407. .strength-card {
  408. background: #1a1a1a;
  409. border-radius: 32rpx;
  410. padding: 48rpx 40rpx;
  411. color: #fff;
  412. box-shadow: 0 20rpx 60rpx rgba(0, 0, 0, 0.15);
  413. }
  414. .s-header {
  415. margin-bottom: 50rpx;
  416. }
  417. .s-title {
  418. font-size: 34rpx;
  419. font-weight: bold;
  420. display: block;
  421. margin-bottom: 8rpx;
  422. color: #fff;
  423. letter-spacing: 4rpx;
  424. }
  425. .s-subtitle {
  426. font-size: 18rpx;
  427. color: #666;
  428. font-family: 'Arial';
  429. text-transform: uppercase;
  430. }
  431. .s-stats {
  432. display: flex;
  433. justify-content: space-between;
  434. align-items: center;
  435. margin-bottom: 40rpx;
  436. }
  437. .stat-box {
  438. text-align: center;
  439. flex: 1;
  440. }
  441. .stat-box .num {
  442. font-size: 44rpx;
  443. font-weight: 800;
  444. color: #FFD700;
  445. display: block;
  446. margin-bottom: 4rpx;
  447. }
  448. .stat-box .unit {
  449. font-size: 20rpx;
  450. margin-left: 4rpx;
  451. font-weight: normal;
  452. }
  453. .stat-box .label {
  454. font-size: 22rpx;
  455. color: #ababab;
  456. }
  457. .stat-divider {
  458. width: 1rpx;
  459. height: 50rpx;
  460. background: rgba(255, 255, 255, 0.1);
  461. }
  462. .s-footer {
  463. border-top: 1rpx solid rgba(255, 255, 255, 0.05);
  464. padding-top: 30rpx;
  465. text-align: center;
  466. }
  467. .s-footer text {
  468. font-size: 18rpx;
  469. color: #555;
  470. letter-spacing: 6rpx;
  471. }
  472. .safe-bottom-gap {
  473. height: 140rpx;
  474. }
  475. </style>