first commit
Some checks failed
Node CI / build (14.x, macOS-latest) (push) Has been cancelled
Node CI / build (14.x, ubuntu-latest) (push) Has been cancelled
Node CI / build (14.x, windows-latest) (push) Has been cancelled
Node CI / build (16.x, macOS-latest) (push) Has been cancelled
Node CI / build (16.x, ubuntu-latest) (push) Has been cancelled
Node CI / build (16.x, windows-latest) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
coverage CI / build (push) Has been cancelled
Node pnpm CI / build (16.x, macOS-latest) (push) Has been cancelled
Node pnpm CI / build (16.x, ubuntu-latest) (push) Has been cancelled
Node pnpm CI / build (16.x, windows-latest) (push) Has been cancelled

This commit is contained in:
chenshaohua
2025-11-10 16:28:01 +08:00
commit 30c8a7e8cf
465 changed files with 102912 additions and 0 deletions

16
.editorconfig Normal file
View File

@@ -0,0 +1,16 @@
# http://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false
[Makefile]
indent_style = tab

8
.eslintignore Normal file
View File

@@ -0,0 +1,8 @@
/lambda/
/scripts
/config
.history
public
dist
.umi
mock

7
.eslintrc.js Normal file
View File

@@ -0,0 +1,7 @@
module.exports = {
extends: [require.resolve('@umijs/lint/dist/config/eslint')],
globals: {
page: true,
REACT_APP_ENV: true,
},
};

12
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1,12 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: ant-design
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

48
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@@ -0,0 +1,48 @@
---
name: '报告 Bug | Report bug 🐛'
about: 报告 Ant Design Pro 的 bug
title: '🐛 [BUG]'
labels: '🐛 bug'
assignees: ''
---
### 🐛 bug 描述
<!--
详细地描述 bug让大家都能理解
Describe the bug in detail so that everyone can understand it
-->
### 📷 复现步骤 | Recurrence steps
<!--
清晰描述复现步骤,让别人也能看到问题
Clearly describe the recurrence steps so that others can see the problem
-->
### 🏞 期望结果 | Expected results
<!--
描述你原本期望看到的结果
Describe what you expected to see
-->
### 💻 复现代码 | Recurrence code
<!--
提供可复现的代码,仓库,或线上示例
Provide reproducible code, warehouse, or online examples
-->
### © 版本信息
- Ant Design Pro 版本: [e.g. 4.0.0]
- umi 版本
- 浏览器环境
- 开发环境 [e.g. mac OS]
### 🚑 其他信息
<!--
如截图等其他信息可以贴在这里
-->

View File

@@ -0,0 +1,28 @@
---
name: '功能需求 | Feature Requirements ✨'
about: 对 Ant Design Pro 的需求或建议
title: '👑 [需求 | Feature]'
labels: '👑 Feature Request'
assignees: ''
---
### 🥰 需求描述 | Requirements description
<!--
详细地描述需求,让大家都能理解
Describe the requirements in detail so that everyone can understand them
-->
### 🧐 解决方案 | Solution
<!--
如果你有解决方案,在这里清晰地阐述
If you have a solution, explain it clearly here
-->
### 🚑 其他信息 | Other information
<!--
如截图等其他信息可以贴在这里
Other information such as screenshots can be posted here
-->

34
.github/ISSUE_TEMPLATE/question.md vendored Normal file
View File

@@ -0,0 +1,34 @@
---
name: '疑问或需要帮助 | Questions or need help ❓'
about: 对 Ant Design Pro 使用的疑问或需要帮助
title: '🧐[问题 | question]'
labels: '🧐 question'
assignees: ''
---
### 🧐 问题描述 | Problem description
<!--
详细地描述问题,让大家都能理解
Describe the problem in detail so that everyone can understand it
-->
### 💻 示例代码 | Sample code
<!--
一个最小可重现的代码,让开发者可以快速的定位问题
A minimal reproducible code that allows developers to quickly locate problems
-->
### 🚑 其他信息 | Other information
<!--
如截图等其他信息可以贴在这里
Other information such as screenshots can be posted here
-->
OS:
Node
浏览器 | browser

30
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,30 @@
name: Node CI
on: [push, pull_request]
permissions:
contents: read
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node_version: [16.x, 14.x]
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node_version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node_version }}
- run: echo ${{github.ref}}
- run: npm install
- run: yarn run lint
- run: yarn run tsc
- run: yarn run build
env:
CI: true
PROGRESS: none
NODE_ENV: test
NODE_OPTIONS: --max_old_space_size=4096

41
.github/workflows/codeql.yml vendored Normal file
View File

@@ -0,0 +1,41 @@
name: "CodeQL"
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
schedule:
- cron: "48 12 * * 2"
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ javascript ]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
queries: +security-and-quality
- name: Autobuild
uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{ matrix.language }}"

27
.github/workflows/coverage.yml vendored Normal file
View File

