This commit is contained in:
licuizhu 2023-08-30 13:55:59 +08:00
parent 448aa08789
commit 9dd1cf0301
138 changed files with 30351 additions and 0 deletions

3
.eslintrc.js Normal file
View File

@ -0,0 +1,3 @@
module.exports = {
extends: require.resolve('@umijs/max/eslint'),
};

12
.gitignore vendored Normal file
View File

@ -0,0 +1,12 @@
/node_modules
/.env.local
/.umirc.local.ts
/config/config.local.ts
/src/.umi
/src/.umi-production
/src/.umi-test
/.umi
/.umi-production
/.umi-test
/dist
/.mfsu

17
.lintstagedrc Normal file
View File

@ -0,0 +1,17 @@
{
"*.{md,json}": [
"prettier --cache --write"
],
"*.{js,jsx}": [
"max lint --fix --eslint-only",
"prettier --cache --write"
],
"*.{css,less}": [
"max lint --fix --stylelint-only",
"prettier --cache --write"
],
"*.ts?(x)": [
"max lint --fix --eslint-only",
"prettier --cache --parser=typescript --write"
]
}

2
.npmrc Normal file
View File

@ -0,0 +1,2 @@
registry=https://registry.npmmirror.com

8
.prettierrc Normal file
View File

@ -0,0 +1,8 @@
{
"printWidth": 80,
"singleQuote": true,
"trailingComma": "all",
"proseWrap": "never",
"overrides": [{ "files": ".prettierrc", "options": { "parser": "json" } }],
"plugins": ["prettier-plugin-organize-imports", "prettier-plugin-packagejson"]
}

3
.stylelintrc.js Normal file
View File

@ -0,0 +1,3 @@
module.exports = {
extends: require.resolve('@umijs/max/stylelint'),
};

75
.umirc.ts Normal file
View File

@ -0,0 +1,75 @@
import { defineConfig } from '@umijs/max';
// import logo from './src/assets/images/logo.png'
export default defineConfig({
antd: {},
access: {},
model: {},
initialState: {},
request: {},
layout: {},
routes: [
{
path: '/',
redirect: '/home',
},
{
name: '首页',
path: '/home',
component: './Home',
icon: 'HomeOutlined',
},
{
name: ' 基础图层',
path: '/baseMap',
component: './BaseMap',
icon: 'BlockOutlined',
},
// {
// name: '权限演示',
// path: '/access',
// component: './Access',
// },
{
name: ' CRUD 示例',
path: '/table',
component: './Table',
},
{
name: ' 登录',
path: '/login',
component: './Login',
// 不展示菜单
menuRender: false,
// 不展示在菜单栏里
hideInMenu: true,
},
{
name: ' 关于我们',
path: '/about',
component: './About',
},
// {
// name: ' 3D',
// path: '/three',
// component: './three',
// // 不展示菜单
// menuRender: false,
// },
],
npmClient: 'yarn',
headScripts: [
`https://webapi.amap.com/maps?v=2.0&key=0aafe5ec0678bcfc99f005cc1c5f2faa`
],
links: [
{ rel: 'icon', href: './src/assets/images/logo.png'},
],
proxy: {
'/api': {
'target': 'http://101.42.40.202:8081',//8.142.119.212:8083
'changeOrigin': true,
// 'pathRewrite': { '^/api' : '' },
},
},
});

2
jest-setup.ts Normal file
View File

@ -0,0 +1,2 @@
import '@testing-library/jest-dom';
import '@umijs/max/test-setup'

27
jest.config.ts Normal file
View File

@ -0,0 +1,27 @@
import { Config, configUmiAlias, createConfig } from '@umijs/max/test';
export default async () => {
try{
return (await configUmiAlias({
...createConfig({
target: 'browser',
jsTransformer: 'esbuild',
// config opts for esbuild , it will pass to esbuild directly
jsTransformerOpts: { jsx: 'automatic' },
}),
setupFilesAfterEnv: ['<rootDir>/jest-setup.ts'],
collectCoverageFrom: [
'src/**/*.{ts,js,tsx,jsx}',
'!src/.umi/**',
'!src/.umi-test/**',
'!src/.umi-production/**'
],
// if you require some es-module npm package, please uncomment below line and insert your package name
// transformIgnorePatterns: ['node_modules/(?!.*(lodash-es|your-es-pkg-name)/)']
})) as Config.InitialOptions;
}catch(e){
console.log(e);
throw e;
}
};

