Skip to content

Commit 57d7b70

Browse files
authored
Merge pull request #124 from kaplax/main
feat: admin 页面 UI 风格统一
2 parents d9e2404 + c17d29e commit 57d7b70

File tree

14 files changed

+422
-157
lines changed

14 files changed

+422
-157
lines changed

himarket-web/himarket-admin/src/aliyunThemeToken.ts

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
1-
export default {
2-
"colorPrimary": "#0064c8",
3-
"colorPrimaryBg": "#F0F7FF",
4-
"colorPrimaryBgHover": "#CAE3FD",
5-
"colorPrimaryBorder": "#90C0EF",
6-
"colorPrimaryBorderHover": "#589ADB",
7-
"colorPrimaryHover": "#2A7DD1",
8-
"colorPrimaryActive": "#0057AD",
9-
"colorPrimaryTextHover": "#2A7DD1",
10-
"colorPrimaryText": "#0064c8",
11-
"colorPrimaryTextActive": "#0057AD",
1+
2+
export const colors = {
3+
"colorPrimary": "#6366F1",
4+
"colorPrimaryBg": "#EEF2FF",
5+
"colorPrimaryHover": "#E0E7FF",
6+
"colorPrimaryBgHover": "#E0E7FF",
7+
"colorPrimarySecondary": "#C7D2FE",
8+
"colorPrimaryHoverLight": "#EFF4FF",
9+
"colorTextSecondaryCustom": "#A3A3A3",
10+
"colorPrimaryBorderHover": "#A5B4FC",
11+
"subTitle": "#737373",
12+
"mainTitle": "#404040"
13+
}
14+
15+
export default {
16+
...colors,
17+
"colorPrimaryBorder": "#C7D2FE",
18+
"colorPrimaryActive": "#4F46E5",
19+
"colorPrimaryTextHover": "#818CF8",
20+
"colorPrimaryText": "#6366F1",
21+
"colorPrimaryTextActive": "#4F46E5",
1222
"fontSize": 12,
13-
"borderRadius": 2,
23+
"borderRadius": 8,
1424
"fontSizeSM": 12,
1525
"lineHeight": 1.5,
1626
"lineHeightSM": 1.5,
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { DefaultModel } from "./index";
2+
3+
interface ProductIconRendererProps {
4+
iconType?: string;
5+
className?: string;
6+
}
7+
8+
/**
9+
* 通用的产品图标渲染组件
10+
* 支持:URL 图片、Base64 图片、默认图标
11+
*/
12+
export function ProductIconRenderer({ iconType, className = "w-4 h-4" }: ProductIconRendererProps) {
13+
// 如果是默认图标或空值
14+
if (!iconType || iconType === "default") {
15+
return <DefaultModel className={className} />;
16+
}
17+
18+
// 如果是 URL 或 base64 图片
19+
if (iconType.startsWith('http') || iconType.startsWith('data:image')) {
20+
return <img src={iconType} alt="icon" className={`${className} object-cover rounded`} />;
21+
}
22+
23+
// 其他情况使用默认图标
24+
return <DefaultModel className={className} />;
25+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
export const DefaultModel = ({ className = "" }: { className?: string }) => {
2+
return (
3+
<svg
4+
xmlns="http://www.w3.org/2000/svg"
5+
xmlnsXlink="http://www.w3.org/1999/xlink"
6+
fill="none"
7+
version="1.1"
8+
viewBox="0 0 32 32"
9+
className={className}
10+
>
11+
<defs><clipPath id="master_svg0_97_16530"><rect x="0" y="0" width="32" height="32" rx="0" /></clipPath></defs>
12+
<g clipPath="url(#master_svg0_97_16530)">
13+
<g><path d="M28,10.666459453125C27.999,9.714729453124999,27.4909,8.835649453125,26.6667,8.359789453125L17.3333,3.026455453125C16.5083,2.550101453125,15.4917,2.550101453125,14.6667,3.026455453125L5.33333,8.359789453125C4.5091090000000005,8.835649453125,4.000975927,9.714729453124999,4,10.666459453125L4,21.333089453125C4.000976562,22.284889453125,4.5091090000000005,23.163889453125,5.33333,23.639789453125L14.6667,28.973089453125C15.4917,29.449489453125,16.5083,29.449489453125,17.3333,28.973089453125L26.6667,23.639789453125C27.4909,23.163889453125,27.999,22.284889453125,28,21.333089453125L28,10.666459453125Z" fill="#EFF2F8" fillOpacity="1" /></g>
14+
<g><path d="M16,22.999926567077637C15.999,22.048226567077634,16.824199999999998,17.475796567077637,16,16.999926567077637L15.5,15.499926567077637C14.6749,15.023576567077637,8.5,11.499926567077637,7.5,10.666546567077637L5,9.500045776077636C4.175776,9.975911567077636,4.000975927,9.714725567077636,4,10.666456567077637L4,21.333126567077635C4.000976562,22.284826567077637,4.5091090000000005,23.163926567077638,5.33333,23.639826567077638L14.6667,28.973126567077635C15.4917,29.449526567077637,15.1749,29.449426567077637,16,28.973026567077635L16,27.499926567077637C16,26.499926567077637,15.999,25.951626567077636,16,24.999926567077637L16,22.999926567077637Z" fill="#FFFFFF" fillOpacity="1" /></g>
15+
<g><path d="M26.9147,24.073889453125Q28.4981,23.159789453125,28.5,21.333589453125L28.5,10.666459453125Q28.4981,8.839829453124999,26.9167,7.926779453125L17.581400000000002,2.592333653125Q16,1.679303453125,14.4167,2.593442553125L5.08526,7.925669453125Q3.501873,8.839829453124999,3.5,10.665939453124999L3.5,21.333089453125Q3.501874,23.159789453125,5.08333,24.072789453125L14.4186,29.407289453125Q16,30.320289453125,17.5833,29.406089453125L26.9147,24.073889453125ZM27.5,21.332589453125L27.5,21.333089453125Q27.4985,22.582189453125,26.4186,23.205689453125L17.0833,28.540089453125Q16,29.165589453125,14.9147,28.538989453125L5.58333,23.206789453125Q4.501282,22.582089453125,4.5,21.333089453125L4.5,10.666969453124999Q4.501281,9.417519453125,5.5814,8.793909453125L14.9167,3.459467453125Q16,2.834004453125,17.0853,3.460576453125L26.4167,8.792799453125Q27.4987,9.417519453125,27.5,10.666459453125L27.5,21.332589453125Z" fillRule="evenodd" fill="#E2E5EB" fillOpacity="1" /></g>
16+
<g><path d="M4.6492977111816405,8.899835953125L15.99999771118164,15.423231953125L27.350597711181642,8.899902953125L27.35089771118164,8.899744953125Q27.46659771118164,8.833251953125,27.59999771118164,8.833251953125Q27.64919771118164,8.833251953125,27.69749771118164,8.842858953125Q27.74579771118164,8.852466953124999,27.79129771118164,8.871311953125Q27.836797711181642,8.890157953125,27.87779771118164,8.917516953125Q27.91869771118164,8.944876953125,27.95359771118164,8.979698953125Q27.98839771118164,9.014520953125,28.01569771118164,9.055466953125Q28.04309771118164,9.096412953125,28.06189771118164,9.141909953125Q28.080797711181642,9.187406953125,28.09039771118164,9.235706853125Q28.09999771118164,9.284006253125,28.09999771118164,9.333251953125Q28.09999771118164,9.399203953125,28.08289771118164,9.462899953125Q28.06579771118164,9.526596953125,28.03279771118164,9.583679953125Q27.99969771118164,9.640763953125,27.95299771118164,9.687328953125Q27.90629771118164,9.733894953125,27.849097711181642,9.766757953125L16.24909771118164,16.433421953125Q16.192297711181638,16.466101953125,16.12889771118164,16.483011953125Q16.06559771118164,16.499921953125,15.99999771118164,16.499921953125Q15.93439771118164,16.499921953125,15.87109771118164,16.483011953125Q15.80769771118164,16.466101953125,15.75089771118164,16.433421953125L4.151014711181641,9.766849953125L4.150855711181641,9.766758953125Q4.093674711181641,9.733895953125,4.0469697111816405,9.687329953125Q4.00026571118164,9.640763953125,3.967232711181641,9.583680953125Q3.9341997111816407,9.526596953125,3.9170987111816404,9.462900953125Q3.8999977111816406,9.399204153125,3.8999977111816406,9.333251953125Q3.8999977111816406,9.284006253125,3.9096047111816405,9.235706853125Q3.9192127111816406,9.187406953125,3.9380577111816404,9.141909953125Q3.9569037111816407,9.096412953125,3.9842627111816404,9.055466953125Q4.011622711181641,9.014520953125,4.046444711181641,8.979698953125Q4.081266711181641,8.944876953125,4.122212711181641,8.917516953125Q4.163158711181641,8.890157953125,4.208655711181641,8.871311953125Q4.254152711181641,8.852466953124999,4.302452611181641,8.842858953125Q4.3507520111816405,8.833251953125,4.399997711181641,8.833251953125Q4.5334417111816405,8.833251953125,4.649139711181641,8.899744953125L4.6492977111816405,8.899835953125Z" fillRule="evenodd" fill="#E2E5EB" fillOpacity="1" /></g>
17+
<g><path d="M15.5,16Q15.5,15.9507543,15.509607,15.9024549Q15.519214999999999,15.854155,15.53806,15.808658Q15.556906,15.763161,15.584265,15.722215Q15.611625,15.681269,15.646447,15.646447Q15.681269,15.611625,15.722215,15.584265Q15.763161,15.556906,15.808658,15.53806Q15.854155,15.519214999999999,15.9024549,15.509607Q15.9507543,15.5,16,15.5Q16.0492457,15.5,16.0975451,15.509607Q16.145845,15.519214999999999,16.191342,15.53806Q16.236839,15.556906,16.277785,15.584265Q16.318731,15.611625,16.353553,15.646447Q16.388375,15.681269,16.415735,15.722215Q16.443094,15.763161,16.46194,15.808658Q16.480785,15.854155,16.490393,15.9024549Q16.5,15.9507543,16.5,16L16.5,29.3333Q16.5,29.3826,16.490393,29.4309Q16.480785,29.4792,16.46194,29.5247Q16.443094,29.5702,16.415735,29.6111Q16.388375,29.6521,16.353553,29.6869Q16.318731,29.7217,16.277785,29.7491Q16.236839,29.776400000000002,16.191342,29.795299999999997Q16.145845,29.8141,16.0975451,29.823700000000002Q16.0492457,29.8333,16,29.8333Q15.9507543,29.8333,15.9024549,29.823700000000002Q15.854155,29.8141,15.808658,29.795299999999997Q15.763161,29.776400000000002,15.722215,29.7491Q15.681269,29.7217,15.646447,29.6869Q15.611625,29.6521,15.584265,29.6111Q15.556906,29.5702,15.53806,29.5247Q15.519214999999999,29.4792,15.509607,29.4309Q15.5,29.3826,15.5,29.3333L15.5,16Z" fillRule="evenodd" fill="#E2E5EB" fillOpacity="1" /></g>
18+
</g>
19+
</svg>
20+
)
21+
}

himarket-web/himarket-admin/src/components/portal/PortalDevelopers.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -284,13 +284,13 @@ export function PortalDevelopers({portal}: PortalDevelopersProps) {
284284
key: 'action',
285285
width: 120,
286286
render: (_: any, record: Consumer) => (
287-
<Button
287+
<div
288+
className='text-colorPrimary/80 text-colorPrimary flex items-center gap-2'
288289
onClick={() => handleViewSubscriptions(record)}
289-
type="link"
290-
icon={<UnorderedListOutlined/>}
291290
>
291+
<UnorderedListOutlined/>
292292
订阅列表
293-
</Button>
293+
</div>
294294
),
295295
},
296296
]
@@ -358,4 +358,4 @@ export function PortalDevelopers({portal}: PortalDevelopersProps) {
358358

359359
</div>
360360
)
361-
}
361+
}