@@ -0,0 +1,27 @@
name: coverage CI
on: [push, pull_request]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Use Node.js 16.x
uses: actions/setup-node@v1
with:
node-version: 16.x
- run: echo ${{github.ref}}
- run: curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm@7
- run: pnpm config set store-dir ~/.pnpm-store
- run: pnpm install --strict-peer-dependencies=false
- run: yarn run test:coverage
env:
CI: true
PROGRESS: none
NODE_ENV: test
NODE_OPTIONS: --max_old_space_size=4096
- run: bash <(curl -s https://codecov.io/bash)

14
.github/workflows/emoji-helper.yml vendored Normal file
View File

@@ -0,0 +1,14 @@
name: Emoji Helper
on:
release:
types: [published]
jobs:
emoji:
runs-on: ubuntu-latest
steps:
- uses: actions-cool/emoji-helper@v1.0.0
with:
type: 'release'
emoji: '+1, laugh, heart, hooray, rocket, eyes'

37
.github/workflows/issue-labeled.yml vendored Normal file
View File

@@ -0,0 +1,37 @@
name: Issue labeled
on:
issues:
types: [labeled]
jobs:
reply-helper:
runs-on: ubuntu-latest
steps:
- name: help wanted
if: github.event.label.name == '❤️ help wanted' || github.event.label.name == '🤝Welcome PR'
uses: actions-cool/issues-helper@v1.11
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: |
Hello @${{ github.event.issue.user.login }}. We totally like your proposal/feedback, welcome to [send us a Pull Request](https://help.github.com/en/articles/creating-a-pull-request) for it. Please provide changelog/TypeScript/documentation/test cases if needed and make sure CI passed, we will review it soon. We appreciate your effort in advance and looking forward to your contribution!
你好 @${{ github.event.issue.user.login }},我们完全同意你的提议/反馈,欢迎直接在此仓库 [创建一个 Pull Request](https://help.github.com/en/articles/creating-a-pull-request) 来解决这个问题。请务必提供改动所需相应的 changelog、TypeScript 定义、测试用例、文档等,并确保 CI 通过,我们会尽快进行 Review提前感谢和期待您的贡献。
![giphy](https://user-images.githubusercontent.com/507615/62342668-4735dc00-b51a-11e9-92a7-d46fbb1cc0c7.gif)
- name: Need Reproduce
if: github.event.label.name == '🤔 Need Reproduce'
uses: actions-cool/issues-helper@v1.11
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: |
Hello @${{ github.event.issue.user.login }}. Please provide a online reproduction by forking this link https://codesandbox.io/ or a minimal GitHub repository.
你好 @${{ github.event.issue.user.login }}, 我们需要你提供一个在线的重现实例以便于我们帮你排查问题。你可以通过点击 [此处](https://codesandbox.io/) 创建一个 codesandbox 或者提供一个最小化的 GitHub 仓库。
![](https://gw.alipayobjects.com/zos/antfincdn/y9kwg7DVCd/reproduce.gif)

34
.github/workflows/issue-open-check.yml vendored Normal file
View File

@@ -0,0 +1,34 @@
name: Issue Open Check
on:
issues:
types: [opened, edited]
jobs:
check-issue:
runs-on: ubuntu-latest
steps:
- uses: actions-cool/issues-helper@v2.2.0
id: check
with:
actions: 'check-issue'
issue-number: ${{ github.event.issue.number }}
title-excludes: '🐛 [BUG], 👑 [需求 | Feature], 🧐[问题 | question]'
- if: steps.check.outputs.check-result == 'false' && github.event.issue.state == 'open'
uses: actions-cool/issues-helper@v2.2.0
with:
actions: 'create-comment, close-issue'
issue-number: ${{ github.event.issue.number }}
body: |
当前 Issue 未检测到标题,请规范填写,谢谢!
The title of the current issue is not detected, please fill in according to the specifications, thank you!
- if: steps.check.outputs.check-result == 'true'
uses: actions-cool/issues-similarity-analysis@v1
with:
filter-threshold: 0.8
title-excludes: '🐛[BUG], 👑 [需求 | Feature], 🧐[问题 | question]'
comment-title: '### 以下的 Issues 可能会帮助到你 / The following issues may help you'
show-footer: false

33
.github/workflows/pnpm.yml vendored Normal file
View File

@@ -0,0 +1,33 @@
name: Node pnpm CI
on: [push, pull_request]
permissions:
contents: read
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node_version: [16.x]
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node_version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node_version }}
- run: echo ${{github.ref}}
- run: curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm@7
- run: pnpm config set store-dir ~/.pnpm-store
- run: pnpm install --strict-peer-dependencies=false
- run: pnpm run lint
- run: pnpm run tsc
- run: pnpm run build
- run: pnpm run test
env:
CI: true
PROGRESS: none
NODE_ENV: test
NODE_OPTIONS: --max_old_space_size=4096

41
.github/workflows/preview-build.yml vendored Normal file
View File

@@ -0,0 +1,41 @@
name: Preview Build
on:
pull_request:
types: [opened, synchronize, reopened]
permissions:
contents: read
jobs:
build-preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: build
run: |
yarn
yarn add umi-plugin-pro --save
yarn build
- name: upload dist artifact
uses: actions/upload-artifact@v2
with:
name: dist
path: dist/
retention-days: 5
- name: Save PR number
if: ${{ always() }}
run: echo ${{ github.event.number }} > ./pr-id.txt
- name: Upload PR number
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: pr
path: ./pr-id.txt

100
.github/workflows/preview-deploy.yml vendored Normal file
View File

@@ -0,0 +1,100 @@
name: Preview Deploy
on:
workflow_run:
workflows: ['Preview Build']
types:
- completed
permissions:
contents: read
jobs:
success:
permissions:
actions: read # for dawidd6/action-download-artifact to query and download artifacts
issues: write # for actions-cool/maintain-one-comment to modify or create issue comments
pull-requests: write # for actions-cool/maintain-one-comment to modify or create PR comments
runs-on: ubuntu-latest
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
steps:
- name: download pr artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
name: pr
- name: save PR id
id: pr
run: echo "::set-output name=id::$(<pr-id.txt)"
- name: download dist artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
workflow_conclusion: success
name: dist
- name: upload surge service
id: deploy
run: |
export DEPLOY_DOMAIN=https://ant-design-pro-preview-pr-${{ steps.pr.outputs.id }}.surge.sh
npx surge --project ./ --domain $DEPLOY_DOMAIN --token ${{ secrets.SURGE_TOKEN }}
- name: update status comment
uses: actions-cool/maintain-one-comment@v1.2.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
body: |
🎊 PR Preview has been successfully built and deployed to https://ant-design-pro-preview-pr-${{ steps.pr.outputs.id }}.surge.sh
<img width="300" src="https://user-images.githubusercontent.com/507615/90250366-88233900-de6e-11ea-95a5-84f0762ffd39.png">
<!-- Sticky Pull Request Comment -->
body-include: '<!-- Sticky Pull Request Comment -->'
number: ${{ steps.pr.outputs.id }}
- name: The job failed
if: ${{ failure() }}
uses: actions-cool/maintain-one-comment@v1.2.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
body: |
😭 Deploy PR Preview failed.
<img width="300" src="https://user-images.githubusercontent.com/507615/90250824-4e066700-de6f-11ea-8230-600ecc3d6a6b.png">
<!-- Sticky Pull Request Comment -->
body-include: '<!-- Sticky Pull Request Comment -->'
number: ${{ steps.pr.outputs.id }}
failed:
permissions:
actions: read # for dawidd6/action-download-artifact to query and download artifacts
issues: write # for actions-cool/maintain-one-comment to modify or create issue comments
pull-requests: write # for actions-cool/maintain-one-comment to modify or create PR comments
runs-on: ubuntu-latest
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'failure'
steps:
- name: download pr artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
name: pr
- name: save PR id
id: pr
run: echo "::set-output name=id::$(<pr-id.txt)"
- name: The job failed
uses: actions-cool/maintain-one-comment@v1.2.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
body: |
😭 Deploy PR Preview failed.
<img width="300" src="https://user-images.githubusercontent.com/507615/90250824-4e066700-de6f-11ea-8230-600ecc3d6a6b.png">
<!-- Sticky Pull Request Comment -->
body-include: '<!-- Sticky Pull Request Comment -->'
number: ${{ steps.pr.outputs.id }}

24
.github/workflows/preview-start.yml vendored Normal file
View File

@@ -0,0 +1,24 @@
name: Preview Start
on: pull_request_target
permissions:
contents: read
jobs:
preview:
permissions:
issues: write # for actions-cool/maintain-one-comment to modify or create issue comments
pull-requests: write # for actions-cool/maintain-one-comment to modify or create PR comments
runs-on: ubuntu-latest
steps:
- name: create
uses: actions-cool/maintain-one-comment@v1.2.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
body: |
⚡️ Deploying PR Preview...
<img src="https://user-images.githubusercontent.com/507615/90240294-8d2abd00-de5b-11ea-8140-4840a0b2d571.gif" width="300" />
<!-- Sticky Pull Request Comment -->
body-include: '<!-- Sticky Pull Request Comment -->'

13
.hintrc Normal file
View File

@@ -0,0 +1,13 @@
{
"extends": [
"development"
],
"hints": {
"no-inline-styles": "off"
},
"browserslist": [
"defaults",
"not ie 11",
"not ie <= 11"
]
}

7
.husky/commit-msg Normal file
View File

@@ -0,0 +1,7 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
# Export Git hook params
export GIT_PARAMS=$*
# npx --no-install fabric verify-commit

4
.husky/pre-commit Normal file
View File

@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
# npx --no-install lint-staged

22
.prettierignore Normal file
View File

@@ -0,0 +1,22 @@
**/*.svg
.umi
.umi-production
/dist
.dockerignore
.DS_Store
.eslintignore
*.png
*.toml
docker
.editorconfig
Dockerfile*
.gitignore
.prettierignore
LICENSE
.eslintcache
*.lock
yarn-error.log
.history
CNAME
/build
/public

21
.prettierrc.js Normal file
View File

@@ -0,0 +1,21 @@
module.exports = {
singleQuote: true,
trailingComma: 'all',
printWidth: 100,
proseWrap: 'never',
endOfLine: 'lf',
overrides: [
{
files: '.prettierrc',
options: {
parser: 'json',
},
},
{
files: 'document.ejs',
options: {
parser: 'html',
},
},
],
};

View File

@@ -0,0 +1,6 @@
{
"ExpandedNodes": [
""
],
"PreviewInSolutionExplorer": false
}

BIN
.vs/qingdao-admin/v17/.suo Normal file

Binary file not shown.

BIN
.vs/slnx.sqlite Normal file

Binary file not shown.

46
CODE_OF_CONDUCT.md Normal file
View File

@@ -0,0 +1,46 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment include:
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
- The use of sexualized language or imagery and unwelcome sexual attention or advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at afc163@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019-present Alipay.inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

138
README.md Normal file
View File

@@ -0,0 +1,138 @@
<<<<<<< HEAD
Language : 🇺🇸 | [🇨🇳](./README.zh-CN.md) | [🇷🇺](./README.ru-RU.md) | [🇹🇷](./README.tr-TR.md) | [🇯🇵](./README.ja-JP.md) | [🇫🇷](./README.fr-FR.md) | [🇵🇹](./README.pt-BR.md) | [🇸🇦](./README.ar-DZ.md)
<h1 align="center">Ant Design Pro</h1>
<div align="center">
An out-of-box UI solution for enterprise applications as a React boilerplate.
[![Build Status](https://dev.azure.com/ant-design/ant-design-pro/_apis/build/status/ant-design.ant-design-pro?branchName=master)](https://dev.azure.com/ant-design/ant-design-pro/_build/latest?definitionId=1?branchName=master) ![Github Action](https://github.com/ant-design/ant-design-pro/workflows/Node%20CI/badge.svg) ![Deploy](https://github.com/ant-design/ant-design-pro/workflows/Deploy%20CI/badge.svg)
[![Gitter](https://img.shields.io/gitter/room/ant-design/pro-english.svg?style=flat-square&logoWidth=20&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgd2lkdGg9IjEyMzUiIGhlaWdodD0iNjUwIiB2aWV3Qm94PSIwIDAgNzQxMCAzOTAwIj4NCjxyZWN0IHdpZHRoPSI3NDEwIiBoZWlnaHQ9IjM5MDAiIGZpbGw9IiNiMjIyMzQiLz4NCjxwYXRoIGQ9Ik0wLDQ1MEg3NDEwbTAsNjAwSDBtMCw2MDBINzQxMG0wLDYwMEgwbTAsNjAwSDc0MTBtMCw2MDBIMCIgc3Ryb2tlPSIjZmZmIiBzdHJva2Utd2lkdGg9IjMwMCIvPg0KPHJlY3Qgd2lkdGg9IjI5NjQiIGhlaWdodD0iMjEwMCIgZmlsbD0iIzNjM2I2ZSIvPg0KPGcgZmlsbD0iI2ZmZiI%2BDQo8ZyBpZD0iczE4Ij4NCjxnIGlkPSJzOSI%2BDQo8ZyBpZD0iczUiPg0KPGcgaWQ9InM0Ij4NCjxwYXRoIGlkPSJzIiBkPSJNMjQ3LDkwIDMxNy41MzQyMzAsMzA3LjA4MjAzOSAxMzIuODczMjE4LDE3Mi45MTc5NjFIMzYxLjEyNjc4MkwxNzYuNDY1NzcwLDMwNy4wODIwMzl6Ii8%2BDQo8dXNlIHhsaW5rOmhyZWY9IiNzIiB5PSI0MjAiLz4NCjx1c2UgeGxpbms6aHJlZj0iI3MiIHk9Ijg0MCIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgeT0iMTI2MCIvPg0KPC9nPg0KPHVzZSB4bGluazpocmVmPSIjcyIgeT0iMTY4MCIvPg0KPC9nPg0KPHVzZSB4bGluazpocmVmPSIjczQiIHg9IjI0NyIgeT0iMjEwIi8%2BDQo8L2c%2BDQo8dXNlIHhsaW5rOmhyZWY9IiNzOSIgeD0iNDk0Ii8%2BDQo8L2c%2BDQo8dXNlIHhsaW5rOmhyZWY9IiNzMTgiIHg9Ijk4OCIvPg0KPHVzZSB4bGluazpocmVmPSIjczkiIHg9IjE5NzYiLz4NCjx1c2UgeGxpbms6aHJlZj0iI3M1IiB4PSIyNDcwIi8%2BDQo8L2c%2BDQo8L3N2Zz4%3D)](https://gitter.im/ant-design/pro-english?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![Join the chat at https://gitter.im/ant-design/ant-design-pro](https://img.shields.io/gitter/room/ant-design/ant-design-pro.svg?style=flat-square&logoWidth=20&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgd2lkdGg9IjkwMCIgaGVpZ2h0PSI2MDAiIHZpZXdCb3g9IjAgMCAzMCAyMCI%2BDQo8ZGVmcz4NCjxwYXRoIGlkPSJzIiBkPSJNMCwtMSAwLjU4Nzc4NSwwLjgwOTAxNyAtMC45NTEwNTcsLTAuMzA5MDE3SDAuOTUxMDU3TC0wLjU4Nzc4NSwwLjgwOTAxN3oiIGZpbGw9IiNmZmRlMDAiLz4NCjwvZGVmcz4NCjxyZWN0IHdpZHRoPSIzMCIgaGVpZ2h0PSIyMCIgZmlsbD0iI2RlMjkxMCIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNSw1KSBzY2FsZSgzKSIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAsMikgcm90YXRlKDIzLjAzNjI0MykiLz4NCjx1c2UgeGxpbms6aHJlZj0iI3MiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEyLDQpIHJvdGF0ZSg0NS44Njk4OTgpIi8%2BDQo8dXNlIHhsaW5rOmhyZWY9IiNzIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxMiw3KSByb3RhdGUoNjkuOTQ1Mzk2KSIvPg0KPHVzZSB4bGluazpocmVmPSIjcyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAsOSkgcm90YXRlKDIwLjY1OTgwOCkiLz4NCjwvc3ZnPg%3D%3D)](https://gitter.im/ant-design/ant-design-pro?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![Build With Umi](https://img.shields.io/badge/build%20with-umi-028fe4.svg?style=flat-square)](http://umijs.org/) ![](https://badgen.net/badge/icon/Ant%20Design?icon=https://gw.alipayobjects.com/zos/antfincdn/Pp4WPgVDB3/KDpgvguMpGfqaHPjicRK.svg&label)
![](https://user-images.githubusercontent.com/8186664/44953195-581e3d80-aec4-11e8-8dcb-54b9db38ec11.png)
</div>
- Preview: http://preview.pro.ant.design
- Home Page: http://pro.ant.design
- Documentation: http://pro.ant.design/docs/getting-started
- ChangeLog: http://pro.ant.design/docs/changelog
- FAQ: http://pro.ant.design/docs/faq
- Mirror Site in China: http://ant-design-pro.gitee.io
## 5.0 is out! 🎉🎉🎉
[Ant Design Pro 5.0.0](https://github.com/ant-design/ant-design-pro/issues/8656)
## Translation Recruitment :loudspeaker:
We need your help: https://github.com/ant-design/ant-design-pro/issues/120
## Features
- :bulb: **TypeScript**: A language for application-scale JavaScript
- :scroll: **Blocks**: Build page with block template
- :gem: **Neat Design**: Follow [Ant Design specification](http://ant.design/)
- :triangular_ruler: **Common Templates**: Typical templates for enterprise applications
- :rocket: **State of The Art Development**: Newest development stack of React/umi/dva/antd
- :iphone: **Responsive**: Designed for variable screen sizes
- :art: **Theming**: Customizable theme with simple config
- :globe_with_meridians: **International**: Built-in i18n solution
- :gear: **Best Practices**: Solid workflow to make your code healthy
- :1234: **Mock development**: Easy to use mock development solution
- :white_check_mark: **UI Test**: Fly safely with unit and e2e tests
## Templates
```
- Dashboard
- Analytic
- Monitor
- Workspace
- Form
- Basic Form
- Step Form
- Advanced From
- List
- Standard Table
- Standard List
- Card List
- Search List (Project/Applications/Article)
- Profile
- Simple Profile
- Advanced Profile
- Account
- Account Center
- Account Settings
- Result
- Success
- Failed
- Exception
- 403
- 404
- 500
- User
- Login
- Register
- Register Result
```
## Usage
### Use bash
We provide pro-cli to quickly initialize scaffolding.
```bash
# use npm
npm i @ant-design/pro-cli -g
pro create myapp
```
select umi version
```shell
🐂 Use umi@4 or umi@3 ? (Use arrow keys)
umi@4
umi@3
```
> If the umi@4 version is selected, full blocks are not yet supported.
If you choose umi@3, you can also choose the pro template. Pro is the basic template, which only provides the basic content of the framework operation. Complete contains all blocks, which is not suitable for secondary development as a basic template.
```shell
? 🚀 Full or a simple scaffold? (Use arrow keys)
simple
complete
```
Install dependencies:
```shell
$ cd myapp && tyarn
// or
$ cd myapp && npm install
```
## Browsers support
Modern browsers.
| [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="Edge" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Safari | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/opera/opera_48x48.png" alt="Opera" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Opera |
| --- | --- | --- | --- | --- |
| Edge | last 2 versions | last 2 versions | last 2 versions | last 2 versions |
## Contributing
Any type of contribution is welcome, here are some examples of how you may contribute to this project:
- Use Ant Design Pro in your daily work.
- Submit [issues](http://github.com/ant-design/ant-design-pro/issues) to report bugs or ask questions.
- Propose [pull requests](http://github.com/ant-design/ant-design-pro/pulls) to improve our code.
=======
# qingdao-admin
>>>>>>> 997802589330c49d3abc4f122ed00ce04a3c9601

159
config/config.ts Normal file
View File

@@ -0,0 +1,159 @@
// https://umijs.org/config/
import { defineConfig } from '@umijs/max';
import { join } from 'path';
import defaultSettings from './defaultSettings';
import proxy from './proxy';
import routes from './routes';
const { REACT_APP_ENV = 'dev' } = process.env;
export default defineConfig({
/**
* @name 开启 hash 模式
* @description 让 build 之后的产物包含 hash 后缀。通常用于增量发布和避免浏览器加载缓存。
* @doc https://umijs.org/docs/api/config#hash
*/
hash: true,
/**
* @name 兼容性设置
* @description 设置 ie11 不一定完美兼容,需要检查自己使用的所有依赖
* @doc https://umijs.org/docs/api/config#targets
*/
// targets: {
// ie: 11,
// },
/**
* @name 路由的配置,不在路由中引入的文件不会编译
* @description 只支持 pathcomponentroutesredirectwrapperstitle 的配置
* @doc https://umijs.org/docs/guides/routes
*/
// umi routes: https://umijs.org/docs/routing
routes,
/**
* @name 主题的配置
* @description 虽然叫主题,但是其实只是 less 的变量设置
* @doc antd的主题设置 https://ant.design/docs/react/customize-theme-cn
* @doc umi 的theme 配置 https://umijs.org/docs/api/config#theme
*/
theme: {
// 如果不想要 configProvide 动态设置主题需要把这个设置为 default
// 只有设置为 variable 才能使用 configProvide 动态设置主色调
'root-entry-name': 'variable',
},
/**
* @name moment 的国际化配置
* @description 如果对国际化没有要求打开之后能减少js的包大小
* @doc https://umijs.org/docs/api/config#ignoremomentlocale
*/
ignoreMomentLocale: true,
/**
* @name 代理配置
* @description 可以让你的本地服务器代理到你的服务器上,这样你就可以访问服务器的数据了
* @see 要注意以下 代理只能在本地开发时使用build 之后就无法使用了。
* @doc 代理介绍 https://umijs.org/docs/guides/proxy
* @doc 代理配置 https://umijs.org/docs/api/config#proxy
*/
proxy: proxy[REACT_APP_ENV as keyof typeof proxy],
/**
* @name 快速热更新配置
* @description 一个不错的热更新组件,更新时可以保留 state
*/
fastRefresh: true,
//============== 以下都是max的插件配置 ===============
/**
* @name 数据流插件
* @@doc https://umijs.org/docs/max/data-flow
*/
model: {},
/**
* 一个全局的初始数据流,可以用它在插件之间共享数据
* @description 可以用来存放一些全局的数据,比如用户信息,或者一些全局的状态,全局初始状态在整个 Umi 项目的最开始创建。
* @doc https://umijs.org/docs/max/data-flow#%E5%85%A8%E5%B1%80%E5%88%9D%E5%A7%8B%E7%8A%B6%E6%80%81
*/
initialState: {},
/**
* @name layout 插件
* @doc https://umijs.org/docs/max/layout-menu
*/
title: '喀什智慧就业服务系统',
layout: {
locale: false,
...defaultSettings,
},
/**
* @name moment2dayjs 插件
* @description 将项目中的 moment 替换为 dayjs
* @doc https://umijs.org/docs/max/moment2dayjs
*/
moment2dayjs: {
preset: 'antd',
plugins: ['duration'],
},
/**
* @name 国际化插件
* @doc https://umijs.org/docs/max/i18n
*/
locale: {
// default zh-CN
default: 'zh-CN',
antd: false,
// default true, when it is true, will use `navigator.language` overwrite default
baseNavigator: false,
},
/**
* @name antd 插件
* @description 内置了 babel import 插件
* @doc https://umijs.org/docs/max/antd#antd
*/
antd: {},
/**
* @name 网络请求配置
* @description 它基于 axios 和 ahooks 的 useRequest 提供了一套统一的网络请求和错误处理方案。
* @doc https://umijs.org/docs/max/request
*/
request: {},
/**
* @name 权限插件
* @description 基于 initialState 的权限插件,必须先打开 initialState
* @doc https://umijs.org/docs/max/access
*/
access: {},
/**
* @name <head> 中额外的 script
* @description 配置 <head> 中额外的 script
*/
headScripts: [
// 解决首次加载时白屏的问题
{ src: '/qingdao/scripts/loading.js', async: true },
],
//================ pro 插件配置 =================
presets: ['umi-presets-pro'],
/**
* @name openAPI 插件的配置
* @description 基于 openapi 的规范生成serve 和mock能减少很多样板代码
* @doc https://pro.ant.design/zh-cn/docs/openapi/
*/
openAPI: [
{
requestLibPath: "import { request } from '@umijs/max'",
// 或者使用在线的版本
// schemaPath: "https://gw.alipayobjects.com/os/antfincdn/M%24jrzTTYJN/oneapi.json"
schemaPath: join(__dirname, 'oneapi.json'),
mock: false,
},
{
requestLibPath: "import { request } from '@umijs/max'",
schemaPath: 'https://gw.alipayobjects.com/os/antfincdn/CA1dOm%2631B/openapi.json',
projectName: 'swagger',
},
],
mfsu: {
strategy: 'normal',
},
outputPath: 'qingdao',
base: '/qingdao/',
publicPath: '/qingdao/',
esbuildMinifyIIFE: true,
requestRecord: {},
});

28
config/defaultSettings.ts Normal file
View File

@@ -0,0 +1,28 @@
import { ProLayoutProps } from '@ant-design/pro-components';
/**
* @name
*/
const Settings: ProLayoutProps & {
pwa?: boolean;
logo?: string;
} = {
navTheme: 'light',
// 拂晓蓝
colorPrimary: '#1890ff',
layout: 'mix',
contentWidth: 'Fluid',
fixedHeader: false,
fixSiderbar: true,
colorWeak: false,
title: '喀什智慧就业服务系统',
pwa: true,
logo: 'https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg',
iconfontUrl: '',
token: {
// 参见ts声明demo 见文档通过token 修改样式
//https://procomponents.ant.design/components/layout#%E9%80%9A%E8%BF%87-token-%E4%BF%AE%E6%94%B9%E6%A0%B7%E5%BC%8F
},
};
export default Settings;

593
config/oneapi.json Normal file
View File

@@ -0,0 +1,593 @@
{
"openapi": "3.0.1",
"info": {
"title": "Ant Design Pro",
"version": "1.0.0"
},
"servers": [
{
"url": "http://localhost:8000/"
},
{
"url": "https://localhost:8000/"
}
],
"paths": {
"/api/currentUser": {
"get": {
"tags": ["api"],
"description": "获取当前的用户",
"operationId": "currentUser",
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CurrentUser"
}
}
}
},
"401": {
"description": "Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
}
},
"x-swagger-router-controller": "api"
},
"/api/login/captcha": {
"post": {
"description": "发送验证码",
"operationId": "getFakeCaptcha",
"tags": ["login"],
"parameters": [
{
"name": "phone",
"in": "query",
"description": "手机号",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/FakeCaptcha"
}
}
}
}
}
}
},
"/api/login/outLogin": {
"post": {
"description": "登录接口",
"operationId": "outLogin",
"tags": ["login"],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"401": {
"description": "Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
}
},
"x-swagger-router-controller": "api"
},
"/api/login/account": {
"post": {
"tags": ["login"],
"description": "登录接口",
"operationId": "login",
"requestBody": {
"description": "登录系统",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/LoginParams"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/LoginResult"
}
}
}
},
"401": {
"description": "Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
},
"x-codegen-request-body-name": "body"
},
"x-swagger-router-controller": "api"
},
"/api/notices": {
"summary": "getNotices",
"description": "NoticeIconItem",
"get": {
"tags": ["api"],
"operationId": "getNotices",
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/NoticeIconList"
}
}
}
}
}
}
},
"/api/rule": {
"get": {
"tags": ["rule"],
"description": "获取规则列表",
"operationId": "rule",
"parameters": [
{
"name": "current",
"in": "query",
"description": "当前的页码",
"schema": {
"type": "number"
}
},
{
"name": "pageSize",
"in": "query",
"description": "页面的容量",
"schema": {
"type": "number"
}
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RuleList"
}
}
}
},
"401": {
"description": "Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
}
},
"post": {
"tags": ["rule"],
"description": "新建规则",
"operationId": "addRule",
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RuleListItem"
}
}
}
},
"401": {
"description": "Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
}
},
"put": {
"tags": ["rule"],
"description": "新建规则",
"operationId": "updateRule",
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RuleListItem"
}
}
}
},
"401": {
"description": "Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
}
},
"delete": {
"tags": ["rule"],
"description": "删除规则",
"operationId": "removeRule",
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"401": {
"description": "Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
}
},
"x-swagger-router-controller": "api"
},
"/swagger": {
"x-swagger-pipe": "swagger_raw"
}
},
"components": {
"schemas": {
"CurrentUser": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"avatar": {
"type": "string"
},
"userid": {
"type": "string"
},
"email": {
"type": "string"
},
"signature": {
"type": "string"
},
"title": {
"type": "string"
},
"group": {
"type": "string"
},
"tags": {
"type": "array",
"items": {
"type": "object",
"properties": {
"key": {
"type": "string"
},
"label": {
"type": "string"
}
}
}
},
"notifyCount": {
"type": "integer",
"format": "int32"
},
"unreadCount": {
"type": "integer",
"format": "int32"
},
"country": {
"type": "string"
},
"access": {
"type": "string"
},
"geographic": {
"type": "object",
"properties": {
"province": {
"type": "object",
"properties": {
"label": {
"type": "string"
},
"key": {
"type": "string"
}
}
},
"city": {
"type": "object",
"properties": {
"label": {
"type": "string"
},
"key": {
"type": "string"
}
}
}
}
},
"address": {
"type": "string"
},
"phone": {
"type": "string"
}
}
},
"LoginResult": {
"type": "object",
"properties": {
"status": {
"type": "string"
},
"type": {
"type": "string"
},
"currentAuthority": {
"type": "string"
}
}
},
"PageParams": {
"type": "object",
"properties": {
"current": {
"type": "number"
},
"pageSize": {
"type": "number"
}
}
},
"RuleListItem": {
"type": "object",
"properties": {
"key": {
"type": "integer",
"format": "int32"
},
"disabled": {
"type": "boolean"
},
"href": {
"type": "string"
},
"avatar": {
"type": "string"
},
"name": {
"type": "string"
},
"owner": {
"type": "string"
},
"desc": {
"type": "string"
},
"callNo": {
"type": "integer",
"format": "int32"
},
"status": {
"type": "integer",
"format": "int32"
},
"updatedAt": {
"type": "string",
"format": "datetime"
},
"createdAt": {
"type": "string",
"format": "datetime"
},
"progress": {
"type": "integer",
"format": "int32"
}
}
},
"RuleList": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/RuleListItem"
}
},
"total": {
"type": "integer",
"description": "列表的内容总数",
"format": "int32"
},
"success": {
"type": "boolean"
}
}
},
"FakeCaptcha": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"status": {
"type": "string"
}
}
},
"LoginParams": {
"type": "object",
"properties": {
"username": {
"type": "string"
},
"password": {
"type": "string"
},
"autoLogin": {
"type": "boolean"
},
"type": {
"type": "string"
}
}
},
"ErrorResponse": {
"required": ["errorCode"],
"type": "object",
"properties": {
"errorCode": {
"type": "string",
"description": "业务约定的错误码"
},
"errorMessage": {
"type": "string",
"description": "业务上的错误信息"
},
"success": {
"type": "boolean",
"description": "业务上的请求是否成功"
}
}
},
"NoticeIconList": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/NoticeIconItem"
}
},
"total": {
"type": "integer",
"description": "列表的内容总数",
"format": "int32"
},
"success": {
"type": "boolean"
}
}
},
"NoticeIconItemType": {
"title": "NoticeIconItemType",
"description": "已读未读列表的枚举",
"type": "string",
"properties": {},
"enum": ["notification", "message", "event"]
},
"NoticeIconItem": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"extra": {
"type": "string",
"format": "any"
},
"key": { "type": "string" },
"read": {
"type": "boolean"
},
"avatar": {
"type": "string"
},
"title": {
"type": "string"
},
"status": {
"type": "string"
},
"datetime": {
"type": "string",
"format": "date"
},
"description": {
"type": "string"
},
"type": {
"extensions": {
"x-is-enum": true
},
"$ref": "#/components/schemas/NoticeIconItemType"
}
}
}
}
}
}

