fix:修复提示词工坊相关功能 5

This commit is contained in:
xiamuceer-j
2026-01-27 16:15:47 +08:00
parent 692dab6912
commit d5589dba6e
4 changed files with 229 additions and 194 deletions
+16 -58
View File
@@ -13,8 +13,6 @@ import {
Typography,
Row,
Col,
Tabs,
Badge,
} from 'antd';
import {
PlusOutlined,
@@ -22,12 +20,10 @@ import {
DeleteOutlined,
StarOutlined,
StarFilled,
CloudOutlined,
} from '@ant-design/icons';
import { useStore } from '../store';
import { writingStyleApi } from '../services/api';
import type { WritingStyle, WritingStyleCreate, WritingStyleUpdate } from '../types';
import PromptWorkshop from '../components/PromptWorkshop';
const { TextArea } = Input;
const { Text, Paragraph } = Typography;
@@ -168,14 +164,24 @@ export default function WritingStyles() {
return styleType === 'preset' ? '预设' : '自定义';
};
// 渲染本地风格列表
const renderLocalStyles = () => (
<div>
return (
<div style={{ display: 'flex', flexDirection: 'column', height: '100%' }}>
<div style={{
marginBottom: 16,
position: 'sticky',
top: 0,
zIndex: 10,
backgroundColor: '#fff',
padding: isMobile ? '12px 0' : '16px 0',
marginBottom: isMobile ? 12 : 16,
borderBottom: '1px solid #f0f0f0',
display: 'flex',
justifyContent: 'flex-end',
justifyContent: 'space-between',
alignItems: 'center',
}}>
<h2 style={{ margin: 0, fontSize: isMobile ? 18 : 24 }}>
<EditOutlined style={{ marginRight: 8 }} />
</h2>
<Button
type="primary"
icon={<PlusOutlined />}
@@ -184,7 +190,7 @@ export default function WritingStyles() {
</Button>
</div>
<div style={{ flex: 1, overflowY: 'auto' }}>
{styles.length === 0 ? (
<Empty description="暂无风格数据" />
@@ -303,54 +309,6 @@ export default function WritingStyles() {
</Row>
)}
</div>
</div>
);
return (
<div style={{ display: 'flex', flexDirection: 'column', height: '100%' }}>
<div style={{
position: 'sticky',
top: 0,
zIndex: 10,
backgroundColor: '#fff',
padding: isMobile ? '12px 0' : '16px 0',
marginBottom: isMobile ? 12 : 16,
borderBottom: '1px solid #f0f0f0',
}}>
<h2 style={{ margin: 0, fontSize: isMobile ? 18 : 24 }}>
<EditOutlined style={{ marginRight: 8 }} />
</h2>
</div>
<Tabs
defaultActiveKey="local"
style={{ flex: 1 }}
items={[
{
key: 'local',
label: (
<span>
<EditOutlined />
</span>
),
children: renderLocalStyles(),
},
{
key: 'workshop',
label: (
<Badge dot>
<span>
<CloudOutlined />
</span>
</Badge>
),
children: <PromptWorkshop onImportSuccess={loadStyles} />,
},
]}
/>
{/* 创建自定义风格 Modal */}
<Modal