ArticleCreate.tsx 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import { ProForm, ProFormText, ProFormSelect } from "@ant-design/pro-components";
  2. import { useIntl } from "react-intl";
  3. import { message } from "antd";
  4. interface IFormData {
  5. title: string;
  6. lang: string;
  7. }
  8. type IWidgetArticleCreate = {
  9. studio: string | undefined;
  10. };
  11. const Widget = (param: IWidgetArticleCreate) => {
  12. const intl = useIntl();
  13. return (
  14. <ProForm<IFormData>
  15. onFinish={async (values: IFormData) => {
  16. // TODO
  17. console.log(values);
  18. message.success(intl.formatMessage({ id: "flashes.success" }));
  19. }}
  20. >
  21. <ProForm.Group>
  22. <ProFormText
  23. width="md"
  24. name="title"
  25. required
  26. label={intl.formatMessage({ id: "channel.name" })}
  27. rules={[
  28. {
  29. required: true,
  30. message: intl.formatMessage({ id: "channel.create.message.noname" }),
  31. },
  32. ]}
  33. />
  34. </ProForm.Group>
  35. <ProForm.Group>
  36. <ProFormSelect
  37. options={[
  38. {
  39. value: "zh-Hans",
  40. label: intl.formatMessage({ id: "languages.zh-Hans" }),
  41. },
  42. {
  43. value: "en-US",
  44. label: intl.formatMessage({ id: "English" }),
  45. },
  46. ]}
  47. width="md"
  48. name="lang"
  49. label={intl.formatMessage({ id: "forms.fields.lang.label" })}
  50. />
  51. </ProForm.Group>
  52. </ProForm>
  53. );
  54. };
  55. export default Widget;