57
config/proxy.ts Normal file
View File

@@ -0,0 +1,57 @@
/**
* @name 代理的配置
* @see 在生产环境 代理是无法生效的,所以这里没有生产环境的配置
* -------------------------------
* The agent cannot take effect in the production environment
* so there is no configuration of the production environment
* For details, please see
* https://pro.ant.design/docs/deploy
*
* @doc https://umijs.org/docs/guides/proxy
*/
export default {
// 如果需要自定义本地开发服务器 请取消注释按需调整
dev: {
// localhost:8000/api/** -> https://preview.pro.ant.design/api/**
'/api/': {
// 要代理的地址
target: 'http://ks.zhaopinzao8dian.com/api/ks',
// 配置了这个可以从 http 代理到 https
// 依赖 origin 的功能可能需要这个,比如 cookie
changeOrigin: true,
pathRewrite: { '^/api': '' },
},
'/profile/avatar/': {
target: 'http://ks.zhaopinzao8dian.com/api/ks',
changeOrigin: true,
},
'/app/': {
// 要代理的地址
target: 'http://ks.zhaopinzao8dian.com/api/ks',
// 配置了这个可以从 http 代理到 https
// 依赖 origin 的功能可能需要这个,比如 cookie
changeOrigin: true,
pathRewrite: { '^/api': '' },
},
},
/**
* @name 详细的代理配置
* @doc https://github.com/chimurai/http-proxy-middleware
*/
test: {
// localhost:8000/api/** -> https://preview.pro.ant.design/api/**
'/api/': {
target: 'https://proapi.azurewebsites.net',
changeOrigin: true,
pathRewrite: { '^': '' },
},
},
pre: {
'/api/': {
target: 'your pre url',
changeOrigin: true,
pathRewrite: { '^': '' },
},
},
};

166
config/routes.ts Normal file
View File

@@ -0,0 +1,166 @@
/**
* @name umi 的路由配置
* @description 只支持 path,component,routes,redirect,wrappers,name,icon 的配置
* @param path path 只支持两种占位符配置,第一种是动态参数 :id 的形式,第二种是 * 通配符,通配符只能出现路由字符串的最后。
* @param component 配置 location 和 path 匹配后用于渲染的 React 组件路径。可以是绝对路径,也可以是相对路径,如果是相对路径,会从 src/pages 开始找起。
* @param routes 配置子路由,通常在需要为多个路径增加 layout 组件时使用。
* @param redirect 配置路由跳转
* @param wrappers 配置路由组件的包装组件,通过包装组件可以为当前的路由组件组合进更多的功能。 比如,可以用于路由级别的权限校验
* @param name 配置路由的标题,默认读取国际化文件 menu.ts 中 menu.xxxx 的值,如配置 name 为 login则读取 menu.ts 中 menu.login 的取值作为标题
* @param icon 配置路由的图标,取值参考 https://ant.design/components/icon-cn 注意去除风格后缀和大小写,如想要配置图标为 <StepBackwardOutlined /> 则取值应为 stepBackward 或 StepBackward如想要配置图标为 <UserOutlined /> 则取值应为 user 或者 User
* @doc https://umijs.org/docs/guides/routes
*/
export default [
{
path: '/',
redirect: '/account/center',
},
{
path: '*',
layout: false,
component: './404',
},
{
path: '/user',
layout: false,
routes: [
{
name: 'login',
path: '/user/login',
component: './User/Login',
},
],
},
{
path: '/job-portal',// 求职者首页
layout: false,
routes: [
{
path: '/job-portal',
component: './JobPortal',
},
{
path: '/job-portal/list',// 职位列表
component: './JobPortal/List',
},
{
path: '/job-portal/detail',// 职位详情
component: './JobPortal/Detail',
},
{
path: '/job-portal/resume',// 简历页面PC布局
component: './JobPortal/Resume',
},
{
path: '/job-portal/profile',// 求职者我的页面
component: './JobPortal/Profile',
},
{
path: '/job-portal/personal-center',// 个人中心页面
component: './JobPortal/PersonalCenter',
},
{
path: '/job-portal/personal-center/applications',// 已投递岗位列表
component: './JobPortal/PersonalCenter/Applications',
},
{
path: '/job-portal/personal-center/favorites',// 收藏岗位列表
component: './JobPortal/PersonalCenter/Favorites',
},
{
path: '/job-portal/personal-center/footprints',// 访问足迹岗位列表
component: './JobPortal/PersonalCenter/Footprints',
},
{
path: '/job-portal/message',// 消息通知页面
component: './JobPortal/Message',
},
],
},
{
path: '/account',
routes: [
{
name: 'acenter',
path: '/account/center',
component: './User/Center',
},
{
name: 'asettings',
path: '/account/settings',
component: './User/Settings',
},
],
},
{
name: 'area',
path: '/area',
routes: [
{
name: '字典数据',
path: '/area/updata-router/index/:id',
component: './Area/Subway/UpLine',
},
],
},
{
name: 'system',
path: '/system',
routes: [
{
name: '字典数据',
path: '/system/dict-data/index/:id',
component: './System/DictData',
},
{
name: '字典数据',
path: '/system/admin-dict-data/index/:id',
component: './System/AdminDictData',
},
{
name: '分配用户',
path: '/system/role-auth/user/:id',
component: './System/Role/authUser',
},
],
},
{
name: 'monitor',
path: '/monitor',
routes: [
{
name: '任务日志',
path: '/monitor/job-log/index/:id',
component: './Monitor/JobLog',
},
],
},
{
name: 'tool',
path: '/tool',
routes: [
{
name: '导入表',
path: '/tool/gen/import',
component: './Tool/Gen/import',
},
{
name: '编辑表',
path: '/tool/gen/edit.tsx',
component: './Tool/Gen/edit.tsx',
},
],
},
{
name: 'management',
path: '/management',
routes: [
{
name: '查看申请人',
path: '/management/see-matching/index/:id',
component: './Management/List/SeeMatching',
},
],
},
];

23
jest.config.ts Normal file
View File

@@ -0,0 +1,23 @@
import { configUmiAlias, createConfig } from '@umijs/max/test';
export default async () => {
const config = await configUmiAlias({
...createConfig({
target: 'browser',
}),
});
console.log();
return {
...config,
testEnvironmentOptions: {
...(config?.testEnvironmentOptions || {}),
url: 'http://localhost:8000',
},
setupFiles: [...(config.setupFiles || []), './tests/setupTests.jsx'],
globals: {
...config.globals,
localStorage: null,
},
};
};

11
jsconfig.json Normal file
View File

@@ -0,0 +1,11 @@
{
"compilerOptions": {
"jsx": "react-jsx",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
}
}

176
mock/listTableList.ts Normal file
View File

