Yansen 2 lat temu
rodzic
commit
4ea112eb5b
1 zmienionych plików z 4 dodań i 15 usunięć
  1. 4
    15
      src/pages/check/components/QuForm.jsx

+ 4
- 15
src/pages/check/components/QuForm.jsx Wyświetl plik

@@ -18,7 +18,6 @@ const queryQu = transformQuery(getTdQuestion, { searchKey: 'title', labelKey: 't
18 18
 export default (props) => {
19 19
   const { open, onOpenChange, quInfo, itemId, itemType, onChange } = props;
20 20
   const [form] = Form.useForm();
21
-  const [value, setValue] = React.useState();
22 21
 
23 22
   const onFinish = async (values) => {
24 23
     const data = {
@@ -237,21 +236,11 @@ export default (props) => {
237 236
                 name="answerList"
238 237
                 label="选项列表"
239 238
                 copyIconProps={false}
240
-                creatorRecord={{ answerCode: value }}
241 239
               >{(f, index) => {
242 240
 
243
-                // console.log('index', index == 0)
244
-                if (index == 0) {
245
-                  setValue('B')
246
-                } else if (index == 1) {
247
-                  setValue('C')
248
-                } else if (index == 2) {
249
-                  setValue('D')
250
-                } else if (index == 3) {
251
-                  setValue('E')
252
-                } else if (index == 4) {
253
-                  setValue('F')
254
-                }
241
+                const charCode = index + 65;
242
+                const initialValue = charCode < 91 ? String.fromCharCode(charCode) : '';
243
+
255 244
                 return (
256 245
                   <Row gutter={24} style={{ width: '730px' }}>
257 246
                     <Col span={8}>
@@ -259,7 +248,7 @@ export default (props) => {
259 248
                         name="answerCode"
260 249
                         label="选项"
261 250
                         help="类似 A, B, C, D"
262
-                        initialValue={'A'}
251
+                        initialValue={initialValue}
263 252
                       />
264 253
                     </Col>
265 254
                     <Col span={8}>