20
mock/userAPI.ts Normal file
View File

@ -0,0 +1,20 @@
const users = [
{ id: 0, name: 'Umi', nickName: 'U', gender: 'MALE' },
{ id: 1, name: 'Fish', nickName: 'B', gender: 'FEMALE' },
];
export default {
'GET /api/v1/queryUserList': (req: any, res: any) => {
res.json({
success: true,
data: { list: users },
errorCode: 0,
});
},
'PUT /api/v1/user/': (req: any, res: any) => {
res.json({
success: true,
errorCode: 0,
});
},
};

16240
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

52
package.json Normal file
View File

@ -0,0 +1,52 @@
{
"private": true,
"author": "licuizhu <1065490369@qq.com>",
"scripts": {
"build": "max build",
"dev": "max dev",
"format": "prettier --cache --write .",
"postinstall": "max setup",
"prepare": "husky install",
"setup": "max setup",
"start": "npm run dev",
"test": "TS_NODE_TRANSPILE_ONLY=yes jest --passWithNoTests"
},
"dependencies": {
"@ant-design/icons": "^4.7.0",
"@ant-design/pro-components": "^2.0.1",
"@antv/l7": "^2.12.0",
"@antv/l7-maps": "^2.12.0",
"@umijs/max": "^4.0.40",
"antd": "^5.0.0",
"axios": "^1.3.5",
"dat.gui": "^0.7.9",
"gsap": "^3.11.5",
"mobx": "^6.9.0",
"mobx-react-lite": "^3.4.3",
"three": "^0.152.2",
"uuid": "^9.0.0"
},
"devDependencies": {
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13",
"@types/jest": "^27",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"@types/testing-library__jest-dom": "^5.14.5",
"husky": "^8.0.3",
"jest": "^27",
"lint-staged": "^13.0.3",
"prettier": "^2.7.1",
"prettier-plugin-organize-imports": "^2",
"prettier-plugin-packagejson": "^2",
"ts-node": "^10",
"typescript": "^4"
},
"husky": {
"hooks": {
"pre-commit": "npm run lint:css && npm run lint:js && npm run lint:ts",
"post-merge": "post-npm-install",
"post-rebase": "post-npm-install"
}
}
}

10
src/access.ts Normal file
View File

@ -0,0 +1,10 @@
export default (initialState: API.UserInfo) => {
// 在这里按照初始化数据定义项目中的权限,统一管理
// 参考文档 https://next.umijs.org/docs/max/access
const canSeeAdmin = !!(
initialState && initialState.name !== 'dontHaveAccess'
);
return {
canSeeAdmin,
};
};

25
src/api/index.js Normal file
View File

@ -0,0 +1,25 @@
import { request } from '@umijs/max';
// 密码登录
export function passwordLogin( params ) {
return request('/api/user/login', {
method: 'GET',
params: params,
});
}
// 获取导航栏
export function queryUserMenu() {
return request('/api/user/queryUserMenu', {
method: 'GET',
});
}
// 基本图层
// 获取图层明细点位数据/热力图数据
export function getLayerPoints( params ) {
return request('/api/basicMap/getLayerPoints', {
method: 'GET',
params: params,
});
}

20
src/app.ts Normal file
View File

@ -0,0 +1,20 @@
// 运行时配置
// 全局初始化数据配置,用于 Layout 用户信息和权限初始化
// 更多信息见文档https://next.umijs.org/docs/api/runtime-config#getinitialstate
export async function getInitialState(): Promise<{ name: string }> {
return {
name: 'logout',
};
}
import logo from './assets/images/logo.png'
export const layout = () => {
return {
logo: logo,
title: '班布地图',
menu: {
locale: false,
},
};
};

0
src/assets/.gitkeep Normal file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 495 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 504 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 848 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 679 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
src/assets/icon/delete.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 510 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1011 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
src/assets/icon/flag.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 837 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
src/assets/icon/home.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 785 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
src/assets/icon/logout.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 650 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 687 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 829 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 779 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 388 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 830 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 MiB

