feat: 自行开发设计 ui样式优化 超管端-控制台 相关的页面

This commit is contained in:
zhanjunhao
2026-11-09 21:45:37 +08:00
parent 6ad95e2baa
commit 5713d541b0
242 changed files with 9242 additions and 5043 deletions
+1 -1
View File
@@ -89,7 +89,7 @@ export default function ArticleEditor({ initial, insights, onApply, onClose }) {
title={initial.id ? '编辑文章' : '新增文章'}
width='min(1100px, 100vw)'
onCancel={close}
maskClosable={false}
maskClosable
footer={
<div className='website-insights-editor-footer'>
<div className='flex gap-2'>
+54 -38
View File
@@ -16,11 +16,13 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import TableEmpty from '../../components/common/table/TableEmpty';
import TableToolbar from '../../components/common/table/TableToolbar';
import { ConsoleFilterField } from '../../components/console/ConsoleModuleFilters';
import React, { useState } from 'react';
import {
Button,
Card,
Empty,
Input,
Modal,
Select,
@@ -167,18 +169,19 @@ export default function InsightsPanel({ value, onChange, disabled, error }) {
key: 'actions',
width: 160,
render: (_, item) => (
<div className='flex gap-2'>
<div className='website-insights-row-actions'>
<Button
type='tertiary'
theme='borderless'
type='link'
size='small'
disabled={disabled}
onClick={() => setArticle({ ...item, related: [...item.related] })}
>
编辑
</Button>
<Button
theme='borderless'
type='danger'
type='link'
size='small'
danger
disabled={disabled}
onClick={() => deleteArticle(item)}
>
@@ -198,7 +201,11 @@ export default function InsightsPanel({ value, onChange, disabled, error }) {
<Card
className='website-insights-categories'
title={
<Typography.Title heading={6} className='truncate' title='内容分类'>
<Typography.Title
heading={6}
className='website-insights-category-heading truncate'
title='内容分类'
>
内容分类
</Typography.Title>
}
@@ -266,43 +273,52 @@ export default function InsightsPanel({ value, onChange, disabled, error }) {
</div>
</Card>
<div className='website-insights-toolbar'>
<Input
prefix={<IconSearch />}
aria-label='搜索文章标题或摘要'
placeholder='搜索文章标题或摘要'
value={keyword}
showClear
onEnterPress={(event) => event.preventDefault()}
onChange={(text) => {
setKeyword(text);
}}
/>
<Select
aria-label='筛选文章分类'
value={activeCategory}
optionList={[
{ label: '全部分类', value: 'all' },
...value.categories.map((c) => ({ label: c.name, value: c.id })),
]}
onChange={selectCategory}
/>
<Button
icon={<IconPlus />}
theme='solid'
disabled={disabled}
onClick={() => {
setArticle(newArticle(activeCategory));
}}
>
新增文章
</Button>
<div className='website-insights-search-field'>
<ConsoleFilterField label='文章标题'>
<Input
className='website-insights-search'
prefix={<IconSearch />}
aria-label='搜索文章标题或摘要'
placeholder='搜索文章标题或摘要'
value={keyword}
showClear
onEnterPress={(event) => event.preventDefault()}
onChange={(text) => {
setKeyword(text);
}}
/>
</ConsoleFilterField>
</div>
</div>
<TableToolbar title='文章列表'>
<div className='website-insights-toolbar-actions'>
<Select
aria-label='筛选文章分类'
value={activeCategory}
optionList={[
{ label: '全部分类', value: 'all' },
...value.categories.map((c) => ({ label: c.name, value: c.id })),
]}
onChange={selectCategory}
/>
<Button
icon={<IconPlus />}
theme='solid'
disabled={disabled}
onClick={() => {
setArticle(newArticle(activeCategory));
}}
>
新增文章
</Button>
</div>
</TableToolbar>
<CardTable
rowKey='id'
columns={columns}
dataSource={rows}
scroll={{ x: 860 }}
empty={<Empty description='暂无匹配的文章,请调整筛选条件或新增文章' />}
empty={<TableEmpty />}
hidePagination
/>
<Modal
+11 -1
View File
@@ -29,13 +29,23 @@ export default function WebsiteField({
onChange,
onBlur,
disabled,
labelSuffix,
children,
}) {
const { t } = useTranslation();
const field = FIELDS[name];
return (
<Form.Slot
label={{ text: t(field.label), required: true, name: `website-${name}` }}
label={{
text: (
<>
{t(field.label)}
{labelSuffix}
</>
),
required: true,
name: `website-${name}`,
}}
error={{
error: error ? t(error) : undefined,
errorMessageId: `website-${name}-error`,
+72 -12
View File
@@ -1,16 +1,10 @@
.website-settings-page {
--website-insights-footer-gap: 18px;
display: flex;
flex-direction: column;
box-sizing: border-box;
/* Match Settings: 24px layout padding + 8px page padding on each side. */
padding-inline: 32px;
min-height: calc(100vh - var(--content-top-offset, 0px));
min-height: calc(100dvh - var(--content-top-offset, 0px));
/* PageLayout already inserts the marquee spacer above this page. */
padding-top: calc(
var(--app-header-height, 64px) - var(--content-top-offset, 0px) + 20px
);
padding-bottom: 20px;
min-width: 0;
padding: 0;
}
.website-settings-page .website-settings-card {
@@ -18,8 +12,43 @@
min-height: 100%;
}
.website-settings-page .website-settings-card.ant-card > .ant-card-body {
padding-top: 8px;
}
.website-settings-page .website-settings-card--error.ant-card > .ant-card-body {
padding-top: 24px;
}
.website-settings-page .website-insights-categories > .ant-card-head,
.website-settings-page .website-insights-categories > .ant-card-body {
padding-inline: 18px;
}
.website-settings-page .website-insights-category-heading {
margin: 0;
line-height: 24px;
}
.website-insights {
min-width: 0;
padding-bottom: var(--website-insights-footer-gap, 18px);
}
.website-insights-row-actions {
display: flex;
align-items: center;
gap: 6px;
}
.website-insights-row-actions .ant-btn {
height: auto;
padding: 0 4px;
font-size: 13px;
}
.website-settings-page .website-research-ratio-hint {
opacity: 0.9;
}
.website-settings-page .website-settings-tab-description {
@@ -100,10 +129,28 @@
}
.website-insights-toolbar {
flex-wrap: wrap;
flex-wrap: nowrap;
justify-content: space-between;
margin-bottom: 16px;
}
.website-settings-page .website-insights-search-field {
flex: 0 1 310px;
width: 310px;
min-width: 0;
}
.website-settings-page .website-insights-search {
width: 100%;
}
.website-insights-toolbar-actions {
display: flex;
align-items: center;
flex-shrink: 0;
gap: 8px;
}
.website-insights-article-meta {
display: grid;
gap: 4px;
@@ -195,9 +242,22 @@
}
@media (max-width: 767px) {
.website-insights-toolbar {
flex-wrap: wrap;
}
.website-settings-page .website-insights-search-field {
flex-basis: 100%;
width: 100%;
}
.website-insights-toolbar-actions {
justify-content: flex-end;
width: 100%;
}
.website-settings-page {
/* Match the shared mobile layout's 5px plus the page's 8px. */
padding-inline: 13px;
padding: 0;
}
.website-insights-editor-layout {
+20 -22
View File
@@ -54,7 +54,6 @@ export default function WebsiteSettings() {
const [dirty, setDirty] = useState(false);
const [loading, setLoading] = useState(true);
const [loadError, setLoadError] = useState('');
const [loadVersion, setLoadVersion] = useState(0);
const originalConfig = useRef({});
const savePending = useRef(false);
useEffect(() => {
@@ -79,7 +78,7 @@ export default function WebsiteSettings() {
return () => {
active = false;
};
}, [loadVersion]);
}, []);
const disabled = saving || loading || Boolean(loadError);
useEffect(() => {
if (!dirty) return;
@@ -161,24 +160,17 @@ export default function WebsiteSettings() {
childStyle={{ flex: 1, display: 'flex', flexDirection: 'column' }}
data-testid='website-settings-loading'
>
<Card className='website-settings-card'>
<Typography.Title heading={4} style={{ marginBottom: 8 }}>
{t('官网设置')}
</Typography.Title>
<Typography.Paragraph type='tertiary'>
{t('配置官网展示内容与商务联系信息')}
</Typography.Paragraph>
<Card
className={`website-settings-card${loadError ? ' website-settings-card--error' : ''}`}
>
{loadError ? (
<Banner
type='danger'
closeIcon={null}
description={t(loadError)}
fullMode={false}
>
<Button onClick={() => setLoadVersion((version) => version + 1)}>
{t('重新加载')}
</Button>
</Banner>
className='website-settings-load-error'
style={{ marginBlock: '0 8px' }}
/>
) : null}
<Tabs type='line' activeKey={activeTab} onChange={setActiveTab}>
{TABS.map((item) => (
@@ -217,6 +209,14 @@ export default function WebsiteSettings() {
>
<WebsiteField
name={name}
labelSuffix={
activeTab === 'home' && name === 'teamMembers' ? (
<span className='website-research-ratio-hint'>
({t('研发人员占比')}:
{values.researchRatio || t('未配置')})
</span>
) : undefined
}
value={values[name]}
error={errors[name]}
disabled={disabled}
@@ -239,12 +239,6 @@ export default function WebsiteSettings() {
/>
)}
</WebsiteField>
{activeTab === 'home' && name === 'teamMembers' && (
<Typography.Text type='tertiary' size='small'>
{t('研发人员占比')}:
{values.researchRatio || t('未配置')}
</Typography.Text>
)}
</div>
))}
</div>
@@ -256,6 +250,10 @@ export default function WebsiteSettings() {
style={{
marginTop: 10,
marginBottom: 2,
marginBlock:
activeTab === 'insights'
? '0 var(--website-insights-footer-gap)'
: undefined,
paddingTop: 2,
paddingBottom: 2,
}}
@@ -263,7 +261,7 @@ export default function WebsiteSettings() {
/>
<div
className='flex justify-center gap-2'
style={{ marginTop: 18 }}
style={{ marginTop: activeTab === 'insights' ? 0 : 18 }}
>
<Button onClick={clear} disabled={disabled}>
{t('清空')}
+8 -1
View File
@@ -171,7 +171,14 @@ export function validateField(key, rawValue) {
export function validateSettings(values) {
return Object.fromEntries(
[...new Set(TABS.flatMap((tab) => tab.fields))]
.map((key) => [key, validateField(key, values[key])])
.map((key) => [
key,
key === 'insights' &&
!values.insights?.categories?.length &&
!values.insights?.articles?.length
? '请完善动态与洞察的配置'
: validateField(key, values[key]),
])
.filter(([, error]) => error),
);
}