@@ -0,0 +1,176 @@
import { Request, Response } from 'express';
import moment from 'moment';
import { parse } from 'url';
// mock tableListDataSource
const genList = (current: number, pageSize: number) => {
const tableListDataSource: API.RuleListItem[] = [];
for (let i = 0; i < pageSize; i += 1) {
const index = (current - 1) * 10 + i;
tableListDataSource.push({
key: index,
disabled: i % 6 === 0,
href: 'https://ant.design',
avatar: [
'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
][i % 2],
name: `TradeCode ${index}`,
owner: '曲丽丽',
desc: '这是一段描述',
callNo: Math.floor(Math.random() * 1000),
status: Math.floor(Math.random() * 10) % 4,
updatedAt: moment().format('YYYY-MM-DD'),
createdAt: moment().format('YYYY-MM-DD'),
progress: Math.ceil(Math.random() * 100),
});
}
tableListDataSource.reverse();
return tableListDataSource;
};
let tableListDataSource = genList(1, 100);
function getRule(req: Request, res: Response, u: string) {
let realUrl = u;
if (!realUrl || Object.prototype.toString.call(realUrl) !== '[object String]') {
realUrl = req.url;
}
const { current = 1, pageSize = 10 } = req.query;
const params = parse(realUrl, true).query as unknown as API.PageParams &
API.RuleListItem & {
sorter: any;
filter: any;
};
let dataSource = [...tableListDataSource].slice(
((current as number) - 1) * (pageSize as number),
(current as number) * (pageSize as number),
);
if (params.sorter) {
const sorter = JSON.parse(params.sorter);
dataSource = dataSource.sort((prev, next) => {
let sortNumber = 0;
(Object.keys(sorter) as Array<keyof API.RuleListItem>).forEach((key) => {
let nextSort = next?.[key] as number;
let preSort = prev?.[key] as number;
if (sorter[key] === 'descend') {
if (preSort - nextSort > 0) {
sortNumber += -1;
} else {
sortNumber += 1;
}
return;
}
if (preSort - nextSort > 0) {
sortNumber += 1;
} else {
sortNumber += -1;
}
});
return sortNumber;
});
}
if (params.filter) {
const filter = JSON.parse(params.filter as any) as {
[key: string]: string[];
};
if (Object.keys(filter).length > 0) {
dataSource = dataSource.filter((item) => {
return (Object.keys(filter) as Array<keyof API.RuleListItem>).some((key) => {
if (!filter[key]) {
return true;
}
if (filter[key].includes(`${item[key]}`)) {
return true;
}
return false;
});
});
}
}
if (params.name) {
dataSource = dataSource.filter((data) => data?.name?.includes(params.name || ''));
}
const result = {
data: dataSource,
total: tableListDataSource.length,
success: true,
pageSize,
current: parseInt(`${params.current}`, 10) || 1,
};
return res.json(result);
}
function postRule(req: Request, res: Response, u: string, b: Request) {
let realUrl = u;
if (!realUrl || Object.prototype.toString.call(realUrl) !== '[object String]') {
realUrl = req.url;
}
const body = (b && b.body) || req.body;
const { method, name, desc, key } = body;
switch (method) {
/* eslint no-case-declarations:0 */
case 'delete':
tableListDataSource = tableListDataSource.filter((item) => key.indexOf(item.key) === -1);
break;
case 'post':
(() => {
const i = Math.ceil(Math.random() * 10000);
const newRule: API.RuleListItem = {
key: tableListDataSource.length,
href: 'https://ant.design',
avatar: [
'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
][i % 2],
name,
owner: '曲丽丽',
desc,
callNo: Math.floor(Math.random() * 1000),
status: Math.floor(Math.random() * 10) % 2,
updatedAt: moment().format('YYYY-MM-DD'),
createdAt: moment().format('YYYY-MM-DD'),
progress: Math.ceil(Math.random() * 100),
};
tableListDataSource.unshift(newRule);
return res.json(newRule);
})();
return;
case 'update':
(() => {
let newRule = {};
tableListDataSource = tableListDataSource.map((item) => {
if (item.key === key) {
newRule = { ...item, desc, name };
return { ...item, desc, name };
}
return item;
});
return res.json(newRule);
})();
return;
default:
break;
}
const result = {
list: tableListDataSource,
pagination: {
total: tableListDataSource.length,
},
};
res.json(result);
}
export default {
'GET /api/rule': getRule,
'POST /api/rule': postRule,
};

115
mock/notices.ts Normal file
View File

@@ -0,0 +1,115 @@
import { Request, Response } from 'express';
const getNotices = (req: Request, res: Response) => {
res.json({
data: [
{
id: '000000001',
avatar:
'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/MSbDR4FR2MUAAAAAAAAAAAAAFl94AQBr',
title: '你收到了 14 份新周报',
datetime: '2017-08-09',
type: 'notification',
},
{
id: '000000002',
avatar:
'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/hX-PTavYIq4AAAAAAAAAAAAAFl94AQBr',
title: '你推荐的 曲妮妮 已通过第三轮面试',
datetime: '2017-08-08',
type: 'notification',
},
{
id: '000000003',
avatar:
'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/jHX5R5l3QjQAAAAAAAAAAAAAFl94AQBr',
title: '这种模板可以区分多种通知类型',
datetime: '2017-08-07',
read: true,
type: 'notification',
},
{
id: '000000004',
avatar:
'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/Wr4mQqx6jfwAAAAAAAAAAAAAFl94AQBr',
title: '左侧图标用于区分不同的类型',
datetime: '2017-08-07',
type: 'notification',
},
{
id: '000000005',
avatar:
'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/Mzj_TbcWUj4AAAAAAAAAAAAAFl94AQBr',
title: '内容不要超过两行字,超出时自动截断',
datetime: '2017-08-07',
type: 'notification',
},
{
id: '000000006',
avatar:
'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/eXLzRbPqQE4AAAAAAAAAAAAAFl94AQBr',
title: '曲丽丽 评论了你',
description: '描述信息描述信息描述信息',
datetime: '2017-08-07',
type: 'message',
clickClose: true,
},
{
id: '000000007',
avatar:
'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/w5mRQY2AmEEAAAAAAAAAAAAAFl94AQBr',
title: '朱偏右 回复了你',
description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像',
datetime: '2017-08-07',
type: 'message',
clickClose: true,
},
{
id: '000000008',
avatar:
'https://mdn.alipayobjects.com/yuyan_qk0oxh/afts/img/wPadR5M9918AAAAAAAAAAAAAFl94AQBr',
title: '标题',
description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像',
datetime: '2017-08-07',
type: 'message',
clickClose: true,
},
{
id: '000000009',
title: '任务名称',
description: '任务需要在 2017-01-12 20:00 前启动',
extra: '未开始',
status: 'todo',
type: 'event',
},
{
id: '000000010',
title: '第三方紧急代码变更',
description: '冠霖提交于 2017-01-06需在 2017-01-07 前完成代码变更任务',
extra: '马上到期',
status: 'urgent',
type: 'event',
},
{
id: '000000011',
title: '信息安全考试',
description: '指派竹尔于 2017-01-09 前完成更新并发布',
extra: '已耗时 8 天',
status: 'doing',
type: 'event',
},
{
id: '000000012',
title: 'ABCD 版本发布',
description: '冠霖提交于 2017-01-06需在 2017-01-07 前完成代码变更任务',
extra: '进行中',
status: 'processing',
type: 'event',
},
],
});
};
export default {
'GET /api/notices': getNotices,
};

324
mock/requestRecord.mock.js Normal file
View File

@@ -0,0 +1,324 @@
module.exports = {
'GET /api/currentUser': {
data: {
name: 'Serati Ma',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png',
userid: '00000001',
email: 'antdesign@alipay.com',
signature: '海纳百川,有容乃大',
title: '交互专家',
group: '蚂蚁金服某某某事业群某某平台部某某技术部UED',
tags: [
{ key: '0', label: '很有想法的' },
{ key: '1', label: '专注设计' },
{ key: '2', label: '辣~' },
{ key: '3', label: '大长腿' },
{ key: '4', label: '川妹子' },
{ key: '5', label: '海纳百川' },
],
notifyCount: 12,
unreadCount: 11,
country: 'China',
geographic: {
province: { label: '浙江省', key: '330000' },
city: { label: '杭州市', key: '330100' },
},
address: '西湖区工专路 77 号',
phone: '0752-268888888',
},
},
'GET /api/rule': {
data: [
{
key: 99,
disabled: false,
href: 'https://ant.design',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
name: 'TradeCode 99',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 503,
status: '0',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 81,
},
{
key: 98,
disabled: false,
href: 'https://ant.design',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
name: 'TradeCode 98',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 164,
status: '0',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 12,
},
{
key: 97,
disabled: false,
href: 'https://ant.design',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
name: 'TradeCode 97',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 174,
status: '1',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 81,
},
{
key: 96,
disabled: true,
href: 'https://ant.design',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
name: 'TradeCode 96',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 914,
status: '0',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 7,
},
{
key: 95,
disabled: false,
href: 'https://ant.design',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
name: 'TradeCode 95',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 698,
status: '2',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 82,
},
{
key: 94,
disabled: false,
href: 'https://ant.design',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
name: 'TradeCode 94',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 488,
status: '1',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 14,
},
{
key: 93,
disabled: false,
href: 'https://ant.design',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
name: 'TradeCode 93',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 580,
status: '2',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 77,
},
{
key: 92,
disabled: false,
href: 'https://ant.design',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
name: 'TradeCode 92',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 244,
status: '3',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 58,
},
{
key: 91,
disabled: false,
href: 'https://ant.design',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
name: 'TradeCode 91',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 959,
status: '0',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 66,
},
{
key: 90,
disabled: true,
href: 'https://ant.design',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
name: 'TradeCode 90',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 958,
status: '0',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 72,
},
{
key: 89,
disabled: false,
href: 'https://ant.design',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
name: 'TradeCode 89',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 301,
status: '2',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 2,
},
{
key: 88,
disabled: false,
href: 'https://ant.design',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
name: 'TradeCode 88',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 277,
status: '1',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 12,
},
{
key: 87,
disabled: false,
href: 'https://ant.design',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
name: 'TradeCode 87',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 810,
status: '1',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 82,
},
{
key: 86,
disabled: false,
href: 'https://ant.design',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
name: 'TradeCode 86',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 780,
status: '3',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 22,
},
{
key: 85,
disabled: false,
href: 'https://ant.design',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
name: 'TradeCode 85',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 705,
status: '3',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 12,
},
{
key: 84,
disabled: true,
href: 'https://ant.design',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
name: 'TradeCode 84',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 203,
status: '0',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 79,
},
{
key: 83,
disabled: false,
href: 'https://ant.design',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
name: 'TradeCode 83',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 491,
status: '2',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 59,
},
{
key: 82,
disabled: false,
href: 'https://ant.design',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
name: 'TradeCode 82',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 73,
status: '0',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 100,
},
{
key: 81,
disabled: false,
href: 'https://ant.design',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
name: 'TradeCode 81',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 406,
status: '3',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 61,
},
{
key: 80,
disabled: false,
href: 'https://ant.design',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
name: 'TradeCode 80',
owner: '曲丽丽',
desc: '这是一段描述',
callNo: 112,
status: '2',
updatedAt: '2022-12-06T05:00:57.040Z',
createdAt: '2022-12-06T05:00:57.040Z',
progress: 20,
},
],
total: 100,
success: true,
pageSize: 20,
current: 1,
},
'POST /api/login/outLogin': { data: {}, success: true },
'POST /api/login/account': {
status: 'ok',
type: 'account',
currentAuthority: 'admin',
},
};

5
mock/route.ts Normal file
View File

@@ -0,0 +1,5 @@
export default {
'/api/auth_routes': {
'/form/advanced-form': { authority: ['admin', 'user'] },
},
};

203
mock/user.ts Normal file
View File

@@ -0,0 +1,203 @@
import { Request, Response } from 'express';
const waitTime = (time: number = 100) => {
return new Promise((resolve) => {
setTimeout(() => {
resolve(true);
}, time);
});
};
async function getFakeCaptcha(req: Request, res: Response) {
await waitTime(2000);
return res.json('captcha-xxx');
}
const { ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION } = process.env;
/**
* 当前用户的权限,如果为空代表没登录
* current user access if is '', user need login
* 如果是 pro 的预览,默认是有权限的
*/
let access = ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site' ? 'admin' : '';
const getAccess = () => {
return access;
};
// 代码中会兼容本地 service mock 以及部署站点的静态数据
export default {
// 支持值为 Object 和 Array
'GET /api/currentUser': (req: Request, res: Response) => {
if (!getAccess()) {
res.status(401).send({
data: {
isLogin: false,
},
errorCode: '401',
errorMessage: '请先登录!',
success: true,
});
return;
}
res.send({
success: true,
data: {
name: 'Serati Ma',
avatar: 'https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png',
userid: '00000001',
email: 'antdesign@alipay.com',
signature: '海纳百川,有容乃大',
title: '交互专家',
group: '蚂蚁金服某某某事业群某某平台部某某技术部UED',
tags: [
{
key: '0',
label: '很有想法的',
},
{
key: '1',
label: '专注设计',
},
{
key: '2',
label: '辣~',
},
{
key: '3',
label: '大长腿',
},
{
key: '4',
label: '川妹子',
},
{
key: '5',
label: '海纳百川',
},
],
notifyCount: 12,
unreadCount: 11,
country: 'China',
access: getAccess(),
geographic: {
province: {
label: '浙江省',
key: '330000',
},
city: {
label: '杭州市',
key: '330100',
},
},
address: '西湖区工专路 77 号',
phone: '0752-268888888',
},
});
},
// GET POST 可省略
'GET /api/users': [
{
key: '1',
name: 'John Brown',
age: 32,
address: 'New York No. 1 Lake Park',
},
{
key: '2',
name: 'Jim Green',
age: 42,
address: 'London No. 1 Lake Park',
},
{
key: '3',
name: 'Joe Black',
age: 32,
address: 'Sidney No. 1 Lake Park',
},
],
'POST /api/login/account': async (req: Request, res: Response) => {
const { password, username, type } = req.body;
await waitTime(2000);
if (password === 'ant.design' && username === 'admin') {
res.send({
status: 'ok',
type,
currentAuthority: 'admin',
});
access = 'admin';
return;
}
if (password === 'ant.design' && username === 'user') {
res.send({
status: 'ok',
type,
currentAuthority: 'user',
});
access = 'user';
return;
}
if (type === 'mobile') {
res.send({
status: 'ok',
type,
currentAuthority: 'admin',
});
access = 'admin';
return;
}
res.send({
status: 'error',
type,
currentAuthority: 'guest',
});
access = 'guest';
},
'POST /api/login/outLogin': (req: Request, res: Response) => {
access = '';
res.send({ data: {}, success: true });
},
'POST /api/register': (req: Request, res: Response) => {
res.send({ status: 'ok', currentAuthority: 'user', success: true });
},
'GET /api/500': (req: Request, res: Response) => {
res.status(500).send({
timestamp: 1513932555104,
status: 500,
error: 'error',
message: 'error',
path: '/base/category/list',
});
},
'GET /api/404': (req: Request, res: Response) => {
res.status(404).send({
timestamp: 1513932643431,
status: 404,
error: 'Not Found',
message: 'No message available',
path: '/base/category/list/2121212',
});
},
'GET /api/403': (req: Request, res: Response) => {
res.status(403).send({
timestamp: 1513932555104,
status: 403,
error: 'Forbidden',
message: 'Forbidden',
path: '/base/category/list',
});
},
'GET /api/401': (req: Request, res: Response) => {
res.status(401).send({
timestamp: 1513932555104,
status: 401,
error: 'Unauthorized',
message: 'Unauthorized',
path: '/base/category/list',
});
},
'GET /api/login/captcha': getFakeCaptcha,
};

42620
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

146
package.json Normal file
View File