himarket-web/himarket-admin/src/components/portal/PortalOverview.tsx

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export function PortalOverview({portal, onEdit}: PortalOverviewProps) {
2626

2727
useEffect(() => {
2828
if (!portal.portalId) return;
29-
29+
3030
portalApi.getDeveloperList(portal.portalId, {
3131
page: 1,
3232
size: 10
@@ -51,13 +51,13 @@ export function PortalOverview({portal, onEdit}: PortalOverviewProps) {
5151
</div>
5252

5353
{/* 基本信息 */}
54-
<Card
54+
<Card
5555
title="基本信息"
5656
extra={
5757
onEdit && (
58-
<Button
59-
type="primary"
60-
icon={<EditOutlined />}
58+
<Button
59+
type="primary"
60+
icon={<EditOutlined />}
6161
onClick={onEdit}
6262
>
6363
编辑
@@ -72,8 +72,8 @@ export function PortalOverview({portal, onEdit}: PortalOverviewProps) {
7272
<span className="text-xs text-gray-600">Portal ID:</span>
7373
<div className="col-span-2 flex items-center gap-2">
7474
<span className="text-xs text-gray-700">{portal.portalId}</span>
75-
<CopyOutlined
76-
className="text-gray-400 hover:text-blue-600 cursor-pointer transition-colors ml-1"
75+
<CopyOutlined
76+
className="text-gray-400 hover:text-colorPrimary cursor-pointer transition-colors ml-1"
7777
style={{ fontSize: '12px' }}
7878
onClick={async () => {
7979
try {
@@ -86,16 +86,16 @@ export function PortalOverview({portal, onEdit}: PortalOverviewProps) {
8686
/>
8787
</div>
8888
</div>
89-
89+
9090
<div className="grid grid-cols-6 gap-8 items-center pt-2 pb-2">
9191
<span className="text-xs text-gray-600">域名:</span>
9292
<div className="col-span-2 flex items-center gap-2">
93-
<LinkOutlined className="text-blue-500" />
94-
<a
95-
href={`http://${portal.portalDomainConfig?.[portal.portalDomainConfig.length - 1]?.domain}`}
93+
<LinkOutlined className="text-colorPrimary" />
94+
<a
95+
href={`http://${portal.portalDomainConfig?.[portal.portalDomainConfig.length - 1]?.domain}`}
9696
target="_blank"
97-
rel="noopener noreferrer"
98-
className="text-xs text-blue-600 hover:underline"
97+
rel="noopener noreferrer"
98+
className="text-xs text-colorPrimary hover:underline"
9999
>
100100
{portal.portalDomainConfig?.[portal.portalDomainConfig.length - 1]?.domain}
101101
</a>
@@ -112,7 +112,7 @@ export function PortalOverview({portal, onEdit}: PortalOverviewProps) {
112112
</span>
113113
</div>
114114
</div>
115-
115+
116116
<div className="grid grid-cols-6 gap-8 items-center pt-2 pb-2">
117117
<span className="text-xs text-gray-600">开发者自动审批:</span>
118118
<div className="col-span-2 flex items-center">
@@ -150,36 +150,38 @@ export function PortalOverview({portal, onEdit}: PortalOverviewProps) {
150150
{/* 统计数据 */}
151151
<Row gutter={[16, 16]}>
152152
<Col xs={24} sm={12} lg={12}>
153-
<Card
153+
<Card
154154
className="cursor-pointer hover:shadow-md transition-shadow"
155155
onClick={() => {
156156
navigate(`/portals/detail?id=${portal.portalId}&tab=developers`)
157157
}}
158158
>
159-
<Statistic
160-
title="注册开发者"
161-
value={developerCount}
162-
prefix={<UserOutlined className="text-blue-500" />}
163-
valueStyle={{ color: '#1677ff', fontSize: '24px' }}
164-
/>
159+
<div className='flex flex-col gap-2 text-subTitle'>
160+
<div>注册开发者</div>
161+
<div className='flex items-center gap-2'>
162+
<UserOutlined className="text-xl text-colorPrimary" />
163+
<div className='text-colorPrimary text-2xl'>{developerCount}</div>
164+
</div>
165+
</div>
165166
</Card>
166167
</Col>
167168
<Col xs={24} sm={12} lg={12}>
168-
<Card
169+
<Card
169170
className="cursor-pointer hover:shadow-md transition-shadow"
170171
onClick={() => {
171172
navigate(`/portals/detail?id=${portal.portalId}&tab=published-apis`)
172173
}}
173174
>
174-
<Statistic
175-
title="已发布的API"
176-
value={apiCount}
177-
prefix={<ApiOutlined className="text-blue-500" />}
178-
valueStyle={{ color: '#1677ff', fontSize: '24px' }}
179-
/>
175+
<div className='flex flex-col gap-2 text-subTitle'>
176+
<div>已发布的API</div>
177+
<div className='flex items-center gap-2'>
178+
<ApiOutlined className="text-xl text-colorPrimary" />
179+
<div className='text-colorPrimary text-2xl'>{apiCount}</div>
180+
</div>
181+
</div>
180182
</Card>
181183
</Col>
182184
</Row>
183185
</div>
184186
)
185-
}
187+
}

himarket-web/himarket-admin/src/components/portal/PortalPublishedApis.tsx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ export function PortalPublishedApis({ portal }: PortalApiProductsProps) {
1818
const [selectedApiIds, setSelectedApiIds] = useState<string[]>([])
1919
const [loading, setLoading] = useState(false)
2020
const [modalLoading, setModalLoading] = useState(false)
21-
21+
2222
// 分页状态
2323
const [currentPage, setCurrentPage] = useState(1)
2424
const [pageSize, setPageSize] = useState(10)
2525
const [total, setTotal] = useState(0)
26-
26+
2727
useEffect(() => {
2828
if (portal.portalId) {
2929
fetchApiProducts()
@@ -53,7 +53,7 @@ export function PortalPublishedApis({ portal }: PortalApiProductsProps) {
5353
status: 'READY'
5454
}).then((res) => {
5555
// 过滤掉已发布在该门户里的api
56-
setApiProductsOptions(res.data.content.filter((api: ApiProduct) =>
56+
setApiProductsOptions(res.data.content.filter((api: ApiProduct) =>
5757
!apiProducts.some((a: ApiProduct) => a.productId === api.productId)
5858
))
5959
}).finally(() => {
@@ -105,14 +105,16 @@ export function PortalPublishedApis({ portal }: PortalApiProductsProps) {
105105
width: 180,
106106
render: (_: any, record: ApiProduct) => (
107107
<Space size="middle">
108-
<Button
108+
<div
109109
onClick={() => {
110110
navigate(`/api-products/detail?productId=${record.productId}`)
111111
}}
112-
type="link" icon={<EyeOutlined />}>
112+
className='flex gap-2 text-colorPrimary/80 cursor-pointer hover:text-colorPrimary'
113+
>
114+
<EyeOutlined />
113115
查看
114-
</Button>
115-
116+
</div>
117+
116118
<Button type="link" danger icon={<DeleteOutlined />} onClick={() => handleDelete(record.productId, record.name)}>
117119
移除
118120
</Button>
@@ -214,8 +216,8 @@ export function PortalPublishedApis({ portal }: PortalApiProductsProps) {
214216
</div>
215217

216218
<Card>
217-
<Table
218-
columns={columns}
219+
<Table
220+
columns={columns}
219221
dataSource={apiProducts}
220222
rowKey="productId"
221223
loading={loading}
@@ -272,4 +274,4 @@ export function PortalPublishedApis({ portal }: PortalApiProductsProps) {
272274
</Modal>
273275
</div>
274276
)
275-
}
277+
}

0 commit comments

Comments
 (0)