-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
719 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,8 @@ | |
"license": "GPL-3.0", | ||
"author": "Romi <[email protected]>", | ||
"scripts": { | ||
"client": "pnpm --filter @moehub/client", | ||
"common": "pnpm --filter @moehub/common", | ||
"dev:core": "nodemon --watch", | ||
"dev:client": "pnpm --filter @moehub/client dev", | ||
"lint": "eslint \"packages/*/src/*.ts\" --fix", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export default class Store { | ||
public static get(key: string) { | ||
return localStorage.getItem(key); | ||
} | ||
|
||
public static set(key: string, value: string) { | ||
localStorage.setItem(key, value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,193 @@ | ||
import React from 'react'; | ||
import { Button, Card, Collapse, DatePicker, Flex, Form, Input, InputNumber, Radio, Space, notification } from 'antd'; | ||
import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons'; | ||
import { MoehubDataCharacter } from '@moehub/common'; | ||
import styles from '../styles.module.css'; | ||
import { createCharacter } from '../../../http'; | ||
|
||
const CreateView: React.FC = () => { | ||
const [form] = Form.useForm(); | ||
|
||
const onFinish = (values: MoehubDataCharacter) => { | ||
createCharacter(values).then(() => notification.success({ message: '角色创建成功' })); | ||
}; | ||
|
||
return ( | ||
<div> | ||
<h1>角色创建</h1> | ||
<Flex justify="center" align="center" vertical> | ||
<Card hoverable className="card cardFixed cleanAll"> | ||
<Form form={form} name="control-hooks" className={styles.form} onFinish={onFinish}> | ||
<Form.Item name="name" label="角色名" rules={[{ required: true }]}> | ||
<Input /> | ||
</Form.Item> | ||
<Form.Item name="romaji" label="罗马音" rules={[{ required: true }]}> | ||
<Input /> | ||
</Form.Item> | ||
<Form.Item name="gender" label="性别" rules={[{ required: true }]}> | ||
<Radio.Group> | ||
<Radio.Button value="MALE">男性</Radio.Button> | ||
<Radio.Button value="FEMALE">女性</Radio.Button> | ||
<Radio.Button value="OTHER">其它/未知</Radio.Button> | ||
</Radio.Group> | ||
</Form.Item> | ||
<Form.Item name="series" label="作品名" rules={[{ required: true }]}> | ||
<Input /> | ||
</Form.Item> | ||
<Form.Item name="seriesGenre" label="作品类型" rules={[{ required: true }]}> | ||
<Radio.Group> | ||
<Radio value="ANIME">动画</Radio> | ||
<Radio value="COMIC">漫画</Radio> | ||
<Radio value="GALGAME">Galgame</Radio> | ||
<Radio value="GAME">游戏</Radio> | ||
<Radio value="NOVEL">轻小说</Radio> | ||
<Radio value="OTHER">其它</Radio> | ||
</Radio.Group> | ||
</Form.Item> | ||
<hr /> | ||
<Form.List name="alias"> | ||
{(fields, { add, remove }, { errors }) => ( | ||
<> | ||
{fields.map((field) => ( | ||
<> | ||
<Form.Item {...field} rules={[{ required: true }]}> | ||
<Input /> | ||
</Form.Item> | ||
<MinusCircleOutlined onClick={() => remove(field.name)} /> | ||
</> | ||
))} | ||
<Form.Item> | ||
<Button type="dashed" onClick={() => add()} icon={<PlusOutlined />}> | ||
添加别名 | ||
</Button> | ||
<Form.ErrorList errors={errors} /> | ||
</Form.Item> | ||
</> | ||
)} | ||
</Form.List> | ||
<Form.List name="images"> | ||
{(fields, { add, remove }, { errors }) => ( | ||
<> | ||
{fields.map((field) => ( | ||
<> | ||
<Form.Item {...field} rules={[{ required: true }]}> | ||
<Input /> | ||
</Form.Item> | ||
<MinusCircleOutlined onClick={() => remove(field.name)} /> | ||
</> | ||
))} | ||
<Form.Item> | ||
<Button type="dashed" onClick={() => add()} icon={<PlusOutlined />}> | ||
添加图片 | ||
</Button> | ||
<Form.ErrorList errors={errors} /> | ||
</Form.Item> | ||
</> | ||
)} | ||
</Form.List> | ||
<Form.Item name="description" label="描述"> | ||
<Input /> | ||
</Form.Item> | ||
<Form.Item name="hitokoto" label="一言"> | ||
<Input /> | ||
</Form.Item> | ||
<Form.Item name="birthday" label="生日"> | ||
<DatePicker format="MM-DD" /> | ||
</Form.Item> | ||
<Form.Item name="comment" label="个人评价"> | ||
<Input /> | ||
</Form.Item> | ||
<Form.List name="tags"> | ||
{(fields, { add, remove }, { errors }) => ( | ||
<> | ||
{fields.map((field) => ( | ||
<> | ||
<Form.Item {...field} rules={[{ required: true }]}> | ||
<Input /> | ||
</Form.Item> | ||
<MinusCircleOutlined onClick={() => remove(field.name)} /> | ||
</> | ||
))} | ||
<Form.Item> | ||
<Button type="dashed" onClick={() => add()} icon={<PlusOutlined />}> | ||
添加萌点 | ||
</Button> | ||
<Form.ErrorList errors={errors} /> | ||
</Form.Item> | ||
</> | ||
)} | ||
</Form.List> | ||
<hr /> | ||
<Collapse> | ||
<Collapse.Panel header="其它信息" key="1"> | ||
<Form.Item name="voice" label="声优"> | ||
<Input /> | ||
</Form.Item> | ||
<Form.Item name="age" label="年龄" rules={[{ type: 'number' }]}> | ||
<InputNumber /> | ||
</Form.Item> | ||
<Form.Item name="height" label="身高" rules={[{ type: 'number' }]}> | ||
<InputNumber /> | ||
</Form.Item> | ||
<Form.Item name="bust" label="胸围" rules={[{ type: 'number' }]}> | ||
<InputNumber /> | ||
</Form.Item> | ||
<Form.Item name="waist" label="腰围" rules={[{ type: 'number' }]}> | ||
<InputNumber /> | ||
</Form.Item> | ||
<Form.Item name="hip" label="臀围" rules={[{ type: 'number' }]}> | ||
<InputNumber /> | ||
</Form.Item> | ||
<Form.Item name="hairColor" label="发色"> | ||
<Input /> | ||
</Form.Item> | ||
<Form.Item name="eyeColor" label="瞳色"> | ||
<Input /> | ||
</Form.Item> | ||
<Form.Item name="bloodType" label="血型"> | ||
<Radio.Group> | ||
<Radio value="A">A 型</Radio> | ||
<Radio value="B">B 型</Radio> | ||
<Radio value="AB">AB 型</Radio> | ||
<Radio value="O">O 型</Radio> | ||
</Radio.Group> | ||
</Form.Item> | ||
|
||
<Form.List name="url"> | ||
{(fields, { add, remove }, { errors }) => ( | ||
<> | ||
{fields.map((field) => ( | ||
<> | ||
<Form.Item {...field} rules={[{ required: true }]}> | ||
<Input /> | ||
</Form.Item> | ||
<MinusCircleOutlined onClick={() => remove(field.name)} /> | ||
</> | ||
))} | ||
<Form.Item> | ||
<Button type="dashed" onClick={() => add()} icon={<PlusOutlined />}> | ||
添加链接 | ||
</Button> | ||
<Form.ErrorList errors={errors} /> | ||
</Form.Item> | ||
</> | ||
)} | ||
</Form.List> | ||
</Collapse.Panel> | ||
</Collapse> | ||
<br /> | ||
<Form.Item> | ||
<Space> | ||
<Button type="primary" htmlType="submit" className="cardButton"> | ||
提交 | ||
</Button> | ||
</Space> | ||
</Form.Item> | ||
</Form> | ||
</Card> | ||
</Flex> | ||
</div> | ||
); | ||
}; | ||
|
||
export default CreateView; |
Oops, something went wrong.