@@ -0,0 +1,146 @@
{
"name": "ant-design-pro",
"version": "6.0.0",
"private": true,
"description": "An out-of-box UI solution for enterprise applications",
"scripts": {
"dev": "npm run start:dev",
"build": "max build",
"deploy": "npm run build && npm run gh-pages",
"preview": "npm run build && max preview --port 8000",
"serve": "umi-serve",
"start": "cross-env UMI_ENV=dev max dev",
"start:dev": "cross-env REACT_APP_ENV=dev MOCK=none UMI_ENV=dev max dev",
"start:no-mock": "cross-env MOCK=none UMI_ENV=dev max dev",
"start:pre": "cross-env REACT_APP_ENV=pre UMI_ENV=dev max dev",
"start:test": "cross-env REACT_APP_ENV=test MOCK=none UMI_ENV=dev max dev",
"test": "jest",
"test:coverage": "npm run jest -- --coverage",
"test:update": "npm run jest -- -u",
"docker-hub:build": "docker build -f Dockerfile.hub -t ant-design-pro ./",
"docker-prod:build": "docker-compose -f ./docker/docker-compose.yml build",
"docker-prod:dev": "docker-compose -f ./docker/docker-compose.yml up",
"docker:build": "docker-compose -f ./docker/docker-compose.dev.yml build",
"docker:dev": "docker-compose -f ./docker/docker-compose.dev.yml up",
"docker:push": "npm run docker-hub:build && npm run docker:tag && docker push antdesign/ant-design-pro",
"docker:tag": "docker tag ant-design-pro antdesign/ant-design-pro",
"analyze": "cross-env ANALYZE=1 max build",
"gh-pages": "gh-pages -d dist",
"i18n-remove": "pro i18n-remove --locale=zh-CN --write",
"postinstall": "max setup",
"jest": "jest",
"lint": "npm run lint:js && npm run lint:prettier && npm run tsc",
"lint-staged": "lint-staged",
"lint-staged:js": "eslint --ext .js,.jsx,.ts,.tsx ",
"lint:fix": "eslint --fix --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src ",
"lint:js": "eslint --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src",
"lint:prettier": "prettier -c --write \"**/**.{js,jsx,tsx,ts,less,md,json}\" --end-of-line auto",
"openapi": "max openapi",
"prepare": "cd .. && husky install",
"prettier": "prettier -c --write \"**/**.{js,jsx,tsx,ts,less,md,json}\"",
"tsc": "tsc --noEmit",
"record": "cross-env NODE_ENV=development REACT_APP_ENV=test max record --scene=login"
},
"lint-staged": {
"**/*.{js,jsx,ts,tsx}": "npm run lint-staged:js",
"**/*.{js,jsx,tsx,ts,less,md,json}": [
"prettier --write"
]
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 10"
],
"dependencies": {
"@amap/amap-jsapi-loader": "^1.0.1",
"@ant-design/charts": "^2.3.0",
"@ant-design/icons": "^5.5.0",
"@ant-design/maps": "^1.0.0",
"@ant-design/plots": "^2.3.2",
"@ant-design/pro-components": "^2.8.7",
"@ant-design/use-emotion-css": "1.0.4",
"@testing-library/dom": "^10.4.0",
"@umijs/route-utils": "^4.0.1",
"antd": "^5.21.1",
"antd-style": "^3.6.2",
"classnames": "^2.5.1",
"dayjs": "^1.11.13",
"echarts": "^5.6.0",
"fabric": "^6.4.0",
"highlight.js": "^11.10.0",
"lodash": "^4.17.21",
"moment": "^2.30.1",
"omit.js": "^2.0.2",
"query-string": "^9.1.0",
"rc-menu": "^9.15.0",
"rc-util": "^5.43.0",
"react": "^18.3.0",
"react-cropper": "^2.3.3",
"react-dev-inspector": "^2.0.1",
"react-dom": "^18.3.0",
"react-helmet-async": "^2.0.0",
"react-highlight": "^0.15.0"
},
"devDependencies": {
"@ant-design/pro-cli": "^3.3.0",
"@testing-library/react": "^16.0.1",
"@types/classnames": "^2.3.1",
"@types/express": "^4.17.21",
"@types/history": "^4.7.11",
"@types/jest": "^29.5.12",
"@types/lodash": "^4.17.4",
"@types/react": "^18.3.0",
"@types/react-dom": "^18.3.0",
"@types/react-helmet": "^6.1.11",
"@umijs/fabric": "^2.14.1",
"@umijs/lint": "^4.2.9",
"@umijs/max": "^4.2.9",
"cross-env": "^7.0.3",
"eslint": "^9.11.0",
"express": "^4.21.0",
"gh-pages": "^6.1.0",
"husky": "^9.1.3",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"lint-staged": "^15.2.0",
"mockjs": "^1.1.0",
"prettier": "^3.3.0",
"swagger-ui-dist": "^5.17.14",
"ts-node": "^10.9.1",
"typescript": "^5.6.2",
"umi-presets-pro": "^2.0.0"
},
"engines": {
"node": ">=12.0.0"
},
"create-umi": {
"ignoreScript": [
"docker*",
"functions*",
"site",
"generateMock"
],
"ignoreDependencies": [
"netlify*",
"serverless"
],
"ignore": [
".dockerignore",
".git",
".github",
".gitpod.yml",
"CODE_OF_CONDUCT.md",
"Dockerfile",
"Dockerfile.*",
"lambda",
"LICENSE",
"netlify.toml",
"README.*.md",
"azure-pipelines.yml",
"docker",
"CNAME",
"create-umi"
]
}
}

1
public/CNAME Normal file
View File

@@ -0,0 +1 @@
preview.pro.ant.design

BIN
public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

5
public/pro_icon.svg Normal file
View File

@@ -0,0 +1,5 @@
<svg width="42" height="42" xmlns="http://www.w3.org/2000/svg">
<g>
<path fill="#070707" d="m6.717392,13.773912l5.6,0c2.8,0 4.7,1.9 4.7,4.7c0,2.8 -2,4.7 -4.9,4.7l-2.5,0l0,4.3l-2.9,0l0,-13.7zm2.9,2.2l0,4.9l1.9,0c1.6,0 2.6,-0.9 2.6,-2.4c0,-1.6 -0.9,-2.4 -2.6,-2.4l-1.9,0l0,-0.1zm8.9,11.5l2.7,0l0,-5.7c0,-1.4 0.8,-2.3 2.2,-2.3c0.4,0 0.8,0.1 1,0.2l0,-2.4c-0.2,-0.1 -0.5,-0.1 -0.8,-0.1c-1.2,0 -2.1,0.7 -2.4,2l-0.1,0l0,-1.9l-2.7,0l0,10.2l0.1,0zm11.7,0.1c-3.1,0 -5,-2 -5,-5.3c0,-3.3 2,-5.3 5,-5.3s5,2 5,5.3c0,3.4 -1.9,5.3 -5,5.3zm0,-2.1c1.4,0 2.2,-1.1 2.2,-3.2c0,-2 -0.8,-3.2 -2.2,-3.2c-1.4,0 -2.2,1.2 -2.2,3.2c0,2.1 0.8,3.2 2.2,3.2z" class="st0" id="Ant-Design-Pro"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 677 B

202
public/scripts/loading.js Normal file
View File

@@ -0,0 +1,202 @@
/**
* loading 占位
* 解决首次加载时白屏的问题
*/
(function () {
const _root = document.querySelector('#root');
if (_root && _root.innerHTML === '') {
_root.innerHTML = `
<style>
html,
body,
#root {
height: 100%;
margin: 0;
padding: 0;
}
#root {
background-repeat: no-repeat;
background-size: 100% auto;
}
.loading-title {
font-size: 1.1rem;
}
.loading-sub-title {
margin-top: 20px;
font-size: 1rem;
color: #888;
}
.page-loading-warp {
display: flex;
align-items: center;
justify-content: center;
padding: 26px;
}
.ant-spin {
position: absolute;
display: none;
-webkit-box-sizing: border-box;
box-sizing: border-box;
margin: 0;
padding: 0;
color: rgba(0, 0, 0, 0.65);
color: #1890ff;
font-size: 14px;
font-variant: tabular-nums;
line-height: 1.5;
text-align: center;
list-style: none;
opacity: 0;
-webkit-transition: -webkit-transform 0.3s
cubic-bezier(0.78, 0.14, 0.15, 0.86);
transition: -webkit-transform 0.3s
cubic-bezier(0.78, 0.14, 0.15, 0.86);
transition: transform 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86);
transition: transform 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86),
-webkit-transform 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86);
-webkit-font-feature-settings: "tnum";
font-feature-settings: "tnum";
}
.ant-spin-spinning {
position: static;
display: inline-block;
opacity: 1;
}
.ant-spin-dot {
position: relative;
display: inline-block;
width: 20px;
height: 20px;
font-size: 20px;
}
.ant-spin-dot-item {
position: absolute;
display: block;
width: 9px;
height: 9px;
background-color: #1890ff;
border-radius: 100%;
-webkit-transform: scale(0.75);
-ms-transform: scale(0.75);
transform: scale(0.75);
-webkit-transform-origin: 50% 50%;
-ms-transform-origin: 50% 50%;
transform-origin: 50% 50%;
opacity: 0.3;
-webkit-animation: antspinmove 1s infinite linear alternate;
animation: antSpinMove 1s infinite linear alternate;
}
.ant-spin-dot-item:nth-child(1) {
top: 0;
left: 0;
}
.ant-spin-dot-item:nth-child(2) {
top: 0;
right: 0;
-webkit-animation-delay: 0.4s;
animation-delay: 0.4s;
}
.ant-spin-dot-item:nth-child(3) {
right: 0;
bottom: 0;
-webkit-animation-delay: 0.8s;
animation-delay: 0.8s;
}
.ant-spin-dot-item:nth-child(4) {
bottom: 0;
left: 0;
-webkit-animation-delay: 1.2s;
animation-delay: 1.2s;
}
.ant-spin-dot-spin {
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
-webkit-animation: antrotate 1.2s infinite linear;
animation: antRotate 1.2s infinite linear;
}
.ant-spin-lg .ant-spin-dot {
width: 32px;
height: 32px;
font-size: 32px;
}
.ant-spin-lg .ant-spin-dot i {
width: 14px;
height: 14px;
}
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
.ant-spin-blur {
background: #fff;
opacity: 0.5;
}
}
@-webkit-keyframes antSpinMove {
to {
opacity: 1;
}
}
@keyframes antSpinMove {
to {
opacity: 1;
}
}
@-webkit-keyframes antRotate {
to {
-webkit-transform: rotate(405deg);
transform: rotate(405deg);
}
}
@keyframes antRotate {
to {
-webkit-transform: rotate(405deg);
transform: rotate(405deg);
}
}
</style>
<div style="
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100%;
min-height: 362px;
">
<div class="page-loading-warp">
<div class="ant-spin ant-spin-lg ant-spin-spinning">
<span class="ant-spin-dot ant-spin-dot-spin">
<i class="ant-spin-dot-item"></i>
<i class="ant-spin-dot-item"></i>
<i class="ant-spin-dot-item"></i>
<i class="ant-spin-dot-item"></i>
</span>
</div>
</div>
<div class="loading-title">
正在加载资源
</div>
<div class="loading-sub-title">
初次加载资源可能需要较多时间 请耐心等待
</div>
</div>
`;
}
})();

File diff suppressed because one or more lines are too long

View File

@@ -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} />;
}

View File

@@ -0,0 +1,21 @@
// @ts-nocheck
// This file is generated by Umi automatically
// DO NOT CHANGE IT MANUALLY!
import type { IRuntimeConfig as Plugin0 } from 'E:/project/ks-admin/src/.umi-production/plugin-antd/runtimeConfig.d'
import type { IRuntimeConfig as Plugin1 } from 'E:/project/ks-admin/src/.umi-production/plugin-initialState/runtimeConfig.d'
import type { IRuntimeConfig as Plugin2 } from 'E:/project/ks-admin/src/.umi-production/plugin-layout/runtimeConfig.d'
import type { IRuntimeConfig as Plugin3 } from 'E:/project/ks-admin/src/.umi-production/plugin-locale/runtimeConfig.d'
import type { IRuntimeConfig as Plugin4 } from 'E:/project/ks-admin/src/.umi-production/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 & Plugin4
export function defineApp(config: RuntimeConfig): RuntimeConfig {
return config;
}

View File

@@ -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/ks-admin/node_modules/@umijs/renderer-react';
import { context } from './helmetContext';
export const innerProvider = (container) => {
return React.createElement(HelmetProvider, { context }, container);
}

View File

@@ -0,0 +1,4 @@
// @ts-nocheck
// This file is generated by Umi automatically
// DO NOT CHANGE IT MANUALLY!
export const context = {};

View File

@@ -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/ks-admin/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 };

View File

@@ -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/ks-admin/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

View File

@@ -0,0 +1,70 @@
// @ts-nocheck
// This file is generated by Umi automatically
// DO NOT CHANGE IT MANUALLY!
import * as Plugin_0 from 'E:/project/ks-admin/src/app.tsx';
import * as Plugin_1 from '@@/core/helmet.ts';
import * as Plugin_2 from 'E:/project/ks-admin/src/.umi-production/plugin-access/runtime.tsx';
import * as Plugin_3 from 'E:/project/ks-admin/src/.umi-production/plugin-initialState/runtime.tsx';
import * as Plugin_4 from 'E:/project/ks-admin/src/.umi-production/plugin-layout/runtime.tsx';
import * as Plugin_5 from 'E:/project/ks-admin/src/.umi-production/plugin-locale/runtime.tsx';
import * as Plugin_6 from 'E:/project/ks-admin/src/.umi-production/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/ks-admin/src/app.tsx',
},
{
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/ks-admin/src/.umi-production/plugin-access/runtime.tsx',
},
{
apply: Plugin_3,
path: process.env.NODE_ENV === 'production' ? void 0 : 'E:/project/ks-admin/src/.umi-production/plugin-initialState/runtime.tsx',
},
{
apply: Plugin_4,
path: process.env.NODE_ENV === 'production' ? void 0 : 'E:/project/ks-admin/src/.umi-production/plugin-layout/runtime.tsx',
},
{
apply: Plugin_5,
path: process.env.NODE_ENV === 'production' ? void 0 : 'E:/project/ks-admin/src/.umi-production/plugin-locale/runtime.tsx',
},
{
apply: Plugin_6,
path: process.env.NODE_ENV === 'production' ? void 0 : 'E:/project/ks-admin/src/.umi-production/plugin-model/runtime.tsx',
},
];
}
export function getValidKeys() {
return ['patchRoutes','patchClientRoutes','modifyContextOpts','modifyClientRenderOpts','rootContainer','innerProvider','i18nProvider','accessProvider','dataflowProvider','outerProvider','render','onRouteChange','antd','getInitialState','layout','locale','qiankun','request',];
}
let pluginManager = null;
export function createPluginManager() {
pluginManager = PluginManager.create({
plugins: getPlugins(),
validKeys: getValidKeys(),
});
return pluginManager;
}
export function getPluginManager() {
return pluginManager;
}

View File

