import React from 'react'; const services = [ { icon: '/picture/1.jpg', // 这里可以替换为图片或SVG label: '军队自考', href: '/study', }, { icon: '/picture/2.jpg', label: '军人', href: '/scholarship', }, { icon: '/picture/3.jpg', label: '蓝天邮局', href: '/mail', }, { icon: '/picture/4.jpg', label: '策划工具', href: '/plan', }, { icon: '/picture/5.jpg', label: '情调研', href: '/survey', }, { icon: '/picture/6.jpg', label: '上网助手', href: '/net', }, { icon: '/picture/7.jpg', label: '常用软件', href: '/software', }, { icon: '/picture/8.jpg', label: '智能语音', href: '/voice', }, { icon: '/picture/9.jpg', label: '办公模板', href: '/office', }, { icon: '/picture/10.jpg', label: '智能校对', href: '/ai-check', }, { icon: '/picture/11.jpg', label: '考试平台', href: '/exam', }, { icon: '/picture/12.jpg', label: '学习平台', href: '/study', }, ]; const Integrated: React.FC = () => { return (
综合服务
{services.map((service, index) => { // 计算实际显示位置 const row = Math.floor(index / 6); const col = index % 6; // 根据行数调整列的顺序 let displayCol = col; // if (row === 0) { // // 第一行:右下、左下顺序 // displayCol = col < 3 ? col + 3 : col - 3; // } else { // // 第二行:右上、左上顺序 // displayCol = col < 3 ? col + 3 : col - 3; // } // 确定内容在网格中的位置 const positionClass = row === 0 ? (col % 2 === 0 ? 'bottom-0 right-0' : 'bottom-0 left-0') // 第一行:右下、左下 : (col % 2 === 0 ? 'top-0 right-0' : 'top-0 left-0'); // 第二行:右上、左上 return ( // 外部 div:负责网格布局和白色背景,本身不可点击
{/* 这个 div 是 104x108 的容器,绝对定位在单元格内,并负责对齐其内部的可点击链接 */}
{/* 这个 标签是可点击的区域,它将包裹图标和标签,并作为 Flex 容器垂直排列它们 */} {/* 为图标创建一个圆形背景的 div */}
{/* 图标:应用文本颜色 */} {service.label}
{/* 标签:没有额外颜色类,使用默认文本颜色 */} {service.label}
); })}
); }; export default Integrated;