diff --git a/mock/user.ts b/mock/user.ts
index 906aa3f..93883b1 100644
--- a/mock/user.ts
+++ b/mock/user.ts
@@ -41,25 +41,6 @@ export default {
access = 'admin';
return;
}
- // TODO 以下未做任何处理
- // if (pwd === 'ant.design' && username === 'user') {
- // res.send({
- // status: 'ok',
- // type,
- // currentAuthority: 'user',
- // });
- // access = 'user';
- // return;
- // }
- // if (type === 'mobile') {
- // res.send({
- // status: 'ok',
- // type,
- // currentAuthority: 'admin',
- // });
- // access = 'admin';
- // return;
- // }
const failData: failMockApiProps = {
...fetchMockFailFullByOther({
data: {},
@@ -74,8 +55,6 @@ export default {
access = '';
res.send({ data: {}, success: true });
},
- // TODO 以下未使用
-
// 获取用户信息
'GET /api/v1/userInfo': async (req: Request, res: Response) => {
const adminData: successMockApiProps = {
diff --git a/src/app.tsx b/src/app.tsx
index c229fcd..6ae9617 100644
--- a/src/app.tsx
+++ b/src/app.tsx
@@ -18,6 +18,8 @@ import './app.less';
import './base.less';
import './iconfont.less';
import { errorConfig } from './requestErrorConfig';
+import { apiUserInfo } from './services/business/user';
+import { isSuccessApi } from './utils/forApi';
const isDev = true;
const loginPath = '/user/login';
@@ -33,41 +35,54 @@ export async function getInitialState(): Promise<{
fetchUserInfo?: any;
menuData?: MenuDataItem[];
}> {
- // TODO userInfo 暂时定死,后续从接口获取
- const fetchUserInfo = () => {
- return {
- id: 1,
- createTime: '2023-10-08T16:02:30.775742+08:00',
- updateTime: '2024-01-24T14:56:32.620573+08:00',
- userName: 'admin',
- nickName: '管理员1',
- phone: '',
- email: '',
- avatarId: 1,
- roleId: 1,
- postId: null,
- deptId: null,
- access: 'admin',
- roleIds: '1',
- postIds: '',
- remark: '',
- enable: null,
- lastLoginTime: '2024-01-24T14:56:32.620513+08:00',
- roles: [
- {
- label: '管理员1',
- value: 1,
- },
- ],
- avatarUrl: 'uploads/image/user/avatar/39c63ddb96a31b9610cd976b896ad4f0_20231016113731.jpg',
- };
- // try {
- // const msg = await getUserGetUserInfo();
- // return msg.data.userInfo;
- // } catch (error) {
- // history.push(loginPath);
- // }
- // return undefined;
+ const fetchUserInfo = async () => {
+ // return {
+ // id: 1,
+ // createTime: '2023-10-08T16:02:30.775742+08:00',
+ // updateTime: '2024-01-24T14:56:32.620573+08:00',
+ // userName: 'admin123',
+ // nickName: '管理员1',
+ // phone: '',
+ // email: '',
+ // avatarId: 1,
+ // roleId: 1,
+ // postId: null,
+ // deptId: null,
+ // access: 'admin1',
+ // roleIds: '1',
+ // postIds: '',
+ // remark: '',
+ // enable: null,
+ // lastLoginTime: '2024-01-24T14:56:32.620513+08:00',
+ // roles: [
+ // {
+ // label: '管理员1',
+ // value: 1,
+ // },
+ // ],
+ // userName: 'resp.data?.name',
+ // avatarUrl: 'uploads/image/user/avatar/39c63ddb96a31b9610cd976b896ad4f0_20231016113731.jpg',
+ // };
+ try {
+ const resp = await apiUserInfo();
+ console.log(resp, 'apiUserInfo_resp');
+ if (isSuccessApi(resp)) {
+ const currUserInfo = {
+ ...resp?.data,
+ userName: resp.data?.name,
+ // update 接口没有返回avtar, 使用默认头像
+ avatarUrl:
+ resp.data?.avtar ||
+ 'https://img2.baidu.com/it/u=1374514083,943518806&fm=253&fmt=auto&app=138&f=PNG?w=500&h=500',
+ };
+ localStorage.setItem('userInfo', JSON.stringify(currUserInfo));
+ return currUserInfo;
+ }
+ return undefined;
+ } catch (error) {
+ history.push(loginPath);
+ return undefined;
+ }
};
// 如果不是登录页面,执行
const { location } = history;
@@ -185,19 +200,20 @@ export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) =
intl.formatMessage({ id: `menu.${currMenu?.name}`, defaultMessage: '首页' })}
- {initialState?.currentUser?.userName ? (
+
+
+
+ {/* {initialState?.currentUser?.userName ? (
-
) : (
<>>
- )}
+ )} */}
diff --git a/src/components/HeaderDropdown/index.tsx b/src/components/HeaderDropdown/index.tsx
index b01944c..a66db91 100644
--- a/src/components/HeaderDropdown/index.tsx
+++ b/src/components/HeaderDropdown/index.tsx
@@ -21,6 +21,7 @@ export type HeaderDropdownProps = {
const HeaderDropdown: React.FC
= ({ overlayClassName: cls, ...restProps }) => {
const { styles } = useStyles();
+ console.log('HeaderDropdown_restProps', restProps);
return ;
};
diff --git a/src/components/RightContent/AvatarDropdown.tsx b/src/components/RightContent/AvatarDropdown.tsx
index 2d9458a..5d25c78 100644
--- a/src/components/RightContent/AvatarDropdown.tsx
+++ b/src/components/RightContent/AvatarDropdown.tsx
@@ -1,11 +1,11 @@
import { apiLoginOut } from '@/services/business/user';
import { LogoutOutlined } from '@ant-design/icons';
import { history, useModel } from '@umijs/max';
-import { Spin } from 'antd';
-import { createStyles } from 'antd-style';
+// import { Spin } from 'antd';
+// import { createStyles } from 'antd-style';
import { stringify } from 'querystring';
import type { MenuInfo } from 'rc-menu/lib/interface';
-import React, { useCallback } from 'react';
+import React, { useCallback, useEffect } from 'react';
import { flushSync } from 'react-dom';
import HeaderDropdown from '../HeaderDropdown';
@@ -15,28 +15,36 @@ export type GlobalHeaderRightProps = {
};
export const AvatarName = () => {
- const { initialState } = useModel('@@initialState');
- const { currentUser } = initialState || {};
- return {currentUser?.userName};
+ // const { initialState } = useModel('@@initialState');
+ // const { currentUser } = initialState || {};
+ const userInfo = localStorage.getItem('userInfo');
+ console.log(userInfo, JSON.parse(userInfo), 'AvatarName_userInfo');
+ const currUserInfo = JSON.parse(userInfo);
+ return (
+
+

+
{currUserInfo?.userName}
+
+ );
};
-const useStyles = createStyles(({ token }) => {
- return {
- action: {
- display: 'flex',
- height: '48px',
- marginLeft: 'auto',
- overflow: 'hidden',
- alignItems: 'center',
- padding: '0 8px',
- cursor: 'pointer',
- borderRadius: token.borderRadius,
- '&:hover': {
- backgroundColor: token.colorBgTextHover,
- },
- },
- };
-});
+// const useStyles = createStyles(({ token }) => {
+// return {
+// action: {
+// display: 'flex',
+// height: '48px',
+// marginLeft: 'auto',
+// overflow: 'hidden',
+// alignItems: 'center',
+// padding: '0 8px',
+// cursor: 'pointer',
+// borderRadius: token.borderRadius,
+// '&:hover': {
+// backgroundColor: token.colorBgTextHover,
+// },
+// },
+// };
+// });
export const AvatarDropdown: React.FC = ({ children }) => {
/**
@@ -58,7 +66,7 @@ export const AvatarDropdown: React.FC = ({ children }) =
});
}
};
- const { styles } = useStyles();
+ // const { styles } = useStyles();
const { initialState, setInitialState } = useModel('@@initialState');
@@ -66,38 +74,45 @@ export const AvatarDropdown: React.FC = ({ children }) =
(event: MenuInfo) => {
const { key } = event;
if (key === 'logout') {
+ console.log(initialState, 'logout_initialState');
flushSync(() => {
+ localStorage.removeItem('access');
+ localStorage.removeItem('userInfo');
setInitialState((s) => ({ ...s, currentUser: undefined }));
});
loginOut();
return;
}
- history.push(`/account/${key}`);
+ // history.push(`/account/${key}`);
},
[setInitialState],
);
- const loading = (
-
-
-
- );
+ useEffect(() => {
+ console.log(initialState, 'useEffect_initialState');
+ }, [initialState]);
+
+ // const loading = (
+ //
+ //
+ //
+ // );
- if (!initialState) {
- return loading;
- }
+ // if (!initialState) {
+ // return loading;
+ // }
- const { currentUser } = initialState;
+ // const { currentUser } = initialState;
- if (!currentUser || !currentUser.userName) {
- return loading;
- }
+ // if (!currentUser || !currentUser.userName) {
+ // return loading;
+ // }
const menuItems = [
// ...(menu
diff --git a/src/components/TableActionCard/index.tsx b/src/components/TableActionCard/index.tsx
index d8ba546..63f7917 100644
--- a/src/components/TableActionCard/index.tsx
+++ b/src/components/TableActionCard/index.tsx
@@ -2,7 +2,7 @@
* @Author: zhoux zhouxia@supervision.ltd
* @Date: 2023-11-14 15:49:36
* @LastEditors: donghao donghao@supervision.ltd
- * @LastEditTime: 2024-05-17 11:04:28
+ * @LastEditTime: 2024-06-24 14:07:20
* @FilePath: \general-ai-platform-web\src\components\TableActionCard\index.tsx
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
@@ -11,7 +11,6 @@ import { Divider, Dropdown } from 'antd';
import React, { useEffect, useState } from 'react';
import { ReactComponent as MoreIcon } from '/public/home/more_icon.svg';
-//TODO 表单的操作按钮集合 key的报错未解决
export type actionsProps = {
key: string;
renderDom: any;
diff --git a/src/layouts/HomeLayout.tsx b/src/layouts/HomeLayout.tsx
index a9a9b75..2c6e835 100644
--- a/src/layouts/HomeLayout.tsx
+++ b/src/layouts/HomeLayout.tsx
@@ -161,10 +161,6 @@ const HomeLayout: React.FC = () => {
-
diff --git a/src/pages/Business/BusinessModel/components/createForm.tsx b/src/pages/Business/BusinessModel/components/createForm.tsx
index 8947d68..e3da8c4 100644
--- a/src/pages/Business/BusinessModel/components/createForm.tsx
+++ b/src/pages/Business/BusinessModel/components/createForm.tsx
@@ -255,7 +255,7 @@ const CreateForm: React.FC
= (props) => {
return true;
}}
>
- {/* //TODO 此项校验必填 与UI确定调整尺寸布局 */}
+ {/* //TODO 062501 此项校验必填 与UI确定调整尺寸布局 */}
= (props) => {
return { ...data, business_logic: '' };
});
}}
+ openPreviewFile={true}
/>
{/* 参数配置 */}
@@ -368,10 +369,8 @@ const CreateForm: React.FC = (props) => {
return { ...data, business_conf_file: '' };
});
}}
+ openPreviewFile={true}
/>
-
- {/* //TODO 补充json文件上传预览
- */}
{/* 关联节点 */}
{
),
},
- // TODO 编辑接口在新建交互完善后对接
+ // TODO 062502 编辑接口在新建交互完善后对接
{
key: 'destroy',
renderDom: (
diff --git a/src/pages/Business/BusinessState/deviceSate.tsx b/src/pages/Business/BusinessState/deviceSate.tsx
index e7a86ae..c2df943 100644
--- a/src/pages/Business/BusinessState/deviceSate.tsx
+++ b/src/pages/Business/BusinessState/deviceSate.tsx
@@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-05-10 10:47:45
* @LastEditors: donghao donghao@supervision.ltd
- * @LastEditTime: 2024-06-20 14:33:07
+ * @LastEditTime: 2024-06-25 10:06:05
* @FilePath: \general-ai-platform-web\src\pages\Business\BusinessState\deviceSate.tsx
* @Description: 设备状态列表
* @交互说明
@@ -11,7 +11,6 @@
*/
import { CommButton, TextButton } from '@/components/Button';
-import IsConfirmAction from '@/components/TableActionCard/isConfirmAction';
import { deviceStateEnums } from '@/enums/device';
import { useBusinessInfo } from '@/hooks/useBusinessInfo';
import {
@@ -141,31 +140,30 @@ const DeviceSate: React.FC = () => {
),
},
- {
- key: 'destroy',
- renderDom: (
-
-
- }
- buttonType="danger"
- >
- }
- confirmAction={() => {
- // TODO 调用重启接口
- }}
- />
-
- ),
- },
+ // 待开发
+ // {
+ // key: 'destroy',
+ // renderDom: (
+ //
+ //
+ // }
+ // buttonType="danger"
+ // >
+ // }
+ // confirmAction={() => {}}
+ // />
+ //
+ // ),
+ // },
]}
>
),
diff --git a/src/pages/Business/BusinessState/index.tsx b/src/pages/Business/BusinessState/index.tsx
index 37a2690..aef93a8 100644
--- a/src/pages/Business/BusinessState/index.tsx
+++ b/src/pages/Business/BusinessState/index.tsx
@@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-05-07 13:38:03
* @LastEditors: donghao donghao@supervision.ltd
- * @LastEditTime: 2024-06-20 15:29:43
+ * @LastEditTime: 2024-06-25 10:02:48
* @FilePath: \general-ai-platform-web\src\pages\Business\BusinessState\index.tsx
* @Description: 设备服务器状态 一级关键词 businessState(bs)
* @交互说明
@@ -226,7 +226,6 @@ const BusinessState: React.FC = () => {
});
}
}
- // TODO 切换时页码没有显示第一页
const changeTabMode = (key: string) => {
setTabKey(key);
setCurrentPage(1);
diff --git a/src/pages/ComputePowerCenter/index.tsx b/src/pages/ComputePowerCenter/index.tsx
index 5937ec4..0460e48 100644
--- a/src/pages/ComputePowerCenter/index.tsx
+++ b/src/pages/ComputePowerCenter/index.tsx
@@ -1,23 +1,25 @@
/* eslint-disable eqeqeq */
/* eslint-disable react/no-unknown-property */
-import { isSuccessApi } from '@/utils/forApi';
+// import { isSuccessApi } from '@/utils/forApi';
import { ProCard, ProList } from '@ant-design/pro-components';
import { Image } from 'antd';
import React, { useEffect, useState } from 'react';
// type
-import { postPowerGroup, postPowerPoolsList } from '@/services/testApi/computePower';
+// import { postPowerGroup, postPowerPoolsList } from '@/services/testApi/computePower';
import { isArrayAndNotEmpty } from '@/utils/is';
import ComputePowerCube from './components/computePowerCube';
import ComputePowerType from './components/computePowerType';
import './index.less';
+// eslint-disable-next-line @typescript-eslint/no-unused-vars
+import { ComputePowerPoolItem, testGroupList, testPoolsData } from './testData/computePowerData';
/**
* @算力资源池页面组件
* @returns
*/
const ComputePowerAllocation: React.FC = () => {
- const [poolsData, setPoolsData] = useState([]);
+ const [poolsData] = useState(testPoolsData);
const [groupList, setGroupList] = useState([]);
// const [showEdit, setShowEdit] = useState(false);
@@ -39,21 +41,21 @@ const ComputePowerAllocation: React.FC = () => {
console.log(finalList, 'toListDomByData_finalList');
}
- async function fetchPowerData() {
- const resp = await postPowerPoolsList();
- if (isSuccessApi(resp) && resp?.data) {
- console.log('fetchPowerData_res', resp);
- setPoolsData(resp.data);
- }
- }
+ // async function fetchPowerData() {
+ // const resp = await postPowerPoolsList();
+ // if (isSuccessApi(resp) && resp?.data) {
+ // console.log('fetchPowerData_res', resp);
+ // setPoolsData(resp.data);
+ // }
+ // }
- async function fetchGroupData() {
- const resp = await postPowerGroup();
- if (isSuccessApi(resp) && resp?.data) {
- console.log('fetchGroupData_res', resp);
- toListDomByData(resp.data.splice(0, 5));
- }
- }
+ // async function fetchGroupData() {
+ // const resp = await postPowerGroup();
+ // if (isSuccessApi(resp) && resp?.data) {
+ // console.log('fetchGroupData_res', resp);
+ // toListDomByData(resp.data.splice(0, 5));
+ // }
+ // }
// 算力配置
// function editComputePower() {
@@ -62,8 +64,9 @@ const ComputePowerAllocation: React.FC = () => {
// }
useEffect(() => {
- fetchGroupData();
- fetchPowerData();
+ // fetchGroupData();
+ // fetchPowerData();
+ toListDomByData(testGroupList);
}, []);
return (
diff --git a/src/pages/ComputePowerCenter/testData/computePowerData.ts b/src/pages/ComputePowerCenter/testData/computePowerData.ts
new file mode 100644
index 0000000..afbd49e
--- /dev/null
+++ b/src/pages/ComputePowerCenter/testData/computePowerData.ts
@@ -0,0 +1,122 @@
+export type ComputePowerPoolItem = {
+ name: string;
+ type: number; // 类别
+ color?: string; //
+ proportion: number;
+ pretreatmentEfficiency?: number;
+ bgColor?: string;
+};
+
+export const testGroupList: Record[] = [
+ {
+ label: 'NVIDIA GeForce 4090',
+ type: 1,
+ },
+ {
+ label: '瑞芯微 RK3566',
+ type: 0,
+ },
+ {
+ label: '瑞芯微 RK3566',
+ type: 0,
+ },
+ {
+ label: 'NVIDIA GeForce 4090',
+ type: 1,
+ },
+ {
+ label: 'NVIDIA GeForce 4090',
+ type: 1,
+ },
+];
+
+export const testPoolsData: ComputePowerPoolItem[] = [
+ {
+ name: '焊线颜色检测',
+ type: 9,
+ proportion: 7,
+ pretreatmentEfficiency: 20,
+ color: '#014BE6',
+ bgColor: 'linear-gradient(180deg, #015DE6 0%, #4881F6 100%)',
+ },
+ {
+ name: '螺纹缺陷检测',
+ type: 8,
+ proportion: 8,
+ pretreatmentEfficiency: 20,
+ color: '#FAA90B',
+ bgColor: 'linear-gradient(180deg, #E64601 0%, #F6A648 100%)',
+ },
+ {
+ name: 'PIN间距测量',
+ type: 7,
+ proportion: 4,
+ pretreatmentEfficiency: 15,
+ color: '#EA1281',
+ bgColor: 'linear-gradient(180deg, #E60161 0%, #F648E5 100%)',
+ },
+ {
+ name: '螺纹无牙缺陷检测',
+ type: 6,
+ proportion: 7,
+ pretreatmentEfficiency: 20,
+ color: '#FA8616',
+ bgColor: 'linear-gradient(180deg, #FA8316 0%, #FAAD16 100%)',
+ },
+ {
+ name: '压板缺陷检测',
+ type: 5,
+ proportion: 32,
+ pretreatmentEfficiency: 38,
+ color: '#F9DB18',
+ bgColor: 'linear-gradient(180deg, #FFC56F 0%, #F9E006 100%)',
+ },
+ {
+ name: '划伤缺陷检测',
+ type: 4,
+ proportion: 8,
+ pretreatmentEfficiency: 38,
+ color: '#1CCCFA',
+ bgColor: 'linear-gradient(180deg, #6FFFFF 0%, #06BEF9 100%)',
+ },
+ {
+ name: '披锋(毛刺)缺陷检测',
+ type: 3,
+ proportion: 12,
+ pretreatmentEfficiency: 38,
+ color: '#9E26EE',
+ bgColor: 'linear-gradient(180deg, #FF2494 0%, #8D27FF 100%)',
+ },
+ {
+ name: '工件尺寸测量',
+ type: 2,
+ proportion: 7,
+ pretreatmentEfficiency: 38,
+ color: '#6F50F6',
+ bgColor: 'linear-gradient(180deg, #6B55F6 0%, #8C38F8 100%)',
+ },
+ {
+ name: '打孔不良检测',
+ type: 1,
+ proportion: 5,
+ pretreatmentEfficiency: 38,
+ color: '#24ED75',
+ bgColor: 'linear-gradient(180deg, #43EA80 0%, #38F8D4 100%)',
+ },
+ {
+ name: '空闲算力',
+ type: 0,
+ proportion: 10,
+ pretreatmentEfficiency: 0,
+ color: '#DCDCDC',
+ bgColor: 'linear-gradient(90deg, #7B7979 0%, #C1C1C1 100%)',
+ },
+];
+
+// export const powerGroupListData = {
+// data: groupList,
+// };
+
+// export const powerPoolsListData = {
+// data: poolsData,
+// };
diff --git a/src/pages/Model/ModelDetail/components/createForm.tsx b/src/pages/Model/ModelDetail/components/createForm.tsx
index f1592d3..eb70a77 100644
--- a/src/pages/Model/ModelDetail/components/createForm.tsx
+++ b/src/pages/Model/ModelDetail/components/createForm.tsx
@@ -381,8 +381,6 @@ const CreateForm: React.FC = (props) => {
请上传格式为.json.yaml.yml的模型文件
*/}
-
- {/* // TODO label字重与上面统一, 操作按钮需要与输入框对齐 此处改为预览 */}
{/* ;
-export type UpdateFormProps = {
- updateModalOpen: boolean;
- handleModal: () => void;
- values: Partial;
- reload: any;
-};
-
-const UpdateForm: React.FC = (props) => {
- const intl = useIntl();
- // const [isAuto, setIsAuto] = useState(true);
- const [form] = Form.useForm();
- const [cityOptions, setCityOptions] = useState[]>([]);
- const { formatProvinceByData, formatCityByProvinceData } = useCity();
- function changeCity(record1, record2) {
- // 汇总城市数据到表单
- console.log(record1, record2, 'changeProvince_record');
- }
-
- return (
-
- className="gn_form gn_modal_form"
- width={proFormSmallModelWidth}
- title={intl.formatMessage({
- id: 'business.list.table.createForm.title',
- defaultMessage: '新建',
- })}
- open={props.updateModalOpen}
- form={form}
- autoFocusFirstInput
- modalProps={{
- destroyOnClose: true,
- onCancel: () => props.handleModal(),
- }}
- submitTimeout={2000}
- onFinish={async (values) => {
- console.log(values, 'add_finish_values');
- // TODO 对接更新接口
- // postModelCategoryCreateModelCategory(values)
- // .then(() => {
- // message.success(intl.formatMessage({ id: 'common.action.success', defaultMessage: '$$$' }));
- // props.reload();
- // })
- // .catch(() => {
- // message.error(intl.formatMessage({ id: 'common.action.failure', defaultMessage: '$$$' }));
- // });
- props.handleModal();
- return true;
- }}
- >
-
- }
- placeholder={`${intl.formatMessage({
- id: 'common.please_input',
- defaultMessage: '$$$',
- })}${intl.formatMessage({
- id: 'business.list.table.form.name',
- defaultMessage: '$$$',
- })}`}
- initialValue={props.values.name}
- required={true}
- rules={[
- {
- required: true,
- message: (
-
- ),
- },
- ]}
- />
-
- }
- placeholder={`${intl.formatMessage({
- id: 'common.please_select',
- defaultMessage: '$$$',
- })}${intl.formatMessage({
- id: 'business.list.table.form.province',
- defaultMessage: '$$$',
- })}`}
- initialValue={props.values.province}
- required={true}
- showSearch
- debounceTime={500}
- request={() => {
- const respDataList = formatProvinceByData();
- // 初始化有省份数据,默认加载当前省份的城市数据
- if (props.values.province) {
- respDataList.forEach((item) => {
- if (props.values.province === item.value) {
- setCityOptions(() => formatCityByProvinceData(item));
- }
- });
- }
- return respDataList;
- }}
- onChange={(_, record2) => {
- form.setFieldValue('city', null); // 先清空城市
- setCityOptions(() => formatCityByProvinceData(record2));
- }}
- rules={[
- {
- required: true,
- message: (
-
- ),
- },
- ]}
- />
- }
- placeholder={`${intl.formatMessage({
- id: 'common.please_select',
- defaultMessage: '$$$',
- })}${intl.formatMessage({
- id: 'business.list.table.form.city',
- defaultMessage: '$$$',
- })}`}
- initialValue={props.values.city}
- required={true}
- showSearch
- debounceTime={500}
- options={cityOptions}
- onChange={changeCity}
- rules={[
- {
- required: true,
- message: (
-
- ),
- },
- ]}
- />
- }
- placeholder={`${intl.formatMessage({
- id: 'common.please_input',
- defaultMessage: '$$$',
- })}${intl.formatMessage({
- id: 'business.list.table.form.address',
- defaultMessage: '$$$',
- })}`}
- initialValue={props.values.address}
- required={true}
- rules={[
- {
- required: true,
- message: (
-
- ),
- },
- ]}
- />
- }
- placeholder={`${intl.formatMessage({
- id: 'common.please_input',
- defaultMessage: '$$$',
- })}${intl.formatMessage({
- id: 'business.list.table.form.industry',
- defaultMessage: '$$$',
- })}`}
- initialValue={props.values.industry}
- required={true}
- rules={[
- {
- required: true,
- message: (
-
- ),
- },
- ]}
- />
-
- }
- placeholder={`${intl.formatMessage({
- id: 'common.please_input',
- defaultMessage: '$$$',
- })}${intl.formatMessage({
- id: 'business.list.table.form.contacts',
- defaultMessage: '$$$',
- })}`}
- initialValue={props.values.contacts}
- required={true}
- rules={[
- {
- required: true,
- message: (
-
- ),
- },
- ]}
- />
-
- }
- placeholder={`${intl.formatMessage({
- id: 'common.please_input',
- defaultMessage: '$$$',
- })}${intl.formatMessage({
- id: 'business.list.table.form.contactWay',
- defaultMessage: '$$$',
- })}`}
- initialValue={props.values.contactWay}
- required={true}
- rules={[
- {
- required: true,
- message: (
-
- ),
- },
- ]}
- />
- }
- placeholder={`${intl.formatMessage({
- id: 'common.please_input',
- defaultMessage: '$$$',
- })}${intl.formatMessage({
- id: 'business.list.table.form.remark',
- defaultMessage: '$$$',
- })}`}
- initialValue={props.values.remark}
- required={true}
- rules={[
- {
- required: true,
- message: (
-
- ),
- },
- ]}
- disabled={false}
- />
- {/* // TODO level3 按UI实际效果调整上传logo & 改用上传base64格式编码 换手动上传 */}
- }
- fieldProps={{
- name: 'file',
- listType: 'picture-card',
- beforeUpload: beforeUploadImage,
- data: { path: 'user/avatar' },
- headers: {
- 'X-CSRFToken': cookie.load('csrftoken'),
- 'X-Token': `${localStorage.getItem('access') || ''}`,
- },
- }}
- initialValue={props.values.logo}
- required={true}
- rules={[
- {
- required: true,
- message: (
-
- ),
- },
- ]}
- />
-
-
- );
-};
-
-export default UpdateForm;
diff --git a/src/pages/Project/BusinessInfo/index.tsx b/src/pages/Project/BusinessInfo/index.tsx
index 0a98577..546c962 100644
--- a/src/pages/Project/BusinessInfo/index.tsx
+++ b/src/pages/Project/BusinessInfo/index.tsx
@@ -20,10 +20,10 @@ import businessLogoIcon from '/public/home/business_logo.svg';
import React, { useEffect, useState } from 'react';
import { proTablePaginationOptions } from '../../../../config/defaultTable';
// import AlarmDetails from './components/AlarmDetails';
+import UpdateForm from '../BusinessProject/components/updateForm';
import AccountPsw from './components/accountPsw';
import AlgorithmCard from './components/algorithmCard';
import BaseInfo from './components/baseInfo';
-import UpdateForm from './components/updateForm';
import './index.less';
@@ -45,11 +45,7 @@ const BusinessInfo: React.FC = () => {
// 更新
const handleUpdateModal = () => {
- if (updateModalOpen) {
- setUpdateModalOpen(false);
- } else {
- setUpdateModalOpen(true);
- }
+ setUpdateModalOpen(!updateModalOpen);
};
// 处理初始值
@@ -207,11 +203,17 @@ const BusinessInfo: React.FC = () => {
dataSource={list}
/>
- */}
+
diff --git a/src/pages/Project/BusinessProject/index.tsx b/src/pages/Project/BusinessProject/index.tsx
index 9603993..7bb26dc 100644
--- a/src/pages/Project/BusinessProject/index.tsx
+++ b/src/pages/Project/BusinessProject/index.tsx
@@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-04-07 14:02:00
* @LastEditors: donghao donghao@supervision.ltd
- * @LastEditTime: 2024-05-24 18:00:02
+ * @LastEditTime: 2024-06-24 14:36:52
* @FilePath: \general-ai-manage\src\pages\BusinessProject\BusinessProject.tsx
* @Description: 企业项目首页
* @交互说明
@@ -355,7 +355,7 @@ const BusinessProject: React.FC = () => {
handleModal={handleCreateModal}
reload={reloadList}
/>
- {/* updateForm */}
+ {/* 与企业项目首页的编辑相同 */}
{
if (opts?.skipErrorHandler) throw error;
// 我们的 errorThrower 抛出的错误。
+ console.log(error, 'errorInfo');
+
if (error.name === 'BizError') {
const errorInfo: ResponseStructure | undefined = error.info;
if (errorInfo) {
@@ -106,7 +108,7 @@ export const errorConfig: RequestConfig = {
(response) => {
// 拦截响应数据,进行个性化处理
const { data } = response as unknown as ResponseStructure;
-
+ console.log(response, 'responseInterceptors');
if (data?.meta?.code >= 400) {
message.error('请求失败!');
}
diff --git a/src/services/business/user.ts b/src/services/business/user.ts
index d4ad216..1cf7e37 100644
--- a/src/services/business/user.ts
+++ b/src/services/business/user.ts
@@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-05-23 13:56:02
* @LastEditors: donghao donghao@supervision.ltd
- * @LastEditTime: 2024-05-23 16:28:52
+ * @LastEditTime: 2024-06-24 09:57:24
* @FilePath: \general-ai-platform-web\src\services\Business\user.ts
* @Description: api 登录登出
*/
@@ -31,9 +31,9 @@ export async function apiLoginOut(options?: { [key: string]: any }) {
}
/** 获取用户信息 GET /user/getUserInfo */
-export async function getUserGetUserInfo(options?: { [key: string]: any }) {
- return request(`/api/v1/userInfo`, {
- method: 'GET',
+export async function apiUserInfo(options?: { [key: string]: any }) {
+ return request(`/api/v1/user/info`, {
+ method: 'POST',
...(options || {}),
});
}
diff --git a/src/utils/forApi.ts b/src/utils/forApi.ts
index 530eda0..0d65b9f 100644
--- a/src/utils/forApi.ts
+++ b/src/utils/forApi.ts
@@ -2,10 +2,14 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-04-24 10:11:48
* @LastEditors: donghao donghao@supervision.ltd
- * @LastEditTime: 2024-06-05 10:47:32
+ * @LastEditTime: 2024-06-24 13:36:36
* @FilePath: \general-ai-platform-web\src\utils\forApi.ts
* @Description: 这是接口层和业务层的转换工具方法集
*/
+import { history } from '@umijs/max';
+// import { flushSync } from 'react-dom';
+
+const loginPath = '/user/login';
/**
* @判断接口数据是否成功返回
@@ -13,8 +17,19 @@
* @returns boolean
*/
export function isSuccessApi(result: API.API_COMMON_DATA): boolean {
+ // eslint-disable-next-line react-hooks/rules-of-hooks
+ // const { initialState, setInitialState } = useModel('@@initialState');
+
if (result && result?.meta) {
const { meta } = result;
+ if ([401, 403, 405].includes(meta.code)) {
+ // 登录失效,统一处理
+ localStorage.removeItem('access');
+ localStorage.removeItem('userInfo');
+ history.push(loginPath);
+ return false;
+ }
+
if (meta.code < 300 && meta.code >= 200) {
return true;
}