Hanye官网
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

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