@@ -0,0 +1,406 @@
// @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;
transformRuntime: { [x: string]: any };
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: {
defaultPrefetch?: ("none" | "intent" | "render" | "viewport" | undefined);
defaultPrefetchTimeout?: (number | undefined);
};
terminal: {
};
tmpFiles: boolean;
clientLoader: {
};
routeProps: {
};
ssr: {
serverBuildPath?: (string | undefined);
serverBuildTarget?: ("express" | "worker" | undefined);
platform?: (string | undefined);
builder?: ("esbuild" | "webpack" | "mako" | undefined);
__INTERNAL_DO_NOT_USE_OR_YOU_WILL_BE_FIRED?: ({
pureApp?: (boolean | undefined);
pureHtml?: (boolean | undefined);
} | undefined);
useStream?: (boolean | 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: {
plugins?: (Array<{
load?: (((...args: any[]) => unknown) | undefined);
generateEnd?: (((...args: any[]) => unknown) | undefined);
}> | undefined);
px2rem?: ({
root?: (number | undefined);
propBlackList?: (Array<string> | undefined);
propWhiteList?: (Array<string> | undefined);
selectorBlackList?: (Array<string> | undefined);
selectorWhiteList?: (Array<string> | undefined);
selectorDoubleList?: (Array<string> | undefined);
} | undefined);
experimental?: ({
webpackSyntaxValidate?: (Array<string> | undefined);
} | undefined);
flexBugs?: (boolean | undefined);
optimization?: ({
skipModules?: (boolean | undefined);
} | undefined);
};
utoopack: {
};
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);
sort?: ((((...args: any[]) => unknown) | undefined) | 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>
>;

View File

@@ -0,0 +1,50 @@
// This file is generated by Umi automatically
// DO NOT CHANGE IT MANUALLY!
// Created by Umi Plugin
export interface IConfigFromPluginsJoi {
stagewise?: unknown
openAPI?: ({
requestLibPath?: string
schemaPath?: string
mock?: boolean
projectName?: string
apiPrefix?: (string | (() => any))
namespace?: string
hook?: {
customFunctionName?: (() => any)
customClassName?: (() => any)
}
}[] | {
requestLibPath?: string
schemaPath?: string
mock?: boolean
projectName?: string
apiPrefix?: (string | (() => any))
namespace?: string
hook?: {
customFunctionName?: (() => any)
customClassName?: (() => any)
}
})
keepalive?: unknown[]
tabsLayout?: (boolean | {
hasCustomTabs?: boolean
hasDropdown?: boolean
hasFixedHeader?: boolean
})
requestRecord?: {
exclude?: unknown[]
type?: boolean
namespace?: string
comment?: boolean
outputDir?: string
successFilter?: (() => any)
role?: string
mock?: {
outputDir?: string
fileName?: string
usingRole?: string
}
}
}

View File

@@ -0,0 +1,220 @@
// @ts-nocheck
// This file is generated by Umi automatically
// DO NOT CHANGE IT MANUALLY!
import "E:/project/ks-admin/node_modules/core-js/modules/es.error.cause.js";
import "E:/project/ks-admin/node_modules/core-js/modules/es.aggregate-error.js";
import "E:/project/ks-admin/node_modules/core-js/modules/es.aggregate-error.cause.js";
import "E:/project/ks-admin/node_modules/core-js/modules/es.array.at.js";
import "E:/project/ks-admin/node_modules/core-js/modules/es.array.find-last.js";
import "E:/project/ks-admin/node_modules/core-js/modules/es.array.find-last-index.js";
import "E:/project/ks-admin/node_modules/core-js/modules/es.array.push.js";
import "E:/project/ks-admin/node_modules/core-js/modules/es.array.reduce.js";
import "E:/project/ks-admin/node_modules/core-js/modules/es.array.reduce-right.js";
import "E:/project/ks-admin/node_modules/core-js/modules/es.array.to-reversed.js";
import "E:/project/ks-admin/node_modules/core-js/modules/es.array.to-sorted.js";
import "E:/project/ks-admin/node_modules/core-js/modules/es.array.to-spliced.js";
import "E:/project/ks-admin/node_modules/core-js/modules/es.array.with.js";
import "E:/project/ks-admin/node_modules/core-js/modules/es.map.group-by.js";
import "E:/project/ks-admin/node_modules/core-js/modules/es.object.group-by.js";
import "E:/project/ks-admin/node_modules/core-js/modules/es.object.has-own.js";
import "E:/project/ks-admin/node_modules/core-js/modules/es.promise.any.js";
import "E:/project/ks-admin/node_modules/core-js/modules/es.promise.with-resolvers.js";
import "E:/project/ks-admin/node_modules/core-js/modules/es.reflect.to-string-tag.js";
import "E:/project/ks-admin/node_modules/core-js/modules/es.regexp.flags.js";
import "E:/project/ks-admin/node_modules/core-js/modules/es.string.at-alternative.js";
import "E:/project/ks-admin/node_modules/core-js/modules/es.string.is-well-formed.js";
import "E:/project/ks-admin/node_modules/core-js/modules/es.string.replace-all.js";
import "E:/project/ks-admin/node_modules/core-js/modules/es.string.to-well-formed.js";
import "E:/project/ks-admin/node_modules/core-js/modules/es.typed-array.at.js";
import "E:/project/ks-admin/node_modules/core-js/modules/es.typed-array.find-last.js";
import "E:/project/ks-admin/node_modules/core-js/modules/es.typed-array.find-last-index.js";
import "E:/project/ks-admin/node_modules/core-js/modules/es.typed-array.set.js";
import "E:/project/ks-admin/node_modules/core-js/modules/es.typed-array.to-reversed.js";
import "E:/project/ks-admin/node_modules/core-js/modules/es.typed-array.to-sorted.js";
import "E:/project/ks-admin/node_modules/core-js/modules/es.typed-array.with.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.suppressed-error.constructor.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.array.from-async.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.array.filter-out.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.array.filter-reject.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.array.group.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.array.group-by.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.array.group-by-to-map.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.array.group-to-map.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.array.is-template-object.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.array.last-index.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.array.last-item.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.array.unique-by.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.array-buffer.detached.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.array-buffer.transfer.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.array-buffer.transfer-to-fixed-length.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.async-disposable-stack.constructor.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.async-iterator.constructor.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.async-iterator.as-indexed-pairs.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.async-iterator.async-dispose.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.async-iterator.drop.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.async-iterator.every.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.async-iterator.filter.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.async-iterator.find.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.async-iterator.flat-map.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.async-iterator.for-each.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.async-iterator.from.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.async-iterator.indexed.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.async-iterator.map.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.async-iterator.reduce.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.async-iterator.some.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.async-iterator.take.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.async-iterator.to-array.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.bigint.range.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.composite-key.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.composite-symbol.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.data-view.get-float16.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.data-view.get-uint8-clamped.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.data-view.set-float16.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.data-view.set-uint8-clamped.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.disposable-stack.constructor.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.function.demethodize.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.function.is-callable.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.function.is-constructor.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.function.metadata.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.function.un-this.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.iterator.constructor.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.iterator.as-indexed-pairs.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.iterator.dispose.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.iterator.drop.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.iterator.every.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.iterator.filter.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.iterator.find.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.iterator.flat-map.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.iterator.for-each.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.iterator.from.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.iterator.indexed.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.iterator.map.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.iterator.range.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.iterator.reduce.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.iterator.some.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.iterator.take.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.iterator.to-array.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.iterator.to-async.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.json.is-raw-json.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.json.parse.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.json.raw-json.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.map.delete-all.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.map.emplace.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.map.every.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.map.filter.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.map.find.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.map.find-key.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.map.from.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.map.includes.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.map.key-by.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.map.key-of.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.map.map-keys.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.map.map-values.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.map.merge.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.map.of.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.map.reduce.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.map.some.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.map.update.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.map.update-or-insert.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.map.upsert.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.math.clamp.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.math.deg-per-rad.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.math.degrees.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.math.fscale.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.math.f16round.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.math.iaddh.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.math.imulh.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.math.isubh.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.math.rad-per-deg.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.math.radians.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.math.scale.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.math.seeded-prng.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.math.signbit.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.math.umulh.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.number.from-string.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.number.range.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.object.iterate-entries.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.object.iterate-keys.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.object.iterate-values.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.observable.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.promise.try.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.reflect.define-metadata.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.reflect.delete-metadata.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.reflect.get-metadata.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.reflect.get-metadata-keys.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.reflect.get-own-metadata.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.reflect.get-own-metadata-keys.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.reflect.has-metadata.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.reflect.has-own-metadata.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.reflect.metadata.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.regexp.escape.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.set.add-all.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.set.delete-all.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.set.difference.v2.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.set.difference.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.set.every.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.set.filter.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.set.find.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.set.from.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.set.intersection.v2.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.set.intersection.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.set.is-disjoint-from.v2.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.set.is-disjoint-from.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.set.is-subset-of.v2.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.set.is-subset-of.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.set.is-superset-of.v2.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.set.is-superset-of.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.set.join.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.set.map.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.set.of.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.set.reduce.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.set.some.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.set.symmetric-difference.v2.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.set.symmetric-difference.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.set.union.v2.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.set.union.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.string.at.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.string.cooked.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.string.code-points.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.string.dedent.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.symbol.async-dispose.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.symbol.dispose.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.symbol.is-registered-symbol.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.symbol.is-registered.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.symbol.is-well-known-symbol.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.symbol.is-well-known.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.symbol.matcher.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.symbol.metadata.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.symbol.metadata-key.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.symbol.observable.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.symbol.pattern-match.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.symbol.replace-all.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.typed-array.from-async.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.typed-array.filter-out.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.typed-array.filter-reject.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.typed-array.group-by.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.typed-array.to-spliced.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.typed-array.unique-by.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.uint8-array.from-base64.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.uint8-array.from-hex.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.uint8-array.to-base64.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.uint8-array.to-hex.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.weak-map.delete-all.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.weak-map.from.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.weak-map.of.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.weak-map.emplace.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.weak-map.upsert.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.weak-set.add-all.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.weak-set.delete-all.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.weak-set.from.js";
import "E:/project/ks-admin/node_modules/core-js/modules/esnext.weak-set.of.js";
import "E:/project/ks-admin/node_modules/core-js/modules/web.dom-exception.stack.js";
import "E:/project/ks-admin/node_modules/core-js/modules/web.immediate.js";
import "E:/project/ks-admin/node_modules/core-js/modules/web.self.js";
import "E:/project/ks-admin/node_modules/core-js/modules/web.structured-clone.js";
import "E:/project/ks-admin/node_modules/core-js/modules/web.url.can-parse.js";
import "E:/project/ks-admin/node_modules/core-js/modules/web.url-search-params.delete.js";
import "E:/project/ks-admin/node_modules/core-js/modules/web.url-search-params.has.js";
import "E:/project/ks-admin/node_modules/core-js/modules/web.url-search-params.size.js";
import 'E:/project/ks-admin/node_modules/@umijs/preset-umi/node_modules/regenerator-runtime/runtime.js';
export {};

View File

@@ -0,0 +1,45 @@
// @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":"/account/center","parentId":"ant-design-pro-layout","id":"1"},"2":{"path":"*","layout":false,"id":"2"},"3":{"path":"/user","layout":false,"id":"3"},"4":{"name":"login","path":"/user/login","parentId":"3","id":"4"},"5":{"path":"/job-portal","layout":false,"id":"5"},"6":{"path":"/job-portal","parentId":"5","id":"6"},"7":{"path":"/job-portal/list","parentId":"5","id":"7"},"8":{"path":"/job-portal/detail","parentId":"5","id":"8"},"9":{"path":"/job-portal/resume","parentId":"5","id":"9"},"10":{"path":"/job-portal/profile","parentId":"5","id":"10"},"11":{"path":"/job-portal/personal-center","parentId":"5","id":"11"},"12":{"path":"/job-portal/personal-center/applications","parentId":"5","id":"12"},"13":{"path":"/job-portal/personal-center/favorites","parentId":"5","id":"13"},"14":{"path":"/job-portal/personal-center/footprints","parentId":"5","id":"14"},"15":{"path":"/job-portal/message","parentId":"5","id":"15"},"16":{"path":"/account","parentId":"ant-design-pro-layout","id":"16"},"17":{"name":"acenter","path":"/account/center","parentId":"16","id":"17"},"18":{"name":"asettings","path":"/account/settings","parentId":"16","id":"18"},"19":{"name":"area","path":"/area","parentId":"ant-design-pro-layout","id":"19"},"20":{"name":"字典数据","path":"/area/updata-router/index/:id","parentId":"19","id":"20"},"21":{"name":"system","path":"/system","parentId":"ant-design-pro-layout","id":"21"},"22":{"name":"字典数据","path":"/system/dict-data/index/:id","parentId":"21","id":"22"},"23":{"name":"字典数据","path":"/system/admin-dict-data/index/:id","parentId":"21","id":"23"},"24":{"name":"分配用户","path":"/system/role-auth/user/:id","parentId":"21","id":"24"},"25":{"name":"monitor","path":"/monitor","parentId":"ant-design-pro-layout","id":"25"},"26":{"name":"任务日志","path":"/monitor/job-log/index/:id","parentId":"25","id":"26"},"27":{"name":"tool","path":"/tool","parentId":"ant-design-pro-layout","id":"27"},"28":{"name":"导入表","path":"/tool/gen/import","parentId":"27","id":"28"},"29":{"name":"编辑表","path":"/tool/gen/edit.tsx","parentId":"27","id":"29"},"30":{"name":"management","path":"/management","parentId":"ant-design-pro-layout","id":"30"},"31":{"name":"查看申请人","path":"/management/see-matching/index/:id","parentId":"30","id":"31"},"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__404" */'@/pages/404.tsx')),
'3': React.lazy(() => import('./EmptyRoute')),
'4': React.lazy(() => import(/* webpackChunkName: "p__User__Login__index" */'@/pages/User/Login/index.tsx')),
'5': React.lazy(() => import('./EmptyRoute')),
'6': React.lazy(() => import(/* webpackChunkName: "p__JobPortal__index" */'@/pages/JobPortal/index.tsx')),
'7': React.lazy(() => import(/* webpackChunkName: "p__JobPortal__List__index" */'@/pages/JobPortal/List/index.tsx')),
'8': React.lazy(() => import(/* webpackChunkName: "p__JobPortal__Detail__index" */'@/pages/JobPortal/Detail/index.tsx')),
'9': React.lazy(() => import(/* webpackChunkName: "p__JobPortal__Resume__index" */'@/pages/JobPortal/Resume/index.tsx')),
'10': React.lazy(() => import(/* webpackChunkName: "p__JobPortal__Profile__index" */'@/pages/JobPortal/Profile/index.tsx')),
'11': React.lazy(() => import(/* webpackChunkName: "p__JobPortal__PersonalCenter__index" */'@/pages/JobPortal/PersonalCenter/index.tsx')),
'12': React.lazy(() => import(/* webpackChunkName: "p__JobPortal__PersonalCenter__Applications__index" */'@/pages/JobPortal/PersonalCenter/Applications/index.tsx')),
'13': React.lazy(() => import(/* webpackChunkName: "p__JobPortal__PersonalCenter__Favorites__index" */'@/pages/JobPortal/PersonalCenter/Favorites/index.tsx')),
'14': React.lazy(() => import(/* webpackChunkName: "p__JobPortal__PersonalCenter__Footprints__index" */'@/pages/JobPortal/PersonalCenter/Footprints/index.tsx')),
'15': React.lazy(() => import(/* webpackChunkName: "p__JobPortal__Message__index" */'@/pages/JobPortal/Message/index.tsx')),
'16': React.lazy(() => import('./EmptyRoute')),
'17': React.lazy(() => import(/* webpackChunkName: "p__User__Center__index" */'@/pages/User/Center/index.tsx')),
'18': React.lazy(() => import(/* webpackChunkName: "p__User__Settings__index" */'@/pages/User/Settings/index.tsx')),
'19': React.lazy(() => import('./EmptyRoute')),
'20': React.lazy(() => import(/* webpackChunkName: "p__Area__Subway__UpLine__index" */'@/pages/Area/Subway/UpLine/index.tsx')),
'21': React.lazy(() => import('./EmptyRoute')),
'22': React.lazy(() => import(/* webpackChunkName: "p__System__DictData__index" */'@/pages/System/DictData/index.tsx')),
'23': React.lazy(() => import(/* webpackChunkName: "p__System__AdminDictData__index" */'@/pages/System/AdminDictData/index.tsx')),
'24': React.lazy(() => import(/* webpackChunkName: "p__System__Role__authUser" */'@/pages/System/Role/authUser.tsx')),
'25': React.lazy(() => import('./EmptyRoute')),
'26': React.lazy(() => import(/* webpackChunkName: "p__Monitor__JobLog__index" */'@/pages/Monitor/JobLog/index.tsx')),
'27': React.lazy(() => import('./EmptyRoute')),
'28': React.lazy(() => import(/* webpackChunkName: "p__Tool__Gen__import" */'@/pages/Tool/Gen/import.tsx')),
'29': React.lazy(() => import(/* webpackChunkName: "p__Tool__Gen__edit" */'@/pages/Tool/Gen/edit.tsx')),
'30': React.lazy(() => import('./EmptyRoute')),
'31': React.lazy(() => import(/* webpackChunkName: "p__Management__List__SeeMatching__index" */'@/pages/Management/List/SeeMatching/index.tsx')),
'ant-design-pro-layout': React.lazy(() => import(/* webpackChunkName: "t__plugin-layout__Layout" */'E:/project/ks-admin/src/.umi-production/plugin-layout/Layout.tsx')),
},
};
}

