From 41814a2bc8f0c1fb5b96788313783b1b2b917aa3 Mon Sep 17 00:00:00 2001 From: hu xiaotong <416314413@163.com> Date: Fri, 4 Jul 2025 17:04:04 +0800 Subject: [PATCH] =?UTF-8?q?feat(frontend):=20=E4=BC=98=E5=8C=96=E9=85=8D?= =?UTF-8?q?=E8=A3=85=E9=A1=B5=E9=9D=A2=E5=B8=83=E5=B1=80=E5=92=8C=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -调整顶部角色和选项区的布局,增加角色头像和神器信息 - 优化属性区、属性过滤区和指定套装区的样式,采用纵向布局 - 添加角色信息编辑弹窗,可编辑神器、阵型等信息 - 移除按钮区的固定宽度样式,使其自适应布局 - 调整配装结果列表和详情区的样式,优化间距和对齐 --- frontend/src/index.css | 4 - frontend/src/pages/OptimizerPage.tsx | 335 +++++++++++++++++---------- 2 files changed, 219 insertions(+), 120 deletions(-) diff --git a/frontend/src/index.css b/frontend/src/index.css index f5fe4f7..86878d9 100644 --- a/frontend/src/index.css +++ b/frontend/src/index.css @@ -48,10 +48,6 @@ button { button:hover { border-color: #646cff; } -button:focus, -button:focus-visible { - outline: 4px auto -webkit-focus-ring-color; -} @media (prefers-color-scheme: light) { :root { diff --git a/frontend/src/pages/OptimizerPage.tsx b/frontend/src/pages/OptimizerPage.tsx index 12457f1..4347bc2 100644 --- a/frontend/src/pages/OptimizerPage.tsx +++ b/frontend/src/pages/OptimizerPage.tsx @@ -1,140 +1,243 @@ import React from 'react'; -import {Avatar, Button, Card, Col, Divider, Input, Layout, Pagination, Row, Select, Table, Tag} from 'antd'; +import { + Avatar, + Button, + Card, + Col, + Divider, + Input, + InputNumber, + Layout, + Modal, + Pagination, + Row, + Select, + Table, + Tag +} from 'antd'; import {AppstoreOutlined, FilterOutlined, UserOutlined} from '@ant-design/icons'; -const { Content } = Layout; +const {Content} = Layout; // 静态数据示例 const heroList = [ - { id: 1, name: '雅娜凯', avatar: 'https://api.dicebear.com/7.x/miniavs/svg?seed=1' }, - { id: 2, name: '艾莉丝', avatar: 'https://api.dicebear.com/7.x/miniavs/svg?seed=2' }, + {id: 1, name: '雅娜凯', avatar: 'https://api.dicebear.com/7.x/miniavs/svg?seed=1'}, + {id: 2, name: '艾莉丝', avatar: 'https://api.dicebear.com/7.x/miniavs/svg?seed=2'}, ]; const hero = heroList[0]; const attributes = [ - { label: '攻击', value: 1567 }, - { label: '防御', value: 1654 }, - { label: '生命', value: 24447 }, - { label: '速度', value: 188 }, - { label: '暴击', value: 49 }, - { label: '爆伤', value: 166 }, - { label: '命中', value: 46 }, - { label: '抵抗', value: 52 }, + {label: '攻击', value: 1567}, + {label: '防御', value: 1654}, + {label: '生命', value: 24447}, + {label: '速度', value: 188}, + {label: '暴击', value: 49}, + {label: '爆伤', value: 166}, + {label: '命中', value: 46}, + {label: '抵抗', value: 52}, ]; const setOptions = [ - { label: '任意套装', value: 'any' }, - { label: '暴击套', value: 'crit' }, - { label: '速度套', value: 'speed' }, + {label: '任意套装', value: 'any'}, + {label: '暴击套', value: 'crit'}, + {label: '速度套', value: 'speed'}, ]; const filterOptions = [ - { label: '攻击', value: 'atk' }, - { label: '防御', value: 'def' }, - { label: '生命', value: 'hp' }, - { label: '速度', value: 'spd' }, - { label: '暴击', value: 'cr' }, - { label: '爆伤', value: 'cd' }, - { label: '命中', value: 'acc' }, - { label: '抵抗', value: 'res' }, + {label: '攻击', value: 'atk'}, + {label: '防御', value: 'def'}, + {label: '生命', value: 'hp'}, + {label: '速度', value: 'spd'}, + {label: '暴击', value: 'cr'}, + {label: '爆伤', value: 'cd'}, + {label: '命中', value: 'acc'}, + {label: '抵抗', value: 'res'}, ]; const resultColumns = [ - { title: '套装', dataIndex: 'set', key: 'set', render: (v: string) => {v} }, - { title: '攻击', dataIndex: 'atk', key: 'atk' }, - { title: '防御', dataIndex: 'def', key: 'def' }, - { title: '生命', dataIndex: 'hp', key: 'hp' }, - { title: '速度', dataIndex: 'spd', key: 'spd' }, - { title: '暴击', dataIndex: 'cr', key: 'cr' }, - { title: '爆伤', dataIndex: 'cd', key: 'cd' }, - { title: '命中', dataIndex: 'acc', key: 'acc' }, - { title: '抵抗', dataIndex: 'res', key: 'res' }, + {title: '套装', dataIndex: 'set', key: 'set', render: (v: string) => {v}}, + {title: '攻击', dataIndex: 'atk', key: 'atk'}, + {title: '防御', dataIndex: 'def', key: 'def'}, + {title: '生命', dataIndex: 'hp', key: 'hp'}, + {title: '速度', dataIndex: 'spd', key: 'spd'}, + {title: '暴击', dataIndex: 'cr', key: 'cr'}, + {title: '爆伤', dataIndex: 'cd', key: 'cd'}, + {title: '命中', dataIndex: 'acc', key: 'acc'}, + {title: '抵抗', dataIndex: 'res', key: 'res'}, ]; const resultData = [ - { key: 1, set: '暴击套', atk: 2000, def: 1500, hp: 20000, spd: 200, cr: 100, cd: 250, acc: 30, res: 20 }, - { key: 2, set: '速度套', atk: 1800, def: 1400, hp: 21000, spd: 220, cr: 80, cd: 200, acc: 40, res: 30 }, + {key: 1, set: '暴击套', atk: 2000, def: 1500, hp: 20000, spd: 200, cr: 100, cd: 250, acc: 30, res: 20}, + {key: 2, set: '速度套', atk: 1800, def: 1400, hp: 21000, spd: 220, cr: 80, cd: 200, acc: 40, res: 30}, ]; export default function OptimizerPage() { - return ( - - - {/* 顶部角色和选项区 */} - - - {/* 角色头像与选择 */} - - } /> -
{hero.name}
- - - {/* 角色属性 */} - -
属性
-
- {attributes.map(attr => ( -
{attr.label}: {attr.value}
- ))} -
- - {/* 属性过滤 */} - -
属性过滤
-
- {filterOptions.map(opt => ( - - ))} -
- - {/* 套装选择与操作 */} - -
指定套装
- -
- - -
- -
-
+ const [editVisible, setEditVisible] = React.useState(false); + const [editData, setEditData] = React.useState({ + artifact: '', + artifactLevel: 0, + formation: '', + exclusive: '', + star: 5, + }); - {/* 配装结果列表区 */} - -
-
全部排列组合:123,456 条 | 筛选结果:2
- -
- - + return ( + + + {/* 顶部角色和选项区 */} + + + {/* 角色头像与神器区 */} + + } style={{marginRight: 16}}/> +
+
{hero.name}
+
+ 神器: + setEditVisible(true)}> + {/* 假设有artifactUrl则显示图片,否则暂无 */} + {editData.artifact ? 神器 : '暂无'} + +
+
+ 专属神器: + setEditVisible(true)}> + {editData.exclusive ? editData.exclusive : '暂无'} + +
+
+ + {/* 属性区(纵向) */} +
+
属性
+
+ {attributes.map(attr => ( +
{attr.label}: {attr.value}
+ ))} +
+ + {/* 属性过滤区(纵向,最小最大值) */} + +
属性过滤
+
+ {filterOptions.map(opt => ( +
+ {opt.label} + + ~ + +
+ ))} +
+ + {/* 指定套装区(纵向,多选) */} + +
指定套装
+ + + {/* 按钮区,绝对定位到Card右下角 */} +
+ + +
+ + - {/* 单个配装详情区 */} - -
-
- -
{hero.name}
-
- -
-
套装:暴击套
-
攻击:2000,防御:1500,生命:20000,速度:200
-
暴击:100%,爆伤:250%,命中:30%,抵抗:20%
-
- -
- - -
-
-
- - - ); + {/* 配装结果列表区 */} + +
+
全部排列组合:123,456 条 | 筛选结果:2
+ +
+
+ + + {/* 单个配装详情区 */} + +
+
+ +
{hero.name}
+
+ +
+
套装:暴击套
+
攻击:2000,防御:1500,生命:20000,速度:200
+
暴击:100%,爆伤:250%,命中:30%,抵抗:20%
+
+ +
+ + +
+
+
+ + {/* 角色信息编辑弹窗 */} + setEditVisible(false)} + onOk={() => setEditVisible(false)} + > +
+
+ 神器: + setEditData({...editData, artifact: e.target.value})} + placeholder="神器图片URL或名称" + /> +
+
+ 神器等级: + setEditData({...editData, artifactLevel: v || 0})} + /> +
+
+ 阵型: + setEditData({...editData, formation: e.target.value})} + placeholder="如:前排/后排" + /> +
+
+ 专属装备: + setEditData({...editData, exclusive: e.target.value})} + placeholder="如:+9速度" + /> +
+
+ 星数: + setEditData({...editData, star: v || 1})} + /> +
+
+
+ + + ); } \ No newline at end of file