@@ -0,0 +1,3 @@ | |||
module.exports = { | |||
extends: require.resolve('@umijs/max/eslint'), | |||
}; |
@@ -0,0 +1,24 @@ | |||
# Logs | |||
logs | |||
*.log | |||
npm-debug.log* | |||
yarn-debug.log* | |||
yarn-error.log* | |||
pnpm-debug.log* | |||
lerna-debug.log* | |||
node_modules | |||
dist-ssr | |||
*.local | |||
# Editor directories and files | |||
.vscode/* | |||
!.vscode/extensions.json | |||
.idea | |||
.DS_Store | |||
*.suo | |||
*.ntvs* | |||
*.njsproj | |||
*.sln | |||
*.sw? |
@@ -0,0 +1 @@ | |||
npx --no-install max verify-commit $1 |
@@ -0,0 +1 @@ | |||
npx --no-install lint-staged --quiet |
@@ -0,0 +1,17 @@ | |||
{ | |||
"*.{md,json}": [ | |||
"prettier --cache --write" | |||
], | |||
"*.{js,jsx}": [ | |||
"max lint --fix --eslint-only", | |||
"prettier --cache --write" | |||
], | |||
"*.{css,less}": [ | |||
"max lint --fix --stylelint-only", | |||
"prettier --cache --write" | |||
], | |||
"*.ts?(x)": [ | |||
"max lint --fix --eslint-only", | |||
"prettier --cache --parser=typescript --write" | |||
] | |||
} |
@@ -0,0 +1,2 @@ | |||
registry=https://registry.npmjs.com/ | |||
@@ -0,0 +1,3 @@ | |||
node_modules | |||
.umi | |||
.umi-production |
@@ -0,0 +1,8 @@ | |||
{ | |||
"printWidth": 80, | |||
"singleQuote": true, | |||
"trailingComma": "all", | |||
"proseWrap": "never", | |||
"overrides": [{ "files": ".prettierrc", "options": { "parser": "json" } }], | |||
"plugins": ["prettier-plugin-organize-imports", "prettier-plugin-packagejson"] | |||
} |
@@ -0,0 +1,3 @@ | |||
module.exports = { | |||
extends: require.resolve('@umijs/max/stylelint'), | |||
}; |
@@ -0,0 +1,155 @@ | |||
import { defineConfig } from '@umijs/max'; | |||
import type { RequestConfig } from 'umi'; | |||
export default defineConfig({ | |||
antd: {}, | |||
access: {}, | |||
model: {}, | |||
initialState: {}, | |||
request: {}, | |||
layout: { | |||
name: '菊城人才市场', | |||
logo: 'https://preview.pro.ant.design/static/logo.f0355d39.svg', | |||
// copy from pro site | |||
navTheme: 'dark', | |||
primaryColor: '#1890ff', | |||
layout: 'mix', | |||
contentWidth: 'Fluid', | |||
fixedHeader: true, | |||
fixSiderbar: false, | |||
splitMenus: true, | |||
siderWidth: 240, | |||
title: '菊城人才市场', | |||
pwa: false, | |||
iconfontUrl: '', | |||
avatarProps: { | |||
src: 'https://gw.alipayobjects.com/zos/antfincdn/efFD%24IOql2/weixintupian_20170331104822.jpg', | |||
size: 'small', | |||
title: '七妮妮' | |||
}, | |||
}, | |||
routes: [ | |||
{ | |||
path: '/', | |||
redirect: '/main/company/list', | |||
}, | |||
{ | |||
path: '/login', | |||
component: './Login', | |||
layout: false | |||
}, | |||
// 总控路由 | |||
{ | |||
name: '基础管理', | |||
path: '/main', | |||
routes: [ | |||
{ | |||
name: '企业管理', | |||
routes: [ | |||
{ | |||
name: '企业列表', | |||
path: '/main/company/list', | |||
component: './Main/Company/List', | |||
}, | |||
{ | |||
name: 'VIP列表', | |||
path: '/main/company/vip', | |||
component: './Main/Company/Vip', | |||
}, | |||
{ | |||
name: '部门管理', | |||
path: '/main/company/department', | |||
component: './Main/Company/Department', | |||
}, | |||
{ | |||
name: '职位管理', | |||
path: '/main/company/post', | |||
component: './Main/Company/Post', | |||
} | |||
] | |||
}, | |||
{ | |||
name: '求职者管理', | |||
routes: [ | |||
{ | |||
name: '简历列表', | |||
path: '/main/jobseeker/list', | |||
component: './Main/Jobseeker/List', | |||
}, | |||
{ | |||
name: '求职者账号列表', | |||
path: '/main/jobseeker/account', | |||
component: './Main/Jobseeker/Account', | |||
} | |||
] | |||
} | |||
] | |||
}, | |||
// 出租屋路由 | |||
{ | |||
name: '系统管理', | |||
path: '/rent', | |||
routes: [ | |||
{ | |||
name: '房屋管理', | |||
path: '/rent/house', | |||
component: './Rent/House', | |||
}, | |||
{ | |||
name: '租客管理', | |||
path: '/rent/renter', | |||
component: './Rent/Renter', | |||
}, | |||
] | |||
}, | |||
// 学校路由 | |||
{ | |||
name: '账号权限', | |||
path: '/school', | |||
routes: [ | |||
{ | |||
name: '学校管理', | |||
path: '/school/address', | |||
component: './Main/Address', | |||
}, | |||
{ | |||
name: '学生管理', | |||
path: '/school/area', | |||
component: './Main/Area', | |||
}, | |||
] | |||
}, | |||
], | |||
npmClient: 'npm', | |||
}); | |||
export const request: RequestConfig = { | |||
// 统一的请求设定 | |||
baseURL: '', | |||
timeout: 1000, | |||
headers: { | |||
'Content-Type': 'application/json' | |||
}, | |||
// 请求拦截器 | |||
requestInterceptors: [ | |||
(config) => { | |||
sessionStorage.getItem('token') ? config.headers.Authorization = sessionStorage.getItem('token') : ''; | |||
// 在发送请求之前做些什么 | |||
return config; | |||
} | |||
], | |||
// 响应拦截器 | |||
responseInterceptors: [ | |||
(response) => { | |||
// 拦截响应数据,进行个性化处理 | |||
const { data } = response; | |||
if (!data.success) { | |||
} | |||
return response; | |||
} | |||
] | |||
}; |
@@ -0,0 +1,20 @@ | |||
const users = [ | |||
{ id: 0, name: 'Umi', nickName: 'U', gender: 'MALE' }, | |||
{ id: 1, name: 'Fish', nickName: 'B', gender: 'FEMALE' }, | |||
]; | |||
export default { | |||
'GET /api/v1/queryUserList': (req: any, res: any) => { | |||
res.json({ | |||
success: true, | |||
data: { list: users }, | |||
errorCode: 0, | |||
}); | |||
}, | |||
'PUT /api/v1/user/': (req: any, res: any) => { | |||
res.json({ | |||
success: true, | |||
errorCode: 0, | |||
}); | |||
}, | |||
}; |
@@ -0,0 +1,29 @@ | |||
{ | |||
"private": true, | |||
"author": "Soleilw <a617759082@126.com>", | |||
"scripts": { | |||
"build": "max build", | |||
"dev": "max dev", | |||
"format": "prettier --cache --write .", | |||
"postinstall": "max setup", | |||
"prepare": "husky", | |||
"setup": "max setup", | |||
"start": "npm run dev" | |||
}, | |||
"dependencies": { | |||
"@ant-design/icons": "^5.0.1", | |||
"@ant-design/pro-components": "^2.4.4", | |||
"@umijs/max": "^4.2.8", | |||
"antd": "^5.4.0" | |||
}, | |||
"devDependencies": { | |||
"@types/react": "^18.0.33", | |||
"@types/react-dom": "^18.0.11", | |||
"husky": "^9", | |||
"lint-staged": "^13.2.0", | |||
"prettier": "^2.8.7", | |||
"prettier-plugin-organize-imports": "^3.2.2", | |||
"prettier-plugin-packagejson": "^2.4.3", | |||
"typescript": "^5.0.3" | |||
} | |||
} |
@@ -0,0 +1,9 @@ | |||
// @ts-nocheck | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
import React from 'react'; | |||
import { Outlet, useOutletContext } from 'umi'; | |||
export default function EmptyRoute() { | |||
const context = useOutletContext(); | |||
return <Outlet context={context} />; | |||
} |
@@ -0,0 +1,20 @@ | |||
// @ts-nocheck | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
import type { IRuntimeConfig as Plugin0 } from 'E:/project/myproject/rencaishichanghoutai/src/.umi/plugin-antd/runtimeConfig.d' | |||
import type { IRuntimeConfig as Plugin1 } from 'E:/project/myproject/rencaishichanghoutai/src/.umi/plugin-initialState/runtimeConfig.d' | |||
import type { IRuntimeConfig as Plugin2 } from 'E:/project/myproject/rencaishichanghoutai/src/.umi/plugin-layout/runtimeConfig.d' | |||
import type { IRuntimeConfig as Plugin3 } from 'E:/project/myproject/rencaishichanghoutai/src/.umi/plugin-request/runtimeConfig.d' | |||
interface IDefaultRuntimeConfig { | |||
onRouteChange?: (props: { routes: any, clientRoutes: any, location: any, action: any, isFirst: boolean }) => void; | |||
patchRoutes?: (props: { routes: any }) => void; | |||
patchClientRoutes?: (props: { routes: any }) => void; | |||
render?: (oldRender: () => void) => void; | |||
rootContainer?: (lastRootContainer: JSX.Element, args?: any) => void; | |||
[key: string]: any; | |||
} | |||
export type RuntimeConfig = IDefaultRuntimeConfig & Plugin0 & Plugin1 & Plugin2 & Plugin3 | |||
export function defineApp(config: RuntimeConfig): RuntimeConfig { | |||
return config; | |||
} |
@@ -0,0 +1,10 @@ | |||
// @ts-nocheck | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
import React from 'react'; | |||
import { HelmetProvider } from 'E:/project/myproject/rencaishichanghoutai/node_modules/@umijs/renderer-react'; | |||
import { context } from './helmetContext'; | |||
export const innerProvider = (container) => { | |||
return React.createElement(HelmetProvider, { context }, container); | |||
} |
@@ -0,0 +1,4 @@ | |||
// @ts-nocheck | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
export const context = {}; |
@@ -0,0 +1,72 @@ | |||
// @ts-nocheck | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
import { createHashHistory, createMemoryHistory, createBrowserHistory } from 'E:/project/myproject/rencaishichanghoutai/node_modules/@umijs/renderer-react'; | |||
import type { UmiHistory } from './historyIntelli'; | |||
let history: UmiHistory; | |||
let basename: string = '/'; | |||
export function createHistory(opts: any) { | |||
let h; | |||
if (opts.type === 'hash') { | |||
h = createHashHistory(); | |||
} else if (opts.type === 'memory') { | |||
h = createMemoryHistory(opts); | |||
} else { | |||
h = createBrowserHistory(); | |||
} | |||
if (opts.basename) { | |||
basename = opts.basename; | |||
} | |||
history = { | |||
...h, | |||
push(to, state) { | |||
h.push(patchTo(to, h), state); | |||
}, | |||
replace(to, state) { | |||
h.replace(patchTo(to, h), state); | |||
}, | |||
get location() { | |||
return h.location; | |||
}, | |||
get action() { | |||
return h.action; | |||
} | |||
} | |||
return h; | |||
} | |||
export function setHistory(h: UmiHistory) { | |||
if (h) { | |||
history = h; | |||
} | |||
} | |||
// Patch `to` to support basename | |||
// Refs: | |||
// https://github.com/remix-run/history/blob/3e9dab4/packages/history/index.ts#L484 | |||
// https://github.com/remix-run/history/blob/dev/docs/api-reference.md#to | |||
function patchTo(to: any, h: History) { | |||
if (typeof to === 'string') { | |||
return `${stripLastSlash(basename)}${to}`; | |||
} else if (typeof to === 'object') { | |||
const currentPathname = h.location.pathname; | |||
return { | |||
...to, | |||
pathname: to.pathname? `${stripLastSlash(basename)}${to.pathname}` : currentPathname, | |||
}; | |||
} else { | |||
throw new Error(`Unexpected to: ${to}`); | |||
} | |||
} | |||
function stripLastSlash(path) { | |||
return path.slice(-1) === '/' ? path.slice(0, -1) : path; | |||
} | |||
export { history }; |
@@ -0,0 +1,132 @@ | |||
// @ts-nocheck | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
import { getRoutes } from './route' | |||
import type { History } from 'E:/project/myproject/rencaishichanghoutai/node_modules/@umijs/renderer-react' | |||
type Routes = Awaited<ReturnType<typeof getRoutes>>['routes'] | |||
type AllRoute = Routes[keyof Routes] | |||
type IsRoot<T extends any> = 'parentId' extends keyof T ? false : true | |||
// show `/` in not `layout / wrapper` only | |||
type GetAllRouteWithoutLayout<Item extends AllRoute> = Item extends any | |||
? 'isWrapper' extends keyof Item | |||
? never | |||
: 'isLayout' extends keyof Item | |||
? never | |||
: Item | |||
: never | |||
type AllRouteWithoutLayout = GetAllRouteWithoutLayout<AllRoute> | |||
type IndexRoutePathname = '/' extends AllRouteWithoutLayout['path'] | |||
? '/' | |||
: never | |||
type GetChildrens<T extends any> = T extends any | |||
? IsRoot<T> extends true | |||
? never | |||
: T | |||
: never | |||
type Childrens = GetChildrens<AllRoute> | |||
type Root = Exclude<AllRoute, Childrens> | |||
type AllIds = AllRoute['id'] | |||
type GetChildrensByParentId< | |||
Id extends AllIds, | |||
Item = AllRoute | |||
> = Item extends any | |||
? 'parentId' extends keyof Item | |||
? Item['parentId'] extends Id | |||
? Item | |||
: never | |||
: never | |||
: never | |||
type RouteObject< | |||
Id extends AllIds, | |||
Item = GetChildrensByParentId<Id> | |||
> = IsNever<Item> extends true | |||
? '' | |||
: Item extends AllRoute | |||
? { | |||
[Key in Item['path'] as TrimSlash<Key>]: UnionMerge< | |||
RouteObject<Item['id']> | |||
> | |||
} | |||
: never | |||
type GetRootRouteObject<Item extends Root> = Item extends Root | |||
? { | |||
[K in Item['path'] as TrimSlash<K>]: UnionMerge<RouteObject<Item['id']>> | |||
} | |||
: never | |||
type MergedResult = UnionMerge<GetRootRouteObject<Root>> | |||
// --- patch history types --- | |||
type HistoryTo = Parameters<History['push']>['0'] | |||
type HistoryPath = Exclude<HistoryTo, string> | |||
type UmiPathname = Path<MergedResult> | (string & {}) | |||
interface UmiPath extends HistoryPath { | |||
pathname: UmiPathname | |||
} | |||
type UmiTo = UmiPathname | UmiPath | |||
type UmiPush = (to: UmiTo, state?: any) => void | |||
type UmiReplace = (to: UmiTo, state?: any) => void | |||
export interface UmiHistory extends History { | |||
push: UmiPush | |||
replace: UmiReplace | |||
} | |||
// --- type utils --- | |||
type TrimLeftSlash<T extends string> = T extends `/${infer R}` | |||
? TrimLeftSlash<R> | |||
: T | |||
type TrimRightSlash<T extends string> = T extends `${infer R}/` | |||
? TrimRightSlash<R> | |||
: T | |||
type TrimSlash<T extends string> = TrimLeftSlash<TrimRightSlash<T>> | |||
type IsNever<T> = [T] extends [never] ? true : false | |||
type IsEqual<A, B> = (<G>() => G extends A ? 1 : 2) extends <G>() => G extends B | |||
? 1 | |||
: 2 | |||
? true | |||
: false | |||
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ( | |||
k: infer I | |||
) => void | |||
? I | |||
: never | |||
type UnionMerge<U> = UnionToIntersection<U> extends infer O | |||
? { [K in keyof O]: O[K] } | |||
: never | |||
type ExcludeEmptyKey<T> = IsEqual<T, ''> extends true ? never : T | |||
type PathConcat< | |||
TKey extends string, | |||
TValue, | |||
N = TrimSlash<TKey> | |||
> = TValue extends string | |||
? ExcludeEmptyKey<N> | |||
: | |||
| ExcludeEmptyKey<N> | |||
| `${N & string}${IsNever<ExcludeEmptyKey<N>> extends true | |||
? '' | |||
: '/'}${UnionPath<TValue>}` | |||
type UnionPath<T> = { | |||
[K in keyof T]-?: PathConcat<K & string, T[K]> | |||
}[keyof T] | |||
type MakeSureLeftSlash<T> = T extends any | |||
? `/${TrimRightSlash<T & string>}` | |||
: never | |||
// exclude `/*`, because it always at the top of the IDE tip list | |||
type Path<T, K = UnionPath<T>> = Exclude<MakeSureLeftSlash<K>, '/*'> | IndexRoutePathname |
@@ -0,0 +1,65 @@ | |||
// @ts-nocheck | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
import * as Plugin_0 from 'E:/project/myproject/rencaishichanghoutai/src/app.ts'; | |||
import * as Plugin_1 from '@@/core/helmet.ts'; | |||
import * as Plugin_2 from 'E:/project/myproject/rencaishichanghoutai/src/.umi/plugin-access/runtime.tsx'; | |||
import * as Plugin_3 from 'E:/project/myproject/rencaishichanghoutai/src/.umi/plugin-initialState/runtime.tsx'; | |||
import * as Plugin_4 from 'E:/project/myproject/rencaishichanghoutai/src/.umi/plugin-layout/runtime.tsx'; | |||
import * as Plugin_5 from 'E:/project/myproject/rencaishichanghoutai/src/.umi/plugin-model/runtime.tsx'; | |||
import { PluginManager } from 'umi'; | |||
function __defaultExport (obj) { | |||
if (obj.default) { | |||
return typeof obj.default === 'function' ? obj.default() : obj.default | |||
} | |||
return obj; | |||
} | |||
export function getPlugins() { | |||
return [ | |||
{ | |||
apply: __defaultExport(Plugin_0), | |||
path: process.env.NODE_ENV === 'production' ? void 0 : 'E:/project/myproject/rencaishichanghoutai/src/app.ts', | |||
}, | |||
{ | |||
apply: Plugin_1, | |||
path: process.env.NODE_ENV === 'production' ? void 0 : '@@/core/helmet.ts', | |||
}, | |||
{ | |||
apply: Plugin_2, | |||
path: process.env.NODE_ENV === 'production' ? void 0 : 'E:/project/myproject/rencaishichanghoutai/src/.umi/plugin-access/runtime.tsx', | |||
}, | |||
{ | |||
apply: Plugin_3, | |||
path: process.env.NODE_ENV === 'production' ? void 0 : 'E:/project/myproject/rencaishichanghoutai/src/.umi/plugin-initialState/runtime.tsx', | |||
}, | |||
{ | |||
apply: Plugin_4, | |||
path: process.env.NODE_ENV === 'production' ? void 0 : 'E:/project/myproject/rencaishichanghoutai/src/.umi/plugin-layout/runtime.tsx', | |||
}, | |||
{ | |||
apply: Plugin_5, | |||
path: process.env.NODE_ENV === 'production' ? void 0 : 'E:/project/myproject/rencaishichanghoutai/src/.umi/plugin-model/runtime.tsx', | |||
}, | |||
]; | |||
} | |||
export function getValidKeys() { | |||
return ['patchRoutes','patchClientRoutes','modifyContextOpts','modifyClientRenderOpts','rootContainer','innerProvider','i18nProvider','accessProvider','dataflowProvider','outerProvider','render','onRouteChange','antd','getInitialState','layout','qiankun','request',]; | |||
} | |||
let pluginManager = null; | |||
export function createPluginManager() { | |||
pluginManager = PluginManager.create({ | |||
plugins: getPlugins(), | |||
validKeys: getValidKeys(), | |||
}); | |||
return pluginManager; | |||
} | |||
export function getPluginManager() { | |||
return pluginManager; | |||
} |
@@ -0,0 +1,376 @@ | |||
// @ts-nocheck | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
import { IConfigFromPluginsJoi } from "./pluginConfigJoi.d"; | |||
interface IConfigTypes { | |||
codeSplitting: { | |||
jsStrategy: "bigVendors" | "depPerChunk" | "granularChunks"; | |||
jsStrategyOptions?: ({ | |||
} | undefined); | |||
cssStrategy?: ("mergeAll" | undefined); | |||
cssStrategyOptions?: ({ | |||
} | undefined); | |||
}; | |||
title: string; | |||
styles: Array<string | { | |||
src?: (string | undefined); | |||
} | { | |||
content?: (string | undefined); | |||
} | { [x: string]: any }>; | |||
scripts: Array<string | { | |||
src?: (string | undefined); | |||
} | { | |||
content?: (string | undefined); | |||
} | { [x: string]: any }>; | |||
routes: Array<{ | |||
component?: (string | undefined); | |||
layout?: (false | undefined); | |||
path?: (string | undefined); | |||
redirect?: (string | undefined); | |||
routes?: IConfigTypes['routes']; | |||
wrappers?: (Array<string> | undefined); | |||
} | { [x: string]: any }>; | |||
routeLoader: { | |||
moduleType: "esm" | "cjs"; | |||
}; | |||
reactRouter5Compat: boolean | { | |||
}; | |||
presets: Array<string>; | |||
plugins: Array<string>; | |||
npmClient: "pnpm" | "tnpm" | "cnpm" | "yarn" | "npm"; | |||
mountElementId: string; | |||
metas: Array<{ | |||
charset?: (string | undefined); | |||
content?: (string | undefined); | |||
"http-equiv"?: (string | undefined); | |||
name?: (string | undefined); | |||
} | { [x: string]: any }>; | |||
links: Array<{ | |||
crossorigin?: (string | undefined); | |||
href?: (string | undefined); | |||
hreflang?: (string | undefined); | |||
media?: (string | undefined); | |||
referrerpolicy?: (string | undefined); | |||
rel?: (string | undefined); | |||
sizes?: (any | undefined); | |||
title?: (any | undefined); | |||
type?: (any | undefined); | |||
} | { [x: string]: any }>; | |||
historyWithQuery: { | |||
}; | |||
history: { | |||
type: "browser" | "hash" | "memory"; | |||
}; | |||
headScripts: Array<string | { | |||
src?: (string | undefined); | |||
} | { | |||
content?: (string | undefined); | |||
} | { [x: string]: any }>; | |||
esbuildMinifyIIFE: boolean; | |||
conventionRoutes: { | |||
base?: (string | undefined); | |||
exclude?: (Array<any> | undefined); | |||
}; | |||
conventionLayout: boolean; | |||
base: string; | |||
analyze: { | |||
}; | |||
writeToDisk: boolean; | |||
theme: { [x: string]: any }; | |||
targets: { [x: string]: any }; | |||
svgr: { [x: string]: any }; | |||
svgo: { [x: string]: any } | boolean; | |||
stylusLoader: { [x: string]: any }; | |||
styleLoader: { [x: string]: any }; | |||
srcTranspilerOptions: { | |||
esbuild?: ({ [x: string]: any } | undefined); | |||
swc?: ({ [x: string]: any } | undefined); | |||
}; | |||
srcTranspiler: "babel" | "esbuild" | "swc"; | |||
sassLoader: { [x: string]: any }; | |||
runtimePublicPath: { | |||
}; | |||
purgeCSS: { [x: string]: any }; | |||
publicPath: string; | |||
proxy: { [x: string]: any } | Array<any>; | |||
postcssLoader: { [x: string]: any }; | |||
outputPath: string; | |||
normalCSSLoaderModules: { [x: string]: any }; | |||
mfsu: { | |||
cacheDirectory?: (string | undefined); | |||
chainWebpack?: (((...args: any[]) => unknown) | undefined); | |||
esbuild?: (boolean | undefined); | |||
exclude?: (Array<string | any> | undefined); | |||
include?: (Array<string> | undefined); | |||
mfName?: (string | undefined); | |||
remoteAliases?: (Array<string> | undefined); | |||
remoteName?: (string | undefined); | |||
runtimePublicPath?: (boolean | undefined); | |||
shared?: ({ [x: string]: any } | undefined); | |||
strategy?: ("eager" | "normal" | undefined); | |||
} | boolean; | |||
mdx: { | |||
loader?: (string | undefined); | |||
loaderOptions?: ({ [x: string]: any } | undefined); | |||
}; | |||
manifest: { | |||
basePath?: (string | undefined); | |||
fileName?: (string | undefined); | |||
}; | |||
lessLoader: { [x: string]: any }; | |||
jsMinifierOptions: { [x: string]: any }; | |||
jsMinifier: "esbuild" | "swc" | "terser" | "uglifyJs" | "none"; | |||
inlineLimit: number; | |||
ignoreMomentLocale: boolean; | |||
https: { | |||
cert?: (string | undefined); | |||
hosts?: (Array<string> | undefined); | |||
http2?: (boolean | undefined); | |||
key?: (string | undefined); | |||
}; | |||
hash: boolean; | |||
forkTSChecker: { [x: string]: any }; | |||
fastRefresh: boolean; | |||
extraPostCSSPlugins: Array<any>; | |||
extraBabelPresets: Array<string | Array<any>>; | |||
extraBabelPlugins: Array<string | Array<any>>; | |||
extraBabelIncludes: Array<string | any>; | |||
externals: { [x: string]: any } | string | ((...args: any[]) => unknown); | |||
esm: { | |||
}; | |||
devtool: "cheap-source-map" | "cheap-module-source-map" | "eval" | "eval-source-map" | "eval-cheap-source-map" | "eval-cheap-module-source-map" | "eval-nosources-cheap-source-map" | "eval-nosources-cheap-module-source-map" | "eval-nosources-source-map" | "source-map" | "hidden-source-map" | "hidden-nosources-cheap-source-map" | "hidden-nosources-cheap-module-source-map" | "hidden-nosources-source-map" | "hidden-cheap-source-map" | "hidden-cheap-module-source-map" | "inline-source-map" | "inline-cheap-source-map" | "inline-cheap-module-source-map" | "inline-nosources-cheap-source-map" | "inline-nosources-cheap-module-source-map" | "inline-nosources-source-map" | "nosources-source-map" | "nosources-cheap-source-map" | "nosources-cheap-module-source-map" | boolean; | |||
depTranspiler: "babel" | "esbuild" | "swc" | "none"; | |||
define: { [x: string]: any }; | |||
deadCode: { | |||
context?: (string | undefined); | |||
detectUnusedExport?: (boolean | undefined); | |||
detectUnusedFiles?: (boolean | undefined); | |||
exclude?: (Array<string> | undefined); | |||
failOnHint?: (boolean | undefined); | |||
patterns?: (Array<string> | undefined); | |||
}; | |||
cssPublicPath: string; | |||
cssMinifierOptions: { [x: string]: any }; | |||
cssMinifier: "cssnano" | "esbuild" | "parcelCSS" | "none"; | |||
cssLoaderModules: { [x: string]: any }; | |||
cssLoader: { [x: string]: any }; | |||
copy: Array<{ | |||
from: string; | |||
to: string; | |||
} | string>; | |||
checkDepCssModules?: boolean; | |||
cacheDirectoryPath: string; | |||
babelLoaderCustomize: string; | |||
autoprefixer: { [x: string]: any }; | |||
autoCSSModules: boolean; | |||
alias: { [x: string]: any }; | |||
crossorigin: boolean | { | |||
includes?: (Array<any> | undefined); | |||
}; | |||
esmi: { | |||
cdnOrigin: string; | |||
shimUrl?: (string | undefined); | |||
}; | |||
exportStatic: { | |||
extraRoutePaths?: (((...args: any[]) => unknown) | Array<string> | undefined); | |||
ignorePreRenderError?: (boolean | undefined); | |||
}; | |||
favicons: Array<string>; | |||
helmet: boolean; | |||
icons: { | |||
autoInstall?: ({ | |||
} | undefined); | |||
defaultComponentConfig?: ({ | |||
} | undefined); | |||
alias?: ({ | |||
} | undefined); | |||
include?: (Array<string> | undefined); | |||
}; | |||
mock: { | |||
exclude?: (Array<string> | undefined); | |||
include?: (Array<string> | undefined); | |||
}; | |||
mpa: { | |||
template?: (string | undefined); | |||
layout?: (string | undefined); | |||
getConfigFromEntryFile?: (boolean | undefined); | |||
entry?: ({ | |||
} | undefined); | |||
}; | |||
phantomDependency: { | |||
exclude?: (Array<string> | undefined); | |||
}; | |||
polyfill: { | |||
imports?: (Array<string> | undefined); | |||
}; | |||
routePrefetch: { | |||
}; | |||
terminal: { | |||
}; | |||
tmpFiles: boolean; | |||
clientLoader: { | |||
}; | |||
routeProps: { | |||
}; | |||
ssr: { | |||
serverBuildPath?: (string | undefined); | |||
platform?: (string | undefined); | |||
builder?: ("esbuild" | "webpack" | undefined); | |||
}; | |||
lowImport: { | |||
libs?: (Array<any> | undefined); | |||
css?: (string | undefined); | |||
}; | |||
vite: { | |||
}; | |||
apiRoute: { | |||
platform?: (string | undefined); | |||
}; | |||
monorepoRedirect: boolean | { | |||
srcDir?: (Array<string> | undefined); | |||
exclude?: (Array<any> | undefined); | |||
peerDeps?: (boolean | undefined); | |||
}; | |||
test: { | |||
}; | |||
clickToComponent: { | |||
/** 默认情况下,点击将默认编辑器为vscode, 你可以设置编辑器 vscode 或者 vscode-insiders */ | |||
editor?: (string | undefined); | |||
}; | |||
legacy: { | |||
buildOnly?: (boolean | undefined); | |||
nodeModulesTransform?: (boolean | undefined); | |||
checkOutput?: (boolean | undefined); | |||
}; | |||
/** 设置 babel class-properties 启用 loose | |||
@doc https://umijs.org/docs/api/config#classpropertiesloose */ | |||
classPropertiesLoose: boolean | { | |||
}; | |||
ui: { | |||
}; | |||
mako: { | |||
}; | |||
hmrGuardian: boolean; | |||
forget: { | |||
ReactCompilerConfig?: ({ | |||
} | undefined); | |||
}; | |||
verifyCommit: { | |||
scope?: (Array<string> | undefined); | |||
allowEmoji?: (boolean | undefined); | |||
}; | |||
run: { | |||
globals?: (Array<string> | undefined); | |||
}; | |||
access: { [x: string]: any }; | |||
analytics: { | |||
baidu?: (string | undefined); | |||
ga?: (string | undefined); | |||
ga_v2?: (string | undefined); | |||
}; | |||
antd: { | |||
dark?: (boolean | undefined); | |||
compact?: (boolean | undefined); | |||
import?: (boolean | undefined); | |||
style?: ("less" | "css" | undefined); | |||
theme?: ({ | |||
components: { [x: string]: { [x: string]: any } }; | |||
} | { [x: string]: any } | undefined); | |||
appConfig?: ({ [x: string]: any } | undefined); | |||
momentPicker?: (boolean | undefined); | |||
styleProvider?: ({ [x: string]: any } | undefined); | |||
configProvider?: ({ | |||
theme: { | |||
components: { [x: string]: { [x: string]: any } }; | |||
} | { [x: string]: any }; | |||
} | { [x: string]: any } | undefined); | |||
}; | |||
dva: { | |||
extraModels?: (Array<string> | undefined); | |||
immer?: ({ [x: string]: any } | undefined); | |||
skipModelValidate?: (boolean | undefined); | |||
}; | |||
initialState: { | |||
loading?: (string | undefined); | |||
}; | |||
layout: { [x: string]: any }; | |||
locale: { | |||
default?: (string | undefined); | |||
useLocalStorage?: (boolean | undefined); | |||
baseNavigator?: (boolean | undefined); | |||
title?: (boolean | undefined); | |||
antd?: (boolean | undefined); | |||
baseSeparator?: (string | undefined); | |||
}; | |||
mf: { | |||
name?: (string | undefined); | |||
remotes?: (Array<{ | |||
aliasName?: (string | undefined); | |||
name: string; | |||
entry?: (string | undefined); | |||
entries?: ({ | |||
} | undefined); | |||
keyResolver?: (string | undefined); | |||
}> | undefined); | |||
shared?: ({ [x: string]: any } | undefined); | |||
library?: ({ [x: string]: any } | undefined); | |||
remoteHash?: (boolean | undefined); | |||
}; | |||
model: { | |||
extraModels?: (Array<string> | undefined); | |||
}; | |||
moment2dayjs: { | |||
preset?: ("antd" | "antdv3" | "none" | undefined); | |||
plugins?: (Array<string> | undefined); | |||
}; | |||
qiankun: { | |||
slave?: ({ [x: string]: any } | undefined); | |||
master?: ({ [x: string]: any } | undefined); | |||
externalQiankun?: (boolean | undefined); | |||
}; | |||
reactQuery: { | |||
devtool?: ({ [x: string]: any } | boolean | undefined); | |||
queryClient?: ({ [x: string]: any } | boolean | undefined); | |||
}; | |||
request: { | |||
dataField?: (string | undefined); | |||
}; | |||
styledComponents: { | |||
babelPlugin?: ({ [x: string]: any } | undefined); | |||
}; | |||
tailwindcss: { [x: string]: any }; | |||
valtio: { | |||
}; | |||
}; | |||
type PrettifyWithCloseable<T> = { | |||
[K in keyof T]: T[K] | false; | |||
} & {}; | |||
export type IConfigFromPlugins = PrettifyWithCloseable< | |||
IConfigFromPluginsJoi & Partial<IConfigTypes> | |||
>; |
@@ -0,0 +1,7 @@ | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
// Created by Umi Plugin | |||
export interface IConfigFromPluginsJoi { | |||
} |
@@ -0,0 +1,220 @@ | |||
// @ts-nocheck | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/es.error.cause.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/es.aggregate-error.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/es.aggregate-error.cause.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/es.array.at.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/es.array.find-last.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/es.array.find-last-index.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/es.array.push.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/es.array.reduce.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/es.array.reduce-right.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/es.array.to-reversed.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/es.array.to-sorted.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/es.array.to-spliced.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/es.array.with.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/es.map.group-by.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/es.object.group-by.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/es.object.has-own.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/es.promise.any.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/es.promise.with-resolvers.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/es.reflect.to-string-tag.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/es.regexp.flags.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/es.string.at-alternative.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/es.string.is-well-formed.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/es.string.replace-all.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/es.string.to-well-formed.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/es.typed-array.at.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/es.typed-array.find-last.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/es.typed-array.find-last-index.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/es.typed-array.set.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/es.typed-array.to-reversed.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/es.typed-array.to-sorted.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/es.typed-array.with.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.suppressed-error.constructor.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.array.from-async.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.array.filter-out.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.array.filter-reject.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.array.group.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.array.group-by.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.array.group-by-to-map.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.array.group-to-map.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.array.is-template-object.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.array.last-index.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.array.last-item.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.array.unique-by.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.array-buffer.detached.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.array-buffer.transfer.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.array-buffer.transfer-to-fixed-length.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.async-disposable-stack.constructor.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.async-iterator.constructor.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.async-iterator.as-indexed-pairs.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.async-iterator.async-dispose.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.async-iterator.drop.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.async-iterator.every.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.async-iterator.filter.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.async-iterator.find.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.async-iterator.flat-map.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.async-iterator.for-each.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.async-iterator.from.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.async-iterator.indexed.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.async-iterator.map.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.async-iterator.reduce.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.async-iterator.some.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.async-iterator.take.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.async-iterator.to-array.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.bigint.range.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.composite-key.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.composite-symbol.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.data-view.get-float16.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.data-view.get-uint8-clamped.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.data-view.set-float16.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.data-view.set-uint8-clamped.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.disposable-stack.constructor.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.function.demethodize.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.function.is-callable.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.function.is-constructor.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.function.metadata.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.function.un-this.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.iterator.constructor.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.iterator.as-indexed-pairs.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.iterator.dispose.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.iterator.drop.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.iterator.every.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.iterator.filter.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.iterator.find.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.iterator.flat-map.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.iterator.for-each.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.iterator.from.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.iterator.indexed.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.iterator.map.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.iterator.range.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.iterator.reduce.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.iterator.some.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.iterator.take.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.iterator.to-array.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.iterator.to-async.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.json.is-raw-json.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.json.parse.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.json.raw-json.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.map.delete-all.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.map.emplace.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.map.every.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.map.filter.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.map.find.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.map.find-key.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.map.from.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.map.includes.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.map.key-by.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.map.key-of.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.map.map-keys.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.map.map-values.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.map.merge.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.map.of.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.map.reduce.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.map.some.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.map.update.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.map.update-or-insert.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.map.upsert.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.math.clamp.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.math.deg-per-rad.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.math.degrees.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.math.fscale.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.math.f16round.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.math.iaddh.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.math.imulh.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.math.isubh.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.math.rad-per-deg.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.math.radians.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.math.scale.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.math.seeded-prng.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.math.signbit.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.math.umulh.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.number.from-string.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.number.range.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.object.iterate-entries.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.object.iterate-keys.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.object.iterate-values.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.observable.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.promise.try.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.reflect.define-metadata.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.reflect.delete-metadata.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.reflect.get-metadata.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.reflect.get-metadata-keys.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.reflect.get-own-metadata.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.reflect.get-own-metadata-keys.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.reflect.has-metadata.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.reflect.has-own-metadata.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.reflect.metadata.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.regexp.escape.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.set.add-all.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.set.delete-all.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.set.difference.v2.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.set.difference.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.set.every.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.set.filter.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.set.find.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.set.from.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.set.intersection.v2.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.set.intersection.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.set.is-disjoint-from.v2.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.set.is-disjoint-from.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.set.is-subset-of.v2.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.set.is-subset-of.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.set.is-superset-of.v2.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.set.is-superset-of.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.set.join.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.set.map.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.set.of.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.set.reduce.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.set.some.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.set.symmetric-difference.v2.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.set.symmetric-difference.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.set.union.v2.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.set.union.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.string.at.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.string.cooked.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.string.code-points.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.string.dedent.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.symbol.async-dispose.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.symbol.dispose.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.symbol.is-registered-symbol.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.symbol.is-registered.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.symbol.is-well-known-symbol.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.symbol.is-well-known.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.symbol.matcher.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.symbol.metadata.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.symbol.metadata-key.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.symbol.observable.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.symbol.pattern-match.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.symbol.replace-all.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.typed-array.from-async.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.typed-array.filter-out.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.typed-array.filter-reject.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.typed-array.group-by.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.typed-array.to-spliced.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.typed-array.unique-by.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.uint8-array.from-base64.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.uint8-array.from-hex.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.uint8-array.to-base64.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.uint8-array.to-hex.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.weak-map.delete-all.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.weak-map.from.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.weak-map.of.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.weak-map.emplace.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.weak-map.upsert.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.weak-set.add-all.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.weak-set.delete-all.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.weak-set.from.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/esnext.weak-set.of.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/web.dom-exception.stack.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/web.immediate.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/web.self.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/web.structured-clone.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/web.url.can-parse.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/web.url-search-params.delete.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/web.url-search-params.has.js"; | |||
import "E:/project/myproject/rencaishichanghoutai/node_modules/core-js/modules/web.url-search-params.size.js"; | |||
import 'E:/project/myproject/rencaishichanghoutai/node_modules/@umijs/preset-umi/node_modules/regenerator-runtime/runtime.js'; | |||
export {}; |
@@ -0,0 +1,31 @@ | |||
// @ts-nocheck | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
import React from 'react'; | |||
export async function getRoutes() { | |||
const routes = {"1":{"path":"/","redirect":"/main/company/list","parentId":"ant-design-pro-layout","id":"1"},"2":{"path":"/login","layout":false,"id":"2"},"3":{"name":"基础管理","path":"/main","parentId":"ant-design-pro-layout","id":"3"},"4":{"name":"企业管理","parentId":"3","id":"4"},"5":{"name":"企业列表","path":"/main/company/list","parentId":"4","id":"5"},"6":{"name":"VIP列表","path":"/main/company/vip","parentId":"4","id":"6"},"7":{"name":"部门管理","path":"/main/company/department","parentId":"4","id":"7"},"8":{"name":"职位管理","path":"/main/company/post","parentId":"4","id":"8"},"9":{"name":"求职者管理","parentId":"3","id":"9"},"10":{"name":"简历列表","path":"/main/jobseeker/list","parentId":"9","id":"10"},"11":{"name":"求职者账号列表","path":"/main/jobseeker/account","parentId":"9","id":"11"},"12":{"name":"系统管理","path":"/rent","parentId":"ant-design-pro-layout","id":"12"},"13":{"name":"房屋管理","path":"/rent/house","parentId":"12","id":"13"},"14":{"name":"租客管理","path":"/rent/renter","parentId":"12","id":"14"},"15":{"name":"账号权限","path":"/school","parentId":"ant-design-pro-layout","id":"15"},"16":{"name":"学校管理","path":"/school/address","parentId":"15","id":"16"},"17":{"name":"学生管理","path":"/school/area","parentId":"15","id":"17"},"ant-design-pro-layout":{"id":"ant-design-pro-layout","path":"/","isLayout":true}} as const; | |||
return { | |||
routes, | |||
routeComponents: { | |||
'1': React.lazy(() => import('./EmptyRoute')), | |||
'2': React.lazy(() => import(/* webpackChunkName: "p__Login__index" */'@/pages/Login/index.tsx')), | |||
'3': React.lazy(() => import('./EmptyRoute')), | |||
'4': React.lazy(() => import('./EmptyRoute')), | |||
'5': React.lazy(() => import(/* webpackChunkName: "p__Main__Company__List__index" */'@/pages/Main/Company/List/index.tsx')), | |||
'6': React.lazy(() => import(/* webpackChunkName: "p__Main__Company__Vip__index" */'@/pages/Main/Company/Vip/index.tsx')), | |||
'7': React.lazy(() => import(/* webpackChunkName: "p__Main__Company__Department__index" */'@/pages/Main/Company/Department/index.tsx')), | |||
'8': React.lazy(() => import(/* webpackChunkName: "p__Main__Company__Post__index" */'@/pages/Main/Company/Post/index.tsx')), | |||
'9': React.lazy(() => import('./EmptyRoute')), | |||
'10': React.lazy(() => import(/* webpackChunkName: "p__Main__Jobseeker__List__index" */'@/pages/Main/Jobseeker/List/index.tsx')), | |||
'11': React.lazy(() => import(/* webpackChunkName: "p__Main__Jobseeker__Account__index" */'@/pages/Main/Jobseeker/Account/index.tsx')), | |||
'12': React.lazy(() => import('./EmptyRoute')), | |||
'13': React.lazy(() => import(/* webpackChunkName: "p__Rent__House__index" */'@/pages/Rent/House/index.tsx')), | |||
'14': React.lazy(() => import(/* webpackChunkName: "p__Rent__Renter__index" */'@/pages/Rent/Renter/index.tsx')), | |||
'15': React.lazy(() => import('./EmptyRoute')), | |||
'16': React.lazy(() => import(/* webpackChunkName: "p__Main__Address__index" */'@/pages/Main/Address/index.tsx')), | |||
'17': React.lazy(() => import(/* webpackChunkName: "p__Main__Area__index" */'@/pages/Main/Area/index.tsx')), | |||
'ant-design-pro-layout': React.lazy(() => import(/* webpackChunkName: "umi__plugin-layout__Layout" */'E:/project/myproject/rencaishichanghoutai/src/.umi/plugin-layout/Layout.tsx')), | |||
}, | |||
}; | |||
} |
@@ -0,0 +1,37 @@ | |||
// @ts-nocheck | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
let count = 0; | |||
let groupLevel = 0; | |||
function send(type: string, message?: string) { | |||
if(process.env.NODE_ENV==='production'){ | |||
return; | |||
}else{ | |||
const encodedMessage = message ? `&m=${encodeURI(message)}` : ''; | |||
fetch(`/__umi/api/terminal?type=${type}&t=${Date.now()}&c=${count++}&g=${groupLevel}${encodedMessage}`, { mode: 'no-cors' }) | |||
} | |||
} | |||
function prettyPrint(obj: any) { | |||
return JSON.stringify(obj, null, 2); | |||
} | |||
function stringifyObjs(objs: any[]) { | |||
const obj = objs.length > 1 ? objs.map(stringify).join(' ') : objs[0]; | |||
return typeof obj === 'object' ? `${prettyPrint(obj)}` : obj.toString(); | |||
} | |||
function stringify(obj: any) { | |||
return typeof obj === 'object' ? `${JSON.stringify(obj)}` : obj.toString(); | |||
} | |||
const terminal = { | |||
log(...objs: any[]) { send('log', stringifyObjs(objs)) }, | |||
info(...objs: any[]) { send('info', stringifyObjs(objs)) }, | |||
warn(...objs: any[]) { send('warn', stringifyObjs(objs)) }, | |||
error(...objs: any[]) { send('error', stringifyObjs(objs)) }, | |||
group() { groupLevel++ }, | |||
groupCollapsed() { groupLevel++ }, | |||
groupEnd() { groupLevel && --groupLevel }, | |||
clear() { send('clear') }, | |||
trace(...args: any[]) { console.trace(...args) }, | |||
profile(...args: any[]) { console.profile(...args) }, | |||
profileEnd(...args: any[]) { console.profileEnd(...args) }, | |||
}; | |||
export { terminal }; |
@@ -0,0 +1,26 @@ | |||
// @ts-nocheck | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
// defineApp | |||
export { defineApp } from './core/defineApp' | |||
export type { RuntimeConfig } from './core/defineApp' | |||
// plugins | |||
export { Access, useAccess, useAccessMarkedRoutes } from 'E:/project/myproject/rencaishichanghoutai/src/.umi/plugin-access'; | |||
export { Provider, useModel } from 'E:/project/myproject/rencaishichanghoutai/src/.umi/plugin-model'; | |||
export { useRequest, UseRequestProvider, request, getRequestInstance } from 'E:/project/myproject/rencaishichanghoutai/src/.umi/plugin-request'; | |||
// plugins types.d.ts | |||
export * from 'E:/project/myproject/rencaishichanghoutai/src/.umi/plugin-access/types.d'; | |||
export * from 'E:/project/myproject/rencaishichanghoutai/src/.umi/plugin-antd/types.d'; | |||
export * from 'E:/project/myproject/rencaishichanghoutai/src/.umi/plugin-layout/types.d'; | |||
export * from 'E:/project/myproject/rencaishichanghoutai/src/.umi/plugin-request/types.d'; | |||
// @umijs/renderer-* | |||
export { createBrowserHistory, createHashHistory, createMemoryHistory, Helmet, HelmetProvider, createSearchParams, generatePath, matchPath, matchRoutes, Navigate, NavLink, Outlet, resolvePath, useLocation, useMatch, useNavigate, useOutlet, useOutletContext, useParams, useResolvedPath, useRoutes, useSearchParams, useAppData, useClientLoaderData, useRouteProps, useSelectedRoutes, useServerLoaderData, renderClient, __getRoot, Link, useRouteData, __useFetcher, withRouter } from 'E:/project/myproject/rencaishichanghoutai/node_modules/@umijs/renderer-react'; | |||
export type { History } from 'E:/project/myproject/rencaishichanghoutai/node_modules/@umijs/renderer-react' | |||
// umi/client/client/plugin | |||
export { ApplyPluginsType, PluginManager } from 'E:/project/myproject/rencaishichanghoutai/node_modules/umi/client/client/plugin.js'; | |||
export { history, createHistory } from './core/history'; | |||
export { terminal } from './core/terminal'; | |||
// react ssr | |||
export const useServerInsertedHTML: Function = () => {}; | |||
// test | |||
export { TestBrowser } from './testBrowser'; |
@@ -0,0 +1,7 @@ | |||
// @ts-nocheck | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
import React from 'react'; | |||
import { AccessInstance } from './types.d'; | |||
export const AccessContext = React.createContext<AccessInstance>(null); |
@@ -0,0 +1,87 @@ | |||
// @ts-nocheck | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
import React, { PropsWithChildren } from 'react'; | |||
import { AccessContext } from './context'; | |||
import type { IRoute } from '@umijs/max'; | |||
export const useAccess = () => { | |||
return React.useContext(AccessContext); | |||
}; | |||
export interface AccessProps { | |||
accessible: boolean; | |||
fallback?: React.ReactNode; | |||
} | |||
export const Access: React.FC<PropsWithChildren<AccessProps>> = (props) => { | |||
if (process.env.NODE_ENV === 'development' && typeof props.accessible !== 'boolean') { | |||
throw new Error('[access] the `accessible` property on <Access /> should be a boolean'); | |||
} | |||
return <>{ props.accessible ? props.children : props.fallback }</>; | |||
}; | |||
export const useAccessMarkedRoutes = (routes: IRoute[]) => { | |||
const access = useAccess(); | |||
const markdedRoutes: IRoute[] = React.useMemo(() => { | |||
const process = (route, parentAccessCode, parentRoute) => { | |||
let accessCode = route.access; | |||
// 用父级的路由检测父级的 accessCode | |||
let detectorRoute = route; | |||
if (!accessCode && parentAccessCode) { | |||
accessCode = parentAccessCode; | |||
detectorRoute = parentRoute; | |||
} | |||
// set default status | |||
route.unaccessible = false; | |||
// check access code | |||
if (typeof accessCode === 'string') { | |||
const detector = access[accessCode]; | |||
if (typeof detector === 'function') { | |||
route.unaccessible = !detector(detectorRoute); | |||
} else if (typeof detector === 'boolean') { | |||
route.unaccessible = !detector; | |||
} else if (typeof detector === 'undefined') { | |||
route.unaccessible = true; | |||
} | |||
} | |||
// check children access code | |||
if (route.children?.length) { | |||
const isNoAccessibleChild = !route.children.reduce((hasAccessibleChild, child) => { | |||
process(child, accessCode, route); | |||
return hasAccessibleChild || !child.unaccessible; | |||
}, false); | |||
// make sure parent route is unaccessible if all children are unaccessible | |||
if (isNoAccessibleChild) { | |||
route.unaccessible = true; | |||
} | |||
} | |||
// check children access code | |||
if (route.routes?.length) { | |||
const isNoAccessibleChild = !route.routes.reduce((hasAccessibleChild, child) => { | |||
process(child, accessCode, route); | |||
return hasAccessibleChild || !child.unaccessible; | |||
}, false); | |||
// make sure parent route is unaccessible if all children are unaccessible | |||
if (isNoAccessibleChild) { | |||
route.unaccessible = true; | |||
} | |||
} | |||
return route; | |||
} | |||
return routes.map(route => process(route)); | |||
}, [routes.length, access]); | |||
return markdedRoutes; | |||
} |
@@ -0,0 +1,23 @@ | |||
// @ts-nocheck | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
import React from 'react'; | |||
import accessFactory from '@/access'; | |||
import { useModel } from '@@/plugin-model'; | |||
import { AccessContext } from './context'; | |||
function Provider(props) { | |||
const { initialState } = useModel('@@initialState'); | |||
const access = React.useMemo(() => accessFactory(initialState), [initialState]); | |||
return ( | |||
<AccessContext.Provider value={access}> | |||
{ props.children } | |||
</AccessContext.Provider> | |||
); | |||
} | |||
export function accessProvider(container) { | |||
return <Provider>{ container }</Provider>; | |||
} |
@@ -0,0 +1,5 @@ | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
import accessFactory from '@/access'; | |||
export type AccessInstance = ReturnType<typeof accessFactory>; |
@@ -0,0 +1,53 @@ | |||
// @ts-nocheck | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
import React from 'react'; | |||
import { | |||
ConfigProvider, | |||
} from 'antd'; | |||
import { ApplyPluginsType } from 'umi'; | |||
import { getPluginManager } from '../core/plugin'; | |||
let cacheAntdConfig = null; | |||
const getAntdConfig = () => { | |||
if(!cacheAntdConfig){ | |||
cacheAntdConfig = getPluginManager().applyPlugins({ | |||
key: 'antd', | |||
type: ApplyPluginsType.modify, | |||
initialValue: { | |||
}, | |||
}); | |||
} | |||
return cacheAntdConfig; | |||
} | |||
function AntdProvider({ children }) { | |||
let container = children; | |||
const [antdConfig, _setAntdConfig] = React.useState(() => { | |||
const { | |||
appConfig: _, | |||
...finalConfigProvider | |||
} = getAntdConfig(); | |||
return finalConfigProvider | |||
}); | |||
const setAntdConfig: typeof _setAntdConfig = (newConfig) => { | |||
_setAntdConfig(prev => { | |||
return merge({}, prev, typeof newConfig === 'function' ? newConfig(prev) : newConfig) | |||
}) | |||
} | |||
return container; | |||
} | |||
export function rootContainer(children) { | |||
return ( | |||
<AntdProvider> | |||
{children} | |||
</AntdProvider> | |||
); | |||
} |
@@ -0,0 +1,6 @@ | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
import type { RuntimeAntdConfig } from './types.d'; | |||
export type IRuntimeConfig = { | |||
antd?: RuntimeAntdConfig | |||
}; |
@@ -0,0 +1,12 @@ | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
type Prettify<T> = { | |||
[K in keyof T]: T[K]; | |||
} & {}; | |||
type AntdConfig = Prettify<{} | |||
>; | |||
export type RuntimeAntdConfig = (memo: AntdConfig) => AntdConfig; |
@@ -0,0 +1,50 @@ | |||
// @ts-nocheck | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
import { useState, useEffect, useCallback } from 'react'; | |||
import { getInitialState } from '@/app'; | |||
export type InitialStateType = Awaited<ReturnType<typeof getInitialState>> | undefined; | |||
const initState = { | |||
initialState: undefined as InitialStateType, | |||
loading: true, | |||
error: undefined, | |||
}; | |||
export default () => { | |||
const [state, setState] = useState(initState); | |||
const refresh = useCallback(async () => { | |||
setState((s) => ({ ...s, loading: true, error: undefined })); | |||
try { | |||
const ret = await getInitialState(); | |||
setState((s) => ({ ...s, initialState: ret, loading: false })); | |||
} catch (e) { | |||
setState((s) => ({ ...s, error: e, loading: false })); | |||
} | |||
}, []); | |||
const setInitialState = useCallback( | |||
async ( | |||
initialState: InitialStateType | ((initialState: InitialStateType) => InitialStateType), | |||
) => { | |||
setState((s) => { | |||
if (typeof initialState === 'function') { | |||
return { ...s, initialState: initialState(s.initialState), loading: false }; | |||
} | |||
return { ...s, initialState, loading: false }; | |||
}); | |||
}, | |||
[], | |||
); | |||
useEffect(() => { | |||
refresh(); | |||
}, []); | |||
return { | |||
...state, | |||
refresh, | |||
setInitialState, | |||
}; | |||
} |
@@ -0,0 +1,19 @@ | |||
// @ts-nocheck | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
import React from 'react'; | |||
import { useModel } from '@@/plugin-model'; | |||
function Loading() { return <div />; } | |||
export default function InitialStateProvider(props: any) { | |||
const appLoaded = React.useRef(false); | |||
const { loading = false } = useModel("@@initialState") || {}; | |||
React.useEffect(() => { | |||
if (!loading) { | |||
appLoaded.current = true; | |||
} | |||
}, [loading]); | |||
if (loading && !appLoaded.current) { | |||
return <Loading />; | |||
} | |||
return props.children; | |||
} |
@@ -0,0 +1,8 @@ | |||
// @ts-nocheck | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
import React from 'react'; | |||
import Provider from './Provider'; | |||
export function dataflowProvider(container) { | |||
return <Provider>{ container }</Provider>; | |||
} |
@@ -0,0 +1,5 @@ | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
export interface IRuntimeConfig { | |||
getInitialState?: () => Promise<Record<string, any>> | |||
} |
@@ -0,0 +1,37 @@ | |||
// @ts-nocheck | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
import React from 'react'; | |||
import { history, type IRoute } from '@umijs/max'; | |||
import { Result, Button } from 'antd'; | |||
const Exception: React.FC<{ | |||
children: React.ReactNode; | |||
route?: IRoute; | |||
notFound?: React.ReactNode; | |||
noAccessible?: React.ReactNode; | |||
unAccessible?: React.ReactNode; | |||
noFound?: React.ReactNode; | |||
}> = (props) => ( | |||
// render custom 404 | |||
(!props.route && (props.noFound || props.notFound)) || | |||
// render custom 403 | |||
(props.route?.unaccessible && (props.unAccessible || props.noAccessible)) || | |||
// render default exception | |||
((!props.route || props.route?.unaccessible) && ( | |||
<Result | |||
status={props.route ? '403' : '404'} | |||
title={props.route ? '403' : '404'} | |||
subTitle={props.route ? '抱歉,你无权访问该页面' : '抱歉,你访问的页面不存在'} | |||
extra={ | |||
<Button type="primary" onClick={() => history.push('/')}> | |||
返回首页 | |||
</Button> | |||
} | |||
/> | |||
)) || | |||
// normal render | |||
props.children | |||
); | |||
export default Exception; |
@@ -0,0 +1,52 @@ | |||
@media screen and (max-width: 480px) { | |||
/* 在小屏幕的时候可以有更好的体验 */ | |||
.umi-plugin-layout-container { | |||
width: 100% !important; | |||
} | |||
.umi-plugin-layout-container > * { | |||
border-radius: 0 !important; | |||
} | |||
} | |||
.umi-plugin-layout-menu .anticon { | |||
margin-right: 8px; | |||
} | |||
.umi-plugin-layout-menu .ant-dropdown-menu-item { | |||
min-width: 160px; | |||
} | |||
.umi-plugin-layout-right { | |||
display: flex !important; | |||
float: right; | |||
height: 100%; | |||
margin-left: auto; | |||
overflow: hidden; | |||
} | |||
.umi-plugin-layout-right .umi-plugin-layout-action { | |||
display: flex; | |||
align-items: center; | |||
height: 100%; | |||
padding: 0 12px; | |||
cursor: pointer; | |||
transition: all 0.3s; | |||
} | |||
.umi-plugin-layout-right .umi-plugin-layout-action > i { | |||
color: rgba(255, 255, 255, 0.85); | |||
vertical-align: middle; | |||
} | |||
.umi-plugin-layout-right .umi-plugin-layout-action:hover { | |||
background: rgba(0, 0, 0, 0.025); | |||
} | |||
.umi-plugin-layout-right .umi-plugin-layout-action.opened { | |||
background: rgba(0, 0, 0, 0.025); | |||
} | |||
.umi-plugin-layout-right .umi-plugin-layout-search { | |||
padding: 0 12px; | |||
} | |||
.umi-plugin-layout-right .umi-plugin-layout-search:hover { | |||
background: transparent; | |||
} | |||
.umi-plugin-layout-name { | |||
margin-left: 8px; | |||
} | |||
.umi-plugin-layout-name.umi-plugin-layout-hide-avatar-img { | |||
margin-left: 0; | |||
} |
@@ -0,0 +1,201 @@ | |||
// @ts-nocheck | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
/// <reference types="@ant-design/pro-components" /> | |||
/// <reference types="antd" /> | |||
import { | |||
Link, useLocation, useNavigate, Outlet, useAppData, matchRoutes, | |||
type IRoute | |||
} from '@umijs/max'; | |||
import React, { useMemo } from 'react'; | |||
import { | |||
ProLayout, | |||
} from "E:/project/myproject/rencaishichanghoutai/node_modules/@ant-design/pro-components"; | |||
import './Layout.css'; | |||
import Logo from './Logo'; | |||
import Exception from './Exception'; | |||
import { getRightRenderContent } from './rightRender'; | |||
import { useModel } from '@@/plugin-model'; | |||
import { useAccessMarkedRoutes } from '@@/plugin-access'; | |||
// 过滤出需要显示的路由, 这里的filterFn 指 不希望显示的层级 | |||
const filterRoutes = (routes: IRoute[], filterFn: (route: IRoute) => boolean) => { | |||
if (routes.length === 0) { | |||
return [] | |||
} | |||
let newRoutes = [] | |||
for (const route of routes) { | |||
const newRoute = {...route }; | |||
if (filterFn(route)) { | |||
if (Array.isArray(newRoute.routes)) { | |||
newRoutes.push(...filterRoutes(newRoute.routes, filterFn)) | |||
} | |||
} else { | |||
if (Array.isArray(newRoute.children)) { | |||
newRoute.children = filterRoutes(newRoute.children, filterFn); | |||
newRoute.routes = newRoute.children; | |||
} | |||
newRoutes.push(newRoute); | |||
} | |||
} | |||
return newRoutes; | |||
} | |||
// 格式化路由 处理因 wrapper 导致的 菜单 path 不一致 | |||
const mapRoutes = (routes: IRoute[]) => { | |||
if (routes.length === 0) { | |||
return [] | |||
} | |||
return routes.map(route => { | |||
// 需要 copy 一份, 否则会污染原始数据 | |||
const newRoute = {...route} | |||
if (route.originPath) { | |||
newRoute.path = route.originPath | |||
} | |||
if (Array.isArray(route.routes)) { | |||
newRoute.routes = mapRoutes(route.routes); | |||
} | |||
if (Array.isArray(route.children)) { | |||
newRoute.children = mapRoutes(route.children); | |||
} | |||
return newRoute | |||
}) | |||
} | |||
export default (props: any) => { | |||
const location = useLocation(); | |||
const navigate = useNavigate(); | |||
const { clientRoutes, pluginManager } = useAppData(); | |||
const initialInfo = (useModel && useModel('@@initialState')) || { | |||
initialState: undefined, | |||
loading: false, | |||
setInitialState: null, | |||
}; | |||
const { initialState, loading, setInitialState } = initialInfo; | |||
const userConfig = { | |||
"name": "菊城人才市场", | |||
"logo": "https://preview.pro.ant.design/static/logo.f0355d39.svg", | |||
"navTheme": "dark", | |||
"primaryColor": "#1890ff", | |||
"layout": "mix", | |||
"contentWidth": "Fluid", | |||
"fixedHeader": true, | |||
"fixSiderbar": false, | |||
"splitMenus": true, | |||
"siderWidth": 240, | |||
"title": "菊城人才市场", | |||
"pwa": false, | |||
"iconfontUrl": "", | |||
"avatarProps": { | |||
"src": "https://gw.alipayobjects.com/zos/antfincdn/efFD%24IOql2/weixintupian_20170331104822.jpg", | |||
"size": "small", | |||
"title": "七妮妮" | |||
} | |||
}; | |||
const formatMessage = undefined; | |||
const runtimeConfig = pluginManager.applyPlugins({ | |||
key: 'layout', | |||
type: 'modify', | |||
initialValue: { | |||
...initialInfo | |||
}, | |||
}); | |||
// 现在的 layout 及 wrapper 实现是通过父路由的形式实现的, 会导致路由数据多了冗余层级, proLayout 消费时, 无法正确展示菜单, 这里对冗余数据进行过滤操作 | |||
const newRoutes = filterRoutes(clientRoutes.filter(route => route.id === 'ant-design-pro-layout'), (route) => { | |||
return (!!route.isLayout && route.id !== 'ant-design-pro-layout') || !!route.isWrapper; | |||
}) | |||
const [route] = useAccessMarkedRoutes(mapRoutes(newRoutes)); | |||
const matchedRoute = useMemo(() => matchRoutes(route.children, location.pathname)?.pop?.()?.route, [location.pathname]); | |||
return ( | |||
<ProLayout | |||
route={route} | |||
location={location} | |||
title={userConfig.title || 'plugin-layout'} | |||
navTheme="dark" | |||
siderWidth={256} | |||
onMenuHeaderClick={(e) => { | |||
e.stopPropagation(); | |||
e.preventDefault(); | |||
navigate('/'); | |||
}} | |||
formatMessage={userConfig.formatMessage || formatMessage} | |||
menu={{ locale: userConfig.locale }} | |||
logo={Logo} | |||
menuItemRender={(menuItemProps, defaultDom) => { | |||
if (menuItemProps.isUrl || menuItemProps.children) { | |||
return defaultDom; | |||
} | |||
if (menuItemProps.path && location.pathname !== menuItemProps.path) { | |||
return ( | |||
// handle wildcard route path, for example /slave/* from qiankun | |||
<Link to={menuItemProps.path.replace('/*', '')} target={menuItemProps.target}> | |||
{defaultDom} | |||
</Link> | |||
); | |||
} | |||
return defaultDom; | |||
}} | |||
itemRender={(route, _, routes) => { | |||
const { breadcrumbName, title, path } = route; | |||
const label = title || breadcrumbName | |||
const last = routes[routes.length - 1] | |||
if (last) { | |||
if (last.path === path || last.linkPath === path) { | |||
return <span>{label}</span>; | |||
} | |||
} | |||
return <Link to={path}>{label}</Link>; | |||
}} | |||
disableContentMargin | |||
fixSiderbar | |||
fixedHeader | |||
{...runtimeConfig} | |||
rightContentRender={ | |||
runtimeConfig.rightContentRender !== false && | |||
((layoutProps) => { | |||
const dom = getRightRenderContent({ | |||
runtimeConfig, | |||
loading, | |||
initialState, | |||
setInitialState, | |||
}); | |||
if (runtimeConfig.rightContentRender) { | |||
return runtimeConfig.rightContentRender(layoutProps, dom, { | |||
// BREAK CHANGE userConfig > runtimeConfig | |||
userConfig, | |||
runtimeConfig, | |||
loading, | |||
initialState, | |||
setInitialState, | |||
}); | |||
} | |||
return dom; | |||
}) | |||
} | |||
> | |||
<Exception | |||
route={matchedRoute} | |||
noFound={runtimeConfig?.noFound} | |||
notFound={runtimeConfig?.notFound} | |||
unAccessible={runtimeConfig?.unAccessible} | |||
noAccessible={runtimeConfig?.noAccessible} | |||
> | |||
{runtimeConfig.childrenRender | |||
? runtimeConfig.childrenRender(<Outlet />, props) | |||
: <Outlet /> | |||
} | |||
</Exception> | |||
</ProLayout> | |||
); | |||
} |
@@ -0,0 +1,94 @@ | |||
// @ts-nocheck | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
import React from 'react'; | |||
const LogoIcon: React.FC = () => { | |||
return ( | |||
<svg | |||
xmlns="http://www.w3.org/2000/svg" | |||
width="32" | |||
height="32" | |||
viewBox="0 0 200 200" | |||
> | |||
<defs> | |||
<linearGradient | |||
id="linearGradient-1" | |||
x1="62.102%" | |||
x2="108.197%" | |||
y1="0%" | |||
y2="37.864%" | |||
> | |||
<stop offset="0%" stopColor="#4285EB"></stop> | |||
<stop offset="100%" stopColor="#2EC7FF"></stop> | |||
</linearGradient> | |||
<linearGradient | |||
id="linearGradient-2" | |||
x1="69.644%" | |||
x2="54.043%" | |||
y1="0%" | |||
y2="108.457%" | |||
> | |||
<stop offset="0%" stopColor="#29CDFF"></stop> | |||
<stop offset="37.86%" stopColor="#148EFF"></stop> | |||
<stop offset="100%" stopColor="#0A60FF"></stop> | |||
</linearGradient> | |||
<linearGradient | |||
id="linearGradient-3" | |||
x1="69.691%" | |||
x2="16.723%" | |||
y1="-12.974%" | |||
y2="117.391%" | |||
> | |||
<stop offset="0%" stopColor="#FA816E"></stop> | |||
<stop offset="41.473%" stopColor="#F74A5C"></stop> | |||
<stop offset="100%" stopColor="#F51D2C"></stop> | |||
</linearGradient> | |||
<linearGradient | |||
id="linearGradient-4" | |||
x1="68.128%" | |||
x2="30.44%" | |||
y1="-35.691%" | |||
y2="114.943%" | |||
> | |||
<stop offset="0%" stopColor="#FA8E7D"></stop> | |||
<stop offset="51.264%" stopColor="#F74A5C"></stop> | |||
<stop offset="100%" stopColor="#F51D2C"></stop> | |||
</linearGradient> | |||
</defs> | |||
<g fill="none" fillRule="evenodd" stroke="none" strokeWidth="1"> | |||
<g transform="translate(-20 -20)"> | |||
<g transform="translate(20 20)"> | |||
<g> | |||
<g fillRule="nonzero"> | |||
<g> | |||
<path | |||
fill="url(#linearGradient-1)" | |||
d="M91.588 4.177L4.18 91.513a11.981 11.981 0 000 16.974l87.408 87.336a12.005 12.005 0 0016.989 0l36.648-36.618c4.209-4.205 4.209-11.023 0-15.228-4.208-4.205-11.031-4.205-15.24 0l-27.783 27.76c-1.17 1.169-2.945 1.169-4.114 0l-69.802-69.744c-1.17-1.169-1.17-2.942 0-4.11l69.802-69.745c1.17-1.169 2.944-1.169 4.114 0l27.783 27.76c4.209 4.205 11.032 4.205 15.24 0 4.209-4.205 4.209-11.022 0-15.227L108.581 4.056c-4.719-4.594-12.312-4.557-16.993.12z" | |||
></path> | |||
<path | |||
fill="url(#linearGradient-2)" | |||
d="M91.588 4.177L4.18 91.513a11.981 11.981 0 000 16.974l87.408 87.336a12.005 12.005 0 0016.989 0l36.648-36.618c4.209-4.205 4.209-11.023 0-15.228-4.208-4.205-11.031-4.205-15.24 0l-27.783 27.76c-1.17 1.169-2.945 1.169-4.114 0l-69.802-69.744c-1.17-1.169-1.17-2.942 0-4.11l69.802-69.745c2.912-2.51 7.664-7.596 14.642-8.786 5.186-.883 10.855 1.062 17.009 5.837L108.58 4.056c-4.719-4.594-12.312-4.557-16.993.12z" | |||
></path> | |||
</g> | |||
<path | |||
fill="url(#linearGradient-3)" | |||
d="M153.686 135.855c4.208 4.205 11.031 4.205 15.24 0l27.034-27.012c4.7-4.696 4.7-12.28 0-16.974l-27.27-27.15c-4.218-4.2-11.043-4.195-15.254.013-4.209 4.205-4.209 11.022 0 15.227l18.418 18.403c1.17 1.169 1.17 2.943 0 4.111l-18.168 18.154c-4.209 4.205-4.209 11.023 0 15.228z" | |||
></path> | |||
</g> | |||
<ellipse | |||
cx="100.519" | |||
cy="100.437" | |||
fill="url(#linearGradient-4)" | |||
rx="23.6" | |||
ry="23.581" | |||
></ellipse> | |||
</g> | |||
</g> | |||
</g> | |||
</g> | |||
</svg> | |||
); | |||
}; | |||
export default LogoIcon; |
@@ -0,0 +1,4 @@ | |||
// @ts-nocheck | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
export default { }; |
@@ -0,0 +1,4 @@ | |||
// @ts-nocheck | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
export type TempType = string |
@@ -0,0 +1,107 @@ | |||
// @ts-nocheck | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
import React from 'react'; | |||
import { Avatar, version, Dropdown, Menu, Spin } from 'antd'; | |||
import { LogoutOutlined } from 'E:/project/myproject/rencaishichanghoutai/node_modules/@umijs/plugins/node_modules/@ant-design/icons'; | |||
export function getRightRenderContent (opts: { | |||
runtimeConfig: any, | |||
loading: boolean, | |||
initialState: any, | |||
setInitialState: any, | |||
}) { | |||
if (opts.runtimeConfig.rightRender) { | |||
return opts.runtimeConfig.rightRender( | |||
opts.initialState, | |||
opts.setInitialState, | |||
opts.runtimeConfig, | |||
); | |||
} | |||
const showAvatar = opts.initialState?.avatar || opts.initialState?.name || opts.runtimeConfig.logout; | |||
const disableAvatarImg = opts.initialState?.avatar === false; | |||
const nameClassName = disableAvatarImg ? 'umi-plugin-layout-name umi-plugin-layout-hide-avatar-img' : 'umi-plugin-layout-name'; | |||
const avatar = | |||
showAvatar ? ( | |||
<span className="umi-plugin-layout-action"> | |||
{!disableAvatarImg ? | |||
( | |||
<Avatar | |||
size="small" | |||
className="umi-plugin-layout-avatar" | |||
src={ | |||
opts.initialState?.avatar || | |||
"https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png" | |||
} | |||
alt="avatar" | |||
/> | |||
) : null} | |||
<span className={nameClassName}>{opts.initialState?.name}</span> | |||
</span> | |||
) : null; | |||
if (opts.loading) { | |||
return ( | |||
<div className="umi-plugin-layout-right"> | |||
<Spin size="small" style={ { marginLeft: 8, marginRight: 8 } } /> | |||
</div> | |||
); | |||
} | |||
// 如果没有打开Locale,并且头像为空就取消掉这个返回的内容 | |||
if(!avatar) return null; | |||
const langMenu = { | |||
className: "umi-plugin-layout-menu", | |||
selectedKeys: [], | |||
items: [ | |||
{ | |||
key: "logout", | |||
label: ( | |||
<> | |||
<LogoutOutlined /> | |||
退出登录 | |||
</> | |||
), | |||
onClick: () => { | |||
opts?.runtimeConfig?.logout?.(opts.initialState); | |||
}, | |||
}, | |||
], | |||
}; | |||
// antd@5 和 4.24 之后推荐使用 menu,性能更好 | |||
let dropdownProps; | |||
if (version.startsWith("5.") || version.startsWith("4.24.")) { | |||
dropdownProps = { menu: langMenu }; | |||
} else if (version.startsWith("3.")) { | |||
dropdownProps = { | |||
overlay: ( | |||
<Menu> | |||
{langMenu.items.map((item) => ( | |||
<Menu.Item key={item.key} onClick={item.onClick}> | |||
{item.label} | |||
</Menu.Item> | |||
))} | |||
</Menu> | |||
), | |||
}; | |||
} else { // 需要 antd 4.20.0 以上版本 | |||
dropdownProps = { overlay: <Menu {...langMenu} /> }; | |||
} | |||
return ( | |||
<div className="umi-plugin-layout-right anticon"> | |||
{opts.runtimeConfig.logout ? ( | |||
<Dropdown {...dropdownProps} overlayClassName="umi-plugin-layout-container"> | |||
{avatar} | |||
</Dropdown> | |||
) : ( | |||
avatar | |||
)} | |||
</div> | |||
); | |||
} |
@@ -0,0 +1,25 @@ | |||
// @ts-nocheck | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
import React from 'react'; | |||
import icons from './icons'; | |||
function formatIcon(name: string) { | |||
return name | |||
.replace(name[0], name[0].toUpperCase()) | |||
.replace(/-(w)/g, function(all, letter) { | |||
return letter.toUpperCase(); | |||
}); | |||
} | |||
export function patchRoutes({ routes }) { | |||
Object.keys(routes).forEach(key => { | |||
const { icon } = routes[key]; | |||
if (icon && typeof icon === 'string') { | |||
const upperIcon = formatIcon(icon); | |||
if (icons[upperIcon] || icons[upperIcon + 'Outlined']) { | |||
routes[key].icon = React.createElement(icons[upperIcon] || icons[upperIcon + 'Outlined']); | |||
} | |||
} | |||
}); | |||
} |
@@ -0,0 +1,6 @@ | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
import type { RunTimeLayoutConfig } from './types.d'; | |||
export interface IRuntimeConfig { | |||
layout?: RunTimeLayoutConfig | |||
} |
@@ -0,0 +1,37 @@ | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
/// <reference types="@ant-design/pro-components" /> | |||
/// <reference types="antd" /> | |||
import type { ProLayoutProps, HeaderProps } from "E:/project/myproject/rencaishichanghoutai/node_modules/@ant-design/pro-components"; | |||
import type InitialStateType from '@@/plugin-initialState/@@initialState'; | |||
type InitDataType = ReturnType<typeof InitialStateType>; | |||
import type { IConfigFromPlugins } from '@@/core/pluginConfig'; | |||
export type RunTimeLayoutConfig = (initData: InitDataType) => Omit< | |||
ProLayoutProps, | |||
'rightContentRender' | |||
> & { | |||
childrenRender?: (dom: JSX.Element, props: ProLayoutProps) => React.ReactNode; | |||
unAccessible?: JSX.Element; | |||
noFound?: JSX.Element; | |||
logout?: (initialState: InitDataType['initialState']) => Promise<void> | void; | |||
rightContentRender?: (( | |||
headerProps: HeaderProps, | |||
dom: JSX.Element, | |||
props: { | |||
userConfig: IConfigFromPlugins['layout']; | |||
runtimeConfig: RunTimeLayoutConfig; | |||
loading: InitDataType['loading']; | |||
initialState: InitDataType['initialState']; | |||
setInitialState: InitDataType['setInitialState']; | |||
}, | |||
) => JSX.Element) | false; | |||
rightRender?: ( | |||
initialState: InitDataType['initialState'], | |||
setInitialState: InitDataType['setInitialState'], | |||
runtimeConfig: RunTimeLayoutConfig, | |||
) => JSX.Element; | |||
}; |
@@ -0,0 +1,183 @@ | |||
// @ts-nocheck | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
// @ts-ignore | |||
import type { models as rawModels } from '@@/plugin-model/model'; | |||
import isEqual from 'E:/project/myproject/rencaishichanghoutai/node_modules/fast-deep-equal/index.js'; | |||
import React, { useContext, useEffect, useMemo, useRef, useState } from 'react'; | |||
type Models = typeof rawModels; | |||
type GetNamespaces<M> = { | |||
[K in keyof M]: M[K] extends { namespace: string } | |||
? M[K]['namespace'] | |||
: never; | |||
}[keyof M]; | |||
type Namespaces = GetNamespaces<Models>; | |||
// @ts-ignore | |||
const Context = React.createContext<{ dispatcher: Dispatcher }>(null); | |||
class Dispatcher { | |||
callbacks: Record<Namespaces, Set<Function>> = {}; | |||
data: Record<Namespaces, unknown> = {}; | |||
update = (namespace: Namespaces) => { | |||
if (this.callbacks[namespace]) { | |||
this.callbacks[namespace].forEach((cb) => { | |||
try { | |||
const data = this.data[namespace]; | |||
cb(data); | |||
} catch (e) { | |||
cb(undefined); | |||
} | |||
}); | |||
} | |||
}; | |||
} | |||
interface ExecutorProps { | |||
hook: () => any; | |||
onUpdate: (val: any) => void; | |||
namespace: string; | |||
} | |||
function Executor(props: ExecutorProps) { | |||
const { hook, onUpdate, namespace } = props; | |||
const updateRef = useRef(onUpdate); | |||
const initialLoad = useRef(false); | |||
let data: any; | |||
try { | |||
data = hook(); | |||
} catch (e) { | |||
console.error( | |||
`plugin-model: Invoking '${namespace || 'unknown'}' model failed:`, | |||
e, | |||
); | |||
} | |||
// 首次执行时立刻返回初始值 | |||
useMemo(() => { | |||
updateRef.current(data); | |||
}, []); | |||
// React 16.13 后 update 函数用 useEffect 包裹 | |||
useEffect(() => { | |||
if (initialLoad.current) { | |||
updateRef.current(data); | |||
} else { | |||
initialLoad.current = true; | |||
} | |||
}); | |||
return null; | |||
} | |||
const dispatcher = new Dispatcher(); | |||
export function Provider(props: { | |||
models: Record<string, any>; | |||
children: React.ReactNode; | |||
}) { | |||
return ( | |||
<Context.Provider value={{ dispatcher }}> | |||
{Object.keys(props.models).map((namespace) => { | |||
return ( | |||
<Executor | |||
key={namespace} | |||
hook={props.models[namespace]} | |||
namespace={namespace} | |||
onUpdate={(val) => { | |||
dispatcher.data[namespace] = val; | |||
dispatcher.update(namespace); | |||
}} | |||
/> | |||
); | |||
})} | |||
{props.children} | |||
</Context.Provider> | |||
); | |||
} | |||
type GetModelByNamespace<M, N> = { | |||
[K in keyof M]: M[K] extends { namespace: string; model: unknown } | |||
? M[K]['namespace'] extends N | |||
? M[K]['model'] extends (...args: any) => any | |||
? ReturnType<M[K]['model']> | |||
: never | |||
: never | |||
: never; | |||
}[keyof M]; | |||
type Model<N> = GetModelByNamespace<Models, N>; | |||
type Selector<N, S> = (model: Model<N>) => S; | |||
type SelectedModel<N, T> = T extends (...args: any) => any | |||
? ReturnType<NonNullable<T>> | |||
: Model<N>; | |||
export function useModel<N extends Namespaces>(namespace: N): Model<N>; | |||
export function useModel<N extends Namespaces, S>( | |||
namespace: N, | |||
selector: Selector<N, S>, | |||
): SelectedModel<N, typeof selector>; | |||
export function useModel<N extends Namespaces, S>( | |||
namespace: N, | |||
selector?: Selector<N, S>, | |||
): SelectedModel<N, typeof selector> { | |||
const { dispatcher } = useContext<{ dispatcher: Dispatcher }>(Context); | |||
const selectorRef = useRef(selector); | |||
selectorRef.current = selector; | |||
const [state, setState] = useState(() => | |||
selectorRef.current | |||
? selectorRef.current(dispatcher.data[namespace]) | |||
: dispatcher.data[namespace], | |||
); | |||
const stateRef = useRef<any>(state); | |||
stateRef.current = state; | |||
const isMount = useRef(false); | |||
useEffect(() => { | |||
isMount.current = true; | |||
return () => { | |||
isMount.current = false; | |||
}; | |||
}, []); | |||
useEffect(() => { | |||
const handler = (data: any) => { | |||
if (!isMount.current) { | |||
// 如果 handler 执行过程中,组件被卸载了,则强制更新全局 data | |||
// TODO: 需要加个 example 测试 | |||
setTimeout(() => { | |||
dispatcher.data[namespace] = data; | |||
dispatcher.update(namespace); | |||
}); | |||
} else { | |||
const currentState = selectorRef.current | |||
? selectorRef.current(data) | |||
: data; | |||
const previousState = stateRef.current; | |||
if (!isEqual(currentState, previousState)) { | |||
// 避免 currentState 拿到的数据是老的,从而导致 isEqual 比对逻辑有问题 | |||
stateRef.current = currentState; | |||
setState(currentState); | |||
} | |||
} | |||
}; | |||
dispatcher.callbacks[namespace] ||= new Set() as any; // rawModels 是 umi 动态生成的文件,导致前面 callback[namespace] 的类型无法推导出来,所以用 as any 来忽略掉 | |||
dispatcher.callbacks[namespace].add(handler); | |||
dispatcher.update(namespace); | |||
return () => { | |||
dispatcher.callbacks[namespace].delete(handler); | |||
}; | |||
}, [namespace]); | |||
return state; | |||
} |
@@ -0,0 +1,10 @@ | |||
// @ts-nocheck | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
import model_1 from 'E:/project/myproject/rencaishichanghoutai/src/models/global'; | |||
import model_2 from 'E:/project/myproject/rencaishichanghoutai/src/.umi/plugin-initialState/@@initialState'; | |||
export const models = { | |||
model_1: { namespace: 'global', model: model_1 }, | |||
model_2: { namespace: '@@initialState', model: model_2 }, | |||
} as const |
@@ -0,0 +1,20 @@ | |||
// @ts-nocheck | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
import React from 'react'; | |||
import { Provider } from './'; | |||
import { models as rawModels } from './model'; | |||
function ProviderWrapper(props: any) { | |||
const models = React.useMemo(() => { | |||
return Object.keys(rawModels).reduce((memo, key) => { | |||
memo[rawModels[key].namespace] = rawModels[key].model; | |||
return memo; | |||
}, {}); | |||
}, []); | |||
return <Provider models={models} {...props}>{ props.children }</Provider> | |||
} | |||
export function dataflowProvider(container, opts) { | |||
return <ProviderWrapper {...opts}>{ container }</ProviderWrapper>; | |||
} |
@@ -0,0 +1,9 @@ | |||
// @ts-nocheck | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
export { | |||
useRequest, | |||
UseRequestProvider, | |||
request, | |||
getRequestInstance, | |||
} from './request'; |
@@ -0,0 +1,270 @@ | |||
// @ts-nocheck | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
import axios, { | |||
type AxiosInstance, | |||
type AxiosRequestConfig, | |||
type AxiosResponse, | |||
type AxiosError, | |||
} from 'E:/project/myproject/rencaishichanghoutai/node_modules/axios'; | |||
import useUmiRequest, { UseRequestProvider } from 'E:/project/myproject/rencaishichanghoutai/node_modules/@umijs/plugins/node_modules/@ahooksjs/use-request'; | |||
import { ApplyPluginsType } from 'umi'; | |||
import { getPluginManager } from '../core/plugin'; | |||
import { | |||
BaseOptions, | |||
BasePaginatedOptions, | |||
BaseResult, | |||
CombineService, | |||
LoadMoreFormatReturn, | |||
LoadMoreOptions, | |||
LoadMoreOptionsWithFormat, | |||
LoadMoreParams, | |||
LoadMoreResult, | |||
OptionsWithFormat, | |||
PaginatedFormatReturn, | |||
PaginatedOptionsWithFormat, | |||
PaginatedParams, | |||
PaginatedResult, | |||
} from 'E:/project/myproject/rencaishichanghoutai/node_modules/@umijs/plugins/node_modules/@ahooksjs/use-request/es/types'; | |||
type ResultWithData< T = any > = { data?: T; [key: string]: any }; | |||
function useRequest< | |||
R = any, | |||
P extends any[] = any, | |||
U = any, | |||
UU extends U = any, | |||
>( | |||
service: CombineService<R, P>, | |||
options: OptionsWithFormat<R, P, U, UU>, | |||
): BaseResult<U, P>; | |||
function useRequest<R extends ResultWithData = any, P extends any[] = any>( | |||
service: CombineService<R, P>, | |||
options?: BaseOptions<R['data'], P>, | |||
): BaseResult<R['data'], P>; | |||
function useRequest<R extends LoadMoreFormatReturn = any, RR = any>( | |||
service: CombineService<RR, LoadMoreParams<R>>, | |||
options: LoadMoreOptionsWithFormat<R, RR>, | |||
): LoadMoreResult<R>; | |||
function useRequest< | |||
R extends ResultWithData<LoadMoreFormatReturn | any> = any, | |||
RR extends R = any, | |||
>( | |||
service: CombineService<R, LoadMoreParams<R['data']>>, | |||
options: LoadMoreOptions<RR['data']>, | |||
): LoadMoreResult<R['data']>; | |||
function useRequest<R = any, Item = any, U extends Item = any>( | |||
service: CombineService<R, PaginatedParams>, | |||
options: PaginatedOptionsWithFormat<R, Item, U>, | |||
): PaginatedResult<Item>; | |||
function useRequest<Item = any, U extends Item = any>( | |||
service: CombineService< | |||
ResultWithData<PaginatedFormatReturn<Item>>, | |||
PaginatedParams | |||
>, | |||
options: BasePaginatedOptions<U>, | |||
): PaginatedResult<Item>; | |||
function useRequest(service: any, options: any = {}) { | |||
return useUmiRequest(service, { | |||
formatResult: result => result?.data, | |||
requestMethod: (requestOptions: any) => { | |||
if (typeof requestOptions === 'string') { | |||
return request(requestOptions); | |||
} | |||
if (typeof requestOptions === 'object') { | |||
const { url, ...rest } = requestOptions; | |||
return request(url, rest); | |||
} | |||
throw new Error('request options error'); | |||
}, | |||
...options, | |||
}); | |||
} | |||
// request 方法 opts 参数的接口 | |||
interface IRequestOptions extends AxiosRequestConfig { | |||
skipErrorHandler?: boolean; | |||
requestInterceptors?: IRequestInterceptorTuple[]; | |||
responseInterceptors?: IResponseInterceptorTuple[]; | |||
[key: string]: any; | |||
} | |||
interface IRequestOptionsWithResponse extends IRequestOptions { | |||
getResponse: true; | |||
} | |||
interface IRequestOptionsWithoutResponse extends IRequestOptions{ | |||
getResponse: false; | |||
} | |||
interface IRequest{ | |||
<T = any>(url: string, opts: IRequestOptionsWithResponse): Promise<AxiosResponse<T>>; | |||
<T = any>(url: string, opts: IRequestOptionsWithoutResponse): Promise<T>; | |||
<T = any>(url: string, opts: IRequestOptions): Promise<T>; // getResponse 默认是 false, 因此不提供该参数时,只返回 data | |||
<T = any>(url: string): Promise<T>; // 不提供 opts 时,默认使用 'GET' method,并且默认返回 data | |||
} | |||
type RequestError = AxiosError | Error | |||
interface IErrorHandler { | |||
(error: RequestError, opts: IRequestOptions): void; | |||
} | |||
type WithPromise<T> = T | Promise<T>; | |||
type IRequestInterceptorAxios = (config: IRequestOptions) => WithPromise<IRequestOptions>; | |||
type IRequestInterceptorUmiRequest = (url: string, config : IRequestOptions) => WithPromise<{ url: string, options: IRequestOptions }>; | |||
type IRequestInterceptor = IRequestInterceptorAxios | IRequestInterceptorUmiRequest; | |||
type IErrorInterceptor = (error: Error) => Promise<Error>; | |||
type IResponseInterceptor = <T = any>(response : AxiosResponse<T>) => WithPromise<AxiosResponse<T>> ; | |||
type IRequestInterceptorTuple = [IRequestInterceptor , IErrorInterceptor] | [IRequestInterceptor] | IRequestInterceptor | |||
type IResponseInterceptorTuple = [IResponseInterceptor, IErrorInterceptor] | [IResponseInterceptor] | IResponseInterceptor | |||
export interface RequestConfig<T = any> extends AxiosRequestConfig { | |||
errorConfig?: { | |||
errorHandler?: IErrorHandler; | |||
errorThrower?: ( res: T ) => void | |||
}; | |||
requestInterceptors?: IRequestInterceptorTuple[]; | |||
responseInterceptors?: IResponseInterceptorTuple[]; | |||
} | |||
let requestInstance: AxiosInstance; | |||
let config: RequestConfig; | |||
const getConfig = (): RequestConfig => { | |||
if (config) return config; | |||
config = getPluginManager().applyPlugins({ | |||
key: 'request', | |||
type: ApplyPluginsType.modify, | |||
initialValue: {}, | |||
}); | |||
return config; | |||
}; | |||
const getRequestInstance = (): AxiosInstance => { | |||
if (requestInstance) return requestInstance; | |||
const config = getConfig(); | |||
requestInstance = axios.create(config); | |||
config?.requestInterceptors?.forEach((interceptor) => { | |||
if(interceptor instanceof Array){ | |||
requestInstance.interceptors.request.use(async (config) => { | |||
const { url } = config; | |||
if(interceptor[0].length === 2){ | |||
const { url: newUrl, options } = await interceptor[0](url, config); | |||
return { ...options, url: newUrl }; | |||
} | |||
return interceptor[0](config); | |||
}, interceptor[1]); | |||
} else { | |||
requestInstance.interceptors.request.use(async (config) => { | |||
const { url } = config; | |||
if(interceptor.length === 2){ | |||
const { url: newUrl, options } = await interceptor(url, config); | |||
return { ...options, url: newUrl }; | |||
} | |||
return interceptor(config); | |||
}) | |||
} | |||
}); | |||
config?.responseInterceptors?.forEach((interceptor) => { | |||
interceptor instanceof Array ? | |||
requestInstance.interceptors.response.use(interceptor[0], interceptor[1]): | |||
requestInstance.interceptors.response.use(interceptor); | |||
}); | |||
// 当响应的数据 success 是 false 的时候,抛出 error 以供 errorHandler 处理。 | |||
requestInstance.interceptors.response.use((response) => { | |||
const { data } = response; | |||
if(data?.success === false && config?.errorConfig?.errorThrower){ | |||
config.errorConfig.errorThrower(data); | |||
} | |||
return response; | |||
}) | |||
return requestInstance; | |||
}; | |||
const request: IRequest = (url: string, opts: any = { method: 'GET' }) => { | |||
const requestInstance = getRequestInstance(); | |||
const config = getConfig(); | |||
const { getResponse = false, requestInterceptors, responseInterceptors } = opts; | |||
const requestInterceptorsToEject = requestInterceptors?.map((interceptor) => { | |||
if(interceptor instanceof Array){ | |||
return requestInstance.interceptors.request.use(async (config) => { | |||
const { url } = config; | |||
if(interceptor[0].length === 2){ | |||
const { url: newUrl, options } = await interceptor[0](url, config); | |||
return { ...options, url: newUrl }; | |||
} | |||
return interceptor[0](config); | |||
}, interceptor[1]); | |||
} else { | |||
return requestInstance.interceptors.request.use(async (config) => { | |||
const { url } = config; | |||
if(interceptor.length === 2){ | |||
const { url: newUrl, options } = await interceptor(url, config); | |||
return { ...options, url: newUrl }; | |||
} | |||
return interceptor(config); | |||
}) | |||
} | |||
}); | |||
const responseInterceptorsToEject = responseInterceptors?.map((interceptor) => { | |||
return interceptor instanceof Array ? | |||
requestInstance.interceptors.response.use(interceptor[0], interceptor[1]): | |||
requestInstance.interceptors.response.use(interceptor); | |||
}); | |||
return new Promise((resolve, reject)=>{ | |||
requestInstance | |||
.request({...opts, url}) | |||
.then((res)=>{ | |||
requestInterceptorsToEject?.forEach((interceptor) => { | |||
requestInstance.interceptors.request.eject(interceptor); | |||
}); | |||
responseInterceptorsToEject?.forEach((interceptor) => { | |||
requestInstance.interceptors.response.eject(interceptor); | |||
}); | |||
resolve(getResponse ? res : res.data); | |||
}) | |||
.catch((error)=>{ | |||
requestInterceptorsToEject?.forEach((interceptor) => { | |||
requestInstance.interceptors.request.eject(interceptor); | |||
}); | |||
responseInterceptorsToEject?.forEach((interceptor) => { | |||
requestInstance.interceptors.response.eject(interceptor); | |||
}); | |||
try { | |||
const handler = | |||
config?.errorConfig?.errorHandler; | |||
if(handler) | |||
handler(error, opts, config); | |||
} catch (e) { | |||
reject(e); | |||
} | |||
reject(error); | |||
}) | |||
}) | |||
} | |||
export { | |||
useRequest, | |||
UseRequestProvider, | |||
request, | |||
getRequestInstance, | |||
}; | |||
export type { | |||
AxiosInstance, | |||
AxiosRequestConfig, | |||
AxiosResponse, | |||
AxiosError, | |||
RequestError, | |||
IRequestInterceptorAxios as RequestInterceptorAxios, | |||
IRequestInterceptorUmiRequest as RequestInterceptorUmiRequest, | |||
IRequestInterceptor as RequestInterceptor, | |||
IErrorInterceptor as ErrorInterceptor, | |||
IResponseInterceptor as ResponseInterceptor, | |||
IRequestOptions as RequestOptions, | |||
IRequest as Request, | |||
}; |
@@ -0,0 +1,6 @@ | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
import type { RequestConfig } from './types.d' | |||
export type IRuntimeConfig = { | |||
request?: RequestConfig | |||
}; |
@@ -0,0 +1,16 @@ | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
export type { | |||
RequestConfig, | |||
AxiosInstance, | |||
AxiosRequestConfig, | |||
AxiosResponse, | |||
AxiosError, | |||
RequestError, | |||
RequestInterceptorAxios, | |||
RequestInterceptorUmiRequest, | |||
RequestInterceptor, | |||
ErrorInterceptor, | |||
ResponseInterceptor, | |||
RequestOptions, | |||
Request } from './request'; |
@@ -0,0 +1,87 @@ | |||
// @ts-nocheck | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
import React, { useEffect, useState } from 'react'; | |||
import { ApplyPluginsType } from 'umi'; | |||
import { renderClient, RenderClientOpts } from 'E:/project/myproject/rencaishichanghoutai/node_modules/@umijs/renderer-react'; | |||
import { createHistory } from './core/history'; | |||
import { createPluginManager } from './core/plugin'; | |||
import { getRoutes } from './core/route'; | |||
import type { Location } from 'history'; | |||
import 'antd/dist/reset.css'; | |||
const publicPath = '/'; | |||
const runtimePublicPath = false; | |||
type TestBrowserProps = { | |||
location?: Partial<Location>; | |||
historyRef?: React.MutableRefObject<Location>; | |||
}; | |||
export function TestBrowser(props: TestBrowserProps) { | |||
const pluginManager = createPluginManager(); | |||
const [context, setContext] = useState<RenderClientOpts | undefined>( | |||
undefined | |||
); | |||
useEffect(() => { | |||
const genContext = async () => { | |||
const { routes, routeComponents } = await getRoutes(pluginManager); | |||
// allow user to extend routes | |||
await pluginManager.applyPlugins({ | |||
key: 'patchRoutes', | |||
type: ApplyPluginsType.event, | |||
args: { | |||
routes, | |||
routeComponents, | |||
}, | |||
}); | |||
const contextOpts = pluginManager.applyPlugins({ | |||
key: 'modifyContextOpts', | |||
type: ApplyPluginsType.modify, | |||
initialValue: {}, | |||
}); | |||
const basename = contextOpts.basename || '/'; | |||
const history = createHistory({ | |||
type: 'memory', | |||
basename, | |||
}); | |||
const context = { | |||
routes, | |||
routeComponents, | |||
pluginManager, | |||
rootElement: contextOpts.rootElement || document.getElementById('root'), | |||
publicPath, | |||
runtimePublicPath, | |||
history, | |||
basename, | |||
components: true, | |||
}; | |||
const modifiedContext = pluginManager.applyPlugins({ | |||
key: 'modifyClientRenderOpts', | |||
type: ApplyPluginsType.modify, | |||
initialValue: context, | |||
}); | |||
return modifiedContext; | |||
}; | |||
genContext().then((context) => { | |||
setContext(context); | |||
if (props.location) { | |||
context?.history?.push(props.location); | |||
} | |||
if (props.historyRef) { | |||
props.historyRef.current = context?.history; | |||
} | |||
}); | |||
}, []); | |||
if (context === undefined) { | |||
return <div id="loading" />; | |||
} | |||
const Children = renderClient(context); | |||
return ( | |||
<React.Fragment> | |||
<Children /> | |||
</React.Fragment> | |||
); | |||
} |
@@ -0,0 +1,44 @@ | |||
{ | |||
"compilerOptions": { | |||
"target": "esnext", | |||
"module": "esnext", | |||
"lib": [ | |||
"dom", | |||
"dom.iterable", | |||
"esnext" | |||
], | |||
"allowJs": true, | |||
"skipLibCheck": true, | |||
"moduleResolution": "bundler", | |||
"importHelpers": true, | |||
"noEmit": true, | |||
"jsx": "react-jsx", | |||
"esModuleInterop": true, | |||
"sourceMap": true, | |||
"baseUrl": "../../", | |||
"strict": true, | |||
"resolveJsonModule": true, | |||
"allowSyntheticDefaultImports": true, | |||
"paths": { | |||
"@/*": [ | |||
"src/*" | |||
], | |||
"@@/*": [ | |||
"src/.umi/*" | |||
], | |||
"@umijs/max": [ | |||
"E:\\project\\myproject\\rencaishichanghoutai\\node_modules\\umi" | |||
], | |||
"@umijs/max/typings": [ | |||
"src/.umi/typings" | |||
] | |||
} | |||
}, | |||
"include": [ | |||
"../../.umirc.ts", | |||
"../../.umirc.*.ts", | |||
"../../**/*.d.ts", | |||
"../../**/*.ts", | |||
"../../**/*.tsx" | |||
] | |||
} |
@@ -0,0 +1,136 @@ | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
type CSSModuleClasses = { readonly [key: string]: string } | |||
declare module '*.css' { | |||
const classes: CSSModuleClasses | |||
export default classes | |||
} | |||
declare module '*.scss' { | |||
const classes: CSSModuleClasses | |||
export default classes | |||
} | |||
declare module '*.sass' { | |||
const classes: CSSModuleClasses | |||
export default classes | |||
} | |||
declare module '*.less' { | |||
const classes: CSSModuleClasses | |||
export default classes | |||
} | |||
declare module '*.styl' { | |||
const classes: CSSModuleClasses | |||
export default classes | |||
} | |||
declare module '*.stylus' { | |||
const classes: CSSModuleClasses | |||
export default classes | |||
} | |||
// images | |||
declare module '*.jpg' { | |||
const src: string | |||
export default src | |||
} | |||
declare module '*.jpeg' { | |||
const src: string | |||
export default src | |||
} | |||
declare module '*.png' { | |||
const src: string | |||
export default src | |||
} | |||
declare module '*.gif' { | |||
const src: string | |||
export default src | |||
} | |||
declare module '*.svg' { | |||
import * as React from 'react'; | |||
export const ReactComponent: React.FunctionComponent<React.SVGProps< | |||
SVGSVGElement | |||
> & { title?: string }>; | |||
const src: string | |||
export default src | |||
} | |||
declare module '*.ico' { | |||
const src: string | |||
export default src | |||
} | |||
declare module '*.webp' { | |||
const src: string | |||
export default src | |||
} | |||
declare module '*.avif' { | |||
const src: string | |||
export default src | |||
} | |||
// media | |||
declare module '*.mp4' { | |||
const src: string | |||
export default src | |||
} | |||
declare module '*.webm' { | |||
const src: string | |||
export default src | |||
} | |||
declare module '*.ogg' { | |||
const src: string | |||
export default src | |||
} | |||
declare module '*.mp3' { | |||
const src: string | |||
export default src | |||
} | |||
declare module '*.wav' { | |||
const src: string | |||
export default src | |||
} | |||
declare module '*.flac' { | |||
const src: string | |||
export default src | |||
} | |||
declare module '*.aac' { | |||
const src: string | |||
export default src | |||
} | |||
// fonts | |||
declare module '*.woff' { | |||
const src: string | |||
export default src | |||
} | |||
declare module '*.woff2' { | |||
const src: string | |||
export default src | |||
} | |||
declare module '*.eot' { | |||
const src: string | |||
export default src | |||
} | |||
declare module '*.ttf' { | |||
const src: string | |||
export default src | |||
} | |||
declare module '*.otf' { | |||
const src: string | |||
export default src | |||
} | |||
// other | |||
declare module '*.wasm' { | |||
const initWasm: (options: WebAssembly.Imports) => Promise<WebAssembly.Exports> | |||
export default initWasm | |||
} | |||
declare module '*.webmanifest' { | |||
const src: string | |||
export default src | |||
} | |||
declare module '*.pdf' { | |||
const src: string | |||
export default src | |||
} | |||
declare module '*.txt' { | |||
const src: string | |||
export default src | |||
} |
@@ -0,0 +1,76 @@ | |||
// @ts-nocheck | |||
// This file is generated by Umi automatically | |||
// DO NOT CHANGE IT MANUALLY! | |||
import './core/polyfill'; | |||
import 'antd/dist/reset.css'; | |||
import { renderClient } from 'E:/project/myproject/rencaishichanghoutai/node_modules/@umijs/renderer-react'; | |||
import { getRoutes } from './core/route'; | |||
import { createPluginManager } from './core/plugin'; | |||
import { createHistory } from './core/history'; | |||
import { ApplyPluginsType } from 'umi'; | |||
const publicPath = "/"; | |||
const runtimePublicPath = false; | |||
async function render() { | |||
const pluginManager = createPluginManager(); | |||
const { routes, routeComponents } = await getRoutes(pluginManager); | |||
// allow user to extend routes | |||
await pluginManager.applyPlugins({ | |||
key: 'patchRoutes', | |||
type: ApplyPluginsType.event, | |||
args: { | |||
routes, | |||
routeComponents, | |||
}, | |||
}); | |||
const contextOpts = pluginManager.applyPlugins({ | |||
key: 'modifyContextOpts', | |||
type: ApplyPluginsType.modify, | |||
initialValue: {}, | |||
}); | |||
const basename = contextOpts.basename || '/'; | |||
const historyType = contextOpts.historyType || 'browser'; | |||
const history = createHistory({ | |||
type: historyType, | |||
basename, | |||
...contextOpts.historyOpts, | |||
}); | |||
return (pluginManager.applyPlugins({ | |||
key: 'render', | |||
type: ApplyPluginsType.compose, | |||
initialValue() { | |||
const context = { | |||
routes, | |||
routeComponents, | |||
pluginManager, | |||
rootElement: contextOpts.rootElement || document.getElementById('root'), | |||
publicPath, | |||
runtimePublicPath, | |||
history, | |||
historyType, | |||
basename, | |||
callback: contextOpts.callback, | |||
}; | |||
const modifiedContext = pluginManager.applyPlugins({ | |||
key: 'modifyClientRenderOpts', | |||
type: ApplyPluginsType.modify, | |||
initialValue: context, | |||
}); | |||
return renderClient(modifiedContext); | |||
}, | |||
}))(); | |||
} | |||
render(); | |||
window.g_umi = { | |||
version: '4.2.8', | |||
}; |
@@ -0,0 +1,10 @@ | |||
export default (initialState: API.UserInfo) => { | |||
// 在这里按照初始化数据定义项目中的权限,统一管理 | |||
// 参考文档 https://umijs.org/docs/max/access | |||
const canSeeAdmin = !!( | |||
initialState && initialState.name !== 'dontHaveAccess' | |||
); | |||
return { | |||
canSeeAdmin, | |||
}; | |||
}; |
@@ -0,0 +1,7 @@ | |||
import {admin} from '@/constants' | |||
const url: LoginType.user = { | |||
UserLogin: admin + '/user/login', | |||
} | |||
export |
@@ -0,0 +1,7 @@ | |||
declare namespace AreaType { | |||
type form = { | |||
title ?: string, | |||
level_name ?: string, | |||
is_community ?: string | |||
} | |||
} |
@@ -0,0 +1,8 @@ | |||
declare namespace BaiduType { | |||
type form = { | |||
name ?: string, | |||
app_id ?: string, | |||
api_key ?: string, | |||
secret_key ?: string, | |||
} | |||
} |
@@ -0,0 +1,5 @@ | |||
declare namespace LoginType { | |||
type user = { | |||
UserLogin ?: string, | |||
} | |||
} |
@@ -0,0 +1,6 @@ | |||
declare namespace ProjectType { | |||
type form = { | |||
aip_id ?: string, | |||
name ?: string | |||
} | |||
} |
@@ -0,0 +1,24 @@ | |||
// 运行时配置 | |||
// 全局初始化数据配置,用于 Layout 用户信息和权限初始化 | |||
// 更多信息见文档:https://umijs.org/docs/api/runtime-config#getinitialstate | |||
export async function getInitialState(): Promise<{ name: string }> { | |||
return { name: '@umijs/max' }; | |||
} | |||
export const layout = () => { | |||
return { | |||
logo: 'https://img.alicdn.com/tfs/TB1YHEpwUT1gK0jSZFhXXaAtVXa-28-27.svg', | |||
layout: 'mix', | |||
splitMenus: true, | |||
siderWidth: 240, | |||
menu: { | |||
locale: false, | |||
}, | |||
avatarProps: { | |||
src: 'https://gw.alipayobjects.com/zos/antfincdn/efFD%24IOql2/weixintupian_20170331104822.jpg', | |||
size: 'small', | |||
title: '七妮妮' | |||
} | |||
}; | |||
}; |
@@ -0,0 +1,4 @@ | |||
.title { | |||
margin: 0 auto; | |||
font-weight: 200; | |||
} |
@@ -0,0 +1,23 @@ | |||
import { Layout, Row, Typography } from 'antd'; | |||
import React from 'react'; | |||
import styles from './Guide.less'; | |||
interface Props { | |||
name: string; | |||
} | |||
// 脚手架示例组件 | |||
const Guide: React.FC<Props> = (props) => { | |||
const { name } = props; | |||
return ( | |||
<Layout> | |||
<Row> | |||
<Typography.Title level={3} className={styles.title}> | |||
欢迎使用 <strong>{name}</strong> ! | |||
</Typography.Title> | |||
</Row> | |||
</Layout> | |||
); | |||
}; | |||
export default Guide; |
@@ -0,0 +1,2 @@ | |||
import Guide from './Guide'; | |||
export default Guide; |
@@ -0,0 +1,3 @@ | |||
export const DEFAULT_NAME = 'Umi Max'; | |||
export const admin = 'admin'; | |||
export const common = 'common'; |
@@ -0,0 +1,13 @@ | |||
// 全局共享数据示例 | |||
import { DEFAULT_NAME } from '@/constants'; | |||
import { useState } from 'react'; | |||
const useUser = () => { | |||
const [name, setName] = useState<string>(DEFAULT_NAME); | |||
return { | |||
name, | |||
setName, | |||
}; | |||
}; | |||
export default useUser; |
@@ -0,0 +1,117 @@ | |||
import { EllipsisOutlined, PlusOutlined } from '@ant-design/icons'; | |||
import type { ActionType, ProColumns } from '@ant-design/pro-components'; | |||
import { ProTable, TableDropdown } from '@ant-design/pro-components'; | |||
import { Button, Dropdown, Space, Tag } from 'antd'; | |||
import { useRef } from 'react'; | |||
export const waitTimePromise = async (time: number = 100) => { | |||
return new Promise((resolve) => { | |||
setTimeout(() => { | |||
resolve(true); | |||
}, time); | |||
}); | |||
}; | |||
export const waitTime = async (time: number = 100) => { | |||
await waitTimePromise(time); | |||
}; | |||
type GithubIssueItem = { | |||
url: string; | |||
id: number; | |||
number: number; | |||
title: string; | |||
labels: { | |||
name: string; | |||
color: string; | |||
}[]; | |||
state: string; | |||
comments: number; | |||
created_at: string; | |||
updated_at: string; | |||
closed_at?: string; | |||
}; | |||
const columns: ProColumns<GithubIssueItem>[] = [ | |||
{ | |||
dataIndex: 'index', | |||
valueType: 'indexBorder', | |||
width: 48, | |||
}, | |||
{ | |||
title: '标题', | |||
dataIndex: 'title', | |||
}, | |||
{ | |||
disable: true, | |||
title: '状态', | |||
dataIndex: 'state', | |||
}, | |||
{ | |||
disable: true, | |||
title: '标签', | |||
dataIndex: 'labels', | |||
}, | |||
{ | |||
title: '创建时间', | |||
key: 'showTime', | |||
dataIndex: 'created_at', | |||
}, | |||
{ | |||
title: '创建时间', | |||
dataIndex: 'created_at', | |||
valueType: 'dateRange', | |||
}, | |||
{ | |||
title: '操作', | |||
valueType: 'option', | |||
key: 'option', | |||
render: (text, record, _, action) => [ | |||
<a | |||
key="editable" | |||
onClick={() => { | |||
action?.startEditable?.(record.id); | |||
}} | |||
> | |||
编辑 | |||
</a>, | |||
<a href={record.url} target="_blank" rel="noopener noreferrer" key="view"> | |||
查看 | |||
</a>, | |||
<TableDropdown | |||
key="actionGroup" | |||
onSelect={() => action?.reload()} | |||
menus={[ | |||
{ key: 'copy', name: '复制' }, | |||
{ key: 'delete', name: '删除' }, | |||
]} | |||
/>, | |||
], | |||
}, | |||
]; | |||
export default () => { | |||
const actionRef = useRef<ActionType>(); | |||
return ( | |||
<> | |||
<ProTable | |||
headerTitle="高级表格" | |||
columns={columns} | |||
pagination={{ | |||
pageSize: 5, | |||
onChange: (page) => console.log(page), | |||
}} | |||
toolBarRender={() => [ | |||
<Button | |||
key="button" | |||
type="primary" | |||
> | |||
新建 | |||
</Button>, | |||
]} | |||
/> | |||
</> | |||
); | |||
}; |
@@ -0,0 +1,3 @@ | |||
.container { | |||
padding-top: 80px; | |||
} |
@@ -0,0 +1,18 @@ | |||
import Guide from '@/components/Guide'; | |||
import { trim } from '@/utils/format'; | |||
import { PageContainer } from '@ant-design/pro-components'; | |||
import { useModel } from '@umijs/max'; | |||
import styles from './index.less'; | |||
const HomePage: React.FC = () => { | |||
const { name } = useModel('global'); | |||
return ( | |||
<PageContainer ghost> | |||
<div className={styles.container}> | |||
<Guide name={trim(name)} /> | |||
</div> | |||
</PageContainer> | |||
); | |||
}; | |||
export default HomePage; |
@@ -0,0 +1,167 @@ | |||
import { | |||
AlipayCircleOutlined, | |||
LockOutlined, | |||
MobileOutlined, | |||
TaobaoCircleOutlined, | |||
UserOutlined, | |||
WeiboCircleOutlined, | |||
} from '@ant-design/icons'; | |||
import { | |||
LoginForm, | |||
ProConfigProvider, | |||
ProFormCaptcha, | |||
ProFormCheckbox, | |||
ProFormText, | |||
setAlpha, | |||
} from '@ant-design/pro-components'; | |||
import { Space, Tabs, message, theme, Row, Col, Image } from 'antd'; | |||
import type { CSSProperties } from 'react'; | |||
import { useState } from 'react'; | |||
export default () => { | |||
const { token } = theme.useToken(); | |||
const iconStyles: CSSProperties = { | |||
marginInlineStart: '16px', | |||
color: setAlpha(token.colorTextBase, 0.2), | |||
fontSize: '24px', | |||
verticalAlign: 'middle', | |||
cursor: 'pointer', | |||
}; | |||
return ( | |||
<ProConfigProvider hashed={false}> | |||
<div style={{ backgroundColor: token.colorBgContainer }}> | |||
<LoginForm | |||
title="菊城人才后台管理系统" | |||
subTitle="欢迎系统" | |||
> | |||
<> | |||
<ProFormText | |||
name="username" | |||
fieldProps={{ | |||
size: 'large', | |||
prefix: <UserOutlined className={'prefixIcon'} />, | |||
}} | |||
placeholder={'用户名: admin or user'} | |||
rules={[ | |||
{ | |||
required: true, | |||
message: '请输入用户名!', | |||
}, | |||
]} | |||
/> | |||
<ProFormText.Password | |||
name="password" | |||
fieldProps={{ | |||
size: 'large', | |||
prefix: <LockOutlined className={'prefixIcon'} />, | |||
strengthText: | |||
'Password should contain numbers, letters and special characters, at least 8 characters long.', | |||
statusRender: (value) => { | |||
const getStatus = () => { | |||
if (value && value.length > 12) { | |||
return 'ok'; | |||
} | |||
if (value && value.length > 6) { | |||
return 'pass'; | |||
} | |||
return 'poor'; | |||
}; | |||
const status = getStatus(); | |||
if (status === 'pass') { | |||
return ( | |||
<div style={{ color: token.colorWarning }}> | |||
强度:中 | |||
</div> | |||
); | |||
} | |||
if (status === 'ok') { | |||
return ( | |||
<div style={{ color: token.colorSuccess }}> | |||
强度:强 | |||
</div> | |||
); | |||
} | |||
return ( | |||
<div style={{ color: token.colorError }}>强度:弱</div> | |||
); | |||
}, | |||
}} | |||
placeholder={'密码: ant.design'} | |||
rules={[ | |||
{ | |||
required: true, | |||
message: '请输入密码!', | |||
}, | |||
]} | |||
/> | |||
<Row gutter={[16, 16]}> | |||
<Col span={16}> | |||
<ProFormText | |||
name="username" | |||
fieldProps={{ | |||
size: 'large', | |||
}} | |||
placeholder={'请输入图形验证码'} | |||
rules={[ | |||
{ | |||
required: true, | |||
message: '请输入图形验证码!', | |||
}, | |||
]} | |||
/> | |||
</Col> | |||
<Col span={8}> | |||
<Image src='/images/logo.png'></Image> | |||
</Col> | |||
</Row> | |||
<ProFormCaptcha | |||
fieldProps={{ | |||
size: 'large', | |||
prefix: <LockOutlined className={'prefixIcon'} />, | |||
}} | |||
captchaProps={{ | |||
size: 'large', | |||
}} | |||
placeholder={'请输入验证码'} | |||
captchaTextRender={(timing, count) => { | |||
if (timing) { | |||
return `${count} ${'获取验证码'}`; | |||
} | |||
return '获取验证码'; | |||
}} | |||
name="captcha" | |||
rules={[ | |||
{ | |||
required: true, | |||
message: '请输入验证码!', | |||
}, | |||
]} | |||
onGetCaptcha={async () => { | |||
message.success('获取验证码成功!验证码为:1234'); | |||
}} | |||
/> | |||
</> | |||
<div | |||
style={{ | |||
marginBlockEnd: 24, | |||
}} | |||
> | |||
<ProFormCheckbox noStyle name="autoLogin"> | |||
自动登录 | |||
</ProFormCheckbox> | |||
<a | |||
style={{ | |||
float: 'right', | |||
}} | |||
> | |||
忘记密码 | |||
</a> | |||
</div> | |||
</LoginForm> | |||
</div> | |||
</ProConfigProvider> | |||
); | |||
}; |
@@ -0,0 +1,121 @@ | |||
import { EllipsisOutlined, PlusOutlined } from '@ant-design/icons'; | |||
import type { ActionType, ProColumns } from '@ant-design/pro-components'; | |||
import { ProTable, TableDropdown, PageContainer } from '@ant-design/pro-components'; | |||
import { Button, Dropdown, Space, Tag } from 'antd'; | |||
import { useRef } from 'react'; | |||
export const waitTimePromise = async (time: number = 100) => { | |||
return new Promise((resolve) => { | |||
setTimeout(() => { | |||
resolve(true); | |||
}, time); | |||
}); | |||
}; | |||
export const waitTime = async (time: number = 100) => { | |||
await waitTimePromise(time); | |||
}; | |||
type GithubIssueItem = { | |||
url: string; | |||
id: number; | |||
number: number; | |||
title: string; | |||
labels: { | |||
name: string; | |||
color: string; | |||
}[]; | |||
state: string; | |||
comments: number; | |||
created_at: string; | |||
updated_at: string; | |||
closed_at?: string; | |||
}; | |||
const columns: ProColumns<GithubIssueItem>[] = [ | |||
{ | |||
dataIndex: 'index', | |||
valueType: 'indexBorder', | |||
width: 48, | |||
}, | |||
{ | |||
title: '标题', | |||
dataIndex: 'title', | |||
hideInSearch: true | |||
}, | |||
{ | |||
disable: true, | |||
title: '状态', | |||
dataIndex: 'state', | |||
}, | |||
{ | |||
disable: true, | |||
title: '标签', | |||
dataIndex: 'labels', | |||
}, | |||
{ | |||
title: '创建时间', | |||
key: 'showTime', | |||
dataIndex: 'created_at', | |||
}, | |||
{ | |||
title: '创建时间', | |||
dataIndex: 'created_at', | |||
valueType: 'dateRange', | |||
}, | |||
{ | |||
title: '操作', | |||
valueType: 'option', | |||
key: 'option', | |||
render: (text, record, _, action) => [ | |||
<a | |||
key="editable" | |||
onClick={() => { | |||
action?.startEditable?.(record.id); | |||
}} | |||
> | |||
编辑 | |||
</a>, | |||
<a href={record.url} target="_blank" rel="noopener noreferrer" key="view"> | |||
查看 | |||
</a>, | |||
<TableDropdown | |||
key="actionGroup" | |||
onSelect={() => action?.reload()} | |||
menus={[ | |||
{ key: 'copy', name: '复制' }, | |||
{ key: 'delete', name: '删除' }, | |||
]} | |||
/>, | |||
], | |||
}, | |||
]; | |||
export default () => { | |||
const actionRef = useRef<ActionType>(); | |||
return ( | |||
<> | |||
<PageContainer> | |||
<ProTable | |||
columns={columns} | |||
search={{title: false}} | |||
pagination={{ | |||
pageSize: 5, | |||
onChange: (page) => console.log(page), | |||
}} | |||
toolBarRender={() => [ | |||
<Button | |||
key="button" | |||
type="primary" | |||
> | |||
新建 | |||
</Button>, | |||
]} | |||
/> | |||
</PageContainer> | |||
</> | |||
); | |||
}; |
@@ -0,0 +1,223 @@ | |||
import { EllipsisOutlined, PlusOutlined } from '@ant-design/icons'; | |||
import type { ActionType, ProColumns } from '@ant-design/pro-components'; | |||
import { | |||
ProTable, TableDropdown, PageContainer, ModalForm, ProForm, | |||
ProFormDateRangePicker, | |||
ProFormSelect, | |||
ProFormText, | |||
} from '@ant-design/pro-components'; | |||
import { Button, Dropdown, Space, Tag, Form } from 'antd'; | |||
import { useRef } from 'react'; | |||
export const waitTimePromise = async (time: number = 100) => { | |||
return new Promise((resolve) => { | |||
setTimeout(() => { | |||
resolve(true); | |||
}, time); | |||
}); | |||
}; | |||
export const waitTime = async (time: number = 100) => { | |||
await waitTimePromise(time); | |||
}; | |||
type GithubIssueItem = { | |||
url: string; | |||
id: number; | |||
number: number; | |||
title: string; | |||
labels: { | |||
name: string; | |||
color: string; | |||
}[]; | |||
state: string; | |||
comments: number; | |||
created_at: string; | |||
updated_at: string; | |||
closed_at?: string; | |||
}; | |||
const columns: ProColumns<GithubIssueItem>[] = [ | |||
{ | |||
dataIndex: 'index', | |||
valueType: 'indexBorder', | |||
width: 48, | |||
}, | |||
{ | |||
title: '标题', | |||
dataIndex: 'title', | |||
hideInSearch: true | |||
}, | |||
{ | |||
disable: true, | |||
title: '状态', | |||
dataIndex: 'state', | |||
}, | |||
{ | |||
disable: true, | |||
title: '标签', | |||
dataIndex: 'labels', | |||
}, | |||
{ | |||
title: '创建时间', | |||
key: 'showTime', | |||
dataIndex: 'created_at', | |||
}, | |||
{ | |||
title: '创建时间', | |||
dataIndex: 'created_at', | |||
valueType: 'dateRange', | |||
}, | |||
{ | |||
title: '操作', | |||
valueType: 'option', | |||
key: 'option', | |||
render: (text, record, _, action) => [ | |||
<a | |||
key="editable" | |||
onClick={() => { | |||
action?.startEditable?.(record.id); | |||
}} | |||
> | |||
编辑 | |||
</a>, | |||
<a href={record.url} target="_blank" rel="noopener noreferrer" key="view"> | |||
查看 | |||
</a>, | |||
<TableDropdown | |||
key="actionGroup" | |||
onSelect={() => action?.reload()} | |||
menus={[ | |||
{ key: 'copy', name: '复制' }, | |||
{ key: 'delete', name: '删除' }, | |||
]} | |||
/>, | |||
], | |||
}, | |||
]; | |||
export default () => { | |||
const [form] = Form.useForm<{ name: string; company: string }>(); | |||
return ( | |||
<> | |||
<PageContainer> | |||
<ProTable | |||
columns={columns} | |||
pagination={{ | |||
pageSize: 5, | |||
onChange: (page) => console.log(page), | |||
}} | |||
toolBarRender={() => [ | |||
<ModalForm<{ | |||
name: string; | |||
company: string; | |||
}> | |||
title="新增百度接口" | |||
trigger={ | |||
<Button type="primary"> | |||
<PlusOutlined /> | |||
新建表单 | |||
</Button> | |||
} | |||
submitter={{ | |||
render: (props, defaultDoms) => { | |||
return [ | |||
<Button | |||
key="extra-reset" | |||
onClick={() => { | |||
props.reset(); | |||
}} | |||
> | |||
重置 | |||
</Button>, | |||
...defaultDoms, | |||
]; | |||
}, | |||
}} | |||
form={form} | |||
autoFocusFirstInput | |||
modalProps={{ | |||
destroyOnClose: true, | |||
onCancel: () => console.log('run'), | |||
}} | |||
submitTimeout={2000} | |||
onFinish={async (values) => { | |||
await waitTime(2000); | |||
console.log(values.name); | |||
return true; | |||
}} | |||
> | |||
<ProForm.Group> | |||
<ProFormText | |||
width="md" | |||
name="name" | |||
label="签约客户名称" | |||
tooltip="最长为 24 位" | |||
placeholder="请输入名称" | |||
/> | |||
<ProFormText | |||
width="md" | |||
name="company" | |||
label="我方公司名称" | |||
placeholder="请输入名称" | |||
/> | |||
</ProForm.Group> | |||
<ProForm.Group> | |||
<ProFormText | |||
width="md" | |||
name="contract" | |||
label="合同名称" | |||
placeholder="请输入名称" | |||
/> | |||
<ProFormDateRangePicker name="contractTime" label="合同生效时间" /> | |||
</ProForm.Group> | |||
<ProForm.Group> | |||
<ProFormSelect | |||
request={async () => [ | |||
{ | |||
value: 'chapter', | |||
label: '盖章后生效', | |||
}, | |||
]} | |||
width="xs" | |||
name="useMode" | |||
label="合同约定生效方式" | |||
/> | |||
<ProFormSelect | |||
width="xs" | |||
options={[ | |||
{ | |||
value: 'time', | |||
label: '履行完终止', | |||
}, | |||
]} | |||
name="unusedMode" | |||
label="合同约定失效效方式" | |||
/> | |||
</ProForm.Group> | |||
<ProFormText width="sm" name="id" label="主合同编号" /> | |||
<ProFormText | |||
name="project" | |||
disabled | |||
label="项目名称" | |||
initialValue="xxxx项目" | |||
/> | |||
<ProFormText | |||
width="xs" | |||
name="mangerName" | |||
disabled | |||
label="商务经理" | |||
initialValue="启途" | |||
/> | |||
</ModalForm> | |||
]} | |||
/> | |||
</PageContainer> | |||
</> | |||
); | |||
}; |
@@ -0,0 +1,148 @@ | |||
import { EllipsisOutlined, PlusOutlined } from '@ant-design/icons'; | |||
import type { ActionType, ProColumns } from '@ant-design/pro-components'; | |||
import { | |||
ProTable, TableDropdown, PageContainer, ModalForm, ProForm, | |||
ProFormDateRangePicker, | |||
ProFormSelect, | |||
ProFormText, | |||
} from '@ant-design/pro-components'; | |||
import { Button, Dropdown, Space, Tag, Form } from 'antd'; | |||
import { useRef, useState } from 'react'; | |||
export const waitTimePromise = async (time: number = 100) => { | |||
return new Promise((resolve) => { | |||
setTimeout(() => { | |||
resolve(true); | |||
}, time); | |||
}); | |||
}; | |||
export const waitTime = async (time: number = 100) => { | |||
await waitTimePromise(time); | |||
}; | |||
const columns: ProColumns[] = [ | |||
{ | |||
title: 'ID', | |||
dataIndex: 'id', | |||
}, | |||
{ | |||
title: '应用名', | |||
dataIndex: 'name', | |||
}, | |||
{ | |||
title: '备注', | |||
dataIndex: 'remark', | |||
}, | |||
{ | |||
title: '状态', | |||
dataIndex: 'state', | |||
}, | |||
{ | |||
title: 'AppId', | |||
dataIndex: 'app_id', | |||
}, | |||
{ | |||
title: 'ApiKey', | |||
dataIndex: 'api_key', | |||
}, | |||
{ | |||
title: 'SecretKey', | |||
dataIndex: 'secret_key', | |||
}, | |||
{ | |||
title: '操作', | |||
valueType: 'option', | |||
key: 'option', | |||
render: (text, record, _, action) => [ | |||
<a | |||
key="editable" | |||
onClick={() => { | |||
action?.startEditable?.(record.id); | |||
}} | |||
> | |||
编辑 | |||
</a>, | |||
], | |||
}, | |||
]; | |||
export default () => { | |||
const [form] = Form.useForm<BaiduType.form>(); | |||
const [data, setData] = useState([{id: 1}]) | |||
return ( | |||
<> | |||
<PageContainer> | |||
<ProTable | |||
dataSource={data} | |||
columns={columns} | |||
pagination={{ | |||
pageSize: 5, | |||
onChange: (page) => console.log(page), | |||
}} | |||
toolBarRender={() => [ | |||
<ModalForm<BaiduType.form> | |||
title="新增百度接口" | |||
trigger={ | |||
<Button type="primary"> | |||
<PlusOutlined /> | |||
新建表单 | |||
</Button> | |||
} | |||
submitter={{ | |||
render: (props, defaultDoms) => { | |||
return [ | |||
<Button | |||
key="extra-reset" | |||
onClick={() => { | |||
props.reset(); | |||
}} | |||
> | |||
重置 | |||
</Button>, | |||
...defaultDoms, | |||
]; | |||
}, | |||
}} | |||
form={form} | |||
autoFocusFirstInput | |||
modalProps={{ | |||
destroyOnClose: true, | |||
onCancel: () => console.log('run'), | |||
}} | |||
submitTimeout={2000} | |||
onFinish={async (values) => { | |||
await waitTime(2000); | |||
console.log(values.name); | |||
return true; | |||
}} | |||
> | |||
<ProFormText | |||
name="name" | |||
label="应用名" | |||
placeholder="请输入应用名" | |||
/> | |||
<ProFormText | |||
name="app_id" | |||
label="AppID" | |||
placeholder="请输入AppID" | |||
/> | |||
<ProFormText | |||
name="api_key" | |||
label="APIKEY" | |||
placeholder="请输入APIKEY" | |||
/> | |||
<ProFormText | |||
name="secret_key" | |||
label="SecretKey" | |||
placeholder="请输入SecretKey" | |||
/> | |||
</ModalForm> | |||
]} | |||
/> | |||
</PageContainer> | |||
</> | |||
); | |||
}; |
@@ -0,0 +1,121 @@ | |||
import { EllipsisOutlined, PlusOutlined } from '@ant-design/icons'; | |||
import type { ActionType, ProColumns } from '@ant-design/pro-components'; | |||
import { | |||
ProTable, TableDropdown, PageContainer, ModalForm, ProForm, | |||
ProFormDateRangePicker, | |||
ProFormSelect, | |||
ProFormText, | |||
} from '@ant-design/pro-components'; | |||
import { Button, Dropdown, Space, Tag, Form } from 'antd'; | |||
import { useRef, useState } from 'react'; | |||
export const waitTimePromise = async (time: number = 100) => { | |||
return new Promise((resolve) => { | |||
setTimeout(() => { | |||
resolve(true); | |||
}, time); | |||
}); | |||
}; | |||
export const waitTime = async (time: number = 100) => { | |||
await waitTimePromise(time); | |||
}; | |||
const columns: ProColumns[] = [ | |||
{ | |||
title: 'ID', | |||
dataIndex: 'id', | |||
}, | |||
{ | |||
title: '部门名称', | |||
dataIndex: 'title', | |||
}, | |||
{ | |||
title: '部门等级', | |||
dataIndex: 'level', | |||
}, | |||
{ | |||
title: '操作', | |||
valueType: 'option', | |||
key: 'option', | |||
render: (text, record, _, action) => [ | |||
<a | |||
key="editable" | |||
onClick={() => { | |||
action?.startEditable?.(record.id); | |||
}} | |||
> | |||
编辑 | |||
</a>, | |||
], | |||
}, | |||
]; | |||
export default () => { | |||
const [form] = Form.useForm<BaiduType.form>(); | |||
const [data, setData] = useState([{ id: 1 }]) | |||
return ( | |||
<> | |||
<PageContainer> | |||
<ProTable | |||
dataSource={data} | |||
columns={columns} | |||
pagination={{ | |||
pageSize: 5, | |||
onChange: (page) => console.log(page), | |||
}} | |||
toolBarRender={() => [ | |||
<ModalForm<ProjectType.form> | |||
title="新增部门" | |||
trigger={ | |||
<Button type="primary"> | |||
<PlusOutlined /> | |||
新建表单 | |||
</Button> | |||
} | |||
submitter={{ | |||
render: (props, defaultDoms) => { | |||
return [ | |||
<Button | |||
key="extra-reset" | |||
onClick={() => { | |||
props.reset(); | |||
}} | |||
> | |||
重置 | |||
</Button>, | |||
...defaultDoms, | |||
]; | |||
}, | |||
}} | |||
form={form} | |||
autoFocusFirstInput | |||
modalProps={{ | |||
destroyOnClose: true, | |||
onCancel: () => console.log('run'), | |||
}} | |||
submitTimeout={2000} | |||
onFinish={async (values) => { | |||
await waitTime(2000); | |||
console.log(values.name); | |||
return true; | |||
}} | |||
> | |||
<ProFormText | |||
name="title" | |||
label="部门名称" | |||
placeholder="请输入部门名称" | |||
/> | |||
<ProFormSelect | |||
name="level_name" | |||
label="部门等级" | |||
placeholder="请选择部门等级" | |||
/> | |||
</ModalForm> | |||
]} | |||
/> | |||
</PageContainer> | |||
</> | |||
); | |||
}; |
@@ -0,0 +1,179 @@ | |||
import { EllipsisOutlined, PlusOutlined } from '@ant-design/icons'; | |||
import type { ActionType, ProColumns } from '@ant-design/pro-components'; | |||
import { | |||
ProTable, TableDropdown, PageContainer, ModalForm, ProForm, | |||
ProFormDateRangePicker, | |||
ProFormSelect, | |||
ProFormText, | |||
} from '@ant-design/pro-components'; | |||
import { Button, Dropdown, Space, Tag, Form } from 'antd'; | |||
import { useRef, useState } from 'react'; | |||
export const waitTimePromise = async (time: number = 100) => { | |||
return new Promise((resolve) => { | |||
setTimeout(() => { | |||
resolve(true); | |||
}, time); | |||
}); | |||
}; | |||
export const waitTime = async (time: number = 100) => { | |||
await waitTimePromise(time); | |||
}; | |||
const columns: ProColumns[] = [ | |||
{ | |||
title: 'ID', | |||
dataIndex: 'id', | |||
}, | |||
{ | |||
title: '省份 (社区)', | |||
dataIndex: 'title', | |||
}, | |||
{ | |||
title: '上级', | |||
dataIndex: 'parent_id', | |||
}, | |||
{ | |||
title: '操作', | |||
valueType: 'option', | |||
key: 'option', | |||
render: (text, record, _, action) => [ | |||
<a | |||
key="editable" | |||
onClick={() => { | |||
action?.startEditable?.(record.id); | |||
}} | |||
> | |||
编辑 | |||
</a>, | |||
], | |||
}, | |||
]; | |||
export default () => { | |||
const [form] = Form.useForm<AreaType.form>(); | |||
const [data, setData] = useState([{ id: 1 }]) | |||
return ( | |||
<> | |||
<PageContainer> | |||
<ProTable | |||
dataSource={data} | |||
columns={columns} | |||
pagination={{ | |||
pageSize: 5, | |||
onChange: (page) => console.log(page), | |||
}} | |||
toolBarRender={() => [ | |||
<ModalForm<AreaType.form> | |||
title="新增地区" | |||
trigger={ | |||
<Button type="primary"> | |||
<PlusOutlined /> | |||
新建地区 | |||
</Button> | |||
} | |||
submitter={{ | |||
render: (props, defaultDoms) => { | |||
return [ | |||
<Button | |||
key="extra-reset" | |||
onClick={() => { | |||
props.reset(); | |||
}} | |||
> | |||
重置 | |||
</Button>, | |||
...defaultDoms, | |||
]; | |||
}, | |||
}} | |||
form={form} | |||
autoFocusFirstInput | |||
modalProps={{ | |||
destroyOnClose: true, | |||
onCancel: () => console.log('run'), | |||
}} | |||
submitTimeout={2000} | |||
onFinish={async (values) => { | |||
await waitTime(2000); | |||
console.log(values.title); | |||
return true; | |||
}} | |||
> | |||
<ProFormText | |||
name="title" | |||
label="地区名称" | |||
placeholder="请输入地区名称" | |||
/> | |||
<ProFormSelect | |||
name="level_name" | |||
label="选择归属地" | |||
placeholder="请选择归属地" | |||
/> | |||
<ProFormSelect | |||
name="is_community" | |||
label="是否是社区" | |||
placeholder="请选择是否是社区" | |||
/> | |||
</ModalForm>, | |||
<ModalForm<AreaType.form> | |||
title="导入街道(镇)" | |||
trigger={ | |||
<Button type="primary"> | |||
<PlusOutlined /> | |||
导入街道(镇) | |||
</Button> | |||
} | |||
submitter={{ | |||
render: (props, defaultDoms) => { | |||
return [ | |||
<Button | |||
key="extra-reset" | |||
onClick={() => { | |||
props.reset(); | |||
}} | |||
> | |||
重置 | |||
</Button>, | |||
...defaultDoms, | |||
]; | |||
}, | |||
}} | |||
form={form} | |||
autoFocusFirstInput | |||
modalProps={{ | |||
destroyOnClose: true, | |||
onCancel: () => console.log('run'), | |||
}} | |||
submitTimeout={2000} | |||
onFinish={async (values) => { | |||
await waitTime(2000); | |||
console.log(values.title); | |||
return true; | |||
}} | |||
> | |||
<ProFormText | |||
name="title" | |||
label="地区名称" | |||
placeholder="请输入地区名称" | |||
/> | |||
<ProFormSelect | |||
name="level_name" | |||
label="选择归属地" | |||
placeholder="请选择归属地" | |||
/> | |||
<ProFormSelect | |||
name="is_community" | |||
label="是否是社区" | |||
placeholder="请选择是否是社区" | |||
/> | |||
</ModalForm> | |||
]} | |||
/> | |||
</PageContainer> | |||
</> | |||
); | |||
}; | |||
@@ -0,0 +1,121 @@ | |||
import { EllipsisOutlined, PlusOutlined } from '@ant-design/icons'; | |||
import type { ActionType, ProColumns } from '@ant-design/pro-components'; | |||
import { | |||
ProTable, TableDropdown, PageContainer, ModalForm, ProForm, | |||
ProFormDateRangePicker, | |||
ProFormSelect, | |||
ProFormText, | |||
} from '@ant-design/pro-components'; | |||
import { Button, Dropdown, Space, Tag, Form } from 'antd'; | |||
import { useRef, useState } from 'react'; | |||
export const waitTimePromise = async (time: number = 100) => { | |||
return new Promise((resolve) => { | |||
setTimeout(() => { | |||
resolve(true); | |||
}, time); | |||
}); | |||
}; | |||
export const waitTime = async (time: number = 100) => { | |||
await waitTimePromise(time); | |||
}; | |||
const columns: ProColumns[] = [ | |||
{ | |||
title: 'ID', | |||
dataIndex: 'id', | |||
}, | |||
{ | |||
title: '部门名称', | |||
dataIndex: 'title', | |||
}, | |||
{ | |||
title: '部门等级', | |||
dataIndex: 'level', | |||
}, | |||
{ | |||
title: '操作', | |||
valueType: 'option', | |||
key: 'option', | |||
render: (text, record, _, action) => [ | |||
<a | |||
key="editable" | |||
onClick={() => { | |||
action?.startEditable?.(record.id); | |||
}} | |||
> | |||
编辑 | |||
</a>, | |||
], | |||
}, | |||
]; | |||
export default () => { | |||
const [form] = Form.useForm<BaiduType.form>(); | |||
const [data, setData] = useState([{ id: 1 }]) | |||
return ( | |||
<> | |||
<PageContainer> | |||
<ProTable | |||
dataSource={data} | |||
columns={columns} | |||
pagination={{ | |||
pageSize: 5, | |||
onChange: (page) => console.log(page), | |||
}} | |||
toolBarRender={() => [ | |||
<ModalForm<ProjectType.form> | |||
title="新增部门" | |||
trigger={ | |||
<Button type="primary"> | |||
<PlusOutlined /> | |||
新建表单 | |||
</Button> | |||
} | |||
submitter={{ | |||
render: (props, defaultDoms) => { | |||
return [ | |||
<Button | |||
key="extra-reset" | |||
onClick={() => { | |||
props.reset(); | |||
}} | |||
> | |||
重置 | |||
</Button>, | |||
...defaultDoms, | |||
]; | |||
}, | |||
}} | |||
form={form} | |||
autoFocusFirstInput | |||
modalProps={{ | |||
destroyOnClose: true, | |||
onCancel: () => console.log('run'), | |||
}} | |||
submitTimeout={2000} | |||
onFinish={async (values) => { | |||
await waitTime(2000); | |||
console.log(values.name); | |||
return true; | |||
}} | |||
> | |||
<ProFormText | |||
name="title" | |||
label="部门名称" | |||
placeholder="请输入部门名称" | |||
/> | |||
<ProFormSelect | |||
name="level_name" | |||
label="部门等级" | |||
placeholder="请选择部门等级" | |||
/> | |||
</ModalForm> | |||
]} | |||
/> | |||
</PageContainer> | |||
</> | |||
); | |||
}; |
@@ -0,0 +1,121 @@ | |||
import { EllipsisOutlined, PlusOutlined } from '@ant-design/icons'; | |||
import type { ActionType, ProColumns } from '@ant-design/pro-components'; | |||
import { | |||
ProTable, TableDropdown, PageContainer, ModalForm, ProForm, | |||
ProFormDateRangePicker, | |||
ProFormSelect, | |||
ProFormText, | |||
} from '@ant-design/pro-components'; | |||
import { Button, Dropdown, Space, Tag, Form } from 'antd'; | |||
import { useRef, useState } from 'react'; | |||
export const waitTimePromise = async (time: number = 100) => { | |||
return new Promise((resolve) => { | |||
setTimeout(() => { | |||
resolve(true); | |||
}, time); | |||
}); | |||
}; | |||
export const waitTime = async (time: number = 100) => { | |||
await waitTimePromise(time); | |||
}; | |||
const columns: ProColumns[] = [ | |||
{ | |||
title: 'ID', | |||
dataIndex: 'id', | |||
}, | |||
{ | |||
title: '部门名称', | |||
dataIndex: 'title', | |||
}, | |||
{ | |||
title: '部门等级', | |||
dataIndex: 'level', | |||
}, | |||
{ | |||
title: '操作', | |||
valueType: 'option', | |||
key: 'option', | |||
render: (text, record, _, action) => [ | |||
<a | |||
key="editable" | |||
onClick={() => { | |||
action?.startEditable?.(record.id); | |||
}} | |||
> | |||
编辑 | |||
</a>, | |||
], | |||
}, | |||
]; | |||
export default () => { | |||
const [form] = Form.useForm<BaiduType.form>(); | |||
const [data, setData] = useState([{ id: 1 }]) | |||
return ( | |||
<> | |||
<PageContainer> | |||
<ProTable | |||
dataSource={data} | |||
columns={columns} | |||
pagination={{ | |||
pageSize: 5, | |||
onChange: (page) => console.log(page), | |||
}} | |||
toolBarRender={() => [ | |||
<ModalForm<ProjectType.form> | |||
title="新增部门" | |||
trigger={ | |||
<Button type="primary"> | |||
<PlusOutlined /> | |||
新建表单 | |||
</Button> | |||
} | |||
submitter={{ | |||
render: (props, defaultDoms) => { | |||
return [ | |||
<Button | |||
key="extra-reset" | |||
onClick={() => { | |||
props.reset(); | |||
}} | |||
> | |||
重置 | |||
</Button>, | |||
...defaultDoms, | |||
]; | |||
}, | |||
}} | |||
form={form} | |||
autoFocusFirstInput | |||
modalProps={{ | |||
destroyOnClose: true, | |||
onCancel: () => console.log('run'), | |||
}} | |||
submitTimeout={2000} | |||
onFinish={async (values) => { | |||
await waitTime(2000); | |||
console.log(values.name); | |||
return true; | |||
}} | |||
> | |||
<ProFormText | |||
name="title" | |||
label="部门名称" | |||
placeholder="请输入部门名称" | |||
/> | |||
<ProFormSelect | |||
name="level_name" | |||
label="部门等级" | |||
placeholder="请选择部门等级" | |||
/> | |||
</ModalForm> | |||
]} | |||
/> | |||
</PageContainer> | |||
</> | |||
); | |||
}; |
@@ -0,0 +1,170 @@ | |||
import { EllipsisOutlined, PlusOutlined } from '@ant-design/icons'; | |||
import type { ActionType, ProColumns } from '@ant-design/pro-components'; | |||
import { | |||
ProTable, TableDropdown, PageContainer, ModalForm, ProForm, | |||
ProFormDateRangePicker, | |||
ProFormSelect, | |||
ProFormText, | |||
} from '@ant-design/pro-components'; | |||
import { Button, Dropdown, Space, Tag, Form } from 'antd'; | |||
import { useRef, useState } from 'react'; | |||
export const waitTimePromise = async (time: number = 100) => { | |||
return new Promise((resolve) => { | |||
setTimeout(() => { | |||
resolve(true); | |||
}, time); | |||
}); | |||
}; | |||
export const waitTime = async (time: number = 100) => { | |||
await waitTimePromise(time); | |||
}; | |||
const columns: ProColumns[] = [ | |||
{ | |||
title: 'ID', | |||
dataIndex: 'id', | |||
}, | |||
{ | |||
title: '姓名', | |||
dataIndex: 'name', | |||
}, | |||
{ | |||
title: '手机号', | |||
dataIndex: 'phone', | |||
}, | |||
{ | |||
title: '工号', | |||
dataIndex: 'number', | |||
}, | |||
{ | |||
title: '所属辖区', | |||
dataIndex: 'station.name', | |||
}, | |||
{ | |||
title: '所属部门', | |||
dataIndex: 'department.title', | |||
}, | |||
{ | |||
title: '审核状态', | |||
dataIndex: 'state', | |||
valueEnum: { | |||
open: { | |||
text: '待审核', | |||
status: 'Error', | |||
}, | |||
closed: { | |||
text: '已审核', | |||
status: 'Success', | |||
disabled: true, | |||
}, | |||
processing: { | |||
text: '不通过', | |||
status: 'Processing', | |||
}, | |||
}, | |||
}, | |||
{ | |||
title: '门禁图像', | |||
dataIndex: 'face_image', | |||
}, | |||
{ | |||
title: '操作', | |||
valueType: 'option', | |||
key: 'option', | |||
render: (text, record, _, action) => [ | |||
<a | |||
key="editable" | |||
onClick={() => { | |||
action?.startEditable?.(record.id); | |||
}} | |||
> | |||
编辑 | |||
</a>, | |||
], | |||
}, | |||
]; | |||
export default () => { | |||
const [form] = Form.useForm<BaiduType.form>(); | |||
const [data, setData] = useState([{ id: 1 }]) | |||
return ( | |||
<> | |||
<PageContainer> | |||
<ProTable | |||
dataSource={data} | |||
columns={columns} | |||
pagination={{ | |||
pageSize: 5, | |||
onChange: (page) => console.log(page), | |||
}} | |||
toolBarRender={() => [ | |||
<ModalForm<ProjectType.form> | |||
title="新增用户信息" | |||
trigger={ | |||
<Button type="primary"> | |||
<PlusOutlined /> | |||
新建表单 | |||
</Button> | |||
} | |||
submitter={{ | |||
render: (props, defaultDoms) => { | |||
return [ | |||
<Button | |||
key="extra-reset" | |||
onClick={() => { | |||
props.reset(); | |||
}} | |||
> | |||
重置 | |||
</Button>, | |||
...defaultDoms, | |||
]; | |||
}, | |||
}} | |||
form={form} | |||
autoFocusFirstInput | |||
modalProps={{ | |||
destroyOnClose: true, | |||
onCancel: () => console.log('run'), | |||
}} | |||
submitTimeout={2000} | |||
onFinish={async (values) => { | |||
await waitTime(2000); | |||
console.log(values.name); | |||
return true; | |||
}} | |||
> | |||
<ProFormText | |||
name="name" | |||
label="用户姓名" | |||
placeholder="请输入用户姓名" | |||
/> | |||
<ProFormText | |||
name="name" | |||
label="联系方式" | |||
placeholder="请输入联系方式" | |||
/> <ProFormText | |||
name="name" | |||
label="工号" | |||
placeholder="请输入工号" | |||
/> | |||
<ProFormSelect | |||
name="aip_id" | |||
label="所属辖区" | |||
placeholder="请选择所属辖区" | |||
/> | |||
<ProFormSelect | |||
name="aip_id" | |||
label="所属部门:" | |||
placeholder="请选择所属部门" | |||
/> | |||
</ModalForm> | |||
]} | |||
/> | |||
</PageContainer> | |||
</> | |||
); | |||
}; |
@@ -0,0 +1,133 @@ | |||
import { EllipsisOutlined, PlusOutlined } from '@ant-design/icons'; | |||
import type { ActionType, ProColumns } from '@ant-design/pro-components'; | |||
import { | |||
ProTable, TableDropdown, PageContainer, ModalForm, ProForm, | |||
ProFormDateRangePicker, | |||
ProFormSelect, | |||
ProFormText, | |||
} from '@ant-design/pro-components'; | |||
import { Button, Dropdown, Space, Tag, Form } from 'antd'; | |||
import { useRef, useState } from 'react'; | |||
export const waitTimePromise = async (time: number = 100) => { | |||
return new Promise((resolve) => { | |||
setTimeout(() => { | |||
resolve(true); | |||
}, time); | |||
}); | |||
}; | |||
export const waitTime = async (time: number = 100) => { | |||
await waitTimePromise(time); | |||
}; | |||
const columns: ProColumns[] = [ | |||
{ | |||
title: 'ID', | |||
dataIndex: 'id', | |||
}, | |||
{ | |||
title: '企业名称', | |||
dataIndex: 'name', | |||
}, | |||
{ | |||
title: '来源', | |||
dataIndex: 'state', | |||
}, | |||
{ | |||
title: '登录次数', | |||
dataIndex: 'app_id', | |||
}, | |||
{ | |||
title: 'ApiKey', | |||
dataIndex: 'api_key', | |||
}, | |||
{ | |||
title: 'SecretKey', | |||
dataIndex: 'secret_key', | |||
}, | |||
{ | |||
title: '操作', | |||
valueType: 'option', | |||
key: 'option', | |||
render: (text, record, _, action) => [ | |||
<a | |||
key="editable" | |||
onClick={() => { | |||
action?.startEditable?.(record.id); | |||
}} | |||
> | |||
编辑 | |||
</a>, | |||
], | |||
}, | |||
]; | |||
export default () => { | |||
const [form] = Form.useForm<ProjectType.form>(); | |||
const [data, setData] = useState([{id: 1}]) | |||
return ( | |||
<> | |||
<PageContainer> | |||
<ProTable | |||
dataSource={data} | |||
columns={columns} | |||
pagination={{ | |||
pageSize: 5, | |||
onChange: (page) => console.log(page), | |||
}} | |||
toolBarRender={() => [ | |||
<ModalForm<ProjectType.form> | |||
title="新增项目" | |||
trigger={ | |||
<Button type="primary"> | |||
<PlusOutlined /> | |||
新建表单 | |||
</Button> | |||
} | |||
submitter={{ | |||
render: (props, defaultDoms) => { | |||
return [ | |||
<Button | |||
key="extra-reset" | |||
onClick={() => { | |||
props.reset(); | |||
}} | |||
> | |||
重置 | |||
</Button>, | |||
...defaultDoms, | |||
]; | |||
}, | |||
}} | |||
form={form} | |||
autoFocusFirstInput | |||
modalProps={{ | |||
destroyOnClose: true, | |||
onCancel: () => console.log('run'), | |||
}} | |||
submitTimeout={2000} | |||
onFinish={async (values) => { | |||
await waitTime(2000); | |||
console.log(values.name); | |||
return true; | |||
}} | |||
> | |||
<ProFormText | |||
name="name" | |||
label="项目名" | |||
placeholder="请输入项目名" | |||
/> | |||
<ProFormSelect | |||
name="aip_id" | |||
label="选择百度接口" | |||
placeholder="请选择百度接口" | |||
/> | |||
</ModalForm> | |||
]} | |||
/> | |||
</PageContainer> | |||
</> | |||
); | |||
}; |
@@ -0,0 +1,133 @@ | |||
import { EllipsisOutlined, PlusOutlined } from '@ant-design/icons'; | |||
import type { ActionType, ProColumns } from '@ant-design/pro-components'; | |||
import { | |||
ProTable, TableDropdown, PageContainer, ModalForm, ProForm, | |||
ProFormDateRangePicker, | |||
ProFormSelect, | |||
ProFormText, | |||
} from '@ant-design/pro-components'; | |||
import { Button, Dropdown, Space, Tag, Form } from 'antd'; | |||
import { useRef, useState } from 'react'; | |||
export const waitTimePromise = async (time: number = 100) => { | |||
return new Promise((resolve) => { | |||
setTimeout(() => { | |||
resolve(true); | |||
}, time); | |||
}); | |||
}; | |||
export const waitTime = async (time: number = 100) => { | |||
await waitTimePromise(time); | |||
}; | |||
const columns: ProColumns[] = [ | |||
{ | |||
title: 'ID', | |||
dataIndex: 'id', | |||
}, | |||
{ | |||
title: '企业名称', | |||
dataIndex: 'name', | |||
}, | |||
{ | |||
title: '来源', | |||
dataIndex: 'state', | |||
}, | |||
{ | |||
title: '登录次数', | |||
dataIndex: 'app_id', | |||
}, | |||
{ | |||
title: 'ApiKey', | |||
dataIndex: 'api_key', | |||
}, | |||
{ | |||
title: 'SecretKey', | |||
dataIndex: 'secret_key', | |||
}, | |||
{ | |||
title: '操作', | |||
valueType: 'option', | |||
key: 'option', | |||
render: (text, record, _, action) => [ | |||
<a | |||
key="editable" | |||
onClick={() => { | |||
action?.startEditable?.(record.id); | |||
}} | |||
> | |||
编辑 | |||
</a>, | |||
], | |||
}, | |||
]; | |||
export default () => { | |||
const [form] = Form.useForm<ProjectType.form>(); | |||
const [data, setData] = useState([{id: 1}]) | |||
return ( | |||
<> | |||
<PageContainer> | |||
<ProTable | |||
dataSource={data} | |||
columns={columns} | |||
pagination={{ | |||
pageSize: 5, | |||
onChange: (page) => console.log(page), | |||
}} | |||
toolBarRender={() => [ | |||
<ModalForm<ProjectType.form> | |||
title="新增项目" | |||
trigger={ | |||
<Button type="primary"> | |||
<PlusOutlined /> | |||
新建表单 | |||
</Button> | |||
} | |||
submitter={{ | |||
render: (props, defaultDoms) => { | |||
return [ | |||
<Button | |||
key="extra-reset" | |||
onClick={() => { | |||
props.reset(); | |||
}} | |||
> | |||
重置 | |||
</Button>, | |||
...defaultDoms, | |||
]; | |||
}, | |||
}} | |||
form={form} | |||
autoFocusFirstInput | |||
modalProps={{ | |||
destroyOnClose: true, | |||
onCancel: () => console.log('run'), | |||
}} | |||
submitTimeout={2000} | |||
onFinish={async (values) => { | |||
await waitTime(2000); | |||
console.log(values.name); | |||
return true; | |||
}} | |||
> | |||
<ProFormText | |||
name="name" | |||
label="项目名" | |||
placeholder="请输入项目名" | |||
/> | |||
<ProFormSelect | |||
name="aip_id" | |||
label="选择百度接口" | |||
placeholder="请选择百度接口" | |||
/> | |||
</ModalForm> | |||
]} | |||
/> | |||
</PageContainer> | |||
</> | |||
); | |||
}; |
@@ -0,0 +1,133 @@ | |||
import { EllipsisOutlined, PlusOutlined } from '@ant-design/icons'; | |||
import type { ActionType, ProColumns } from '@ant-design/pro-components'; | |||
import { | |||
ProTable, TableDropdown, PageContainer, ModalForm, ProForm, | |||
ProFormDateRangePicker, | |||
ProFormSelect, | |||
ProFormText, | |||
} from '@ant-design/pro-components'; | |||
import { Button, Dropdown, Space, Tag, Form } from 'antd'; | |||
import { useRef, useState } from 'react'; | |||
export const waitTimePromise = async (time: number = 100) => { | |||
return new Promise((resolve) => { | |||
setTimeout(() => { | |||
resolve(true); | |||
}, time); | |||
}); | |||
}; | |||
export const waitTime = async (time: number = 100) => { | |||
await waitTimePromise(time); | |||
}; | |||
const columns: ProColumns[] = [ | |||
{ | |||
title: 'ID', | |||
dataIndex: 'id', | |||
}, | |||
{ | |||
title: '企业名称', | |||
dataIndex: 'name', | |||
}, | |||
{ | |||
title: '来源', | |||
dataIndex: 'state', | |||
}, | |||
{ | |||
title: '登录次数', | |||
dataIndex: 'app_id', | |||
}, | |||
{ | |||
title: 'ApiKey', | |||
dataIndex: 'api_key', | |||
}, | |||
{ | |||
title: 'SecretKey', | |||
dataIndex: 'secret_key', | |||
}, | |||
{ | |||
title: '操作', | |||
valueType: 'option', | |||
key: 'option', | |||
render: (text, record, _, action) => [ | |||
<a | |||
key="editable" | |||
onClick={() => { | |||
action?.startEditable?.(record.id); | |||
}} | |||
> | |||
编辑 | |||
</a>, | |||
], | |||
}, | |||
]; | |||
export default () => { | |||
const [form] = Form.useForm<ProjectType.form>(); | |||
const [data, setData] = useState([{id: 1}]) | |||
return ( | |||
<> | |||
<PageContainer> | |||
<ProTable | |||
dataSource={data} | |||
columns={columns} | |||
pagination={{ | |||
pageSize: 5, | |||
onChange: (page) => console.log(page), | |||
}} | |||
toolBarRender={() => [ | |||
<ModalForm<ProjectType.form> | |||
title="新增项目" | |||
trigger={ | |||
<Button type="primary"> | |||
<PlusOutlined /> | |||
新建表单 | |||
</Button> | |||
} | |||
submitter={{ | |||
render: (props, defaultDoms) => { | |||
return [ | |||
<Button | |||
key="extra-reset" | |||
onClick={() => { | |||
props.reset(); | |||
}} | |||
> | |||
重置 | |||
</Button>, | |||
...defaultDoms, | |||
]; | |||
}, | |||
}} | |||
form={form} | |||
autoFocusFirstInput | |||
modalProps={{ | |||
destroyOnClose: true, | |||
onCancel: () => console.log('run'), | |||
}} | |||
submitTimeout={2000} | |||
onFinish={async (values) => { | |||
await waitTime(2000); | |||
console.log(values.name); | |||
return true; | |||
}} | |||
> | |||
<ProFormText | |||
name="name" | |||
label="项目名" | |||
placeholder="请输入项目名" | |||
/> | |||
<ProFormSelect | |||
name="aip_id" | |||
label="选择百度接口" | |||
placeholder="请选择百度接口" | |||
/> | |||
</ModalForm> | |||
]} | |||
/> | |||
</PageContainer> | |||
</> | |||
); | |||
}; |
@@ -0,0 +1,133 @@ | |||
import { EllipsisOutlined, PlusOutlined } from '@ant-design/icons'; | |||
import type { ActionType, ProColumns } from '@ant-design/pro-components'; | |||
import { | |||
ProTable, TableDropdown, PageContainer, ModalForm, ProForm, | |||
ProFormDateRangePicker, | |||
ProFormSelect, | |||
ProFormText, | |||
} from '@ant-design/pro-components'; | |||
import { Button, Dropdown, Space, Tag, Form } from 'antd'; | |||
import { useRef, useState } from 'react'; | |||
export const waitTimePromise = async (time: number = 100) => { | |||
return new Promise((resolve) => { | |||
setTimeout(() => { | |||
resolve(true); | |||
}, time); | |||
}); | |||
}; | |||
export const waitTime = async (time: number = 100) => { | |||
await waitTimePromise(time); | |||
}; | |||
const columns: ProColumns[] = [ | |||
{ | |||
title: 'ID', | |||
dataIndex: 'id', | |||
}, | |||
{ | |||
title: '企业名称', | |||
dataIndex: 'name', | |||
}, | |||
{ | |||
title: '来源', | |||
dataIndex: 'state', | |||
}, | |||
{ | |||
title: '登录次数', | |||
dataIndex: 'app_id', | |||
}, | |||
{ | |||
title: 'ApiKey', | |||
dataIndex: 'api_key', | |||
}, | |||
{ | |||
title: 'SecretKey', | |||
dataIndex: 'secret_key', | |||
}, | |||
{ | |||
title: '操作', | |||
valueType: 'option', | |||
key: 'option', | |||
render: (text, record, _, action) => [ | |||
<a | |||
key="editable" | |||
onClick={() => { | |||
action?.startEditable?.(record.id); | |||
}} | |||
> | |||
编辑 | |||
</a>, | |||
], | |||
}, | |||
]; | |||
export default () => { | |||
const [form] = Form.useForm<ProjectType.form>(); | |||
const [data, setData] = useState([{id: 1}]) | |||
return ( | |||
<> | |||
<PageContainer> | |||
<ProTable | |||
dataSource={data} | |||
columns={columns} | |||
pagination={{ | |||
pageSize: 5, | |||
onChange: (page) => console.log(page), | |||
}} | |||
toolBarRender={() => [ | |||
<ModalForm<ProjectType.form> | |||
title="新增项目" | |||
trigger={ | |||
<Button type="primary"> | |||
<PlusOutlined /> | |||
新建表单 | |||
</Button> | |||
} | |||
submitter={{ | |||
render: (props, defaultDoms) => { | |||
return [ | |||
<Button | |||
key="extra-reset" | |||
onClick={() => { | |||
props.reset(); | |||
}} | |||
> | |||
重置 | |||
</Button>, | |||
...defaultDoms, | |||
]; | |||
}, | |||
}} | |||
form={form} | |||
autoFocusFirstInput | |||
modalProps={{ | |||
destroyOnClose: true, | |||
onCancel: () => console.log('run'), | |||
}} | |||
submitTimeout={2000} | |||
onFinish={async (values) => { | |||
await waitTime(2000); | |||
console.log(values.name); | |||
return true; | |||
}} | |||
> | |||
<ProFormText | |||
name="name" | |||
label="项目名" | |||
placeholder="请输入项目名" | |||
/> | |||
<ProFormSelect | |||
name="aip_id" | |||
label="选择百度接口" | |||
placeholder="请选择百度接口" | |||
/> | |||
</ModalForm> | |||
]} | |||
/> | |||
</PageContainer> | |||
</> | |||
); | |||
}; |
@@ -0,0 +1,133 @@ | |||
import { EllipsisOutlined, PlusOutlined } from '@ant-design/icons'; | |||
import type { ActionType, ProColumns } from '@ant-design/pro-components'; | |||
import { | |||
ProTable, TableDropdown, PageContainer, ModalForm, ProForm, | |||
ProFormDateRangePicker, | |||
ProFormSelect, | |||
ProFormText, | |||
} from '@ant-design/pro-components'; | |||
import { Button, Dropdown, Space, Tag, Form } from 'antd'; | |||
import { useRef, useState } from 'react'; | |||
export const waitTimePromise = async (time: number = 100) => { | |||
return new Promise((resolve) => { | |||
setTimeout(() => { | |||
resolve(true); | |||
}, time); | |||
}); | |||
}; | |||
export const waitTime = async (time: number = 100) => { | |||
await waitTimePromise(time); | |||
}; | |||
const columns: ProColumns[] = [ | |||
{ | |||
title: 'ID', | |||
dataIndex: 'id', | |||
}, | |||
{ | |||
title: '项目名称', | |||
dataIndex: 'name', | |||
}, | |||
{ | |||
title: '状态', | |||
dataIndex: 'state', | |||
}, | |||
{ | |||
title: 'AppId', | |||
dataIndex: 'app_id', | |||
}, | |||
{ | |||
title: 'ApiKey', | |||
dataIndex: 'api_key', | |||
}, | |||
{ | |||
title: 'SecretKey', | |||
dataIndex: 'secret_key', | |||
}, | |||
{ | |||
title: '操作', | |||
valueType: 'option', | |||
key: 'option', | |||
render: (text, record, _, action) => [ | |||
<a | |||
key="editable" | |||
onClick={() => { | |||
action?.startEditable?.(record.id); | |||
}} | |||
> | |||
编辑 | |||
</a>, | |||
], | |||
}, | |||
]; | |||
export default () => { | |||
const [form] = Form.useForm<ProjectType.form>(); | |||
const [data, setData] = useState([{id: 1}]) | |||
return ( | |||
<> | |||
<PageContainer> | |||
<ProTable | |||
dataSource={data} | |||
columns={columns} | |||
pagination={{ | |||
pageSize: 5, | |||
onChange: (page) => console.log(page), | |||
}} | |||
toolBarRender={() => [ | |||
<ModalForm<ProjectType.form> | |||
title="新增项目" | |||
trigger={ | |||
<Button type="primary"> | |||
<PlusOutlined /> | |||
新建表单 | |||
</Button> | |||
} | |||
submitter={{ | |||
render: (props, defaultDoms) => { | |||
return [ | |||
<Button | |||
key="extra-reset" | |||
onClick={() => { | |||
props.reset(); | |||
}} | |||
> | |||
重置 | |||
</Button>, | |||
...defaultDoms, | |||
]; | |||
}, | |||
}} | |||
form={form} | |||
autoFocusFirstInput | |||
modalProps={{ | |||
destroyOnClose: true, | |||
onCancel: () => console.log('run'), | |||
}} | |||
submitTimeout={2000} | |||
onFinish={async (values) => { | |||
await waitTime(2000); | |||
console.log(values.name); | |||
return true; | |||
}} | |||
> | |||
<ProFormText | |||
name="name" | |||
label="项目名" | |||
placeholder="请输入项目名" | |||
/> | |||
<ProFormSelect | |||
name="aip_id" | |||
label="选择百度接口" | |||
placeholder="请选择百度接口" | |||
/> | |||
</ModalForm> | |||
]} | |||
/> | |||
</PageContainer> | |||
</> | |||
); | |||
}; |
@@ -0,0 +1,133 @@ | |||
import { EllipsisOutlined, PlusOutlined } from '@ant-design/icons'; | |||
import type { ActionType, ProColumns } from '@ant-design/pro-components'; | |||
import { | |||
ProTable, TableDropdown, PageContainer, ModalForm, ProForm, | |||
ProFormDateRangePicker, | |||
ProFormSelect, | |||
ProFormText, | |||
} from '@ant-design/pro-components'; | |||
import { Button, Dropdown, Space, Tag, Form } from 'antd'; | |||
import { useRef, useState } from 'react'; | |||
export const waitTimePromise = async (time: number = 100) => { | |||
return new Promise((resolve) => { | |||
setTimeout(() => { | |||
resolve(true); | |||
}, time); | |||
}); | |||
}; | |||
export const waitTime = async (time: number = 100) => { | |||
await waitTimePromise(time); | |||
}; | |||
const columns: ProColumns[] = [ | |||
{ | |||
title: 'ID', | |||
dataIndex: 'id', | |||
}, | |||
{ | |||
title: '项目名称', | |||
dataIndex: 'name', | |||
}, | |||
{ | |||
title: '状态', | |||
dataIndex: 'state', | |||
}, | |||
{ | |||
title: 'AppId', | |||
dataIndex: 'app_id', | |||
}, | |||
{ | |||
title: 'ApiKey', | |||
dataIndex: 'api_key', | |||
}, | |||
{ | |||
title: 'SecretKey', | |||
dataIndex: 'secret_key', | |||
}, | |||
{ | |||
title: '操作', | |||
valueType: 'option', | |||
key: 'option', | |||
render: (text, record, _, action) => [ | |||
<a | |||
key="editable" | |||
onClick={() => { | |||
action?.startEditable?.(record.id); | |||
}} | |||
> | |||
编辑 | |||
</a>, | |||
], | |||
}, | |||
]; | |||
export default () => { | |||
const [form] = Form.useForm<ProjectType.form>(); | |||
const [data, setData] = useState([{id: 1}]) | |||
return ( | |||
<> | |||
<PageContainer> | |||
<ProTable | |||
dataSource={data} | |||
columns={columns} | |||
pagination={{ | |||
pageSize: 5, | |||
onChange: (page) => console.log(page), | |||
}} | |||
toolBarRender={() => [ | |||
<ModalForm<ProjectType.form> | |||
title="新增项目" | |||
trigger={ | |||
<Button type="primary"> | |||
<PlusOutlined /> | |||
新建表单 | |||
</Button> | |||
} | |||
submitter={{ | |||
render: (props, defaultDoms) => { | |||
return [ | |||
<Button | |||
key="extra-reset" | |||
onClick={() => { | |||
props.reset(); | |||
}} | |||
> | |||
重置 | |||
</Button>, | |||
...defaultDoms, | |||
]; | |||
}, | |||
}} | |||
form={form} | |||
autoFocusFirstInput | |||
modalProps={{ | |||
destroyOnClose: true, | |||
onCancel: () => console.log('run'), | |||
}} | |||
submitTimeout={2000} | |||
onFinish={async (values) => { | |||
await waitTime(2000); | |||
console.log(values.name); | |||
return true; | |||
}} | |||
> | |||
<ProFormText | |||
name="name" | |||
label="项目名" | |||
placeholder="请输入项目名" | |||
/> | |||
<ProFormSelect | |||
name="aip_id" | |||
label="选择百度接口" | |||
placeholder="请选择百度接口" | |||
/> | |||
</ModalForm> | |||
]} | |||
/> | |||
</PageContainer> | |||
</> | |||
); | |||
}; |
@@ -0,0 +1,133 @@ | |||
import { EllipsisOutlined, PlusOutlined } from '@ant-design/icons'; | |||
import type { ActionType, ProColumns } from '@ant-design/pro-components'; | |||
import { | |||
ProTable, TableDropdown, PageContainer, ModalForm, ProForm, | |||
ProFormDateRangePicker, | |||
ProFormSelect, | |||
ProFormText, | |||
} from '@ant-design/pro-components'; | |||
import { Button, Dropdown, Space, Tag, Form } from 'antd'; | |||
import { useRef, useState } from 'react'; | |||
export const waitTimePromise = async (time: number = 100) => { | |||
return new Promise((resolve) => { | |||
setTimeout(() => { | |||
resolve(true); | |||
}, time); | |||
}); | |||
}; | |||
export const waitTime = async (time: number = 100) => { | |||
await waitTimePromise(time); | |||
}; | |||
const columns: ProColumns[] = [ | |||
{ | |||
title: 'ID', | |||
dataIndex: 'id', | |||
}, | |||
{ | |||
title: '项目名称', | |||
dataIndex: 'name', | |||
}, | |||
{ | |||
title: '状态', | |||
dataIndex: 'state', | |||
}, | |||
{ | |||
title: 'AppId', | |||
dataIndex: 'app_id', | |||
}, | |||
{ | |||
title: 'ApiKey', | |||
dataIndex: 'api_key', | |||
}, | |||
{ | |||
title: 'SecretKey', | |||
dataIndex: 'secret_key', | |||
}, | |||
{ | |||
title: '操作', | |||
valueType: 'option', | |||
key: 'option', | |||
render: (text, record, _, action) => [ | |||
<a | |||
key="editable" | |||
onClick={() => { | |||
action?.startEditable?.(record.id); | |||
}} | |||
> | |||
编辑 | |||
</a>, | |||
], | |||
}, | |||
]; | |||
export default () => { | |||
const [form] = Form.useForm<ProjectType.form>(); | |||
const [data, setData] = useState([{id: 1}]) | |||
return ( | |||
<> | |||
<PageContainer> | |||
<ProTable | |||
dataSource={data} | |||
columns={columns} | |||
pagination={{ | |||
pageSize: 5, | |||
onChange: (page) => console.log(page), | |||
}} | |||
toolBarRender={() => [ | |||
<ModalForm<ProjectType.form> | |||
title="新增项目" | |||
trigger={ | |||
<Button type="primary"> | |||
<PlusOutlined /> | |||
新建表单 | |||
</Button> | |||
} | |||
submitter={{ | |||
render: (props, defaultDoms) => { | |||
return [ | |||
<Button | |||
key="extra-reset" | |||
onClick={() => { | |||
props.reset(); | |||
}} | |||
> | |||
重置 | |||
</Button>, | |||
...defaultDoms, | |||
]; | |||
}, | |||
}} | |||
form={form} | |||
autoFocusFirstInput | |||
modalProps={{ | |||
destroyOnClose: true, | |||
onCancel: () => console.log('run'), | |||
}} | |||
submitTimeout={2000} | |||
onFinish={async (values) => { | |||
await waitTime(2000); | |||
console.log(values.name); | |||
return true; | |||
}} | |||
> | |||
<ProFormText | |||
name="name" | |||
label="项目名" | |||
placeholder="请输入项目名" | |||
/> | |||
<ProFormSelect | |||
name="aip_id" | |||
label="选择百度接口" | |||
placeholder="请选择百度接口" | |||
/> | |||
</ModalForm> | |||
]} | |||
/> | |||
</PageContainer> | |||
</> | |||
); | |||
}; |
@@ -0,0 +1,133 @@ | |||
import { EllipsisOutlined, PlusOutlined } from '@ant-design/icons'; | |||
import type { ActionType, ProColumns } from '@ant-design/pro-components'; | |||
import { | |||
ProTable, TableDropdown, PageContainer, ModalForm, ProForm, | |||
ProFormDateRangePicker, | |||
ProFormSelect, | |||
ProFormText, | |||
} from '@ant-design/pro-components'; | |||
import { Button, Dropdown, Space, Tag, Form } from 'antd'; | |||
import { useRef, useState } from 'react'; | |||
export const waitTimePromise = async (time: number = 100) => { | |||
return new Promise((resolve) => { | |||
setTimeout(() => { | |||
resolve(true); | |||
}, time); | |||
}); | |||
}; | |||
export const waitTime = async (time: number = 100) => { | |||
await waitTimePromise(time); | |||
}; | |||
const columns: ProColumns[] = [ | |||
{ | |||
title: 'ID', | |||
dataIndex: 'id', | |||
}, | |||
{ | |||
title: '项目名称', | |||
dataIndex: 'name', | |||
}, | |||
{ | |||
title: '状态', | |||
dataIndex: 'state', | |||
}, | |||
{ | |||
title: 'AppId', | |||
dataIndex: 'app_id', | |||
}, | |||
{ | |||
title: 'ApiKey', | |||
dataIndex: 'api_key', | |||
}, | |||
{ | |||
title: 'SecretKey', | |||
dataIndex: 'secret_key', | |||
}, | |||
{ | |||
title: '操作', | |||
valueType: 'option', | |||
key: 'option', | |||
render: (text, record, _, action) => [ | |||
<a | |||
key="editable" | |||
onClick={() => { | |||
action?.startEditable?.(record.id); | |||
}} | |||
> | |||
编辑 | |||
</a>, | |||
], | |||
}, | |||
]; | |||
export default () => { | |||
const [form] = Form.useForm<ProjectType.form>(); | |||
const [data, setData] = useState([{id: 1}]) | |||
return ( | |||
<> | |||
<PageContainer> | |||
<ProTable | |||
dataSource={data} | |||
columns={columns} | |||
pagination={{ | |||
pageSize: 5, | |||
onChange: (page) => console.log(page), | |||
}} | |||
toolBarRender={() => [ | |||
<ModalForm<ProjectType.form> | |||
title="新增项目" | |||
trigger={ | |||
<Button type="primary"> | |||
<PlusOutlined /> | |||
新建表单 | |||
</Button> | |||
} | |||
submitter={{ | |||
render: (props, defaultDoms) => { | |||
return [ | |||
<Button | |||
key="extra-reset" | |||
onClick={() => { | |||
props.reset(); | |||
}} | |||
> | |||
重置 | |||
</Button>, | |||
...defaultDoms, | |||
]; | |||
}, | |||
}} | |||
form={form} | |||
autoFocusFirstInput | |||
modalProps={{ | |||
destroyOnClose: true, | |||
onCancel: () => console.log('run'), | |||
}} | |||
submitTimeout={2000} | |||
onFinish={async (values) => { | |||
await waitTime(2000); | |||
console.log(values.name); | |||
return true; | |||
}} | |||
> | |||
<ProFormText | |||
name="name" | |||
label="项目名" | |||
placeholder="请输入项目名" | |||
/> | |||
<ProFormSelect | |||
name="aip_id" | |||
label="选择百度接口" | |||
placeholder="请选择百度接口" | |||
/> | |||
</ModalForm> | |||
]} | |||
/> | |||
</PageContainer> | |||
</> | |||
); | |||
}; |
@@ -0,0 +1,133 @@ | |||
import { EllipsisOutlined, PlusOutlined } from '@ant-design/icons'; | |||
import type { ActionType, ProColumns } from '@ant-design/pro-components'; | |||
import { | |||
ProTable, TableDropdown, PageContainer, ModalForm, ProForm, | |||
ProFormDateRangePicker, | |||
ProFormSelect, | |||
ProFormText, | |||
} from '@ant-design/pro-components'; | |||
import { Button, Dropdown, Space, Tag, Form } from 'antd'; | |||
import { useRef, useState } from 'react'; | |||
export const waitTimePromise = async (time: number = 100) => { | |||
return new Promise((resolve) => { | |||
setTimeout(() => { | |||
resolve(true); | |||
}, time); | |||
}); | |||
}; | |||
export const waitTime = async (time: number = 100) => { | |||
await waitTimePromise(time); | |||
}; | |||
const columns: ProColumns[] = [ | |||
{ | |||
title: 'ID', | |||
dataIndex: 'id', | |||
}, | |||
{ | |||
title: '项目名称', | |||
dataIndex: 'name', | |||
}, | |||
{ | |||
title: '状态', | |||
dataIndex: 'state', | |||
}, | |||
{ | |||
title: 'AppId', | |||
dataIndex: 'app_id', | |||
}, | |||
{ | |||
title: 'ApiKey', | |||
dataIndex: 'api_key', | |||
}, | |||
{ | |||
title: 'SecretKey', | |||
dataIndex: 'secret_key', | |||
}, | |||
{ | |||
title: '操作', | |||
valueType: 'option', | |||
key: 'option', | |||
render: (text, record, _, action) => [ | |||
<a | |||
key="editable" | |||
onClick={() => { | |||
action?.startEditable?.(record.id); | |||
}} | |||
> | |||
编辑 | |||
</a>, | |||
], | |||
}, | |||
]; | |||
export default () => { | |||
const [form] = Form.useForm<ProjectType.form>(); | |||
const [data, setData] = useState([{id: 1}]) | |||
return ( | |||
<> | |||
<PageContainer> | |||
<ProTable | |||
dataSource={data} | |||
columns={columns} | |||
pagination={{ | |||
pageSize: 5, | |||
onChange: (page) => console.log(page), | |||
}} | |||
toolBarRender={() => [ | |||
<ModalForm<ProjectType.form> | |||
title="新增项目" | |||
trigger={ | |||
<Button type="primary"> | |||
<PlusOutlined /> | |||
新建表单 | |||
</Button> | |||
} | |||
submitter={{ | |||
render: (props, defaultDoms) => { | |||
return [ | |||
<Button | |||
key="extra-reset" | |||
onClick={() => { | |||
props.reset(); | |||
}} | |||
> | |||
重置 | |||
</Button>, | |||
...defaultDoms, | |||
]; | |||
}, | |||
}} | |||
form={form} | |||
autoFocusFirstInput | |||
modalProps={{ | |||
destroyOnClose: true, | |||
onCancel: () => console.log('run'), | |||
}} | |||
submitTimeout={2000} | |||
onFinish={async (values) => { | |||
await waitTime(2000); | |||
console.log(values.name); | |||
return true; | |||
}} | |||
> | |||
<ProFormText | |||
name="name" | |||
label="项目名" | |||
placeholder="请输入项目名" | |||
/> | |||
<ProFormSelect | |||
name="aip_id" | |||
label="选择百度接口" | |||
placeholder="请选择百度接口" | |||
/> | |||
</ModalForm> | |||
]} | |||
/> | |||
</PageContainer> | |||
</> | |||
); | |||
}; |
@@ -0,0 +1,133 @@ | |||
import { EllipsisOutlined, PlusOutlined } from '@ant-design/icons'; | |||
import type { ActionType, ProColumns } from '@ant-design/pro-components'; | |||
import { | |||
ProTable, TableDropdown, PageContainer, ModalForm, ProForm, | |||
ProFormDateRangePicker, | |||
ProFormSelect, | |||
ProFormText, | |||
} from '@ant-design/pro-components'; | |||
import { Button, Dropdown, Space, Tag, Form } from 'antd'; | |||
import { useRef, useState } from 'react'; | |||
export const waitTimePromise = async (time: number = 100) => { | |||
return new Promise((resolve) => { | |||
setTimeout(() => { | |||
resolve(true); | |||
}, time); | |||
}); | |||
}; | |||
export const waitTime = async (time: number = 100) => { | |||
await waitTimePromise(time); | |||
}; | |||
const columns: ProColumns[] = [ | |||
{ | |||
title: 'ID', | |||
dataIndex: 'id', | |||
}, | |||
{ | |||
title: '企业名称', | |||
dataIndex: 'name', | |||
}, | |||
{ | |||
title: '来源', | |||
dataIndex: 'state', | |||
}, | |||
{ | |||
title: '登录次数', | |||
dataIndex: 'app_id', | |||
}, | |||
{ | |||
title: 'ApiKey', | |||
dataIndex: 'api_key', | |||
}, | |||
{ | |||
title: 'SecretKey', | |||
dataIndex: 'secret_key', | |||
}, | |||
{ | |||
title: '操作', | |||
valueType: 'option', | |||
key: 'option', | |||
render: (text, record, _, action) => [ | |||
<a | |||
key="editable" | |||
onClick={() => { | |||
action?.startEditable?.(record.id); | |||
}} | |||
> | |||
编辑 | |||
</a>, | |||
], | |||
}, | |||
]; | |||
export default () => { | |||
const [form] = Form.useForm<ProjectType.form>(); | |||
const [data, setData] = useState([{id: 1}]) | |||
return ( | |||
<> | |||
<PageContainer> | |||
<ProTable | |||
dataSource={data} | |||
columns={columns} | |||
pagination={{ | |||
pageSize: 5, | |||
onChange: (page) => console.log(page), | |||
}} | |||
toolBarRender={() => [ | |||
<ModalForm<ProjectType.form> | |||
title="新增项目" | |||
trigger={ | |||
<Button type="primary"> | |||
<PlusOutlined /> | |||
新建表单 | |||
</Button> | |||
} | |||
submitter={{ | |||
render: (props, defaultDoms) => { | |||
return [ | |||
<Button | |||
key="extra-reset" | |||
onClick={() => { | |||
props.reset(); | |||
}} | |||
> | |||
重置 | |||
</Button>, | |||
...defaultDoms, | |||
]; | |||
}, | |||
}} | |||
form={form} | |||
autoFocusFirstInput | |||
modalProps={{ | |||
destroyOnClose: true, | |||
onCancel: () => console.log('run'), | |||
}} | |||
submitTimeout={2000} | |||
onFinish={async (values) => { | |||
await waitTime(2000); | |||
console.log(values.name); | |||
return true; | |||
}} | |||
> | |||
<ProFormText | |||
name="name" | |||
label="项目名" | |||
placeholder="请输入项目名" | |||
/> | |||
<ProFormSelect | |||
name="aip_id" | |||
label="选择百度接口" | |||
placeholder="请选择百度接口" | |||
/> | |||
</ModalForm> | |||
]} | |||
/> | |||
</PageContainer> | |||
</> | |||
); | |||
}; |
@@ -0,0 +1,133 @@ | |||
import { EllipsisOutlined, PlusOutlined } from '@ant-design/icons'; | |||
import type { ActionType, ProColumns } from '@ant-design/pro-components'; | |||
import { | |||
ProTable, TableDropdown, PageContainer, ModalForm, ProForm, | |||
ProFormDateRangePicker, | |||
ProFormSelect, | |||
ProFormText, | |||
} from '@ant-design/pro-components'; | |||
import { Button, Dropdown, Space, Tag, Form } from 'antd'; | |||
import { useRef, useState } from 'react'; | |||
export const waitTimePromise = async (time: number = 100) => { | |||
return new Promise((resolve) => { | |||
setTimeout(() => { | |||
resolve(true); | |||
}, time); | |||
}); | |||
}; | |||
export const waitTime = async (time: number = 100) => { | |||
await waitTimePromise(time); | |||
}; | |||
const columns: ProColumns[] = [ | |||
{ | |||
title: 'ID', | |||
dataIndex: 'id', | |||
}, | |||
{ | |||
title: '企业名称', | |||
dataIndex: 'name', | |||
}, | |||
{ | |||
title: '来源', | |||
dataIndex: 'state', | |||
}, | |||
{ | |||
title: '登录次数', | |||
dataIndex: 'app_id', | |||
}, | |||
{ | |||
title: 'ApiKey', | |||
dataIndex: 'api_key', | |||
}, | |||
{ | |||
title: 'SecretKey', | |||
dataIndex: 'secret_key', | |||
}, | |||
{ | |||
title: '操作', | |||
valueType: 'option', | |||
key: 'option', | |||
render: (text, record, _, action) => [ | |||
<a | |||
key="editable" | |||
onClick={() => { | |||
action?.startEditable?.(record.id); | |||
}} | |||
> | |||
编辑 | |||
</a>, | |||
], | |||
}, | |||
]; | |||
export default () => { | |||
const [form] = Form.useForm<ProjectType.form>(); | |||
const [data, setData] = useState([{id: 1}]) | |||
return ( | |||
<> | |||
<PageContainer> | |||
<ProTable | |||
dataSource={data} | |||
columns={columns} | |||
pagination={{ | |||
pageSize: 5, | |||
onChange: (page) => console.log(page), | |||
}} | |||
toolBarRender={() => [ | |||
<ModalForm<ProjectType.form> | |||
title="新增项目" | |||
trigger={ | |||
<Button type="primary"> | |||
<PlusOutlined /> | |||
新建表单 | |||
</Button> | |||
} | |||
submitter={{ | |||
render: (props, defaultDoms) => { | |||
return [ | |||
<Button | |||
key="extra-reset" | |||
onClick={() => { | |||
props.reset(); | |||
}} | |||
> | |||
重置 | |||
</Button>, | |||
...defaultDoms, | |||
]; | |||
}, | |||
}} | |||
form={form} | |||
autoFocusFirstInput | |||
modalProps={{ | |||
destroyOnClose: true, | |||
onCancel: () => console.log('run'), | |||
}} | |||
submitTimeout={2000} | |||
onFinish={async (values) => { | |||
await waitTime(2000); | |||
console.log(values.name); | |||
return true; | |||
}} | |||
> | |||
<ProFormText | |||
name="name" | |||
label="项目名" | |||
placeholder="请输入项目名" | |||
/> | |||
<ProFormSelect | |||
name="aip_id" | |||
label="选择百度接口" | |||
placeholder="请选择百度接口" | |||
/> | |||
</ModalForm> | |||
]} | |||
/> | |||
</PageContainer> | |||
</> | |||
); | |||
}; |
@@ -0,0 +1,133 @@ | |||
import { EllipsisOutlined, PlusOutlined } from '@ant-design/icons'; | |||
import type { ActionType, ProColumns } from '@ant-design/pro-components'; | |||
import { | |||
ProTable, TableDropdown, PageContainer, ModalForm, ProForm, | |||
ProFormDateRangePicker, | |||
ProFormSelect, | |||
ProFormText, | |||
} from '@ant-design/pro-components'; | |||
import { Button, Dropdown, Space, Tag, Form } from 'antd'; | |||
import { useRef, useState } from 'react'; | |||
export const waitTimePromise = async (time: number = 100) => { | |||
return new Promise((resolve) => { | |||
setTimeout(() => { | |||
resolve(true); | |||
}, time); | |||
}); | |||
}; | |||
export const waitTime = async (time: number = 100) => { | |||
await waitTimePromise(time); | |||
}; | |||
const columns: ProColumns[] = [ | |||
{ | |||
title: 'ID', | |||
dataIndex: 'id', | |||
}, | |||
{ | |||
title: '项目名称', | |||
dataIndex: 'name', | |||
}, | |||
{ | |||
title: '状态', | |||
dataIndex: 'state', | |||
}, | |||
{ | |||
title: 'AppId', | |||
dataIndex: 'app_id', | |||
}, | |||
{ | |||
title: 'ApiKey', | |||
dataIndex: 'api_key', | |||
}, | |||
{ | |||
title: 'SecretKey', | |||
dataIndex: 'secret_key', | |||
}, | |||
{ | |||
title: '操作', | |||
valueType: 'option', | |||
key: 'option', | |||
render: (text, record, _, action) => [ | |||
<a | |||
key="editable" | |||
onClick={() => { | |||
action?.startEditable?.(record.id); | |||
}} | |||
> | |||
编辑 | |||
</a>, | |||
], | |||
}, | |||
]; | |||
export default () => { | |||
const [form] = Form.useForm<ProjectType.form>(); | |||
const [data, setData] = useState([{id: 1}]) | |||
return ( | |||
<> | |||
<PageContainer> | |||
<ProTable | |||
dataSource={data} | |||
columns={columns} | |||
pagination={{ | |||
pageSize: 5, | |||
onChange: (page) => console.log(page), | |||
}} | |||
toolBarRender={() => [ | |||
<ModalForm<ProjectType.form> | |||
title="新增项目" | |||
trigger={ | |||
<Button type="primary"> | |||
<PlusOutlined /> | |||
新建表单 | |||
</Button> | |||
} | |||
submitter={{ | |||
render: (props, defaultDoms) => { | |||
return [ | |||
<Button | |||
key="extra-reset" | |||
onClick={() => { | |||
props.reset(); | |||
}} | |||
> | |||
重置 | |||
</Button>, | |||
...defaultDoms, | |||
]; | |||
}, | |||
}} | |||
form={form} | |||
autoFocusFirstInput | |||
modalProps={{ | |||
destroyOnClose: true, | |||
onCancel: () => console.log('run'), | |||
}} | |||
submitTimeout={2000} | |||
onFinish={async (values) => { | |||
await waitTime(2000); | |||
console.log(values.name); | |||
return true; | |||
}} | |||
> | |||
<ProFormText | |||
name="name" | |||
label="项目名" | |||
placeholder="请输入项目名" | |||
/> | |||
<ProFormSelect | |||
name="aip_id" | |||
label="选择百度接口" | |||
placeholder="请选择百度接口" | |||
/> | |||
</ModalForm> | |||
]} | |||
/> | |||
</PageContainer> | |||
</> | |||
); | |||
}; |