feat: 增加创作页面
This commit is contained in:
@@ -7,6 +7,7 @@ import Test from './pages/Test.tsx'
|
|||||||
import Bookshelf from './pages/book/Bookshelf.tsx'
|
import Bookshelf from './pages/book/Bookshelf.tsx'
|
||||||
import Book from './pages/book/Book.tsx'
|
import Book from './pages/book/Book.tsx'
|
||||||
import Chapter from './pages/book/Chapter.tsx'
|
import Chapter from './pages/book/Chapter.tsx'
|
||||||
|
import Creator from './pages/Creator.tsx'
|
||||||
|
|
||||||
const routes: RouteObject[] = [
|
const routes: RouteObject[] = [
|
||||||
{
|
{
|
||||||
@@ -34,6 +35,10 @@ const routes: RouteObject[] = [
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'creator',
|
||||||
|
Component: Creator,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'test',
|
path: 'test',
|
||||||
Component: Test,
|
Component: Test,
|
||||||
|
|||||||
182
client/src/pages/Creator.tsx
Normal file
182
client/src/pages/Creator.tsx
Normal file
@@ -0,0 +1,182 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import {amisRender, commonInfo, horizontalFormOptions} from '../util/amis.tsx'
|
||||||
|
|
||||||
|
function Creator() {
|
||||||
|
return (
|
||||||
|
<div className="creator">
|
||||||
|
{amisRender(
|
||||||
|
{
|
||||||
|
type: 'page',
|
||||||
|
title: 'AI创作',
|
||||||
|
body: [
|
||||||
|
{
|
||||||
|
debug: true,
|
||||||
|
type: 'form',
|
||||||
|
...horizontalFormOptions(),
|
||||||
|
wrapWithPanel: false,
|
||||||
|
canAccessSuperData: false,
|
||||||
|
body: [
|
||||||
|
{
|
||||||
|
type: 'textarea',
|
||||||
|
name: 'outline',
|
||||||
|
label: '故事概述',
|
||||||
|
clearable: true,
|
||||||
|
required: true,
|
||||||
|
trimContents: true,
|
||||||
|
showCounter: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'textarea',
|
||||||
|
name: 'world',
|
||||||
|
label: '世界观',
|
||||||
|
clearable: true,
|
||||||
|
required: true,
|
||||||
|
trimContents: true,
|
||||||
|
showCounter: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'input-tag',
|
||||||
|
name: 'tags',
|
||||||
|
label: '标签',
|
||||||
|
placeholder: '',
|
||||||
|
clearable: true,
|
||||||
|
source: `${commonInfo.baseUrl}/book/tags`,
|
||||||
|
max: 10,
|
||||||
|
joinValues: false,
|
||||||
|
extractValue: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'combo',
|
||||||
|
name: 'characters',
|
||||||
|
label: '故事人物',
|
||||||
|
multiLine: true,
|
||||||
|
addable: true,
|
||||||
|
removable: true,
|
||||||
|
multiple: true,
|
||||||
|
subFormMode: 'horizontal',
|
||||||
|
subFormHorizontal: {
|
||||||
|
leftFixed: 'sm',
|
||||||
|
},
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
type: 'uuid',
|
||||||
|
name: 'id',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'input-text',
|
||||||
|
name: 'name',
|
||||||
|
label: '名称',
|
||||||
|
clearable: true,
|
||||||
|
required: true,
|
||||||
|
trimContents: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'select',
|
||||||
|
name: 'sex',
|
||||||
|
label: '性别',
|
||||||
|
required: true,
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
label: '男',
|
||||||
|
value: 'male',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '女',
|
||||||
|
value: 'female',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'input-number',
|
||||||
|
name: 'age',
|
||||||
|
label: '年龄',
|
||||||
|
min: 10,
|
||||||
|
step: 1,
|
||||||
|
precision: 0,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'textarea',
|
||||||
|
name: 'appearance',
|
||||||
|
label: '外形',
|
||||||
|
clearable: true,
|
||||||
|
required: true,
|
||||||
|
trimContents: true,
|
||||||
|
showCounter: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'textarea',
|
||||||
|
name: 'disposition',
|
||||||
|
label: '性格',
|
||||||
|
clearable: true,
|
||||||
|
required: true,
|
||||||
|
trimContents: true,
|
||||||
|
showCounter: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'textarea',
|
||||||
|
name: 'clothes',
|
||||||
|
label: '衣着',
|
||||||
|
clearable: true,
|
||||||
|
trimContents: true,
|
||||||
|
showCounter: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'textarea',
|
||||||
|
name: 'experience',
|
||||||
|
label: '经历',
|
||||||
|
clearable: true,
|
||||||
|
trimContents: true,
|
||||||
|
showCounter: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'textarea',
|
||||||
|
name: 'family',
|
||||||
|
label: '家庭',
|
||||||
|
clearable: true,
|
||||||
|
trimContents: true,
|
||||||
|
showCounter: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'input-kvs',
|
||||||
|
name: 'extra2',
|
||||||
|
label: '更多信息',
|
||||||
|
draggable: false,
|
||||||
|
keyItem: {
|
||||||
|
type: 'input-text',
|
||||||
|
label: '属性名称',
|
||||||
|
clearable: true,
|
||||||
|
trimContents: true,
|
||||||
|
mode: 'horizontal',
|
||||||
|
horizontal: {
|
||||||
|
leftFixed: 'sm',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
valueItems: [
|
||||||
|
{
|
||||||
|
type: 'textarea',
|
||||||
|
name: 'value',
|
||||||
|
label: '属性内容',
|
||||||
|
clearable: true,
|
||||||
|
required: true,
|
||||||
|
trimContents: true,
|
||||||
|
showCounter: true,
|
||||||
|
mode: 'horizontal',
|
||||||
|
horizontal: {
|
||||||
|
leftFixed: 'sm',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default React.memo(Creator)
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import {BookOutlined, DeploymentUnitOutlined, InfoCircleOutlined} from '@ant-design/icons'
|
import {BookOutlined, DeploymentUnitOutlined, EditOutlined, InfoCircleOutlined} from '@ant-design/icons'
|
||||||
import {type AppItemProps, ProLayout} from '@ant-design/pro-components'
|
import {type AppItemProps, ProLayout} from '@ant-design/pro-components'
|
||||||
import {ConfigProvider} from 'antd'
|
import {ConfigProvider} from 'antd'
|
||||||
import React, {useMemo} from 'react'
|
import React, {useMemo} from 'react'
|
||||||
@@ -30,6 +30,11 @@ const menus = {
|
|||||||
name: '书架',
|
name: '书架',
|
||||||
icon: <BookOutlined/>,
|
icon: <BookOutlined/>,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/creator',
|
||||||
|
name: '创作',
|
||||||
|
icon: <EditOutlined/>,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/test',
|
path: '/test',
|
||||||
name: '测试',
|
name: '测试',
|
||||||
|
|||||||
Reference in New Issue
Block a user