page.tsx 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. import {Button} from "antd"
  2. import {ArrowRightOutlined} from "@ant-design/icons"
  3. import MainTitle from "@/components/MainTitle"
  4. import Image from "next/image"
  5. import PaginationClient from "@/components/PaginationClient"
  6. import {serverGet} from "@/utils/request"
  7. import {removeHTMLTags} from "@/utils/removeHTMLTags"
  8. import AnimatedSection from "@/components/AnimatedSection";
  9. export default async function SolutionsPage({
  10. searchParams,
  11. }: {
  12. searchParams: Promise<{ page?: string }>
  13. }) {
  14. // 等待 searchParams 解析
  15. const params = await searchParams
  16. const pageNum = Number.parseInt(params.page || "1", 10)
  17. const pageSize = 6
  18. const res = await serverGet<Page<Solution>>("/webSite/getSolution", {
  19. pageNum: pageNum,
  20. pageSize: pageSize,
  21. },{
  22. next: {
  23. revalidate: 180
  24. },
  25. cache: "force-cache"
  26. })
  27. const solutionsData = res.data.records
  28. return (
  29. <>
  30. <AnimatedSection effect="slide" direction="left">
  31. <div>
  32. <Image src={"/assets/solutions/1.jpg"} alt={"banner"} width={1920} height={1080}/>
  33. </div>
  34. </AnimatedSection>
  35. <div className={"py-6 sm:py-10"}>
  36. <MainTitle title={"解决方案"} titleLetter={"SOLUTIONS"}/>
  37. </div>
  38. <AnimatedSection effect="scale">
  39. <div className="" style={{ background: "linear-gradient(135deg, #f0f8ff 0%, #e6f3ff 100%)" }}>
  40. <div className="w-9/10 sm:w-7/10 mx-auto px-3 sm:px-4 py-4 sm:py-8">
  41. <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3 sm:gap-6 mb-4 sm:mb-8">
  42. {solutionsData.map((solution, index) => (
  43. <div
  44. key={solution.id}
  45. className="h-full shadow-md hover:shadow-lg transition-all duration-300 transform hover:-translate-y-1 rounded-xl overflow-hidden bg-white relative"
  46. style={{
  47. backgroundImage: `url("/assets/solutions/2.png")`,
  48. backgroundSize: "cover",
  49. }}
  50. >
  51. {/* 内容容器 */}
  52. <div className="p-4 sm:p-6 h-full flex flex-col relative z-10">
  53. <div className="mb-2 sm:mb-3">
  54. <h3
  55. className="text-base sm:text-lg font-semibold text-black mb-1 sm:mb-2 line-clamp-2 leading-tight sm:leading-normal drop-shadow-sm">
  56. {solution.programName}
  57. </h3>
  58. <p className="text-xs sm:text-sm text-black/80 mb-2 sm:mb-3 drop-shadow-sm">
  59. {solution.releaseTime}
  60. </p>
  61. </div>
  62. <div className="flex-1 mb-4">
  63. <p
  64. className="text-black/90 text-xs sm:text-sm leading-relaxed line-clamp-3 sm:line-clamp-4 drop-shadow-sm">
  65. {removeHTMLTags(solution.programDetails)}
  66. </p>
  67. </div>
  68. {/* 按钮区域 */}
  69. <div className="mt-auto pt-3 border-t border-white/20">
  70. <Button
  71. href={`/solutions/${solution.id}`}
  72. type="link"
  73. icon={<ArrowRightOutlined/>}
  74. className="text-white hover:text-white/80 p-0 h-auto font-medium transition-colors duration-200"
  75. style={{
  76. color: "black",
  77. textShadow: "0 1px 2px rgba(0,0,0,0.3)",
  78. }}
  79. >
  80. 了解更多
  81. </Button>
  82. </div>
  83. </div>
  84. {/* 装饰性元素 */}
  85. <div
  86. className="absolute top-0 right-0 w-20 h-20 opacity-10"
  87. style={{
  88. background: "radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%)",
  89. transform: "translate(25%, -25%)",
  90. }}
  91. />
  92. </div>
  93. ))}
  94. </div>
  95. <div className="flex justify-center">
  96. <PaginationClient current={pageNum} total={solutionsData.length} pageSize={pageSize}/>
  97. </div>
  98. </div>
  99. </div>
  100. </AnimatedSection>
  101. </>
  102. )
  103. }