feat: 优化界面显示,对deck添加编辑功能
This commit is contained in:
@@ -58,6 +58,9 @@ const FormModal = () => {
|
||||
<Form.Item name='title' label='title'>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item name='description' label='description'>
|
||||
<Input.TextArea rows={4} />
|
||||
</Form.Item>
|
||||
<Form.Item name='code' label='code'>
|
||||
<TextArea />
|
||||
</Form.Item>
|
||||
@@ -127,7 +130,7 @@ export const ContainerList = () => {
|
||||
}}>
|
||||
{item.title || '-'}
|
||||
</div>
|
||||
<div className='font-light'>{item.description ? item.description : '-'}</div>
|
||||
<div className='font-light text-xs mt-2'>{item.description ? item.description : '-'}</div>
|
||||
</div>
|
||||
<div className='w-full text-xs'>
|
||||
<TextArea className='max-h-[240px] scrollbar' value={item.code} readonly />
|
||||
|
||||
@@ -9,9 +9,10 @@ export const App = () => {
|
||||
<Route path='/' element={<Navigate to='/container/edit/list' />}></Route>
|
||||
<Route path='edit/list' element={<ContainerList />} />
|
||||
<Route path='preview/:id/wrapper' element={<PreviewWrapper />} />
|
||||
<Route path='/' element={<div>Home</div>} />
|
||||
</Route>
|
||||
<Route path='preview/:id' element={<Preview />} />
|
||||
</Routes>
|
||||
);
|
||||
};
|
||||
|
||||
export * from './module/Select';
|
||||
|
||||
39
src/pages/container/module/Select.tsx
Normal file
39
src/pages/container/module/Select.tsx
Normal file
@@ -0,0 +1,39 @@
|
||||
import { query } from '@/modules';
|
||||
import { Select as AntSelect, message, SelectProps } from 'antd';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
export const Select = (props: SelectProps) => {
|
||||
const [options, setOptions] = useState<{ value: string; id: string }[]>([]);
|
||||
useEffect(() => {
|
||||
fetch();
|
||||
}, []);
|
||||
const fetch = async () => {
|
||||
const res = await query.post({
|
||||
path: 'container',
|
||||
key: 'list',
|
||||
});
|
||||
if (res.code !== 200) {
|
||||
message.error(res.message || '获取容器列表失败');
|
||||
return;
|
||||
}
|
||||
const data = res.data || [];
|
||||
setOptions(
|
||||
data.map((item: any) => {
|
||||
return {
|
||||
label: item.title,
|
||||
value: item.id,
|
||||
};
|
||||
}),
|
||||
);
|
||||
};
|
||||
return (
|
||||
<AntSelect
|
||||
{...props}
|
||||
options={options}
|
||||
// onChange={(e) => {
|
||||
// const labelValue = options.find((item) => item.value === e);
|
||||
// props.onChange?.(e, options);
|
||||
// }}
|
||||
/>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user