View File

@@ -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 };

View File

@@ -0,0 +1,25 @@
// @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/ks-admin/src/.umi-production/plugin-access';
export { addLocale, setLocale, getLocale, getIntl, useIntl, injectIntl, formatMessage, FormattedMessage, getAllLocales, FormattedDate, FormattedDateParts, FormattedDisplayName, FormattedHTMLMessage, FormattedList, FormattedNumber, FormattedNumberParts, FormattedPlural, FormattedRelativeTime, FormattedTime, FormattedTimeParts, IntlProvider, RawIntlProvider, SelectLang } from 'E:/project/ks-admin/src/.umi-production/plugin-locale';
export { Provider, useModel } from 'E:/project/ks-admin/src/.umi-production/plugin-model';
export { useRequest, UseRequestProvider, request, getRequestInstance } from 'E:/project/ks-admin/src/.umi-production/plugin-request';
// plugins types.d.ts
export * from 'E:/project/ks-admin/src/.umi-production/plugin-access/types.d';
export * from 'E:/project/ks-admin/src/.umi-production/plugin-antd/types.d';
export * from 'E:/project/ks-admin/src/.umi-production/plugin-layout/types.d';
export * from 'E:/project/ks-admin/src/.umi-production/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, useLoaderData, useRouteProps, useSelectedRoutes, useServerLoaderData, renderClient, __getRoot, Link, useRouteData, __useFetcher, withRouter } from 'E:/project/ks-admin/node_modules/@umijs/renderer-react';
export type { History, ClientLoader } from 'E:/project/ks-admin/node_modules/@umijs/renderer-react'
// umi/client/client/plugin
export { ApplyPluginsType, PluginManager } from 'E:/project/ks-admin/node_modules/umi/client/client/plugin.js';
export { history, createHistory } from './core/history';
export { terminal } from './core/terminal';
// react ssr
export const useServerInsertedHTML: Function = () => {};

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -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>;
}

View File

@@ -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>;

View File

@@ -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>
);
}

View File

@@ -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
};

View File

@@ -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;

View File

@@ -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,
};
}

View File

@@ -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 && typeof window !== 'undefined') {
return <Loading />;
}
return props.children;
}

View File

@@ -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>;
}

View File

@@ -0,0 +1,5 @@
// This file is generated by Umi automatically
// DO NOT CHANGE IT MANUALLY!
export interface IRuntimeConfig {
getInitialState?: () => Promise<Record<string, any>>
}

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -0,0 +1,196 @@
// @ts-nocheck
// This file is generated by Umi automatically
// DO NOT CHANGE IT MANUALLY!
/// <reference types="E:/project/ks-admin/node_modules/@ant-design/pro-components" />
import {
Link, useLocation, useNavigate, Outlet, useAppData, matchRoutes,
type IRoute
} from '@umijs/max';
import React, { useMemo } from 'react';
import {
ProLayout,
} from "E:/project/ks-admin/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';
import { useIntl } from '@@/plugin-locale';
// 过滤出需要显示的路由, 这里的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 = {
"locale": false,
"navTheme": "light",
"colorPrimary": "#1890ff",
"layout": "mix",
"contentWidth": "Fluid",
"fixedHeader": false,
"fixSiderbar": true,
"colorWeak": false,
"title": "喀什智慧就业服务系统",
"pwa": true,
"logo": "https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg",
"iconfontUrl": "",
"token": {}
};
const { formatMessage } = useIntl();
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 || 'ant-design-pro'}
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>
);
}

View File

@@ -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;

View File

@@ -0,0 +1,4 @@
// @ts-nocheck
// This file is generated by Umi automatically
// DO NOT CHANGE IT MANUALLY!
export default { };

View File

@@ -0,0 +1,4 @@
// @ts-nocheck
// This file is generated by Umi automatically
// DO NOT CHANGE IT MANUALLY!
export type TempType = string

View File

@@ -0,0 +1,108 @@
// @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/ks-admin/node_modules/@umijs/plugins/node_modules/@ant-design/icons';
import { SelectLang } from '@@/plugin-locale';
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并且头像为空就取消掉这个返回的内容
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
)}
<SelectLang />
</div>
);
}

View File

@@ -0,0 +1,28 @@
// @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']);
}
}
});
}

View File

@@ -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
}

View File

@@ -0,0 +1,37 @@
// This file is generated by Umi automatically
// DO NOT CHANGE IT MANUALLY!
/// <reference types="E:/project/ks-admin/node_modules/@ant-design/pro-components" />
import type { ProLayoutProps, HeaderProps } from "E:/project/ks-admin/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;
};

View File

@@ -0,0 +1,367 @@
// @ts-nocheck
// This file is generated by Umi automatically
// DO NOT CHANGE IT MANUALLY!
import React,{ useState } from 'react';
import { getLocale, getAllLocales, setLocale } from './localeExports';
interface LocalData {
lang: string,
label?: string,
icon?: string,
title?: string,
}
interface SelectLangProps {
globalIconClassName?: string;
postLocalesData?: (locales: LocalData[]) => LocalData[];
onItemClick?: (params: ClickParam) => void;
className?: string;
reload?: boolean;
icon?: React.ReactNode;
style?: React.CSSProperties;
}
const transformArrayToObject = (allLangUIConfig:LocalData[])=>{
return allLangUIConfig.reduce((obj, item) => {
if(!item.lang){
return obj;
}
return {
...obj,
[item.lang]: item,
};
}, {});
}
const defaultLangUConfigMap = {
'ar-EG': {
lang: 'ar-EG',
label: 'العربية',
icon: '🇪🇬',
title: 'لغة'
},
'az-AZ': {
lang: 'az-AZ',
label: 'Azərbaycan dili',
icon: '🇦🇿',
title: 'Dil'
},
'bg-BG': {
lang: 'bg-BG',
label: 'Български език',
icon: '🇧🇬',
title: 'език'
},
'bn-BD': {
lang: 'bn-BD',
label: 'বাংলা',
icon: '🇧🇩',
title: 'ভাষা'
},
'ca-ES': {
lang: 'ca-ES',
label: 'Catalá',
icon: '🇨🇦',
title: 'llengua'
},
'cs-CZ': {
lang: 'cs-CZ',
label: 'Čeština',
icon: '🇨🇿',
title: 'Jazyk'
},
'da-DK': {
lang: 'da-DK',
label: 'Dansk',
icon: '🇩🇰',
title: 'Sprog'
},
'de-DE': {
lang: 'de-DE',
label: 'Deutsch',
icon: '🇩🇪',
title: 'Sprache'
},
'el-GR': {
lang: 'el-GR',
label: 'Ελληνικά',
icon: '🇬🇷',
title: 'Γλώσσα'
},
'en-GB': {
lang: 'en-GB',
label: 'English',
icon: '🇬🇧',
title: 'Language'
},
'en-US': {
lang: 'en-US',
label: 'English',
icon: '🇺🇸',
title: 'Language'
},
'es-ES': {
lang: 'es-ES',
label: 'Español',
icon: '🇪🇸',
title: 'Idioma'
},
'et-EE': {
lang: 'et-EE',
label: 'Eesti',
icon: '🇪🇪',
title: 'Keel'
},
'fa-IR': {
lang: 'fa-IR',
label: 'فارسی',
icon: '🇮🇷',
title: 'زبان'
},
'fi-FI': {
lang: 'fi-FI',
label: 'Suomi',
icon: '🇫🇮',
title: 'Kieli'
},
'fr-BE': {
lang: 'fr-BE',
label: 'Français',
icon: '🇧🇪',
title: 'Langue'
},
'fr-FR': {
lang: 'fr-FR',
label: 'Français',
icon: '🇫🇷',
title: 'Langue'
},
'ga-IE': {
lang: 'ga-IE',
label: 'Gaeilge',
icon: '🇮🇪',
title: 'Teanga'
},
'he-IL': {
lang: 'he-IL',
label: 'עברית',
icon: '🇮🇱',
title: 'שפה'
},
'hi-IN': {
lang: 'hi-IN',
label: 'हिन्दी, हिंदी',
icon: '🇮🇳',
title: 'भाषा: हिन्दी'
},
'hr-HR': {
lang: 'hr-HR',
label: 'Hrvatski jezik',
icon: '🇭🇷',
title: 'Jezik'
},
'hu-HU': {
lang: 'hu-HU',
label: 'Magyar',
icon: '🇭🇺',
title: 'Nyelv'
},
'hy-AM': {
lang: 'hu-HU',
label: 'Հայերեն',
icon: '🇦🇲',
title: 'Լեզու'
},
'id-ID': {
lang: 'id-ID',
label: 'Bahasa Indonesia',
icon: '🇮🇩',
title: 'Bahasa'
},
'it-IT': {
lang: 'it-IT',
label: 'Italiano',
icon: '🇮🇹',
title: 'Linguaggio'
},
'is-IS': {
lang: 'is-IS',
label: 'Íslenska',
icon: '🇮🇸',
title: 'Tungumál'
},
'ja-JP': {
lang: 'ja-JP',
label: '日本語',
icon: '🇯🇵',
title: '言語'
},
'ku-IQ': {
lang: 'ku-IQ',
label: 'کوردی',
icon: '🇮🇶',
title: 'Ziman'
},
'kn-IN': {
lang: 'kn-IN',
label: 'ಕನ್ನಡ',
icon: '🇮🇳',
title: 'ಭಾಷೆ'
},
'ko-KR': {
lang: 'ko-KR',
label: '한국어',
icon: '🇰🇷',
title: '언어'
},
'lv-LV': {
lang: 'lv-LV',
label: 'Latviešu valoda',
icon: '🇱🇮',
title: 'Kalba'
},
'mk-MK': {
lang: 'mk-MK',
label: 'македонски јазик',
icon: '🇲🇰',
title: 'Јазик'
},
'mn-MN': {
lang: 'mn-MN',
label: 'Монгол хэл',
icon: '🇲🇳',
title: 'Хэл'
},
'ms-MY': {
lang: 'ms-MY',
label: 'بهاس ملايو‎',
icon: '🇲🇾',
title: 'Bahasa'
},
'nb-NO': {
lang: 'nb-NO',
label: 'Norsk',
icon: '🇳🇴',
title: 'Språk'
},
'ne-NP': {
lang: 'ne-NP',
label: 'नेपाली',
icon: '🇳🇵',
title: 'भाषा'
},
'nl-BE': {
lang: 'nl-BE',
label: 'Vlaams',
icon: '🇧🇪',
title: 'Taal'
},
'nl-NL': {
lang: 'nl-NL',
label: 'Nederlands',
icon: '🇳🇱',
title: 'Taal'
},
'pl-PL': {
lang: 'pl-PL',
label: 'Polski',
icon: '🇵🇱',
title: 'Język'
},
'pt-BR': {
lang: 'pt-BR',
label: 'Português',
icon: '🇧🇷',
title: 'Idiomas'
},
'pt-PT': {
lang: 'pt-PT',
label: 'Português',
icon: '🇵🇹',
title: 'Idiomas'
},
'ro-RO': {
lang: 'ro-RO',
label: 'Română',
icon: '🇷🇴',
title: 'Limba'
},
'ru-RU': {
lang: 'ru-RU',
label: 'Русский',
icon: '🇷🇺',
title: 'язык'
},
'sk-SK': {
lang: 'sk-SK',
label: 'Slovenčina',
icon: '🇸🇰',
title: 'Jazyk'
},
'sr-RS': {
lang: 'sr-RS',
label: 'српски језик',
icon: '🇸🇷',
title: 'Језик'
},
'sl-SI': {
lang: 'sl-SI',
label: 'Slovenščina',
icon: '🇸🇱',
title: 'Jezik'
},
'sv-SE': {
lang: 'sv-SE',
label: 'Svenska',
icon: '🇸🇪',
title: 'Språk'
},
'ta-IN': {
lang: 'ta-IN',
label: 'தமிழ்',
icon: '🇮🇳',
title: 'மொழி'
},
'th-TH': {
lang: 'th-TH',
label: 'ไทย',
icon: '🇹🇭',
title: 'ภาษา'
},
'tr-TR': {
lang: 'tr-TR',
label: 'Türkçe',
icon: '🇹🇷',
title: 'Dil'
},
'uk-UA': {
lang: 'uk-UA',
label: 'Українська',
icon: '🇺🇰',
title: 'Мова'
},
'vi-VN': {
lang: 'vi-VN',
label: 'Tiếng Việt',
icon: '🇻🇳',
title: 'Ngôn ngữ'
},
'zh-CN': {
lang: 'zh-CN',
label: '简体中文',
icon: '🇨🇳',
title: '语言'
},
'zh-TW': {
lang: 'zh-TW',
label: '繁體中文',
icon: '🇭🇰',
title: '語言'
}
};
export const SelectLang: React.FC<SelectLangProps> = (props) => {
return <></>
};

View File

@@ -0,0 +1,5 @@
// @ts-nocheck
// This file is generated by Umi automatically
// DO NOT CHANGE IT MANUALLY!
export { addLocale, setLocale, getLocale, getIntl, useIntl, injectIntl, formatMessage, FormattedMessage, getAllLocales, FormattedDate, FormattedDateParts, FormattedDisplayName, FormattedHTMLMessage, FormattedList, FormattedNumber, FormattedNumberParts, FormattedPlural, FormattedRelativeTime, FormattedTime, FormattedTimeParts, IntlProvider, RawIntlProvider } from './localeExports';
export { SelectLang } from './SelectLang';

View File

@@ -0,0 +1,51 @@
// @ts-nocheck
// This file is generated by Umi automatically
// DO NOT CHANGE IT MANUALLY!
import React from 'react';
import moment from 'E:/project/ks-admin/node_modules/dayjs';
import 'E:/project/ks-admin/node_modules/dayjs/locale/en';
import 'E:/project/ks-admin/node_modules/dayjs/locale/zh-cn';
import 'E:/project/ks-admin/node_modules/dayjs/locale/zh-tw';
import { RawIntlProvider, getLocale, getDirection , setIntl, getIntl, localeInfo, event, LANG_CHANGE_EVENT } from './localeExports';
export function _onCreate() {
const locale = getLocale();
if (moment?.locale) {
moment.locale(localeInfo[locale]?.momentLocale || '');
}
setIntl(locale);
}
const useIsomorphicLayoutEffect =
typeof window !== 'undefined' &&
typeof window.document !== 'undefined' &&
typeof window.document.createElement !== 'undefined'
? React.useLayoutEffect
: React.useEffect
export const _LocaleContainer = (props:any) => {
const initLocale = getLocale();
const [locale, setLocale] = React.useState(initLocale);
const [intl, setContainerIntl] = React.useState(() => getIntl(locale, true));
const handleLangChange = (locale:string) => {
if (moment?.locale) {
moment.locale(localeInfo[locale]?.momentLocale || 'en');
}
setLocale(locale);
setContainerIntl(getIntl(locale));
};
useIsomorphicLayoutEffect(() => {
event.on(LANG_CHANGE_EVENT, handleLangChange);
return () => {
event.off(LANG_CHANGE_EVENT, handleLangChange);
};
}, []);
return <RawIntlProvider value={intl}>{props.children}</RawIntlProvider>;
};

