Browse Source

正规化体型选项,包括大、中、小,并添加多语言,应用到UI上

dengdx 2 months ago
parent
commit
46c34507bc

+ 3 - 0
src/assets/i18n/messages/en.js

@@ -126,4 +126,7 @@ export default {
   'actionPanel.burn': 'Burn',
   'actionPanel.export': 'Export',
   'actionPanel.import': 'Import',
+  'Small': 'Small',
+  'Medium': 'Medium',
+  'Large': 'Large',
 };

+ 3 - 0
src/assets/i18n/messages/zh.js

@@ -126,4 +126,7 @@ export default {
   'actionPanel.burn': '刻录',
   'actionPanel.export': '导出',
   'actionPanel.import': '导入',
+  'Small': '小',
+  'Medium': '中',
+  'Large': '大',
 };

+ 9 - 2
src/pages/exam/ContentAreaLarge.tsx

@@ -16,6 +16,8 @@ import {
   CameraOutlined,
   CloseOutlined,
 } from '@ant-design/icons';
+import { patientSizes } from '../../states/patientSize';
+import { FormattedMessage } from 'react-intl';
 
 const ContentAreaLarge = () => {
   return (
@@ -40,8 +42,13 @@ const ContentAreaLarge = () => {
                 placeholder="选择体型"
                 style={{ width: '100%', marginBottom: 8 }}
               >
-                <Select.Option value="体型1">体型1</Select.Option>
-                <Select.Option value="体型2">体型2</Select.Option>
+                {Object.entries(patientSizes).map(
+                  ([key, value]: [string, string]) => (
+                    <Select.Option key={key} value={key}>
+                      <FormattedMessage id={value} />
+                    </Select.Option>
+                  )
+                )}
               </Select>
             </Col>
             <Col span={15}>

+ 8 - 2
src/pages/exam/ContentAreaMedium.tsx

@@ -16,6 +16,7 @@ import {
   CameraOutlined,
   CloseOutlined,
 } from '@ant-design/icons';
+import { patientSizes } from '@/states/patientSize';
 
 const ContentAreaMedium = () => {
   return (
@@ -40,8 +41,13 @@ const ContentAreaMedium = () => {
                 placeholder="选择体型"
                 style={{ width: '100%', marginBottom: 8 }}
               >
-                <Select.Option value="体型1">体型1</Select.Option>
-                <Select.Option value="体型2">体型2</Select.Option>
+                {Object.entries(patientSizes).map(
+                  ([key, value]: [string, string]) => (
+                    <Select.Option key={key} value={key}>
+                      {value}
+                    </Select.Option>
+                  )
+                )}
               </Select>
             </Col>
             <Col span={15}>

+ 8 - 2
src/pages/exam/ContentAreaSmall.tsx

@@ -17,6 +17,7 @@ import {
   CameraOutlined,
   CloseOutlined,
 } from '@ant-design/icons';
+import { patientSizes } from '@/states/patientSize';
 
 const ContentAreaSmall = ({ className }: { className?: string }) => {
   console.log('ContentAreaSmall component rendered');
@@ -41,8 +42,13 @@ const ContentAreaSmall = ({ className }: { className?: string }) => {
               placeholder="选择体型"
               style={{ width: '100%', marginBottom: 8 }}
             >
-              <Select.Option value="体型1">体型1</Select.Option>
-              <Select.Option value="体型2">体型2</Select.Option>
+              {Object.entries(patientSizes).map(
+                ([key, value]: [string, string]) => (
+                  <Select.Option key={key} value={key}>
+                    {value}
+                  </Select.Option>
+                )
+              )}
             </Select>
           </Col>
           <Col span={15}>

+ 7 - 0
src/states/patientSize.ts

@@ -0,0 +1,7 @@
+export const patientSizes = {
+  small: 'Small',
+  medium: 'Medium',
+  large: 'Large',
+} as const;
+
+export type PatientSize = keyof typeof patientSizes;