-
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
52 changed files
with
4,737 additions
and
2,983 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
Binary file not shown.
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,15 @@ | ||
import I18n from '@kotori-bot/i18n' | ||
import locales from './locales' | ||
|
||
const i18n = new I18n() | ||
|
||
i18n.use(locales.en_US, 'en_US') | ||
i18n.use(locales.ja_JP, 'ja_JP') | ||
i18n.use(locales.zh_TW, 'zh_TW') | ||
i18n.use(locales.zh_CN, 'zh_CN') | ||
|
||
i18n.set('zh_CN') | ||
|
||
export const t = i18n.t.bind(i18n) | ||
|
||
export default i18n |
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,53 @@ | ||
export default { | ||
zh_CN: { | ||
'com.characterForm.label.1': '基础信息', | ||
'com.characterForm.label.2': '详细信息', | ||
'com.characterForm.label.3': '其它信息', | ||
'com.characterForm.submit': '提交', | ||
'com.characterForm.name': '角色名', | ||
'com.characterForm.romaji': '罗马音', | ||
'com.characterForm.gender': '性别', | ||
'com.characterForm.gender.male': '男性', | ||
'com.characterForm.gender.female': '女性', | ||
'com.characterForm.gender.other': '其它/未知', | ||
'com.characterForm.series': '作品名', | ||
'com.characterForm.seriesGenre': '作品类型', | ||
/* | ||
<Radio value="ANIME">{t`com.characterForm.seriesGenre.anime`}</Radio> | ||
<Radio value="COMIC">{t`com.characterForm.seriesGenre.comic`}</Radio> | ||
<Radio value="GALGAME">{t`com.characterForm.seriesGenre.galgame`}</Radio> | ||
<Radio value="GAME">{t`com.characterForm.seriesGenre.game`}</Radio> | ||
<Radio value="NOVEL">{t`com.characterForm.seriesGenre.novel`}</Radio> | ||
<Radio value="OTHER">{t`com.characterForm.seriesGenre.other`}</Radio> | ||
*/ | ||
'com.characterForm.seriesGenre.anime': '动画', | ||
'com.characterForm.seriesGenre.comic': '漫画', | ||
'com.characterForm.seriesGenre.galgame': 'Galgame/视觉小说', | ||
'com.characterForm.seriesGenre.game': '游戏', | ||
'com.characterForm.seriesGenre.novel': '轻小说', | ||
'com.characterForm.seriesGenre.other': '其它', | ||
'com.characterForm.tags': '萌点', | ||
'com.characterForm.birthday': '生日', | ||
'com.characterForm.color': '颜色', | ||
'com.characterForm.description': '描述', | ||
'com.characterForm.image': '图片', | ||
'com.characterForm.image.upload': '上传图片', | ||
'com.characterForm.image.upload.tip': '上传图片,支持 jpg、png、webp 格式,大小不超过 5MB', | ||
'com.characterForm.image.upload.error': '上传失败,请重试' | ||
}, | ||
en_US: { | ||
'com.characterForm.label.1': 'Basis', | ||
'com.characterForm.label.2': 'Details', | ||
'com.characterForm.label.3': 'Others' | ||
}, | ||
ja_JP: { | ||
'com.characterForm.label.1': 'Basis', | ||
'com.characterForm.label.2': 'Details', | ||
'com.characterForm.label.3': 'Others' | ||
}, | ||
zh_TW: { | ||
'com.characterForm.label.1': 'Basis', | ||
'com.characterForm.label.2': 'Details', | ||
'com.characterForm.label.3': 'Others' | ||
} | ||
} |
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,65 @@ | ||
import { Card, Flex, Upload, type UploadFile, type UploadProps, notification } from 'antd' | ||
import config from '@/http/config' | ||
import Dragger from 'antd/es/upload/Dragger' | ||
import { InboxOutlined } from '@ant-design/icons' | ||
import { useSelector } from 'react-redux' | ||
import { getToken } from '@/store/adminReducer' | ||
import { useState } from 'react' | ||
|
||
const ImgsView: React.FC = () => { | ||
const token = useSelector(getToken) | ||
const [fileList, setFileList] = useState<UploadFile[]>([]) | ||
|
||
const props: UploadProps = { | ||
name: 'file', | ||
multiple: true, | ||
action: `${config.url}/settings/imgs`, | ||
headers: { | ||
Authorization: `Bearer ${token}` | ||
}, | ||
fileList, | ||
beforeUpload: (file) => { | ||
const isPNG = file.type.startsWith('image/') | ||
if (!isPNG) notification.error({ message: `${file.name} 不是一个图片文件` }) | ||
return isPNG || Upload.LIST_IGNORE | ||
}, | ||
onChange(info) { | ||
setFileList( | ||
info.fileList.map((file) => { | ||
const newName = file.response?.data?.[0]?.filename | ||
const url = newName ? `${new URL(config.url).origin}/imgs/${newName}` : undefined | ||
return { ...file, name: newName ?? file.name, url } | ||
}) | ||
) | ||
console.log(info) | ||
const { status } = info.file | ||
// if (status !== 'uploading') { | ||
// console.log(info.file, info.fileList) | ||
// } | ||
if (status === 'done') { | ||
notification.success({ message: `${info.file.name} 文件上传成功` }) | ||
} else if (status === 'error') { | ||
notification.error({ message: `${info.file.name} 文件上传失败` }) | ||
} | ||
} | ||
} | ||
|
||
return ( | ||
<div> | ||
<h1>图片上传</h1> | ||
<Flex justify="center" align="center" vertical wrap> | ||
<Card hoverable className="card cardFixed"> | ||
<Dragger {...props}> | ||
<p className="ant-upload-drag-icon"> | ||
<InboxOutlined /> | ||
</p> | ||
<p className="ant-upload-text">点击或拖拽文件到该区域进行上传</p> | ||
<p className="ant-upload-hint">一次性支持单个或多个图片上传</p> | ||
</Dragger> | ||
</Card> | ||
</Flex> | ||
</div> | ||
) | ||
} | ||
|
||
export default ImgsView |
Oops, something went wrong.