董国庆
2025-11-19 51c7a653146c98711deba4c8d8fa48eeabc2a039
加排序-加图片
3个文件已修改
198 ■■■■■ 已修改文件
src/pages/study/topic/index.jsx 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/study/type/addAndEdit.jsx 178 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/requestErrorConfig.ts 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/study/topic/index.jsx
@@ -1,6 +1,6 @@
import { buildProTableDataSource, sendRequest, showDelConfirm } from '@/utils/antdUtils';
import { PageContainer, ProTable } from '@ant-design/pro-components';
import { Button, Modal, Space } from 'antd';
import { Button, Modal, Space,Image} from 'antd';
import { useEffect, useRef, useState } from 'react';
import { history, useAccess } from 'umi';
import './index.scss';
@@ -162,6 +162,19 @@
      },
    },
    {
      title: '题目图片',
      dataIndex: 'img',
      width:80,
      hideInSearch: true,
      render: (text, record) => {
        return (
          <div style={{ display: 'flex' }}>
            <Image src={record.img || 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png'} style={{ width: '50px', height: '50px' }} />
          </div>
        );
      },
    },
    {
      title: '题目状态',
      dataIndex: 'state',
      valueEnum: {
@@ -173,6 +186,7 @@
    {
      title: '操作',
      hideInSearch: true,
      fixed:'right',
      render: (text, record) => {
        return (
          <Space style={{ paddingRight: '20px' }}>
src/pages/study/type/addAndEdit.jsx
@@ -618,20 +618,26 @@
      topicType //每天不同的模块
      ) {
        case 1:
          const sortedSelectedRows1 = selectedRows.map((item, index) => {
            return {
              ...item,
              sort: index + 1, // 根据选择顺序默认排序
            };
          });
          let list1 = form.getFieldValue('listenChoose');
          list1[clickNum].List = selectedRows;
          list1[clickNum].List = sortedSelectedRows1;
          form.setFieldsValue({ listenChoose: list1 });
          break;
        case 2:
          selectedRows.map((item) => {
          const sortedSelectedRows2 = selectedRows.map((item, index) => {
            return {
              ...item,
              sort: '',
              sort: index + 1, // 根据选择顺序默认排序
            };
          });
          let list2 = form.getFieldValue('seeImgChoose');
          list2[clickNum].List = selectedRows;
          list2[clickNum].List = sortedSelectedRows2;
          form.setFieldsValue({ seeImgChoose: list2 });
          break;
@@ -657,8 +663,14 @@
          changeFourTable();
          break;
        case 5:
          const sortedSelectedRows5 = selectedRows.map((item, index) => {
            return {
              ...item,
              sort: index + 1, // 根据选择顺序默认排序
            };
          });
          let list5 = form.getFieldValue('musicImgPair');
          list5[clickNum].List = selectedRows;
          list5[clickNum].List = sortedSelectedRows5;
          form.setFieldsValue({ musicImgPair: list5 });
          break;
@@ -734,7 +746,11 @@
              //   return { name: item, id: it.subject.split(',')[index] };
              // });
              let list = it.name.split('#').map((item, index) => {
                return { name: item, id: it.subject.split(',')[index] };
                return {
                  name: item,
                  id: it.subject.split(',')[index],
                  sort: it.sort ? it.sort.split(',')[index] : index + 1, // 添加排序字段,如果没有则默认
                };
              });
              return {
                List: list,
@@ -759,7 +775,11 @@
              //   return { name: item, id: it.subject.split(',')[index] };
              // });
              let list = it.name.split('#').map((item, index) => {
                return { name: item, id: it.subject.split(',')[index] };
                return {
                  name: item,
                  id: it.subject.split(',')[index],
                  sort: it.sort ? it.sort.split(',')[index] : index + 1, // 添加排序字段,如果没有则默认
                };
              });
              return {
                List: list,
@@ -1053,7 +1073,11 @@
            let ids = item.List.map((it) => {
              return it.id;
            });
            let sorts = item.List.map((it) => {
              return it.sort;
            });
            return {
              sort: sorts.join(','), //题目排序
              subject: ids.join(','), //题目id
              isVip: integral1.isVip == true ? 1 : 0,
              integral: integral1.num, //积分
@@ -1189,7 +1213,11 @@
            let ids = item.List.map((it) => {
              return it.id;
            });
            let sorts = item.List.map((it) => {
              return it.sort;
            });
            return {
              sort: sorts.join(','), //题目排序
              subject: ids.join(','), //题目id
              isVip: integral5.isVip == true ? 1 : 0,
              integral: integral5.num, //积分
@@ -1223,7 +1251,7 @@
          };
          console.log('params 1-5天的提交', params);
          // return 提交
          return
          // return
          let state = await sendRequest(addStudySet, params);
          getStudyDetail(activeDayKey, activeWeekKey);
        }, 1);
@@ -1298,7 +1326,7 @@
          };
          console.log('params 6天的提交', form.getFieldValue('superListenGameBank'), params);
          // return 提交
          return
          // return
          let state = await sendRequest(addStudySet, params);
        } else {
          message.error('请先完善数据在提交');
@@ -1352,7 +1380,7 @@
        };
        console.log('params 7天的提交', params);
        //  // return 提交
        return
        // return
        let state = await sendRequest(addStudySet, params);
      } else {
        let params = {
@@ -1582,29 +1610,48 @@
              </div>
            </div>
            <div style={{ display: 'flex', height: '30px' }}>
              {form.getFieldValue('listenChoose')[index].List.map((subField, subIndex) => {
                return (
                  <div
                    key={subIndex}
                    style={{
                      width: '136px',
                      height: '30px',
                      borderRadius: '20px',
                      lineHeight: '30px',
                      border: '1px solid #BBBBBB',
                      marginRight: '10px',
                      textAlign: 'center',
                      overflow: 'hidden',
                      textOverflow: 'ellipsis',
                      whiteSpace: 'nowrap',
                    }}
                  >
                    {subField.name}{' '}
                  </div>
                );
              })}
            </div>
            <Form.List name={[field.name, 'List']}>
              {(subFields, subOpt) => (
                <div>
                  {subFields.map((subField, subIndex) => (
                    <div key={subIndex} style={{ display: 'flex' }}>
                      <Form.Item
                        style={{ marginRight: '20px' }}
                        label=" "
                        colon={false}
                        name={[subField.name, 'name']}
                      >
                        <Input
                          placeholder="请输入"
                          style={{
                            width: '136px',
                            height: '30px',
                            borderRadius: '20px',
                            border: '1px solid #BBBBBB',
                            marginRight: '10px',
                            textAlign: 'center',
                          }}
                        />
                      </Form.Item>
                      <Form.Item
                        style={{ marginLeft: '20px' }}
                        label="排序"
                        required={false}
                        rules={[
                          {
                            required: true,
                            message: '请填写排序',
                          },
                        ]}
                        name={[subField.name, 'sort']}
                      >
                        <Input placeholder="请输入" />
                      </Form.Item>
                    </div>
                  ))}
                </div>
              )}
            </Form.List>
          </Card>
        </Form.Item>
      </div>
@@ -2219,28 +2266,48 @@
                </Button>
              </div>
            </div>
            <div style={{ display: 'flex', height: '30px' }}>
              {form.getFieldValue('musicImgPair')[index].List.map((subField, subIndex) => {
                return (
                  <div
                    key={subIndex}
                    style={{
                      width: '136px',
                      height: '30px',
                      borderRadius: '20px',
                      border: '1px solid #BBBBBB',
                      marginRight: '10px',
                      textAlign: 'center',
                      overflow: 'hidden',
                      textOverflow: 'ellipsis',
                      whiteSpace: 'nowrap',
                    }}
                  >
                    {subField.name}{' '}
                  </div>
                );
              })}
            </div>
            <Form.List name={[field.name, 'List']}>
              {(subFields, subOpt) => (
                <div>
                  {subFields.map((subField, subIndex) => (
                    <div key={subIndex} style={{ display: 'flex' }}>
                      <Form.Item
                        style={{ marginRight: '20px' }}
                        label=" "
                        colon={false}
                        name={[subField.name, 'name']}
                      >
                        <Input
                          placeholder="请输入"
                          style={{
                            width: '136px',
                            height: '30px',
                            borderRadius: '20px',
                            border: '1px solid #BBBBBB',
                            marginRight: '10px',
                            textAlign: 'center',
                          }}
                        />
                      </Form.Item>
                      <Form.Item
                        style={{ marginLeft: '20px' }}
                        label="排序"
                        required={false}
                        rules={[
                          {
                            required: true,
                            message: '请填写排序',
                          },
                        ]}
                        name={[subField.name, 'sort']}
                      >
                        <Input placeholder="请输入" />
                      </Form.Item>
                    </div>
                  ))}
                </div>
              )}
            </Form.List>
          </Card>
        </Form.Item>
      </div>
@@ -3445,6 +3512,7 @@
              toolBarRender={false}
              actionRef={actionRef}
              columns={columns2}
              scroll={{y:500}}
              // search={false}
              pagination={{
                showSizeChanger: true,
src/requestErrorConfig.ts
@@ -26,8 +26,8 @@
 * @doc https://umijs.org/docs/max/request#配置
 */
export const errorConfig: RequestConfig = {
  // baseURL: 'http://192.168.110.111:9000',
  baseURL: 'https://dollearn.com/api',
  baseURL: 'http://192.168.110.111:9000',
  // baseURL: 'https://dollearn.com/api',
  // 请求拦截器
  requestInterceptors: [
    (config: RequestOptions) => {