index.vue 10 KB

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