BIN
src/assets/images/bm.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 KiB

BIN
src/assets/images/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
src/assets/three/1fbx.fbx Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 565 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

BIN
src/assets/three/boxMet.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 976 KiB

View File

@ -0,0 +1,11 @@
Model Information:
* title: Need some space?
* source: https://sketchfab.com/3d-models/need-some-space-d6521362b37b48e3a82bce4911409303
* author: Loïc Norgeot (https://sketchfab.com/norgeotloic)
Model License:
* license type: CC-BY-4.0 (http://creativecommons.org/licenses/by/4.0/)
* requirements: Author must be credited. Commercial use is allowed.
If you use this 3D model in your project be sure to copy paste this credit wherever you share it:
This work is based on "Need some space?" (https://sketchfab.com/3d-models/need-some-space-d6521362b37b48e3a82bce4911409303) by Loïc Norgeot (https://sketchfab.com/norgeotloic) licensed under CC-BY-4.0 (http://creativecommons.org/licenses/by/4.0/)

Binary file not shown.

View File

@ -0,0 +1,146 @@
{
"accessors": [
{
"bufferView": 0,
"componentType": 5126,
"count": 50000,
"max": [
288.8330078125,
313.2330017089844,
225.4040069580078
],
"min": [
-58.488800048828125,
-81.83899688720703,
-15.739500045776367
],
"type": "VEC3"
},
{
"bufferView": 1,
"componentType": 5126,
"count": 50000,
"max": [
1.0,
1.0,
1.0,
1.0
],
"min": [
0.6745098233222961,
0.0,
0.0,
1.0
],
"type": "VEC4"
}
],
"asset": {
"extras": {
"author": "Loïc Norgeot (https://sketchfab.com/norgeotloic)",
"license": "CC-BY-4.0 (http://creativecommons.org/licenses/by/4.0/)",
"source": "https://sketchfab.com/3d-models/need-some-space-d6521362b37b48e3a82bce4911409303",
"title": "Need some space?"
},
"generator": "Sketchfab-12.63.0",
"version": "2.0"
},
"bufferViews": [
{
"buffer": 0,
"byteLength": 600000,
"byteStride": 12,
"name": "floatBufferViews",
"target": 34962
},
{
"buffer": 0,
"byteLength": 800000,
"byteOffset": 600000,
"byteStride": 16,
"name": "floatBufferViews",
"target": 34962
}
],
"buffers": [
{
"byteLength": 1400000,
"uri": "scene.bin"
}
],
"extensionsUsed": [
"KHR_materials_unlit"
],
"materials": [
{
"doubleSided": true,
"extensions": {
"KHR_materials_unlit": {}
},
"name": "Scene_-_Root",
"pbrMetallicRoughness": {
"metallicFactor": 0.0
}
}
],
"meshes": [
{
"name": "Object_0",
"primitives": [
{
"attributes": {
"COLOR_0": 1,
"POSITION": 0
},
"material": 0,
"mode": 0
}
]
}
],
"nodes": [
{
"children": [
1
],
"matrix": [
0.012779689393937588,
0.0,
0.0,
0.0,
0.0,
2.8376610825414845e-18,
-0.012779689393937588,
0.0,
0.0,
0.012779689393937588,
2.8376610825414845e-18,
0.0,
0.0,
0.0,
0.0,
1.0
],
"name": "Sketchfab_model"
},
{
"children": [
2
],
"name": "Geode"
},
{
"mesh": 0,
"name": "Object_2"
}
],
"scene": 0,
"scenes": [
{
"name": "Sketchfab_Scene",
"nodes": [
0
]
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 889 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 772 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 MiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 KiB

View File

@ -0,0 +1,19 @@
// 判断本地是否有token如果有就返回子组件否则就重定向到登录Login
import { getToken } from "../../utils";
import { Navigate } from "react-router-dom";
function AuthRouter ({ children }) {
const isToken = getToken();
if (isToken) {
return <>{ children }</>
} else {
return <Navigate to="/login" replace/>
}
}
export {
AuthRouter
}
// 使用
// <AuthRouter> <Layout/> </AuthRouter>

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