@yyp92-cli/template-react-pc 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -1
- package/CHANGELOG.md +0 -55
- package/template/.env.development +0 -5
- package/template/.env.production +0 -4
- package/template/.env.test +0 -4
- package/template/.eslintrc.cjs +0 -18
- package/template/README.md +0 -15
- package/template/index.html +0 -13
- package/template/package.json +0 -42
- package/template/pnpm-lock.yaml +0 -3570
- package/template/public/vite.svg +0 -1
- package/template/src/antdTheme/darkTheme.ts +0 -285
- package/template/src/antdTheme/lightTheme.ts +0 -286
- package/template/src/app.scss +0 -29
- package/template/src/app.tsx +0 -14
- package/template/src/assets/iconfont/demo.css +0 -539
- package/template/src/assets/iconfont/demo_index.html +0 -211
- package/template/src/assets/iconfont/iconfont.css +0 -19
- package/template/src/assets/iconfont/iconfont.js +0 -1
- package/template/src/assets/iconfont/iconfont.json +0 -16
- package/template/src/assets/iconfont/iconfont.ttf +0 -0
- package/template/src/assets/iconfont/iconfont.woff +0 -0
- package/template/src/assets/iconfont/iconfont.woff2 +0 -0
- package/template/src/assets/react.svg +0 -1
- package/template/src/components/403/index.tsx +0 -22
- package/template/src/components/404/index.tsx +0 -24
- package/template/src/components/index.ts +0 -3
- package/template/src/components/layout/content/index.module.scss +0 -22
- package/template/src/components/layout/content/index.tsx +0 -109
- package/template/src/components/layout/footer/index.module.scss +0 -12
- package/template/src/components/layout/footer/index.tsx +0 -15
- package/template/src/components/layout/header/index.module.scss +0 -21
- package/template/src/components/layout/header/index.tsx +0 -115
- package/template/src/components/layout/index.module.scss +0 -8
- package/template/src/components/layout/index.tsx +0 -47
- package/template/src/components/layout/side/index.module.scss +0 -31
- package/template/src/components/layout/side/index.tsx +0 -109
- package/template/src/components/layout-horizontal/content/index.module.scss +0 -22
- package/template/src/components/layout-horizontal/content/index.tsx +0 -105
- package/template/src/components/layout-horizontal/footer/index.module.scss +0 -12
- package/template/src/components/layout-horizontal/footer/index.tsx +0 -15
- package/template/src/components/layout-horizontal/header/index.module.scss +0 -23
- package/template/src/components/layout-horizontal/header/index.tsx +0 -115
- package/template/src/components/layout-horizontal/index.module.scss +0 -8
- package/template/src/components/layout-horizontal/index.tsx +0 -48
- package/template/src/components/layout-horizontal/side/index.module.scss +0 -32
- package/template/src/components/layout-horizontal/side/index.tsx +0 -104
- package/template/src/components/login/index.module.scss +0 -23
- package/template/src/components/login/index.tsx +0 -133
- package/template/src/global/constants.ts +0 -5
- package/template/src/pages/home/index.module.scss +0 -0
- package/template/src/pages/home/index.tsx +0 -90
- package/template/src/router/router.tsx +0 -190
- package/template/src/service/api.ts +0 -9
- package/template/src/service/config.ts +0 -9
- package/template/src/service/index.ts +0 -1
- package/template/src/service/request/index.ts +0 -267
- package/template/src/service/request/type.ts +0 -5
- package/template/src/service/service.ts +0 -27
- package/template/src/store/antdToken.ts +0 -35
- package/template/src/store/login.ts +0 -38
- package/template/src/store/menus.ts +0 -30
- package/template/src/store/permission.ts +0 -30
- package/template/src/store/token.ts +0 -30
- package/template/src/theme/darkTheme.scss +0 -47
- package/template/src/theme/lightTheme.scss +0 -49
- package/template/src/utils/base64ToBlob.ts +0 -41
- package/template/src/utils/cache.ts +0 -44
- package/template/src/utils/changeTheme.ts +0 -14
- package/template/src/utils/download.ts +0 -45
- package/template/src/utils/filterMenu.ts +0 -34
- package/template/src/utils/index.ts +0 -5
- package/template/src/vite-env.d.ts +0 -5
- package/template/tsconfig.json +0 -45
- package/template/tsconfig.node.json +0 -10
- package/template/vite.config.ts +0 -49
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import {isFunction} from 'lodash-es'
|
|
2
|
-
|
|
3
|
-
// 下载文件
|
|
4
|
-
export const downloadFile = (
|
|
5
|
-
output: any,
|
|
6
|
-
downloadFileName: string = '未命名文件',
|
|
7
|
-
handleCancel: () => void = () => {}
|
|
8
|
-
) => {
|
|
9
|
-
if (!output && isFunction(handleCancel)) {
|
|
10
|
-
handleCancel()
|
|
11
|
-
return
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
fetch(output, {responseType: 'blob'} as any)
|
|
15
|
-
.then((res: any) => res?.blob?.())
|
|
16
|
-
.then((res: any) => {
|
|
17
|
-
if ((window?.navigator as any)?.msSaveBlob) {
|
|
18
|
-
const suffix = output?.split?.('.')?.pop?.();
|
|
19
|
-
downloadFileName = downloadFileName === '未命名文件'
|
|
20
|
-
? downloadFileName + '.' + suffix
|
|
21
|
-
: downloadFileName;
|
|
22
|
-
|
|
23
|
-
try {
|
|
24
|
-
(window?.navigator as any)?.msSaveBlob(res, downloadFileName);
|
|
25
|
-
}
|
|
26
|
-
catch(e) {
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
const link = document.createElement('a');
|
|
32
|
-
link.href = window.URL.createObjectURL(res);
|
|
33
|
-
link.download = downloadFileName;
|
|
34
|
-
link.style.display = 'none';
|
|
35
|
-
document.body.appendChild(link);
|
|
36
|
-
link.click();
|
|
37
|
-
}
|
|
38
|
-
}).catch(e => {
|
|
39
|
-
// console.error(e)
|
|
40
|
-
// handleCancel()
|
|
41
|
-
})
|
|
42
|
-
.finally(() => {
|
|
43
|
-
isFunction(handleCancel) && handleCancel()
|
|
44
|
-
})
|
|
45
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* * 根据权限来生成菜单
|
|
3
|
-
* @param menu
|
|
4
|
-
* @param permissions
|
|
5
|
-
* @returns
|
|
6
|
-
*/
|
|
7
|
-
export const filterMenu = (menu: any[], permissions: string[]) => {
|
|
8
|
-
const newList: any = []
|
|
9
|
-
|
|
10
|
-
menu.forEach((group: any) => {
|
|
11
|
-
if (permissions.includes(group.key)) {
|
|
12
|
-
const data = {...group}
|
|
13
|
-
delete data.hideInMenu
|
|
14
|
-
delete data.showFullScreen
|
|
15
|
-
|
|
16
|
-
if (Array.isArray(data?.children)) {
|
|
17
|
-
const children = data.children
|
|
18
|
-
.filter((item: any) => permissions.includes(item.key) && !item?.hideInMenu)
|
|
19
|
-
.map((item: any) => {
|
|
20
|
-
const newItem = {...item}
|
|
21
|
-
delete newItem.hideInMenu
|
|
22
|
-
delete newItem.showFullScreen
|
|
23
|
-
|
|
24
|
-
return newItem
|
|
25
|
-
})
|
|
26
|
-
data.children = children
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
newList.push(data)
|
|
30
|
-
}
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
return newList
|
|
34
|
-
}
|
package/template/tsconfig.json
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2020",
|
|
4
|
-
"useDefineForClassFields": true,
|
|
5
|
-
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
6
|
-
"module": "ESNext",
|
|
7
|
-
"skipLibCheck": true,
|
|
8
|
-
|
|
9
|
-
/* Bundler mode */
|
|
10
|
-
/*
|
|
11
|
-
* 报错:配置文件报错及 React.StrictNode报错:类型“Element”的参数不能赋给类型“ReactNode”的参数
|
|
12
|
-
*
|
|
13
|
-
* 解决:
|
|
14
|
-
* 1.改为node
|
|
15
|
-
* 2.删除这行 "resolveJsonModule": true
|
|
16
|
-
*/
|
|
17
|
-
"moduleResolution": "node",
|
|
18
|
-
|
|
19
|
-
/*
|
|
20
|
-
* import 导入的react报错
|
|
21
|
-
* 解决: 增加这行:"esModuleInterop": true,
|
|
22
|
-
*/
|
|
23
|
-
"esModuleInterop": true,
|
|
24
|
-
"allowSyntheticDefaultImports": true,
|
|
25
|
-
"isolatedModules": true,
|
|
26
|
-
"noEmit": true,
|
|
27
|
-
"jsx": "react-jsx",
|
|
28
|
-
|
|
29
|
-
/* Linting */
|
|
30
|
-
"strict": true,
|
|
31
|
-
"noUnusedLocals": true,
|
|
32
|
-
"noUnusedParameters": true,
|
|
33
|
-
"noFallthroughCasesInSwitch": true,
|
|
34
|
-
|
|
35
|
-
"baseUrl": ".",
|
|
36
|
-
"paths": {
|
|
37
|
-
"@/*": ["src/*"],
|
|
38
|
-
"@components/*": ["src/components/*"],
|
|
39
|
-
"@utils/*": ["src/utils/*"]
|
|
40
|
-
// 其他路径别名...
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
"include": ["src"],
|
|
44
|
-
"references": [{ "path": "./tsconfig.node.json" }]
|
|
45
|
-
}
|
package/template/vite.config.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { defineConfig, loadEnv } from 'vite'
|
|
2
|
-
import type {ConfigEnv} from 'vite'
|
|
3
|
-
import react from '@vitejs/plugin-react'
|
|
4
|
-
import path from 'path'
|
|
5
|
-
|
|
6
|
-
// https://vitejs.dev/config/
|
|
7
|
-
export default defineConfig({
|
|
8
|
-
base: './',
|
|
9
|
-
|
|
10
|
-
server: {
|
|
11
|
-
proxy: {
|
|
12
|
-
'/api': {
|
|
13
|
-
target: 'https://httpbin.org',
|
|
14
|
-
changeOrigin: true,
|
|
15
|
-
rewrite: (path) => path.replace(/^\/api/, '')
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
build: {
|
|
21
|
-
sourcemap: true,
|
|
22
|
-
outDir: 'dist'
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
plugins: [
|
|
26
|
-
react()
|
|
27
|
-
],
|
|
28
|
-
|
|
29
|
-
css: {
|
|
30
|
-
preprocessorOptions: {
|
|
31
|
-
scss: {
|
|
32
|
-
// 启用现代 API(关键配置)
|
|
33
|
-
api: 'modern-compiler'
|
|
34
|
-
},
|
|
35
|
-
sass: {
|
|
36
|
-
// sass 和 scss 都需要配置
|
|
37
|
-
api: 'modern-compiler'
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
resolve: {
|
|
43
|
-
alias: {
|
|
44
|
-
// 在这里添加路径别名
|
|
45
|
-
'@': path.resolve("./src")
|
|
46
|
-
// 其他路径别名...
|
|
47
|
-
},
|
|
48
|
-
}
|
|
49
|
-
})
|