diff --git a/src/common/libs/valtio/actions.ts b/src/common/libs/valtio/actions.ts index 49c396b..d0db805 100644 --- a/src/common/libs/valtio/actions.ts +++ b/src/common/libs/valtio/actions.ts @@ -35,7 +35,7 @@ export const stateActions = { state.storage.access_token = undefined; }, me: async () => { - const res = await Apis.Auth.Me(); + const res = await Apis.Common.Auth.Me(); if (res.success) { stateActions.setLogin(res); return { diff --git a/src/common/pages/MyLoginPage1.tsx b/src/common/pages/MyLoginPage1.tsx index 5a786ae..8365b17 100644 --- a/src/common/pages/MyLoginPage1.tsx +++ b/src/common/pages/MyLoginPage1.tsx @@ -18,7 +18,7 @@ export function MyLoginPage1() { const [getCaptcha, setCaptcha] = useState({}); const methods = { getCaptcha: () => { - Apis.Auth.Captcha().then(async (res) => { + Apis.Common.Auth.Captcha().then(async (res) => { setCaptcha(res?.data); console.log(res, 'res'); }); @@ -35,12 +35,12 @@ export function MyLoginPage1() { height: '100vh', }} > - + title="欢迎使用后台管理系统" backgroundVideoUrl="https://gw.alipayobjects.com/v/huamei_gcee1x/afts/video/jXRBRK_VAwoAAAAAAAAAAAAAK4eUAQBr" subTitle="Admin management system" onFinish={async (values: any) => { - Apis.Auth.Login({ + Apis.Common.Auth.Login({ ...values, ...{ captcha_key: getCaptcha?.key }, }) diff --git a/src/components/Selects.tsx b/src/components/Selects.tsx deleted file mode 100644 index 8296cba..0000000 --- a/src/components/Selects.tsx +++ /dev/null @@ -1,205 +0,0 @@ -import { rulesHelper } from '@/common'; -import { Apis } from '@/gen/Apis'; -import { ProColumns, ProFormColumnsType } from '@ant-design/pro-components'; - -type ReturnType = ProColumns & ProFormColumnsType; -type PropsType = { required?: boolean } & ReturnType; - -export const Selects = { - Agents(props?: PropsType): ReturnType { - const { - title = '代理', - key = 'agents_id', - dataIndex = ['agent', 'name'], - required = false, - hideInTable = false, - ...rest - } = props ?? {}; - - return { - title: title, - key: key, - dataIndex: dataIndex, - valueType: 'select', - hideInTable: hideInTable, - formItemProps: { ...(required ? rulesHelper.number : {}) }, - fieldProps: { - showSearch: false, - fieldNames: { - label: 'name', - value: 'id', - }, - }, - request: async () => (await Apis.Select.Agents()).data, - ...rest, - }; - }, - LoanCompany(props?: PropsType): ReturnType { - const { - title = '资金方', - key = 'loan_companies_id', - dataIndex = ['loan_company', 'name'], - required = false, - hideInTable = false, - ...rest - } = props ?? {}; - - return { - title: title, - key: key, - dataIndex: dataIndex, - valueType: 'select', - hideInTable: hideInTable, - formItemProps: { ...(required ? rulesHelper.number : {}) }, - fieldProps: { - showSearch: false, - fieldNames: { - label: 'name', - value: 'id', - }, - }, - request: async () => (await Apis.Select.LoanCompanies()).data, - ...rest, - }; - }, - Markets(props?: PropsType): ReturnType { - const { - title = '选择上游', - key = 'markets_id', - dataIndex = ['market', 'name'], - required = false, - hideInTable = false, - ...rest - } = props ?? {}; - - return { - title: title, - key: key, - dataIndex: dataIndex, - valueType: 'select', - hideInTable: hideInTable, - formItemProps: { ...(required ? rulesHelper.number : {}) }, - fieldProps: { - showSearch: false, - fieldNames: { - label: 'name', - value: 'id', - }, - }, - request: async () => (await Apis.Select.Markets()).data, - ...rest, - }; - }, - Bosses(props?: PropsType): ReturnType { - const { - title = '老板', - key = 'bosses_id', - dataIndex = ['boss', 'name'], - required = false, - hideInTable = false, - ...rest - } = props ?? {}; - - return { - title: title, - key: key, - dataIndex: dataIndex, - valueType: 'select', - hideInTable: hideInTable, - formItemProps: { ...(required ? rulesHelper.number : {}) }, - fieldProps: { - showSearch: false, - fieldNames: { - label: 'name', - value: 'id', - }, - }, - request: async () => (await Apis.Select.Bosses()).data, - ...rest, - }; - }, - Factories(props?: PropsType): ReturnType { - const { - title = '下游厂家', - key = 'factories_id', - dataIndex = ['factory', 'name'], - required = false, - hideInTable = false, - ...rest - } = props ?? {}; - - return { - title: title, - key: key, - dataIndex: dataIndex, - valueType: 'select', - hideInTable: hideInTable, - formItemProps: { ...(required ? rulesHelper.number : {}) }, - fieldProps: { - showSearch: false, - fieldNames: { - label: 'name', - value: 'id', - }, - }, - request: async () => (await Apis.Select.Factories()).data, - ...rest, - }; - }, - Platforms(props?: PropsType): ReturnType { - const { - title = '平台', - key = 'platforms_id', - dataIndex = ['platform', 'name'], - required = false, - hideInTable = false, - ...rest - } = props ?? {}; - - return { - title: title, - key: key, - dataIndex: dataIndex, - valueType: 'select', - hideInTable: hideInTable, - formItemProps: { ...(required ? rulesHelper.number : {}) }, - fieldProps: { - showSearch: false, - fieldNames: { - label: 'name', - value: 'id', - }, - }, - request: async () => (await Apis.Select.Platforms()).data, - ...rest, - }; - }, - Merchants(props?: PropsType): ReturnType { - const { - title = '商户', - key = 'merchants_id', - dataIndex = ['merchant', 'name'], - required = false, - hideInTable = false, - ...rest - } = props ?? {}; - - return { - title: title, - key: key, - dataIndex: dataIndex, - valueType: 'select', - hideInTable: hideInTable, - formItemProps: { ...(required ? rulesHelper.number : {}) }, - fieldProps: { - showSearch: false, - fieldNames: { - label: 'name', - value: 'id', - }, - }, - request: async () => (await Apis.Select.Merchants()).data, - ...rest, - }; - }, -}; diff --git a/src/components/SysSelects.tsx b/src/components/SysSelects.tsx index bbc0cff..00b402c 100644 --- a/src/components/SysSelects.tsx +++ b/src/components/SysSelects.tsx @@ -28,7 +28,7 @@ export const SysSelects = { }, }, request: async () => - (await Apis.SysPermissions.SelectApi()).data?.children, + (await Apis.Permission.SysPermissions.SelectApi()).data?.children, ...rest, }; }, @@ -40,9 +40,9 @@ export const SysSelects = { title: '上级菜单', valueType: 'treeSelect', request: async () => { - return Apis.SysPermissions.Tree({ guard_name: guard_name }).then( - (res) => res.data, - ); + return Apis.Permission.SysPermissions.Tree({ + guard_name: guard_name, + }).then((res) => res.data); }, fieldProps: { allowClear: true, @@ -83,7 +83,7 @@ export const SysSelects = { value: 'id', }, }, - request: async () => (await Apis.SysRoles.Select()).data, + request: async () => (await Apis.Permission.SysRoles.Select()).data, ...rest, }; }, diff --git a/src/pages/system/admins/index.tsx b/src/pages/system/admins/index.tsx index db6108e..e344ac1 100644 --- a/src/pages/system/admins/index.tsx +++ b/src/pages/system/admins/index.tsx @@ -35,16 +35,6 @@ export default function Index({ title = '管理员' }) { renderText: renderTextHelper.TagList, hideInSearch: true, }, - { - title: 'last_login_ip', - dataIndex: 'last_login_ip', - search: false, - }, - { - title: 'last_login_at', - dataIndex: 'last_login_at', - search: false, - }, MyColumns.UpdatedAt(), MyColumns.CreatedAt(), MyColumns.Option({