Hanye官网
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097
  1. <template>
  2. <div>
  3. <div class="w-full h-[88px] md:h-[0]"></div>
  4. <!-- 轮播图 -->
  5. <section class="max-w-full mb-12 md:mb-32 xl:px-8 lg:px-6 md:px-4 px-4">
  6. <Swiper
  7. :modules="[Pagination, Autoplay, EffectCreative]"
  8. :slides-per-view="1"
  9. :space-between="30"
  10. :loop="true"
  11. :pagination="{ el: '.swiper-pagination-1', clickable: true }"
  12. :autoplay="{
  13. delay: 5000,
  14. disableOnInteraction: false,
  15. pauseOnMouseEnter: true,
  16. waitForTransition: true,
  17. }"
  18. effect="creative"
  19. :creativeEffect="{
  20. prev: {
  21. shadow: true,
  22. translate: ['-120%', 0, -500],
  23. rotate: [0, 0, -90],
  24. opacity: 0,
  25. },
  26. next: {
  27. shadow: true,
  28. translate: ['120%', 0, -500],
  29. rotate: [0, 0, 90],
  30. opacity: 0,
  31. },
  32. }"
  33. :speed="1000"
  34. :grabCursor="true"
  35. :parallax="true"
  36. class="h-[320px] sm:h-[320px] md:h-[768px] lg:h-[900px] swiper-container-1"
  37. >
  38. <SwiperSlide>
  39. <div
  40. class="max-w-screen-2xl mx-auto h-full relative"
  41. :style="{
  42. backgroundImage: `url(${homeA1Webp})`,
  43. backgroundSize: 'cover',
  44. backgroundPosition: 'center',
  45. backgroundRepeat: 'no-repeat',
  46. }"
  47. >
  48. <div
  49. class="w-full h-full flex-col justify-center hidden md:flex relative z-10"
  50. >
  51. <div
  52. class="rounded border border-white w-11 h-6 leading-none justify-center flex items-center text-white text-sm font-normal"
  53. >
  54. SSD
  55. </div>
  56. <div class="justify-center">
  57. <span class="text-white text-6xl font-normal leading-[78px]">{{
  58. t("home.carousel.one.title")
  59. }}</span>
  60. <span class="text-white text-6xl font-normal leading-[78px]">{{
  61. t("home.carousel.one.description")
  62. }}</span>
  63. <br />
  64. <span class="text-white text-6xl font-normal leading-[78px]">{{
  65. t("home.carousel.one.description2")
  66. }}</span
  67. ><br />
  68. <span
  69. class="text-cyan-400 text-6xl font-normal leading-[78px]"
  70. >{{ t("home.carousel.one.description3") }}</span
  71. >
  72. </div>
  73. <div class="flex flex-col gap-2 mt-4">
  74. <div
  75. class="flex items-center gap-2 text-stone-50 text-xl font-normal"
  76. >
  77. <div class="w-2 h-2 bg-white rounded-full"></div>
  78. {{ t("home.carousel.one.description4") }}
  79. </div>
  80. <div
  81. class="flex items-center gap-2 text-stone-50 text-xl font-normal"
  82. >
  83. <div class="w-2 h-2 bg-white rounded-full"></div>
  84. {{ t("home.carousel.one.description5") }}
  85. </div>
  86. </div>
  87. <div
  88. class="w-36 h-14 mt-12 flex items-center justify-center bg-[#35F1FF] rounded-lg hover:bg-[#35F1FF]/80 transition-colors duration-300"
  89. >
  90. <nuxt-link
  91. to="/products/1"
  92. class="w-full h-full !flex items-center justify-center text-zinc-900"
  93. >
  94. {{ t("products.view_details") }}
  95. </nuxt-link>
  96. </div>
  97. </div>
  98. </div>
  99. </SwiperSlide>
  100. <div class="max-w-screen-2xl mx-auto relative">
  101. <div
  102. class="swiper-pagination swiper-pagination-1 text-left bottom-1 top-0"
  103. ></div>
  104. </div>
  105. </Swiper>
  106. </section>
  107. <!-- 按用途产品展示 -->
  108. <section class="max-w-full mb-12 md:mb-32 xl:px-8 lg:px-6 md:px-4 px-4">
  109. <div class="max-w-screen-2xl mx-auto relative">
  110. <div
  111. class="justify-center text-cyan-400 text-base font-normal leading-tight mb-4"
  112. >
  113. {{ t("products.usage") }}
  114. </div>
  115. <div
  116. class="justify-center text-white font-normal mb-8 md:mb-16 text-xl sm:text-2xl md:text-4xl lg:text-6xl"
  117. >
  118. {{ t("products.usage_title") }}
  119. </div>
  120. </div>
  121. <div class="max-w-screen-2xl mx-auto">
  122. <div class="w-full mb-8">
  123. <div class="flex flex-wrap items-center gap-2">
  124. <div
  125. v-for="(usage, index) in typedUsageList"
  126. :key="usage.id"
  127. class="cursor-pointer select-none px-4 sm:px-7 py-2 sm:py-3 rounded-full border border-zinc-700 text-white transition-all duration-300 relative group"
  128. :class="{
  129. 'bg-cyan-400/10 border-cyan-400 text-cyan-400':
  130. activeIndex === index,
  131. 'hover:border-zinc-600': activeIndex !== index,
  132. }"
  133. @click="handleUsageClick(usage.id)"
  134. >
  135. <div
  136. class="usage-name text-center text-xs sm:text-sm font-normal leading-tight md:text-base transition-colors duration-300 relative z-10"
  137. >
  138. {{ usage.name }}
  139. <!-- 用途名称 -->
  140. </div>
  141. <div
  142. class="absolute inset-0 rounded-full bg-cyan-400/20 scale-0 transition-transform duration-300 group-hover:scale-100"
  143. ></div>
  144. </div>
  145. <div class="flex items-center justify-center gap-4 ml-auto">
  146. <div
  147. class="swiper-button-prev-2 bg-zinc-700 w-8 h-8 sm:w-10 sm:h-10 rounded-full flex items-center justify-center cursor-pointer hover:bg-zinc-600 transition-colors duration-200"
  148. >
  149. <i
  150. class="icon-arrow-left text-zinc-300 text-xs sm:text-sm font-normal"
  151. ></i>
  152. </div>
  153. <div
  154. class="swiper-button-next-2 bg-zinc-700 w-8 h-8 sm:w-10 sm:h-10 rounded-full flex items-center justify-center cursor-pointer hover:bg-zinc-600 transition-colors duration-200"
  155. >
  156. <i
  157. class="icon-arrow-right text-zinc-300 text-xs sm:text-sm font-normal"
  158. ></i>
  159. </div>
  160. </div>
  161. </div>
  162. </div>
  163. </div>
  164. <div class="max-w-screen-2xl mx-auto">
  165. <div
  166. class="w-full h-[380px] sm:h-[300px] md:h-[350px] lg:h-[360px] xl:h-[380px] 2xl:h-[460px] relative"
  167. >
  168. <TransitionGroup name="slide-fade" tag="div" class="relative h-full">
  169. <div :key="activeUsageId" class="w-full h-full">
  170. <Swiper
  171. :modules="[Navigation]"
  172. :spaceBetween="30"
  173. :slidesPerView="4"
  174. :breakpoints="{
  175. 320: { slidesPerView: 1, spaceBetween: 10 },
  176. 448: { slidesPerView: 2, spaceBetween: 10 },
  177. 640: { slidesPerView: 3, spaceBetween: 20 },
  178. 1024: { slidesPerView: 4, spaceBetween: 20 },
  179. 1280: { slidesPerView: 4, spaceBetween: 30 },
  180. 1536: { slidesPerView: 4, spaceBetween: 30 },
  181. }"
  182. :navigation="{
  183. prevEl: '.swiper-button-prev-2',
  184. nextEl: '.swiper-button-next-2',
  185. }"
  186. class="h-full"
  187. >
  188. <SwiperSlide
  189. v-for="product in activeProducts"
  190. :key="product.id"
  191. class="w-full sm:w-1/2 md:w-1/3 lg:w-1/4"
  192. >
  193. <div class="w-full h-full p-2">
  194. <nuxt-link :to="product.link" class="block w-full h-full">
  195. <div
  196. class="w-full h-full bg-zinc-900 rounded-2xl p-4 flex flex-col items-center justify-start relative overflow-hidden group hover:bg-zinc-800 transition-all duration-300 hover:shadow-lg hover:shadow-cyan-400/10"
  197. >
  198. <!-- 图片加载占位 -->
  199. <div
  200. v-if="!isImageLoaded[product.id]"
  201. class="absolute inset-0 bg-gradient-to-br from-zinc-800 via-zinc-700 to-zinc-800 animate-gradient"
  202. >
  203. <div
  204. class="absolute inset-0 flex items-center justify-center"
  205. >
  206. <div
  207. class="w-8 h-8 border-4 border-cyan-400/20 border-t-cyan-400 rounded-full animate-spin"
  208. ></div>
  209. </div>
  210. </div>
  211. <!-- 图片容器 -->
  212. <div
  213. class="w-full aspect-square relative transition-all duration-300 overflow-hidden rounded-lg"
  214. :class="{ 'opacity-0': !isImageLoaded[product.id] }"
  215. >
  216. <img
  217. :src="product.image"
  218. :alt="product.title"
  219. class="w-full h-full object-cover transition-all duration-500 group-hover:scale-110"
  220. @load="handleImageLoad(product.id)"
  221. @error="handleImageError(product.id)"
  222. loading="lazy"
  223. />
  224. <div
  225. class="absolute inset-0 bg-gradient-to-t from-black/60 via-black/20 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300"
  226. ></div>
  227. <!-- 添加查看详情按钮 -->
  228. <div
  229. class="absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-all duration-300 transform translate-y-4 group-hover:translate-y-0"
  230. >
  231. <div
  232. class="px-4 py-2 bg-cyan-400/20 backdrop-blur-sm rounded-full text-white text-sm font-medium border border-cyan-400/30 transform transition-transform duration-300 group-hover:scale-105"
  233. >
  234. {{ t("products.view_details") }}
  235. </div>
  236. </div>
  237. </div>
  238. <!-- 文字内容 -->
  239. <div
  240. class="w-full mt-4 min-h-[80px] transition-all duration-300 transform"
  241. :class="{
  242. 'opacity-0 translate-y-4':
  243. !isImageLoaded[product.id],
  244. 'opacity-100 translate-y-0':
  245. isImageLoaded[product.id],
  246. }"
  247. >
  248. <div
  249. class="text-center text-white text-base font-bold leading-tight mb-2 line-clamp-2 group-hover:text-cyan-400 transition-colors duration-300"
  250. >
  251. {{ product.title }}
  252. </div>
  253. <div
  254. class="text-center text-zinc-400 text-sm font-normal leading-tight line-clamp-2 group-hover:text-zinc-300 transition-colors duration-300"
  255. >
  256. {{ product.description }}
  257. </div>
  258. </div>
  259. </div>
  260. </nuxt-link>
  261. </div>
  262. </SwiperSlide>
  263. </Swiper>
  264. </div>
  265. </TransitionGroup>
  266. </div>
  267. </div>
  268. </section>
  269. <!-- 按分类栏目展示 -->
  270. <section class="max-w-full mb-12 md:mb-32 xl:px-8 lg:px-6 md:px-4 px-4">
  271. <div class="max-w-screen-2xl mx-auto relative">
  272. <div
  273. class="justify-center text-cyan-400 text-base font-normal leading-tight mb-4"
  274. >
  275. Hanye独自に開発・製造、販売
  276. </div>
  277. <div
  278. class="justify-center text-white font-normal mb-8 md:mb-16 text-xl sm:text-2xl md:text-4xl lg:text-6xl"
  279. >
  280. 製品カテゴリー
  281. </div>
  282. </div>
  283. <div class="max-w-screen-2xl mx-auto">
  284. <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
  285. <nuxt-link
  286. v-for="category in typedCategoryList"
  287. :key="category.id"
  288. :to="category.link"
  289. class="bg-zinc-950/10 backdrop-blur-[50px] border border-white/10 rounded-lg flex gap-8 p-4 sm:p-8 justify-between category-item group hover:border-cyan-400/30 transition-all duration-300"
  290. >
  291. <div class="col-span-1 flex flex-col gap-4">
  292. <div
  293. class="flex flex-col gap-2 opacity-80 group-hover:opacity-100 transition-opacity duration-300"
  294. >
  295. <div
  296. v-for="capacitie in category.capacities"
  297. :key="capacitie"
  298. class="text-white text-sm md:text-base font-normal leading-tight flex gap-2 items-center group-hover:text-cyan-400 transition-colors duration-300"
  299. >
  300. <i
  301. class="icon-star text-sm group-hover:scale-110 transition-transform duration-300"
  302. ></i>
  303. <span>{{ capacitie }}</span>
  304. </div>
  305. </div>
  306. <div
  307. class="p-2 sm:p-4 mt-auto bg-zinc-500/20 rounded-lg outline outline-1 outline-offset-[-1px] outline-white/10 backdrop-blur-xl inline-flex justify-center items-center gap-3 overflow-hidden group-hover:bg-cyan-400/10 group-hover:outline-cyan-400/30 transition-all duration-300"
  308. >
  309. <div
  310. class="justify-start text-neutral-200 text-xs md:text-sm font-medium uppercase leading-relaxed group-hover:text-cyan-400 transition-colors duration-300"
  311. >
  312. {{ category.title }}
  313. </div>
  314. </div>
  315. </div>
  316. <div
  317. class="w-32 h-32 md:w-44 md:h-44 relative overflow-hidden rounded-lg"
  318. >
  319. <img
  320. :src="category.image"
  321. :alt="category.title"
  322. class="w-full h-full object-contain transition-transform duration-500 group-hover:scale-110"
  323. />
  324. <div
  325. class="absolute inset-0 bg-gradient-to-t from-black/60 via-black/20 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300"
  326. ></div>
  327. </div>
  328. </nuxt-link>
  329. </div>
  330. </div>
  331. </section>
  332. <!-- 产品核心展示 -->
  333. <section class="max-w-full mb-12 md:mb-32 xl:px-8 lg:px-6 md:px-4 px-4">
  334. <div
  335. class="max-w-screen-2xl mx-auto grid grid-cols-1 lg:grid-cols-3 md:grid-cols-2 sm:grid-cols-1 gap-4"
  336. >
  337. <div class="inline-flex justify-start items-center gap-5">
  338. <div
  339. class="w-12 h-12 md:w-16 md:h-16 relative bg-gradient-to-b from-neutral-600 to-slate-400 rounded-xl border-b-[1.50px] border-neutral-700 overflow-hidden"
  340. >
  341. <div class="w-full h-full flex items-center justify-center">
  342. <i class="icon-h1 text-white text-5xl"></i>
  343. </div>
  344. </div>
  345. <div class="inline-flex flex-col justify-center items-start flex-1">
  346. <div
  347. class="justify-start text-white font-medium text-1xl md:text-lg"
  348. >
  349. {{ t("products.support") }}
  350. </div>
  351. <div
  352. class="justify-start text-zinc-300 text-xs font-normal md:text-sm"
  353. >
  354. {{ t("products.support_description") }}
  355. </div>
  356. </div>
  357. </div>
  358. <div class="inline-flex justify-start items-center gap-5">
  359. <div
  360. class="w-12 h-12 md:w-16 md:h-16 relative bg-gradient-to-b from-neutral-600 to-slate-400 rounded-xl border-b-[1.50px] border-neutral-700 overflow-hidden"
  361. >
  362. <div class="w-full h-full flex items-center justify-center">
  363. <i class="icon-h2 text-white text-5xl"></i>
  364. </div>
  365. </div>
  366. <div class="inline-flex flex-col justify-center items-start flex-1">
  367. <div
  368. class="justify-start text-white font-medium text-1xl md:text-lg"
  369. >
  370. {{ t("products.development") }}
  371. </div>
  372. <div
  373. class="justify-start text-zinc-300 text-xs font-normal md:text-sm"
  374. >
  375. {{ t("products.development_description") }}
  376. </div>
  377. </div>
  378. </div>
  379. <div class="inline-flex justify-start items-center gap-5">
  380. <div
  381. class="w-12 h-12 md:w-16 md:h-16 relative bg-gradient-to-b from-neutral-600 to-slate-400 rounded-xl border-b-[1.50px] border-neutral-700 overflow-hidden"
  382. >
  383. <div class="w-full h-full flex items-center justify-center">
  384. <i class="icon-h3 text-white text-5xl"></i>
  385. </div>
  386. </div>
  387. <div class="inline-flex flex-col justify-center items-start flex-1">
  388. <div
  389. class="justify-start text-white font-medium text-1xl md:text-lg"
  390. >
  391. {{ t("products.develop") }}
  392. </div>
  393. <div
  394. class="justify-start text-zinc-300 text-xs font-normal md:text-sm"
  395. >
  396. {{ t("products.develop_description") }}
  397. </div>
  398. </div>
  399. </div>
  400. </div>
  401. </section>
  402. <!-- 当社の強み -->
  403. <section class="max-w-full mb-12 md:mb-32 xl:px-8 lg:px-6 md:px-4 px-4">
  404. <div class="max-w-screen-2xl mx-auto relative">
  405. <div
  406. class="justify-center text-cyan-400 text-base font-normal leading-tight mb-4"
  407. >
  408. {{ t("products.strong_point") }}
  409. </div>
  410. <div
  411. class="justify-center text-white font-normal mb-8 md:mb-16 text-xl sm:text-2xl md:text-4xl lg:text-6xl"
  412. >
  413. {{ t("products.strong_point_title") }}
  414. </div>
  415. <div
  416. class="absolute right-0 top-1/2 -translate-y-1/2 z-10 lg:block hidden"
  417. >
  418. <div class="flex items-center justify-center gap-4">
  419. <div
  420. class="swiper-button-prev-3 bg-zinc-700 w-10 h-10 rounded-full flex items-center justify-center cursor-pointer hover:bg-zinc-600 transition-colors duration-200"
  421. >
  422. <i class="icon-arrow-left text-zinc-300 text-sm font-normal"></i>
  423. </div>
  424. <div
  425. class="swiper-button-next-3 bg-zinc-700 w-10 h-10 rounded-full flex items-center justify-center cursor-pointer hover:bg-zinc-600 transition-colors duration-200"
  426. >
  427. <i class="icon-arrow-right text-zinc-300 text-sm font-normal"></i>
  428. </div>
  429. </div>
  430. </div>
  431. </div>
  432. <div class="max-w-screen-2xl mx-auto">
  433. <div class="w-full relative max-w-full">
  434. <Swiper
  435. :modules="[Navigation, Pagination]"
  436. slides-per-view="auto"
  437. :space-between="30"
  438. :pagination="{ el: '.swiper-pagination-3', clickable: true }"
  439. :navigation="{
  440. prevEl: '.swiper-button-prev-3',
  441. nextEl: '.swiper-button-next-3',
  442. }"
  443. class="h-[320px] sm:h-[320px] md:h-[480px] lg:h-[720px] max-w-full"
  444. >
  445. <SwiperSlide class="!max-w-screen-2xl !w-full">
  446. <div
  447. class="w-full h-full flex items-center px-0 md:px-20"
  448. :style="{
  449. backgroundImage: `url(${homeC1Webp})`,
  450. backgroundSize: 'cover',
  451. backgroundPosition: 'center',
  452. backgroundRepeat: 'no-repeat',
  453. }"
  454. >
  455. <div
  456. class="w-full lg:w-[50%] h-full md:h-auto bg-white/5 rounded-0 md:rounded-2xl backdrop-blur-[50px] px-4 py-8 md:py-12 md:px-8 flex flex-col gap-8 border border-white/10"
  457. >
  458. <div
  459. class="opacity-90 justify-start text-white text-2xl font-normal md:text-4xl"
  460. >
  461. 一貫体制による高品質と安定供給
  462. </div>
  463. <div
  464. class="opacity-70 justify-start text-white text-base md:text-lg font-normal leading-relaxed"
  465. >
  466. 「企画・開発から製造、品質管理、販売、オンラインショップ運営まで自社で完結。ISO認証取得の工場で生産された信頼性の高い製品を、安定してお届けします。」
  467. </div>
  468. </div>
  469. </div>
  470. </SwiperSlide>
  471. </Swiper>
  472. </div>
  473. <div class="max-w-screen-2xl mx-auto relative">
  474. <div class="swiper-pagination swiper-pagination-3"></div>
  475. </div>
  476. </div>
  477. </section>
  478. <!-- 产品咨询 -->
  479. <section class="max-w-full h-[240px] md:h-[480px] bg-black/80 md:block">
  480. <div class="h-full relative">
  481. <div
  482. class="absolute top-0 left-0 w-full h-full flex flex-col gap-6 items-center justify-center z-10"
  483. >
  484. <h1
  485. class="text-center justify-start text-white font-normal text-xl sm:text-2xl md:text-3xl px-2"
  486. >
  487. {{ t("products.consultation") }}
  488. </h1>
  489. <nuxt-link
  490. :to="locale === defaultLocale ? '/contact' : `/${locale}/contact`"
  491. class="w-32 h-10 md:w-40 md:h-11 bg-zinc-300/10 rounded-lg outline outline-1 flex items-center justify-center gap-2 outline-white/20 backdrop-blur-[10px] cursor-pointer hover:bg-zinc-300/20 transition-colors duration-200"
  492. >
  493. <span class="text-xs md:text-sm font-normal">{{
  494. t("products.consultation_button")
  495. }}</span>
  496. <i class="icon-arrow-right text-sm font-normal"></i>
  497. </nuxt-link>
  498. </div>
  499. <img
  500. v-if="isMobile"
  501. :src="videoWebp"
  502. alt="video"
  503. class="w-full h-full object-cover opacity-20"
  504. />
  505. <video
  506. v-else
  507. :src="videoSrc"
  508. autoplay
  509. muted
  510. loop
  511. :poster="videoWebp"
  512. class="w-full h-full object-cover opacity-20"
  513. ></video>
  514. </div>
  515. </section>
  516. </div>
  517. </template>
  518. <script setup lang="ts">
  519. import { Swiper, SwiperSlide } from "swiper/vue";
  520. import {
  521. Navigation,
  522. Pagination,
  523. Autoplay,
  524. EffectCreative,
  525. } from "swiper/modules";
  526. import "swiper/css";
  527. import "swiper/css/navigation";
  528. import "swiper/css/pagination";
  529. import { useBreakpoints, breakpointsTailwind } from "@vueuse/core";
  530. import { useI18n, useRoute, useAsyncData, queryCollection } from "#imports";
  531. import video from "@/assets/videos/video.mp4";
  532. import videoWebp from "@/assets/videos/video.webp";
  533. import homeA1Webp from "@/assets/images/home-a-1.webp";
  534. import homeC1Webp from "@/assets/images/home-c-1.webp";
  535. // 数据类型定义
  536. interface Product {
  537. id: number;
  538. title: string;
  539. image: string;
  540. link: string;
  541. description?: string;
  542. }
  543. interface Usage {
  544. id: number;
  545. name: string;
  546. category?: string;
  547. products: Product[];
  548. }
  549. interface Category {
  550. id: number;
  551. title: string;
  552. description: string;
  553. capacities: string[];
  554. summary: string;
  555. sort: number;
  556. image: string;
  557. link: string;
  558. }
  559. // 使用i18n
  560. const { t, locale } = useI18n();
  561. // 默认语言
  562. const defaultLocale = "ja";
  563. // 获取路由
  564. const route = useRoute();
  565. // 断点
  566. const breakpoints = useBreakpoints(breakpointsTailwind);
  567. // 是否移动端
  568. const isMobile = breakpoints.smaller("md");
  569. const videoSrc = ref(video);
  570. // 获取轮播图数据(由于没有对应的content文件,这里保留为静态数据)
  571. const carouselList = ref([
  572. {
  573. id: 1,
  574. title: "高性能SSD",
  575. image: homeA1Webp,
  576. link: "/products/W400-1TBSY01",
  577. },
  578. ]);
  579. /**
  580. * 使用计算属性获取当前语言的数据文件URL
  581. */
  582. const usageDataUrl = computed(() => {
  583. return `/data/usages-${locale.value}.json`;
  584. });
  585. const categoryDataUrl = computed(() => {
  586. return `/data/categories-${locale.value}.json`;
  587. });
  588. const productsDataUrl = computed(() => {
  589. return `/data/products-${locale.value}.json`;
  590. });
  591. const homepagePath = computed(() => {
  592. return locale.value === "zh" ? "" : `/${locale.value}`;
  593. });
  594. // 获取按用途产品数据
  595. const usageList = ref<Usage[]>([]);
  596. const isLoadingUsage = ref(true);
  597. const activeUsageId = ref(1);
  598. // 获取按分类栏目数据
  599. const categoryList = ref<Category[]>([]);
  600. const isLoadingCategory = ref(true);
  601. // 加载用途数据
  602. const loadUsageData = async () => {
  603. try {
  604. isLoadingUsage.value = true;
  605. // 使用fetch获取数据
  606. if (process.client) {
  607. const response = await fetch(usageDataUrl.value);
  608. if (!response.ok) {
  609. throw new Error(`加载用途数据失败: ${response.status}`);
  610. }
  611. const usageData = await response.json();
  612. // 加载对应的产品数据
  613. const productsResponse = await fetch(productsDataUrl.value);
  614. if (!productsResponse.ok) {
  615. throw new Error(`加载产品数据失败: ${productsResponse.status}`);
  616. }
  617. const productsData = await productsResponse.json();
  618. // 处理数据
  619. usageList.value = usageData
  620. .map((usage: any) => {
  621. console.log(`处理用途: ${usage.id} - ${usage.title}`, usage);
  622. // 为每种用途找到对应的产品
  623. const usageProducts = [];
  624. // 按照正确的设计模式:使用用途的title与产品的usage数组进行匹配
  625. // 找出所有usage属性包含当前用途title的产品
  626. const matchedProducts = productsData.filter(
  627. (product: any) =>
  628. product.usage &&
  629. Array.isArray(product.usage) &&
  630. product.usage.includes(usage.title)
  631. );
  632. console.log(
  633. `用途"${usage.title}"匹配到 ${matchedProducts.length} 个产品`
  634. );
  635. // 将匹配的产品添加到列表
  636. if (matchedProducts.length > 0) {
  637. matchedProducts.forEach((product: any) => {
  638. usageProducts.push({
  639. id: product.id,
  640. title: product.title,
  641. image: product.image,
  642. link: `${homepagePath.value}/products/${product.id}`,
  643. description: product.summary,
  644. });
  645. });
  646. } else {
  647. // 如果没有找到匹配的产品,添加一个占位产品
  648. console.log(`用途 ${usage.title} 没有匹配到任何产品,添加占位产品`);
  649. usageProducts.push({
  650. id: `placeholder-${usage.id}`,
  651. title: usage.title,
  652. image: ``,
  653. link: `${homepagePath.value}/products?usage=${encodeURIComponent(usage.title)}`,
  654. description: "",
  655. });
  656. }
  657. return {
  658. id: parseInt(usage.id) || 0,
  659. name: usage.title,
  660. category: usage.category || "",
  661. products: usageProducts,
  662. };
  663. })
  664. .sort((a: any, b: any) => a.id - b.id);
  665. // 设置默认选中的用途
  666. if (usageList.value.length > 0) {
  667. activeUsageId.value = usageList.value[0].id;
  668. }
  669. }
  670. } catch (error) {
  671. console.error("Error loading usage data:", error);
  672. } finally {
  673. isLoadingUsage.value = false;
  674. }
  675. };
  676. // 加载分类数据
  677. const loadCategoryData = async () => {
  678. try {
  679. isLoadingCategory.value = true;
  680. // 使用fetch获取数据
  681. if (process.client) {
  682. const response = await fetch(categoryDataUrl.value);
  683. if (!response.ok) {
  684. throw new Error(`加载分类数据失败: ${response.status}`);
  685. }
  686. const data = await response.json();
  687. console.log("Raw category data:", data);
  688. // 处理数据
  689. categoryList.value = data
  690. .map((category: any) => {
  691. return {
  692. id: parseInt(category.id) || 0,
  693. title: category.title || "",
  694. description: category.description || "",
  695. image: category.image || "",
  696. link: `${homepagePath.value}/products?category=${encodeURIComponent(category.title)}`,
  697. capacities: category.capacities || [],
  698. summary: category.summary || "",
  699. sort: category.sort || 0,
  700. };
  701. })
  702. .sort((a: any, b: any) => a.id - b.id);
  703. }
  704. } catch (error) {
  705. console.error("Error loading category data:", error);
  706. } finally {
  707. isLoadingCategory.value = false;
  708. }
  709. };
  710. // 当页面加载或语言改变时加载数据
  711. onMounted(() => {
  712. loadUsageData();
  713. loadCategoryData();
  714. });
  715. watch(locale, () => {
  716. loadUsageData();
  717. loadCategoryData();
  718. });
  719. // 处理数据变化
  720. watchEffect(() => {
  721. if (usageList.value) {
  722. console.log("Updated usage list:", usageList.value);
  723. }
  724. if (categoryList.value) {
  725. console.log("Updated category list:", categoryList.value);
  726. }
  727. });
  728. // 计算当前用途列表
  729. const typedUsageList = computed(() => {
  730. console.log("Typed Usage List:", usageList.value);
  731. return usageList.value as Usage[];
  732. });
  733. // 计算当前激活的索引
  734. const activeIndex = computed(() => {
  735. return typedUsageList.value.findIndex(
  736. (item) => item.id === activeUsageId.value
  737. );
  738. });
  739. const activeProducts = computed(() => {
  740. const currentUsage = typedUsageList.value.find(
  741. (item: Usage) => item.id === activeUsageId.value
  742. );
  743. if (currentUsage?.products) {
  744. console.log(
  745. "Products:",
  746. currentUsage.products.map((p: Product) => ({
  747. id: p.id,
  748. title: p.title,
  749. image: p.image,
  750. link: p.link,
  751. }))
  752. );
  753. }
  754. return currentUsage?.products || [];
  755. });
  756. // 图片加载状态
  757. const isImageLoaded = ref<Record<number, boolean>>({});
  758. const imageErrors = ref<Record<number, boolean>>({});
  759. // 监听图片加载状态
  760. watch(
  761. activeProducts,
  762. (newProducts: Product[]) => {
  763. console.log("Active Products Changed:", newProducts);
  764. if (process.client) {
  765. newProducts.forEach((product: Product) => {
  766. if (product.image) {
  767. console.log(
  768. `Checking image for product ${product.id}:`,
  769. product.image
  770. );
  771. const img = new window.Image();
  772. img.onload = () => handleImageLoad(product.id);
  773. img.onerror = () => handleImageError(product.id);
  774. img.src = product.image;
  775. }
  776. });
  777. }
  778. },
  779. { immediate: true }
  780. );
  781. // 处理图片加载
  782. const handleImageLoad = (id: number) => {
  783. if (process.client) {
  784. console.log(`Image loaded for product ${id}`);
  785. isImageLoaded.value[id] = true;
  786. imageErrors.value[id] = false;
  787. }
  788. };
  789. // 处理图片加载错误
  790. const handleImageError = (id: number) => {
  791. if (process.client) {
  792. console.error(`Failed to load image for product ${id}`);
  793. isImageLoaded.value[id] = true;
  794. imageErrors.value[id] = true;
  795. }
  796. };
  797. // 处理用途点击
  798. const handleUsageClick = (id: number) => {
  799. if (process.client) {
  800. console.log("Usage clicked:", id);
  801. // 重置图片加载状态
  802. isImageLoaded.value = {};
  803. imageErrors.value = {};
  804. activeUsageId.value = id;
  805. }
  806. };
  807. // 计算当前分类列表
  808. const typedCategoryList = computed(() => {
  809. return categoryList.value as Category[];
  810. });
  811. // SEO优化
  812. useHead({
  813. title: t("home.title") + " - Hanye",
  814. meta: [
  815. {
  816. name: "description",
  817. content: t("home.description"),
  818. },
  819. {
  820. name: "keywords",
  821. content: t("home.keywords"),
  822. },
  823. ],
  824. });
  825. </script>
  826. <style lang="scss" scoped>
  827. :deep(.swiper-pagination-3) {
  828. margin: auto;
  829. position: static;
  830. padding: 1rem 0;
  831. }
  832. :deep(.swiper-pagination-bullet) {
  833. background-color: var(--color-bg); /* Example color */
  834. border: 2px solid var(--color-text);
  835. }
  836. :deep(.swiper-pagination-bullet-active) {
  837. background-color: var(--color-text); /* Example color */
  838. }
  839. .category-item {
  840. background-image: url("@/assets/images/home-b-1.webp");
  841. background-size: cover;
  842. background-position: center;
  843. background-repeat: no-repeat;
  844. opacity: 0.8;
  845. transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  846. position: relative;
  847. overflow: hidden;
  848. &:hover {
  849. opacity: 1;
  850. transform: translateY(-2px);
  851. box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
  852. &::before {
  853. opacity: 1;
  854. }
  855. }
  856. &::before {
  857. content: "";
  858. position: absolute;
  859. inset: 0;
  860. background: linear-gradient(45deg, rgba(6, 182, 212, 0.1), transparent);
  861. opacity: 0;
  862. transition: opacity 0.3s ease;
  863. pointer-events: none;
  864. }
  865. }
  866. // 优化过渡动画
  867. .slide-fade-enter-active,
  868. .slide-fade-leave-active {
  869. transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  870. position: absolute;
  871. width: 100%;
  872. height: 300px;
  873. }
  874. @media (min-width: 640px) {
  875. .slide-fade-enter-active,
  876. .slide-fade-leave-active {
  877. height: 350px;
  878. }
  879. }
  880. @media (min-width: 768px) {
  881. .slide-fade-enter-active,
  882. .slide-fade-leave-active {
  883. height: 400px;
  884. }
  885. }
  886. @media (min-width: 1024px) {
  887. .slide-fade-enter-active,
  888. .slide-fade-leave-active {
  889. height: 450px;
  890. }
  891. }
  892. .slide-fade-enter-from {
  893. opacity: 0;
  894. transform: translateX(30px);
  895. }
  896. .slide-fade-leave-to {
  897. opacity: 0;
  898. transform: translateX(-30px);
  899. }
  900. // 添加响应式优化
  901. @media (max-width: 640px) {
  902. .slide-fade-enter-from,
  903. .slide-fade-leave-to {
  904. transform: translateX(15px);
  905. }
  906. }
  907. // 优化图片加载动画
  908. @keyframes gradient {
  909. 0% {
  910. background-position: 0% 50%;
  911. }
  912. 50% {
  913. background-position: 100% 50%;
  914. }
  915. 100% {
  916. background-position: 0% 50%;
  917. }
  918. }
  919. .animate-gradient {
  920. background-size: 200% 200%;
  921. animation: gradient 3s ease infinite;
  922. }
  923. // 移除 pagination 相关样式
  924. :deep(.swiper-pagination-2) {
  925. display: none;
  926. }
  927. // 添加导航按钮禁用样式
  928. :deep(.swiper-button-disabled) {
  929. opacity: 0.35;
  930. cursor: not-allowed;
  931. pointer-events: none;
  932. }
  933. // 优化轮播图样式
  934. :deep(.swiper-container-1) {
  935. .swiper-slide {
  936. transition: all 0.5s ease;
  937. transform-origin: center center;
  938. backface-visibility: hidden;
  939. perspective: 1000px;
  940. }
  941. .swiper-pagination-bullet {
  942. width: 12px;
  943. height: 12px;
  944. background: transparent;
  945. border: 2px solid rgba(255, 255, 255, 0.5);
  946. opacity: 1;
  947. transition: all 0.3s ease;
  948. margin: 0 8px !important;
  949. &-active {
  950. background: #fff;
  951. border-color: #fff;
  952. transform: scale(1.2);
  953. }
  954. }
  955. .swiper-pagination {
  956. display: flex;
  957. justify-content: center;
  958. align-items: center;
  959. padding: 20px 0;
  960. }
  961. }
  962. // 添加轮播图遮罩效果
  963. .swiper-slide {
  964. &::before {
  965. content: "";
  966. position: absolute;
  967. top: 0;
  968. left: 0;
  969. right: 0;
  970. bottom: 0;
  971. background: linear-gradient(
  972. to bottom,
  973. rgba(0, 0, 0, 0.2) 0%,
  974. rgba(0, 0, 0, 0.4) 100%
  975. );
  976. z-index: 1;
  977. }
  978. }
  979. // 优化图片加载动画
  980. @keyframes fadeIn {
  981. from {
  982. opacity: 0;
  983. transform: scale(1.1);
  984. }
  985. to {
  986. opacity: 1;
  987. transform: scale(1);
  988. }
  989. }
  990. .swiper-slide-active {
  991. img {
  992. animation: fadeIn 0.8s ease-out forwards;
  993. }
  994. }
  995. // 优化产品卡片动画和交互
  996. .swiper-slide {
  997. a {
  998. text-decoration: none;
  999. display: block;
  1000. height: 100%;
  1001. &:hover {
  1002. text-decoration: none;
  1003. }
  1004. > div {
  1005. position: relative;
  1006. z-index: 1;
  1007. cursor: pointer;
  1008. transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  1009. &:hover {
  1010. transform: translateY(-2px);
  1011. box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
  1012. }
  1013. }
  1014. }
  1015. }
  1016. // 移除卡片抖动动画
  1017. @keyframes cardHover {
  1018. 0% {
  1019. transform: translateY(0);
  1020. }
  1021. 100% {
  1022. transform: translateY(-2px);
  1023. }
  1024. }
  1025. </style>