View File

@@ -0,0 +1,310 @@
// @ts-nocheck
// This file is generated by Umi automatically
// DO NOT CHANGE IT MANUALLY!
import {
createIntl,
IntlShape,
MessageDescriptor,
} from 'E:/project/ks-admin/node_modules/@umijs/plugins/node_modules/react-intl';
import { getPluginManager } from '../core/plugin';
import EventEmitter from 'E:/project/ks-admin/node_modules/event-emitter';
// @ts-ignore
import warning from 'E:/project/ks-admin/node_modules/warning';
export {
createIntl,
};
export {
FormattedDate,
FormattedDateParts,
FormattedDisplayName,
FormattedHTMLMessage,
FormattedList,
FormattedMessage,
FormattedNumber,
FormattedNumberParts,
FormattedPlural,
FormattedRelativeTime,
FormattedTime,
FormattedTimeParts,
IntlContext,
IntlProvider,
RawIntlProvider,
createIntlCache,
defineMessages,
injectIntl,
useIntl,
} from 'E:/project/ks-admin/node_modules/@umijs/plugins/node_modules/react-intl';
let g_intl: IntlShape;
const useLocalStorage = true;
// @ts-ignore
export const event = new EventEmitter();
export const LANG_CHANGE_EVENT = Symbol('LANG_CHANGE');
import enUS0 from 'antd/es/locale/en_US';
import lang_enUS0 from "E:/project/ks-admin/src/locales/en-US.ts";
import zhCN0 from 'antd/es/locale/zh_CN';
import lang_zhCN0 from "E:/project/ks-admin/src/locales/zh-CN.ts";
import lang_zhCN1 from "E:/project/ks-admin/src/pages/Tool/Gen/locales/zh-CN.ts";
import zhTW0 from 'antd/es/locale/zh_TW';
import lang_zhTW0 from "E:/project/ks-admin/src/locales/zh-TW.ts";
const flattenMessages=(
nestedMessages: Record<string, any>,
prefix = '',
) => {
return Object.keys(nestedMessages).reduce(
(messages: Record<string, any>, key) => {
const value = nestedMessages[key];
const prefixedKey = prefix ? `${prefix}.${key}` : key;
if (typeof value === 'string') {
messages[prefixedKey] = value;
} else {
Object.assign(messages, flattenMessages(value, prefixedKey));
}
return messages;
},
{},
);
}
export const localeInfo: {[key: string]: any} = {
'en-US': {
messages: {
...flattenMessages(lang_enUS0),
},
locale: 'en-US',
momentLocale: 'en',
},
'zh-CN': {
messages: {
...flattenMessages(lang_zhCN0),...flattenMessages(lang_zhCN1),
},
locale: 'zh-CN',
momentLocale: 'zh-cn',
},
'zh-TW': {
messages: {
...flattenMessages(lang_zhTW0),
},
locale: 'zh-TW',
momentLocale: 'zh-tw',
},
};
/**
* 增加一个新的国际化语言
* @param name 语言的 key
* @param messages 对应的枚举对象
* @param extraLocales momentLocale, antd 国际化
*/
export const addLocale = (
name: string,
messages: Object,
extraLocales: {
momentLocale:string;
antd: import('antd/es/locale').Locale
},
) => {
if (!name) {
return;
}
// 可以合并
const mergeMessages = localeInfo[name]?.messages
? Object.assign({}, localeInfo[name].messages, messages)
: messages;
// 用户只是追加 messages 时extraLocales 可选
const { momentLocale = localeInfo[name]?.momentLocale, antd = localeInfo[name]?.antd } = extraLocales || {};
const locale = name.split('-')?.join('-')
localeInfo[name] = {
messages: mergeMessages,
locale,
momentLocale: momentLocale,
};
// 如果这是的 name 和当前的locale 相同需要重新设置一下,不然更新不了
if (locale === getLocale()) {
event.emit(LANG_CHANGE_EVENT, locale);
}
};
const applyRuntimeLocalePlugin = (initialValue: any) => {
return getPluginManager().applyPlugins({
key: 'locale',
type: 'modify',
initialValue
});
}
const _createIntl = (locale: string) => {
const runtimeLocale = applyRuntimeLocalePlugin(localeInfo[locale]);
const { cache, ...config } = runtimeLocale;
return createIntl(config, cache);
}
/**
* 获取当前的 intl 对象,可以在 node 中使用
* @param locale 需要切换的语言类型
* @param changeIntl 是否不使用 g_intl
* @returns IntlShape
*/
export const getIntl = (locale?: string, changeIntl?: boolean) => {
// 如果全局的 g_intl 存在,且不是 setIntl 调用
if (g_intl && !changeIntl && !locale) {
return g_intl;
}
// 获取当前 locale
if (!locale) locale = getLocale();
// 如果存在于 localeInfo 中
if (locale&&localeInfo[locale]) {
return _createIntl(locale);
}
// 不存在需要一个报错提醒
warning(
!locale||!!localeInfo[locale],
`The current popular language does not exist, please check the locales folder!`,
);
// 使用 zh-CN
if (localeInfo["zh-CN"]) {
return _createIntl("zh-CN");
}
// 如果还没有,返回一个空的
return createIntl({
locale: "zh-CN",
messages: {}
});
};
/**
* 切换全局的 intl 的设置
* @param locale 语言的key
*/
export const setIntl = (locale: string) => {
g_intl = getIntl(locale, true);
};
/**
* 获取当前选择的语言
* @returns string
*/
export const getLocale = () => {
const runtimeLocale = applyRuntimeLocalePlugin({});
// runtime getLocale for user define
if (typeof runtimeLocale?.getLocale === 'function') {
return runtimeLocale.getLocale();
}
// please clear localStorage if you change the baseSeparator config
// because changing will break the app
const lang =
navigator.cookieEnabled && typeof localStorage !== 'undefined' && useLocalStorage
? window.localStorage.getItem('umi_locale')
: '';
// support baseNavigator, default true
let browserLang;
return lang || browserLang || "zh-CN";
};
/**
* 获取当前选择的方向
* @returns string
*/
export const getDirection = () => {
const lang = getLocale();
// array with all prefixs for rtl langueges ex: ar-EG , he-IL
const rtlLangs = ['he', 'ar', 'fa', 'ku']
const direction = rtlLangs.filter(lng => lang.startsWith(lng)).length ? 'rtl' : 'ltr';
return direction;
};
/**
* 切换语言
* @param lang 语言的 key
* @param realReload 是否刷新页面,默认刷新
* @returns string
*/
export const setLocale = (lang: string, realReload: boolean = true) => {
//const { pluginManager } = useAppContext();
//const runtimeLocale = pluginManagerapplyPlugins({
// key: 'locale',
// workaround: 不使用 ApplyPluginsType.modify 是为了避免循环依赖,与 fast-refresh 一起用时会有问题
// type: 'modify',
// initialValue: {},
//});
const updater = () => {
if (getLocale() !== lang) {
if (navigator.cookieEnabled && typeof window.localStorage !== 'undefined' && useLocalStorage) {
window.localStorage.setItem('umi_locale', lang || '');
}
setIntl(lang);
if (realReload) {
window.location.reload();
} else {
event.emit(LANG_CHANGE_EVENT, lang);
// chrome 不支持这个事件。所以人肉触发一下
if (window.dispatchEvent) {
const event = new Event('languagechange');
window.dispatchEvent(event);
}
}
}
}
//if (typeof runtimeLocale?.setLocale === 'function') {
// runtimeLocale.setLocale({
// lang,
// realReload,
// updater: updater,
// });
// return;
//}
updater();
};
let firstWaring = true;
/**
* intl.formatMessage 的语法糖
* @deprecated 使用此 api 会造成切换语言的时候无法自动刷新,请使用 useIntl 或 injectIntl
* @param descriptor { id : string, defaultMessage : string }
* @param values { [key:string] : string }
* @returns string
*/
export const formatMessage: IntlShape['formatMessage'] = (
descriptor: MessageDescriptor,
values: any,
) => {
if (firstWaring) {
warning(
false,
`Using this API will cause automatic refresh when switching languages, please use useIntl or injectIntl.
使用此 api 会造成切换语言的时候无法自动刷新,请使用 useIntl 或 injectIntl。
http://j.mp/37Fkd5Q
`,
);
firstWaring = false;
}
if (!g_intl) {
setIntl(getLocale());
}
return g_intl.formatMessage(descriptor, values);
};
/**
* 获取语言列表
* @returns string[]
*/
export const getAllLocales = () => Object.keys(localeInfo);

View File

@@ -0,0 +1,9 @@
// @ts-nocheck
// This file is generated by Umi automatically
// DO NOT CHANGE IT MANUALLY!
import React from 'react';
// @ts-ignore
import { _LocaleContainer } from './locale';
export function i18nProvider(container: Element) {
return React.createElement(_LocaleContainer, null, container);
}

View File

@@ -0,0 +1,13 @@
// This file is generated by Umi automatically
// DO NOT CHANGE IT MANUALLY!
import {
IntlCache,
createIntl,
} from 'E:/project/ks-admin/node_modules/@umijs/plugins/node_modules/react-intl';
type OptionalIntlConfig = Omit<Parameters<typeof createIntl>[0], 'locale' | 'defaultLocale'>;
export interface IRuntimeConfig {
locale?: {
getLocale?: () => string;
cache?: IntlCache;
} & OptionalIntlConfig;
};

View File

@@ -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/ks-admin/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;
}

View File

@@ -0,0 +1,12 @@
// @ts-nocheck
// This file is generated by Umi automatically
// DO NOT CHANGE IT MANUALLY!
import model_1 from 'E:/project/ks-admin/src/models/jobportal/user';
import model_2 from 'E:/project/ks-admin/src/models/testModel';
import model_3 from 'E:/project/ks-admin/src/.umi-production/plugin-initialState/@@initialState';
export const models = {
model_1: { namespace: 'jobportal.user', model: model_1 },
model_2: { namespace: 'testModel', model: model_2 },
model_3: { namespace: '@@initialState', model: model_3 },
} as const

View File

@@ -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>;
}

View File

@@ -0,0 +1,31 @@
// @ts-nocheck
// This file is generated by Umi automatically
// DO NOT CHANGE IT MANUALLY!
import dayjs from 'E:/project/ks-admin/node_modules/dayjs';
import antdPlugin from 'E:/project/ks-admin/node_modules/antd-dayjs-webpack-plugin/src/antd-plugin.js';
import isSameOrBefore from 'E:/project/ks-admin/node_modules/dayjs/plugin/isSameOrBefore';
import isSameOrAfter from 'E:/project/ks-admin/node_modules/dayjs/plugin/isSameOrAfter';
import advancedFormat from 'E:/project/ks-admin/node_modules/dayjs/plugin/advancedFormat';
import customParseFormat from 'E:/project/ks-admin/node_modules/dayjs/plugin/customParseFormat';
import weekday from 'E:/project/ks-admin/node_modules/dayjs/plugin/weekday';
import weekYear from 'E:/project/ks-admin/node_modules/dayjs/plugin/weekYear';
import weekOfYear from 'E:/project/ks-admin/node_modules/dayjs/plugin/weekOfYear';
import isMoment from 'E:/project/ks-admin/node_modules/dayjs/plugin/isMoment';
import localeData from 'E:/project/ks-admin/node_modules/dayjs/plugin/localeData';
import localizedFormat from 'E:/project/ks-admin/node_modules/dayjs/plugin/localizedFormat';
import duration from 'E:/project/ks-admin/node_modules/dayjs/plugin/duration';
dayjs.extend(isSameOrBefore);
dayjs.extend(isSameOrAfter);
dayjs.extend(advancedFormat);
dayjs.extend(customParseFormat);
dayjs.extend(weekday);
dayjs.extend(weekYear);
dayjs.extend(weekOfYear);
dayjs.extend(isMoment);
dayjs.extend(localeData);
dayjs.extend(localizedFormat);
dayjs.extend(duration);
dayjs.extend(antdPlugin);

View File

@@ -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';

View File

@@ -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/ks-admin/node_modules/axios';
import useUmiRequest, { UseRequestProvider } from 'E:/project/ks-admin/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/ks-admin/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,
};

View File

@@ -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
};

View File

@@ -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';

View File

@@ -0,0 +1,39 @@
// @ts-nocheck
// This file is generated by Umi automatically
// DO NOT CHANGE IT MANUALLY!
import { fork } from 'child_process';
import { merge } from 'lodash';
import { join } from 'path';
type ArgsType = { port: number; scene: string };
export const startMock = (args?: ArgsType) => {
const { port, scene } = merge(
{
port: 7000,
scene: 'default',
},
args
);
return new Promise<{
close: () => void;
}>((resolve, reject) => {
const proc = fork(join(__dirname, './startMock.js'), [], {
env: {
scene,
port: String(port),
},
});
proc.on('exit', (code) => {
if (code !== 0) {
reject(new Error(`Mock server exited with code ${code}`));
}
});
resolve({
close: () => {
proc.kill();
},
});
});
};

View File

@@ -0,0 +1,53 @@
// This file is generated by Umi automatically
// DO NOT CHANGE IT MANUALLY!
var express = require('express');
var fs = require('fs');
var { join } = require('path');
var { parse } = require('url');
var { scene, port } = process.env;
var getCachePath = (scene2) => {
return join(
process.cwd(),
'types',
'cache',
'mock',
(scene2 === 'default' ? '' : `${scene2}.`) + 'mock.cache.js'
);
};
var cachePath = getCachePath(scene);
if (!fs.existsSync(cachePath)) {
throw new Error(`mock cache file not found: ${cachePath}`);
}
fs.copyFileSync(
cachePath,
join(process.cwd(), 'mock', 'requestRecord.mock.js')
);
var mockFile = require(join(process.cwd(), 'mock', `requestRecord.mock.js`));
var app = express();
var server = app.listen(port, () => {
console.log(
'[Request Mock] Mock server is running at http://localhost:%s',
port
);
});
app.get('*', (req, res) => {
const { url } = req;
const key = `GET ${parse(url).pathname}`;
if (mockFile[key]) {
res.json(mockFile[key]);
} else {
res.status(404).send(`Mock key ${key} Not Found`);
}
});
app.post('*', (req, res) => {
const { url } = req;
const key = `POST ${parse(url).pathname}`;
if (mockFile[key]) {
res.json(mockFile[key]);
} else {
res.status(404).send(`Mock key ${key} Not Found`);
}
});
process.on('exit', () => {
server.close();
});

Some files were not shown because too many files have changed in this diff Show More