@gx-design-vue/create-gx-cli 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +2 -1
- package/template-gx-design-thin/.editorconfig +19 -0
- package/template-gx-design-thin/.env +4 -0
- package/template-gx-design-thin/.env.development +15 -0
- package/template-gx-design-thin/.env.production +28 -0
- package/template-gx-design-thin/.eslintignore +16 -0
- package/template-gx-design-thin/.prettierignore +9 -0
- package/template-gx-design-thin/LICENSE +21 -0
- package/template-gx-design-thin/README.md +112 -0
- package/template-gx-design-thin/build/constant.ts +1 -0
- package/template-gx-design-thin/build/generate/generateModifyVars.ts +14 -0
- package/template-gx-design-thin/build/rollupOptions/index.ts +22 -0
- package/template-gx-design-thin/build/util/hash.ts +17 -0
- package/template-gx-design-thin/build/util/index.ts +131 -0
- package/template-gx-design-thin/build/vite/cdn.ts +63 -0
- package/template-gx-design-thin/build/vite/optimizer.ts +26 -0
- package/template-gx-design-thin/build/vite/plugin/appConfig.ts +91 -0
- package/template-gx-design-thin/build/vite/plugin/autoImport.ts +26 -0
- package/template-gx-design-thin/build/vite/plugin/compress.ts +31 -0
- package/template-gx-design-thin/build/vite/plugin/html.ts +39 -0
- package/template-gx-design-thin/build/vite/plugin/index.ts +75 -0
- package/template-gx-design-thin/build/vite/plugin/mock.ts +14 -0
- package/template-gx-design-thin/build/vite/plugin/pwa.ts +31 -0
- package/template-gx-design-thin/build/vite/plugin/visualizer.ts +14 -0
- package/template-gx-design-thin/build/vite/plugin/viteMock/client.ts +88 -0
- package/template-gx-design-thin/build/vite/plugin/viteMock/createMockServer.ts +271 -0
- package/template-gx-design-thin/build/vite/plugin/viteMock/index.ts +69 -0
- package/template-gx-design-thin/build/vite/plugin/viteMock/types.ts +48 -0
- package/template-gx-design-thin/build/vite/plugin/viteMock/utils.ts +48 -0
- package/template-gx-design-thin/build/vite/plugin/viteNotice.ts +40 -0
- package/template-gx-design-thin/commitlint.config.cjs +32 -0
- package/template-gx-design-thin/config/default/defaultSettings.ts +78 -0
- package/template-gx-design-thin/config/default/network.ts +10 -0
- package/template-gx-design-thin/config/default/proxy.ts +47 -0
- package/template-gx-design-thin/config/default/theme.ts +3 -0
- package/template-gx-design-thin/config/index.ts +11 -0
- package/template-gx-design-thin/eslint.config.js +51 -0
- package/template-gx-design-thin/index.html +42 -0
- package/template-gx-design-thin/mock/_createProductionServer.ts +19 -0
- package/template-gx-design-thin/mock/_util.ts +33 -0
- package/template-gx-design-thin/mock/config/menu.ts +21 -0
- package/template-gx-design-thin/mock/config/user.ts +123 -0
- package/template-gx-design-thin/mock/datasSource/system/menu.ts +10 -0
- package/template-gx-design-thin/mock/datasSource/user/account.ts +30 -0
- package/template-gx-design-thin/mock/datasSource/user/index.ts +47 -0
- package/template-gx-design-thin/mock/util/crypto.ts +23 -0
- package/template-gx-design-thin/mock/util/table.ts +92 -0
- package/template-gx-design-thin/mock/util/utils.ts +73 -0
- package/template-gx-design-thin/package.json +129 -0
- package/template-gx-design-thin/pnpm-lock.yaml +12575 -0
- package/template-gx-design-thin/prettier.config.cjs +18 -0
- package/template-gx-design-thin/public/resource/css/index.css +119 -0
- package/template-gx-design-thin/public/resource/css/normalize.css +396 -0
- package/template-gx-design-thin/public/resource/img/favicon.ico +0 -0
- package/template-gx-design-thin/public/resource/img/logo.png +0 -0
- package/template-gx-design-thin/public/resource/img/pro_icon.svg +1 -0
- package/template-gx-design-thin/public/resource/img/pwa-192x192.png +0 -0
- package/template-gx-design-thin/public/resource/img/pwa-512x512.png +0 -0
- package/template-gx-design-thin/src/App.vue +42 -0
- package/template-gx-design-thin/src/assets/error_images/403.png +0 -0
- package/template-gx-design-thin/src/assets/error_images/404.png +0 -0
- package/template-gx-design-thin/src/assets/error_images/cloud.png +0 -0
- package/template-gx-design-thin/src/assets/login_images/login_background.svg +1 -0
- package/template-gx-design-thin/src/assets/logo.png +0 -0
- package/template-gx-design-thin/src/assets/menu_font/iconfont.css +94 -0
- package/template-gx-design-thin/src/assets/menu_font/iconfont.eot +0 -0
- package/template-gx-design-thin/src/assets/menu_font/iconfont.js +1 -0
- package/template-gx-design-thin/src/assets/menu_font/iconfont.json +142 -0
- package/template-gx-design-thin/src/assets/menu_font/iconfont.svg +1 -0
- package/template-gx-design-thin/src/assets/menu_font/iconfont.ttf +0 -0
- package/template-gx-design-thin/src/assets/menu_font/iconfont.woff +0 -0
- package/template-gx-design-thin/src/assets/menu_font/iconfont.woff2 +0 -0
- package/template-gx-design-thin/src/assets/menu_font/index.less +94 -0
- package/template-gx-design-thin/src/assets/public_icon/iconfont.css +42 -0
- package/template-gx-design-thin/src/assets/public_icon/iconfont.eot +0 -0
- package/template-gx-design-thin/src/assets/public_icon/iconfont.js +1 -0
- package/template-gx-design-thin/src/assets/public_icon/iconfont.json +51 -0
- package/template-gx-design-thin/src/assets/public_icon/iconfont.svg +1 -0
- package/template-gx-design-thin/src/assets/public_icon/iconfont.ttf +0 -0
- package/template-gx-design-thin/src/assets/public_icon/iconfont.woff +0 -0
- package/template-gx-design-thin/src/assets/public_icon/iconfont.woff2 +0 -0
- package/template-gx-design-thin/src/assets/public_icon/index.less +42 -0
- package/template-gx-design-thin/src/assets/public_images/nodata.svg +1 -0
- package/template-gx-design-thin/src/common/global.ts +4 -0
- package/template-gx-design-thin/src/components/GDesign/Result/index.tsx +144 -0
- package/template-gx-design-thin/src/components/GDesign/Result/style.less +140 -0
- package/template-gx-design-thin/src/components/GDesign/utils/index.ts +7 -0
- package/template-gx-design-thin/src/components/GlobalLayout/Confirm/index.ts +21 -0
- package/template-gx-design-thin/src/components/GlobalLayout/Empty/index.vue +18 -0
- package/template-gx-design-thin/src/components/GlobalLayout/RightContent/index.tsx +126 -0
- package/template-gx-design-thin/src/components/GlobalLayout/RightContent/style.ts +77 -0
- package/template-gx-design-thin/src/components/GlobalLayout/Spin/index.tsx +30 -0
- package/template-gx-design-thin/src/components/PageLoading/index.tsx +51 -0
- package/template-gx-design-thin/src/components/index.ts +6 -0
- package/template-gx-design-thin/src/core/ant-design/index.ts +10 -0
- package/template-gx-design-thin/src/core/gx-admin-design/index.ts +6 -0
- package/template-gx-design-thin/src/core/gx-design/index.ts +6 -0
- package/template-gx-design-thin/src/core/gx-pro-design/index.ts +8 -0
- package/template-gx-design-thin/src/core/index.ts +84 -0
- package/template-gx-design-thin/src/design/ant-design/index.less +4 -0
- package/template-gx-design-thin/src/design/ant-design/layout.less +22 -0
- package/template-gx-design-thin/src/design/ant-design/menu.less +48 -0
- package/template-gx-design-thin/src/design/ant-design/spin.less +23 -0
- package/template-gx-design-thin/src/design/ant-design/tooltip.less +7 -0
- package/template-gx-design-thin/src/design/color.less +1 -0
- package/template-gx-design-thin/src/design/config.less +5 -0
- package/template-gx-design-thin/src/design/imageEditor.less +180 -0
- package/template-gx-design-thin/src/design/index.less +95 -0
- package/template-gx-design-thin/src/design/mixin.less +65 -0
- package/template-gx-design-thin/src/design/normalize.less +391 -0
- package/template-gx-design-thin/src/design/root.less +3 -0
- package/template-gx-design-thin/src/hooks/core/index.ts +3 -0
- package/template-gx-design-thin/src/hooks/core/useRequest/index.ts +118 -0
- package/template-gx-design-thin/src/hooks/event/index.ts +3 -0
- package/template-gx-design-thin/src/hooks/event/useClipboard.ts +15 -0
- package/template-gx-design-thin/src/hooks/web/index.ts +5 -0
- package/template-gx-design-thin/src/hooks/web/useThemeStyle.ts +16 -0
- package/template-gx-design-thin/src/layout/BasicLayout.vue +123 -0
- package/template-gx-design-thin/src/layout/BlankLayout.vue +5 -0
- package/template-gx-design-thin/src/layout/ContentView.vue +50 -0
- package/template-gx-design-thin/src/layout/IframeView.vue +1 -0
- package/template-gx-design-thin/src/layout/UserLayout.vue +7 -0
- package/template-gx-design-thin/src/main.ts +34 -0
- package/template-gx-design-thin/src/plugins/index.ts +2 -0
- package/template-gx-design-thin/src/router/guard/index.ts +83 -0
- package/template-gx-design-thin/src/router/guard/permissions.ts +70 -0
- package/template-gx-design-thin/src/router/guard/stateGuard.ts +10 -0
- package/template-gx-design-thin/src/router/helper/routeHelper.ts +231 -0
- package/template-gx-design-thin/src/router/helper/utils.ts +19 -0
- package/template-gx-design-thin/src/router/index.ts +31 -0
- package/template-gx-design-thin/src/router/routes/index.ts +86 -0
- package/template-gx-design-thin/src/router/routes/modules/dataSource.ts +12 -0
- package/template-gx-design-thin/src/services/common/index.ts +11 -0
- package/template-gx-design-thin/src/services/systemCenter/index.ts +1 -0
- package/template-gx-design-thin/src/services/systemCenter/menu.ts +9 -0
- package/template-gx-design-thin/src/services/userCenter/account.ts +42 -0
- package/template-gx-design-thin/src/services/userCenter/index.ts +28 -0
- package/template-gx-design-thin/src/store/index.ts +32 -0
- package/template-gx-design-thin/src/store/modules/dict.ts +28 -0
- package/template-gx-design-thin/src/store/modules/global.ts +42 -0
- package/template-gx-design-thin/src/store/modules/permission.ts +19 -0
- package/template-gx-design-thin/src/store/modules/routes.ts +113 -0
- package/template-gx-design-thin/src/store/modules/tabsRouter.ts +76 -0
- package/template-gx-design-thin/src/store/modules/user.ts +136 -0
- package/template-gx-design-thin/src/utils/accessToken.ts +80 -0
- package/template-gx-design-thin/src/utils/crypto/base64.ts +101 -0
- package/template-gx-design-thin/src/utils/crypto/index.ts +57 -0
- package/template-gx-design-thin/src/utils/env.ts +50 -0
- package/template-gx-design-thin/src/utils/fetchFile.ts +81 -0
- package/template-gx-design-thin/src/utils/index.ts +123 -0
- package/template-gx-design-thin/src/utils/pageTitle.ts +20 -0
- package/template-gx-design-thin/src/utils/request/XHR.ts +139 -0
- package/template-gx-design-thin/src/utils/request/axiosCancel.ts +69 -0
- package/template-gx-design-thin/src/utils/request/checkStatus.ts +25 -0
- package/template-gx-design-thin/src/utils/request/index.ts +144 -0
- package/template-gx-design-thin/src/utils/request/typings.ts +171 -0
- package/template-gx-design-thin/src/utils/storage.ts +199 -0
- package/template-gx-design-thin/src/utils/uploadFile.ts +27 -0
- package/template-gx-design-thin/src/utils/util.ts +198 -0
- package/template-gx-design-thin/src/utils/validate.ts +216 -0
- package/template-gx-design-thin/src/views/Iframe/index.vue +76 -0
- package/template-gx-design-thin/src/views/Page/one.vue +13 -0
- package/template-gx-design-thin/src/views/Page/two.vue +13 -0
- package/template-gx-design-thin/src/views/exception/403/index.vue +7 -0
- package/template-gx-design-thin/src/views/exception/404/index.vue +9 -0
- package/template-gx-design-thin/src/views/user/login/index.vue +109 -0
- package/template-gx-design-thin/src/views/user/login/style.less +38 -0
- package/template-gx-design-thin/tsconfig.json +46 -0
- package/template-gx-design-thin/types/ant-design-import.d.ts +99 -0
- package/template-gx-design-thin/types/auto-imports.d.ts +81 -0
- package/template-gx-design-thin/types/components.d.ts +24 -0
- package/template-gx-design-thin/types/config.d.ts +44 -0
- package/template-gx-design-thin/types/global.d.ts +97 -0
- package/template-gx-design-thin/types/mock.d.ts +16 -0
- package/template-gx-design-thin/types/module.d.ts +20 -0
- package/template-gx-design-thin/types/response.d.ts +15 -0
- package/template-gx-design-thin/unocss.config.ts +101 -0
- package/template-gx-design-thin/vite.config.ts +120 -0
- package/template-gx-design-thin/yarn.lock +9492 -0
@@ -0,0 +1,40 @@
|
|
1
|
+
import type { Plugin } from 'vite'
|
2
|
+
import chalk from 'chalk'
|
3
|
+
import { readPackageJSON } from 'pkg-types'
|
4
|
+
import { defaultSettings } from '../../../config'
|
5
|
+
import { getPackageSize, getRootPath, rootPath } from '../../util'
|
6
|
+
|
7
|
+
const { outputDir } = defaultSettings
|
8
|
+
|
9
|
+
export default async function viteNotice(): Promise<Plugin> {
|
10
|
+
let config: { command: string }
|
11
|
+
const { name = '' } = await readPackageJSON(rootPath)
|
12
|
+
|
13
|
+
return {
|
14
|
+
name: 'vite:notice',
|
15
|
+
configResolved(resolvedConfig) {
|
16
|
+
config = resolvedConfig
|
17
|
+
},
|
18
|
+
buildStart() {
|
19
|
+
console.log(
|
20
|
+
chalk.bold(
|
21
|
+
chalk.green(
|
22
|
+
`👏Welcome to use ${chalk.blue(
|
23
|
+
'[gx-design-pro]'
|
24
|
+
)}, If you feel good, remember to click on the link below to give a star https://github.com/gx12358/vue3-antd-admin`
|
25
|
+
)
|
26
|
+
)
|
27
|
+
)
|
28
|
+
},
|
29
|
+
closeBundle() {
|
30
|
+
if (config.command === 'build') {
|
31
|
+
getPackageSize({
|
32
|
+
folder: getRootPath(outputDir),
|
33
|
+
callBack: (size: string) => {
|
34
|
+
console.log(chalk.bold(chalk.green(`✨ ${chalk.blue(`[${name}]`)} all build successfully, Total files ${size}`)))
|
35
|
+
}
|
36
|
+
})
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module.exports = {
|
2
|
+
ignores: [(commit) => commit.includes('init')],
|
3
|
+
extends: ['@commitlint/config-conventional'],
|
4
|
+
rules: {
|
5
|
+
'body-leading-blank': [2, 'always'],
|
6
|
+
'footer-leading-blank': [1, 'always'],
|
7
|
+
'header-max-length': [2, 'always', 108],
|
8
|
+
'subject-empty': [2, 'never'],
|
9
|
+
'type-empty': [2, 'never'],
|
10
|
+
'type-enum': [
|
11
|
+
2,
|
12
|
+
'always',
|
13
|
+
[
|
14
|
+
'feat',
|
15
|
+
'fix',
|
16
|
+
'perf',
|
17
|
+
'style',
|
18
|
+
'docs',
|
19
|
+
'test',
|
20
|
+
'refactor',
|
21
|
+
'build',
|
22
|
+
'ci',
|
23
|
+
'chore',
|
24
|
+
'revert',
|
25
|
+
'wip',
|
26
|
+
'workflow',
|
27
|
+
'types',
|
28
|
+
'release',
|
29
|
+
],
|
30
|
+
],
|
31
|
+
},
|
32
|
+
};
|
@@ -0,0 +1,78 @@
|
|
1
|
+
/**
|
2
|
+
* @description 导出默认通用配置
|
3
|
+
*/
|
4
|
+
const settingConfig: SettingConfig = {
|
5
|
+
// 开发以及部署时的URL,hash模式时在不确定二级目录名称的情况下建议使用""代表相对路径或者"/二级目录/",history模式默认使用"/"或者"/二级目录/"
|
6
|
+
publicPath: './',
|
7
|
+
// 生产环境构建文件的目录名
|
8
|
+
outputDir: 'dist',
|
9
|
+
// 放置生成的静态资源 (js、css、img、fonts) 的 (相对于 outputDir 的) 目录。
|
10
|
+
assetsDir: 'static',
|
11
|
+
// 标题 (包括初次加载雪花屏的标题 页面的标题 浏览器的标题)
|
12
|
+
title: 'GX Pro Admin',
|
13
|
+
// 短标题
|
14
|
+
shortName: 'gx_pro_admin',
|
15
|
+
// 标题分隔符
|
16
|
+
titleSeparator: ' - ',
|
17
|
+
// 标题是否反转 如果为false:"page - title",如果为ture:"title - page"
|
18
|
+
titleReverse: false,
|
19
|
+
// 是否开启水印
|
20
|
+
waterMark: true,
|
21
|
+
// 水印字符
|
22
|
+
waterMarkTitle: 'GX Pro Admin',
|
23
|
+
// 滚动区域选择器
|
24
|
+
viewScrollRoot: '#gx-pro-admin>.gx-scrollbar>.gx-scrollbar-wrap',
|
25
|
+
// 开启cdn
|
26
|
+
useCdn: true,
|
27
|
+
// cdn 地址
|
28
|
+
cdnUrl: 'https://cdn.bootcdn.net/ajax/libs/{name}/{version}/{path}',
|
29
|
+
// cdn 模块集合
|
30
|
+
cdnModules: [
|
31
|
+
{
|
32
|
+
name: 'axios',
|
33
|
+
globalName: 'axios',
|
34
|
+
path: 'axios.min.js'
|
35
|
+
},
|
36
|
+
{
|
37
|
+
name: 'dayjs',
|
38
|
+
globalName: 'dayjs',
|
39
|
+
path: 'dayjs.min.js'
|
40
|
+
}
|
41
|
+
],
|
42
|
+
// 开启proxy
|
43
|
+
useProxy: true,
|
44
|
+
// proxy target
|
45
|
+
proxyTarget: 'http://127.0.0.1:3000',
|
46
|
+
// 接口前缀
|
47
|
+
requestPrefix: '/api',
|
48
|
+
// mock-接口前缀
|
49
|
+
mockPrefixUrl: '/mock-server',
|
50
|
+
// 开发环境端口号
|
51
|
+
devPort: 9260,
|
52
|
+
// pro版本copyright可随意修改
|
53
|
+
copyright: 'gx12358 2539306317@qq.com',
|
54
|
+
// 缓存路由的最大数量
|
55
|
+
keepAliveMaxNum: 99,
|
56
|
+
// 路由模式,可选值为 browser 或 hash
|
57
|
+
routerMode: 'hash',
|
58
|
+
// 不经过token校验的路由
|
59
|
+
routesWhiteList: [ '/user/login', '/user/register', '/exception/404', '/exception/403' ],
|
60
|
+
// token名称
|
61
|
+
tokenName: 'Authorization',
|
62
|
+
// token在localStorage、sessionStorage、cookie存储的key的名称
|
63
|
+
tokenTableName: 'GxAccessToken',
|
64
|
+
// token存储位置localStorage sessionStorage cookie
|
65
|
+
storage: 'localStorage',
|
66
|
+
// token失效回退到登录页时是否记录本次的路由
|
67
|
+
recordRoute: false,
|
68
|
+
// 是否开启登录拦截
|
69
|
+
loginInterception: true,
|
70
|
+
// 是否开启登录RSA加密
|
71
|
+
loginRSA: false,
|
72
|
+
// front(前端导出路由)和 all(后端导出路由)两种方式
|
73
|
+
authentication: 'all',
|
74
|
+
// mock数据是否检查token
|
75
|
+
checkMockToken: true
|
76
|
+
}
|
77
|
+
|
78
|
+
export default settingConfig
|
@@ -0,0 +1,47 @@
|
|
1
|
+
/**
|
2
|
+
* 在生产环境 代理是无法生效的,所以这里没有生产环境的配置
|
3
|
+
* The agent cannot take effect in the production environment
|
4
|
+
* so there is no configuration of the production environment
|
5
|
+
* For details, please see
|
6
|
+
* https://pro.ant.design/docs/deploy
|
7
|
+
*/
|
8
|
+
import type { ProxyOptions } from 'vite'
|
9
|
+
import { isObject, isString } from '@gx-design-vue/pro-utils'
|
10
|
+
import defaultSettings from './defaultSettings'
|
11
|
+
|
12
|
+
type ProxyTargetList = ProxyOptions & { rewrite: (path: string) => string }
|
13
|
+
|
14
|
+
export function createProxy(prefix) {
|
15
|
+
const ret = {
|
16
|
+
dev: {},
|
17
|
+
test: {},
|
18
|
+
pre: {}
|
19
|
+
}
|
20
|
+
|
21
|
+
if (isObject(defaultSettings.proxyTarget)) {
|
22
|
+
Object.keys(defaultSettings.proxyTarget).forEach((prefix) => {
|
23
|
+
const proxy = {
|
24
|
+
target: `${defaultSettings.proxyTarget[prefix]}`,
|
25
|
+
changeOrigin: true,
|
26
|
+
ws: true,
|
27
|
+
rewrite: path => path.replace(new RegExp(`^${prefix}`), '')
|
28
|
+
} as ProxyTargetList
|
29
|
+
|
30
|
+
ret.dev[prefix] = proxy
|
31
|
+
ret.test[prefix] = proxy
|
32
|
+
ret.pre[prefix] = proxy
|
33
|
+
})
|
34
|
+
} else if (isString(defaultSettings.proxyTarget)) {
|
35
|
+
const proxy = {
|
36
|
+
target: `${defaultSettings.proxyTarget}`,
|
37
|
+
changeOrigin: true,
|
38
|
+
ws: true,
|
39
|
+
rewrite: path => path.replace(new RegExp(`^${prefix}`), '')
|
40
|
+
}
|
41
|
+
ret.dev[prefix] = proxy
|
42
|
+
ret.test[prefix] = proxy
|
43
|
+
ret.pre[prefix] = proxy
|
44
|
+
}
|
45
|
+
|
46
|
+
return ret
|
47
|
+
}
|
@@ -0,0 +1,51 @@
|
|
1
|
+
import antFuEslint from '@antfu/eslint-config'
|
2
|
+
|
3
|
+
export default antFuEslint({
|
4
|
+
vue: true,
|
5
|
+
vueJsx: true,
|
6
|
+
typescript: true,
|
7
|
+
gitignore: true,
|
8
|
+
markdown: true,
|
9
|
+
ignores: [
|
10
|
+
'src/assets/**/*.js',
|
11
|
+
'build/vite/plugin/viteMock',
|
12
|
+
'public',
|
13
|
+
'tsconfig.*.json',
|
14
|
+
'tsconfig.json'
|
15
|
+
]
|
16
|
+
}, {
|
17
|
+
rules: {
|
18
|
+
'curly': 0,
|
19
|
+
'no-console': 0,
|
20
|
+
'import/order': 0,
|
21
|
+
'style/quote-props': 0,
|
22
|
+
'style/brace-style': 0,
|
23
|
+
'style/comma-dangle': 0,
|
24
|
+
'style/multiline-ternary': 0,
|
25
|
+
'prefer-regex-literals': 0,
|
26
|
+
'antfu/top-level-function': 0,
|
27
|
+
'vue/array-bracket-spacing': 0,
|
28
|
+
'style/array-bracket-spacing': 0,
|
29
|
+
'node/prefer-global/process': 0,
|
30
|
+
'style/indent': 0,
|
31
|
+
'prefer-template': 0,
|
32
|
+
'dot-notation': 0,
|
33
|
+
'no-cond-assign': 0,
|
34
|
+
'no-useless-computed-key': 0,
|
35
|
+
'node/no-deprecated-api': 0,
|
36
|
+
'antfu/consistent-list-newline': 0,
|
37
|
+
'import/no-mutable-exports': 0,
|
38
|
+
'style/member-delimiter-style': 0,
|
39
|
+
'unused-imports/no-unused-imports': 0,
|
40
|
+
'eslint-comments/no-unlimited-disable': 0,
|
41
|
+
'no-async-promise-executor': 0,
|
42
|
+
'unicorn/escape-case': 0,
|
43
|
+
'ts/ban-ts-comment': 0,
|
44
|
+
'ts/prefer-ts-expect-error': 0,
|
45
|
+
'ts/method-signature-style': 0,
|
46
|
+
'style/no-trailing-spaces': 0,
|
47
|
+
'ts/consistent-type-imports': 0,
|
48
|
+
'style/type-generic-spacing': 0,
|
49
|
+
'prefer-promise-reject-errors': 0
|
50
|
+
}
|
51
|
+
})
|
@@ -0,0 +1,42 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="zh">
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8" />
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
6
|
+
<meta
|
7
|
+
name="viewport"
|
8
|
+
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"
|
9
|
+
/>
|
10
|
+
<% for (var i in injectScript) { %>
|
11
|
+
<script type="text/javascript" src="<%= injectScript[i] %>"></script>
|
12
|
+
<% } %>
|
13
|
+
<title><%= VUE_APP_TITLE %></title>
|
14
|
+
<link rel="icon" href="/resource/img/favicon.ico" type="image/x-icon" />
|
15
|
+
<% for (var i in injectLink) { %>
|
16
|
+
<link rel="stylesheet" type="text/css" href="<%= injectLink[i] %>" />
|
17
|
+
<% } %>
|
18
|
+
<link rel="stylesheet" href="/resource/css/normalize.css">
|
19
|
+
<link rel="stylesheet" href="/resource/css/index.css">
|
20
|
+
</head>
|
21
|
+
<body>
|
22
|
+
<div id="app">
|
23
|
+
<div class="gx-app-loading">
|
24
|
+
<div class="gx-app-title">
|
25
|
+
<img src="/resource/img/logo.png" alt="logo" />
|
26
|
+
</div>
|
27
|
+
<div class="page-loading-warp">
|
28
|
+
<div class="gx-spin gx-spin-spinning">
|
29
|
+
<span class="gx-spin-dot gx-spin-dot-spin">
|
30
|
+
<svg t="1708486459357" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="983" width="40" height="40"><path d="M470.869333 9.130667c0-5.034667 4.096-9.130667 9.130667-9.130667h64c5.034667 0 9.130667 4.096 9.130667 9.130667v237.738666A9.130667 9.130667 0 0 1 544 256h-64a9.130667 9.130667 0 0 1-9.130667-9.130667V9.130667z" fill="#1677ff" p-id="984"></path><path d="M224 97.066667a9.130667 9.130667 0 0 1 3.328-12.501334l55.466667-32a9.130667 9.130667 0 0 1 12.458666 3.370667l118.869334 205.866667a9.130667 9.130667 0 0 1-3.370667 12.458666l-55.424 32a9.130667 9.130667 0 0 1-12.458667-3.328L224 97.066667z" fill="#1677ff" p-id="985"></path><path d="M55.893333 295.253333a9.130667 9.130667 0 0 1-3.328-12.501333l32-55.424a9.130667 9.130667 0 0 1 12.501334-3.328L302.933333 342.869333a9.130667 9.130667 0 0 1 3.328 12.458667l-32 55.466667a9.130667 9.130667 0 0 1-12.458666 3.328L55.893333 295.253333z" fill="#1677ff" p-id="986"></path><path d="M9.130667 553.130667A9.130667 9.130667 0 0 1 0 544v-64c0-5.034667 4.096-9.130667 9.130667-9.130667h237.738666c5.034667 0 9.130667 4.096 9.130667 9.130667v64a9.130667 9.130667 0 0 1-9.130667 9.130667H9.130667z" fill="#1677ff" p-id="987"></path><path d="M800 97.066667a9.130667 9.130667 0 0 0-3.328-12.501334l-55.466667-32a9.130667 9.130667 0 0 0-12.458666 3.370667l-118.869334 205.866667a9.130667 9.130667 0 0 0 3.370667 12.458666l55.424 32a9.130667 9.130667 0 0 0 12.458667-3.328l118.869333-205.866666z" fill="#1677ff" p-id="988"></path><path d="M968.106667 295.253333a9.130667 9.130667 0 0 0 3.328-12.501333l-32-55.424a9.130667 9.130667 0 0 0-12.501334-3.328L721.066667 342.869333a9.130667 9.130667 0 0 0-3.328 12.458667l32 55.466667c2.517333 4.352 8.106667 5.845333 12.458666 3.328L968.106667 295.253333z" fill="#1677ff" p-id="989"></path><path d="M1014.869333 553.130667A9.130667 9.130667 0 0 0 1024 544v-64a9.130667 9.130667 0 0 0-9.130667-9.130667h-237.738666a9.130667 9.130667 0 0 0-9.130667 9.130667v64c0 5.034667 4.096 9.130667 9.130667 9.130667h237.738666z" fill="#1677ff" p-id="990"></path><path d="M470.869333 1014.869333c0 5.034667 4.096 9.130667 9.130667 9.130667h64a9.130667 9.130667 0 0 0 9.130667-9.130667v-237.738666A9.130667 9.130667 0 0 0 544 768h-64a9.130667 9.130667 0 0 0-9.130667 9.130667v237.738666z" fill="#1677ff" p-id="991"></path><path d="M224 926.933333a9.130667 9.130667 0 0 0 3.328 12.501334l55.466667 32c4.352 2.517333 9.941333 1.024 12.458666-3.370667l118.869334-205.866667a9.130667 9.130667 0 0 0-3.370667-12.458666l-55.424-32a9.130667 9.130667 0 0 0-12.458667 3.328L224 926.933333z" fill="#1677ff" p-id="992"></path><path d="M55.893333 728.746667a9.130667 9.130667 0 0 0-3.328 12.501333l32 55.424c2.56 4.352 8.106667 5.845333 12.501334 3.328L302.933333 681.130667a9.130667 9.130667 0 0 0 3.328-12.458667l-32-55.466667a9.130667 9.130667 0 0 0-12.458666-3.328L55.893333 728.746667z" fill="#1677ff" p-id="993"></path><path d="M800 926.933333a9.130667 9.130667 0 0 1-3.328 12.501334l-55.466667 32a9.130667 9.130667 0 0 1-12.458666-3.370667l-118.869334-205.866667a9.130667 9.130667 0 0 1 3.370667-12.458666l55.424-32a9.130667 9.130667 0 0 1 12.458667 3.328l118.869333 205.866666z" fill="#1677ff" p-id="994"></path><path d="M968.106667 728.746667c4.352 2.517333 5.845333 8.106667 3.328 12.501333l-32 55.424a9.130667 9.130667 0 0 1-12.501334 3.328L721.066667 681.130667a9.130667 9.130667 0 0 1-3.328-12.458667l32-55.466667a9.130667 9.130667 0 0 1 12.458666-3.328l205.866667 118.869334z" fill="#1677ff" p-id="995"></path></svg>
|
31
|
+
</span>
|
32
|
+
</div>
|
33
|
+
<div class="page-loading-warp_mseeage">
|
34
|
+
<p class="page-loading_title">正在加载资源</p>
|
35
|
+
<p class="page-loading_sub_title">初次加载资源可能需要较多时间,请耐心等候</p>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
<script type="module" src="/src/main.ts"></script>
|
41
|
+
</body>
|
42
|
+
</html>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { createProdMockServer } from '../build/vite/plugin/viteMock/client'
|
2
|
+
|
3
|
+
const modules = import.meta.glob('./datasSource/**/*.ts', { eager: true })
|
4
|
+
|
5
|
+
const mockModules: any[] = []
|
6
|
+
Object.keys(modules).forEach((key) => {
|
7
|
+
if (key.includes('/_')) {
|
8
|
+
return
|
9
|
+
}
|
10
|
+
if (modules[key] && modules[key]['default'])
|
11
|
+
mockModules.push(...modules[key]['default'])
|
12
|
+
})
|
13
|
+
|
14
|
+
/**
|
15
|
+
* Used in a production environment. Need to manually import all modules
|
16
|
+
*/
|
17
|
+
export function setupProdMockServer() {
|
18
|
+
createProdMockServer(mockModules)
|
19
|
+
}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import { omit } from 'lodash-es'
|
2
|
+
import { defaultSettings } from '@gx-config'
|
3
|
+
import { checkToken } from '@gx-mock/util/utils'
|
4
|
+
import { isFunction, isObject } from '@gx-design-vue/pro-utils'
|
5
|
+
|
6
|
+
const { tokenName } = defaultSettings
|
7
|
+
|
8
|
+
export function getRequestToken({ headers }: MockResponse<any, any>): string | undefined {
|
9
|
+
return headers?.[tokenName.toLowerCase()]
|
10
|
+
}
|
11
|
+
|
12
|
+
export const checkBackDataFun = (token, config?: Partial<ResponseResult> | Function) => {
|
13
|
+
const configData: Partial<ResponseResult> = isFunction(config) ? (config as Function)?.() : config
|
14
|
+
let code = 200
|
15
|
+
let msg = ''
|
16
|
+
let data: any
|
17
|
+
if (isObject(configData)) {
|
18
|
+
code = configData?.code || 200
|
19
|
+
data = configData?.data || { ...omit(configData, [ 'code', 'msg' ]) }
|
20
|
+
msg = configData?.msg
|
21
|
+
} else {
|
22
|
+
data = configData
|
23
|
+
}
|
24
|
+
|
25
|
+
const invaiteToken = checkToken(token)
|
26
|
+
|
27
|
+
const result: ResponseResult = {
|
28
|
+
...(invaiteToken ? { data } : {}),
|
29
|
+
code: invaiteToken ? code : 401,
|
30
|
+
msg: invaiteToken ? msg || code ? 'success' : 'Request failed' : 'Invalid token!'
|
31
|
+
}
|
32
|
+
return result
|
33
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import dayjs from 'dayjs'
|
2
|
+
import type { MenuDataItem } from '@gx-design-vue/pro-layout'
|
3
|
+
import { getLevelData } from '@gx-design-vue/pro-utils'
|
4
|
+
|
5
|
+
export const menuList: MenuDataItem[] = getLevelData([
|
6
|
+
{
|
7
|
+
component: 'Page/one',
|
8
|
+
createTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
9
|
+
menuId: 2,
|
10
|
+
path: 'One',
|
11
|
+
title: '页面一',
|
12
|
+
name: 'Page',
|
13
|
+
menuType: 'C',
|
14
|
+
orderNum: '2',
|
15
|
+
isFrame: '1',
|
16
|
+
parentId: 0,
|
17
|
+
target: '',
|
18
|
+
hidden: false,
|
19
|
+
outLinkType: 0
|
20
|
+
}
|
21
|
+
]).map(item => ({ ...item, children: [] }))
|
@@ -0,0 +1,123 @@
|
|
1
|
+
import mockjs from 'mockjs'
|
2
|
+
|
3
|
+
const { Random } = mockjs
|
4
|
+
|
5
|
+
const admin = [ 1, 2 ]
|
6
|
+
|
7
|
+
export interface RolesInfo {
|
8
|
+
roleId: number;
|
9
|
+
roleKey: string;
|
10
|
+
roleName: string;
|
11
|
+
status: string;
|
12
|
+
}
|
13
|
+
|
14
|
+
export interface UserDetails {
|
15
|
+
roles: RolesInfo[];
|
16
|
+
userId: number;
|
17
|
+
roleIds: number[];
|
18
|
+
userName: string;
|
19
|
+
nickName: string;
|
20
|
+
avatar: string;
|
21
|
+
admin: boolean;
|
22
|
+
address: string;
|
23
|
+
signature: string;
|
24
|
+
introduction: string;
|
25
|
+
tags?: string;
|
26
|
+
phone?: string;
|
27
|
+
email?: string;
|
28
|
+
levelName?: string;
|
29
|
+
provinceCode?: string;
|
30
|
+
cityCode?: string;
|
31
|
+
districtCode?: string;
|
32
|
+
loginDate?: string;
|
33
|
+
}
|
34
|
+
|
35
|
+
export interface UserInfo {
|
36
|
+
roles: string[];
|
37
|
+
permissions: string[];
|
38
|
+
user: UserDetails;
|
39
|
+
}
|
40
|
+
|
41
|
+
export interface UserList {
|
42
|
+
id: number;
|
43
|
+
name: string;
|
44
|
+
}
|
45
|
+
|
46
|
+
export const accessTokens = {
|
47
|
+
gx12358: 'gx-accessToken',
|
48
|
+
admin: 'admin-accessToken',
|
49
|
+
editor: 'editor-accessToken',
|
50
|
+
no_editor: 'test-accessToken'
|
51
|
+
}
|
52
|
+
|
53
|
+
export const accounts = {
|
54
|
+
admin: 'gx.design',
|
55
|
+
gx12358: 'aa123456',
|
56
|
+
editor: 'gx.design',
|
57
|
+
no_editor: 'gx.design'
|
58
|
+
}
|
59
|
+
|
60
|
+
export const rolesInfo: RolesInfo[] = [
|
61
|
+
{
|
62
|
+
roleId: 1,
|
63
|
+
roleKey: 'gx-admin',
|
64
|
+
roleName: 'gx12358-超级管理员',
|
65
|
+
status: '0'
|
66
|
+
},
|
67
|
+
{
|
68
|
+
roleId: 2,
|
69
|
+
roleKey: 'admin',
|
70
|
+
roleName: '超级管理员',
|
71
|
+
status: '0'
|
72
|
+
},
|
73
|
+
{
|
74
|
+
roleId: 3,
|
75
|
+
roleKey: 'editor',
|
76
|
+
roleName: '编辑人员',
|
77
|
+
status: '0'
|
78
|
+
}
|
79
|
+
]
|
80
|
+
|
81
|
+
export const tokenAccount = {
|
82
|
+
'1': accessTokens.gx12358,
|
83
|
+
'2': accessTokens.admin,
|
84
|
+
'3': accessTokens.editor,
|
85
|
+
'4': accessTokens.no_editor
|
86
|
+
}
|
87
|
+
|
88
|
+
const rolesInfoAccount = {
|
89
|
+
'1': rolesInfo.filter(item => [ 1 ].includes(item.roleId)),
|
90
|
+
'2': rolesInfo.filter(item => [ 2 ].includes(item.roleId)),
|
91
|
+
'3': rolesInfo.filter(item => [ 3 ].includes(item.roleId)),
|
92
|
+
'4': rolesInfo.filter(item => [ 3 ].includes(item.roleId))
|
93
|
+
}
|
94
|
+
|
95
|
+
const nickNameAccount = {
|
96
|
+
'1': 'gx12358',
|
97
|
+
'2': 'admin',
|
98
|
+
'3': 'editor',
|
99
|
+
'4': 'no_editor'
|
100
|
+
}
|
101
|
+
|
102
|
+
export const defaultUser: UserInfo = {
|
103
|
+
permissions: [ '*:*:*' ],
|
104
|
+
roles: rolesInfoAccount[String(2)].map(item => item.roleKey),
|
105
|
+
user: {
|
106
|
+
userId: 1,
|
107
|
+
admin: admin.includes(1),
|
108
|
+
roles: rolesInfoAccount[String(1)],
|
109
|
+
levelName: '前端开发工程师',
|
110
|
+
roleIds: rolesInfoAccount[String(1)].map(item => item.roleId),
|
111
|
+
nickName: nickNameAccount[String(1)],
|
112
|
+
address: '安徽省合肥市瑶海区',
|
113
|
+
provinceCode: '340000',
|
114
|
+
cityCode: '340100',
|
115
|
+
districtCode: '340102',
|
116
|
+
email: 'gx12358@gmail.com',
|
117
|
+
phone: '18811217623',
|
118
|
+
introduction: Random.cparagraph(10, 15),
|
119
|
+
avatar: 'https://ahtv-obs.obs.cn-north-4.myhuaweicloud.com/20211111162748.jpg',
|
120
|
+
tags: Array.from({ length: Random.integer(4, 8) }).map(_ => Random.cword(2, 6)).join(),
|
121
|
+
userName: Object.keys(accessTokens).find(el => tokenAccount[String(1)] === accessTokens[el])
|
122
|
+
} as UserDetails
|
123
|
+
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import dayjs from 'dayjs'
|
2
|
+
import type { UserInfo } from '@gx-mock/config/user'
|
3
|
+
import { defaultUser } from '@gx-mock/config/user'
|
4
|
+
import { getMockRequest, getTokeUserInfo } from '@gx-mock/util/utils'
|
5
|
+
|
6
|
+
export default [
|
7
|
+
getMockRequest<UserInfo | DefaultResult<null>, any>({
|
8
|
+
url: '/user/queryUserDetail',
|
9
|
+
method: 'get',
|
10
|
+
callback: (_, token = '') => {
|
11
|
+
if (token) {
|
12
|
+
const tokenUserInfo = getTokeUserInfo(token)
|
13
|
+
if (tokenUserInfo && tokenUserInfo?.userId) {
|
14
|
+
return {
|
15
|
+
...defaultUser,
|
16
|
+
user: {
|
17
|
+
...defaultUser.user,
|
18
|
+
loginDate: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
return {
|
25
|
+
code: 500,
|
26
|
+
message: '用户信息获取失败'
|
27
|
+
}
|
28
|
+
}
|
29
|
+
})
|
30
|
+
]
|
@@ -0,0 +1,47 @@
|
|
1
|
+
import { defaultSettings } from '@gx-config'
|
2
|
+
import { accessTokens, accounts } from '@gx-mock/config/user'
|
3
|
+
import { createrToken, getMockRequest } from '@gx-mock/util/utils'
|
4
|
+
|
5
|
+
const { tokenName } = defaultSettings
|
6
|
+
|
7
|
+
export default [
|
8
|
+
getMockRequest({
|
9
|
+
url: '/user/login',
|
10
|
+
method: 'post',
|
11
|
+
carryToken: false,
|
12
|
+
callback: ({ body }) => {
|
13
|
+
const { userName, password } = body
|
14
|
+
const accessToken = accessTokens[userName]
|
15
|
+
if (accounts[userName] !== password || !accessToken) {
|
16
|
+
return {
|
17
|
+
code: 500,
|
18
|
+
msg: '帐户或密码不正确。'
|
19
|
+
}
|
20
|
+
}
|
21
|
+
return {
|
22
|
+
code: 200,
|
23
|
+
msg: 'success',
|
24
|
+
data: {
|
25
|
+
[tokenName]: createrToken(accessToken),
|
26
|
+
expiresIn: 720
|
27
|
+
}
|
28
|
+
}
|
29
|
+
}
|
30
|
+
}),
|
31
|
+
getMockRequest({
|
32
|
+
url: '/user/register',
|
33
|
+
method: 'post',
|
34
|
+
carryToken: false,
|
35
|
+
callback: () => {
|
36
|
+
return {
|
37
|
+
code: 200,
|
38
|
+
msg: '模拟注册成功'
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}),
|
42
|
+
getMockRequest({
|
43
|
+
url: '/user/logout',
|
44
|
+
method: 'get',
|
45
|
+
timeout: 200
|
46
|
+
})
|
47
|
+
]
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import { isJSONStr } from '@/utils/validate'
|
2
|
+
import { isArray, isObject } from '@gx-design-vue/pro-utils'
|
3
|
+
import Base64 from '@/utils/crypto/base64'
|
4
|
+
|
5
|
+
const cryptoBase64 = new Base64()
|
6
|
+
|
7
|
+
// 加密方法
|
8
|
+
export function Encrypt(word: string | object) {
|
9
|
+
let str: string
|
10
|
+
if (isObject(word) || isArray(word)) {
|
11
|
+
str = JSON.stringify(word)
|
12
|
+
} else {
|
13
|
+
str = word as string
|
14
|
+
}
|
15
|
+
|
16
|
+
return cryptoBase64.encode(str as string)
|
17
|
+
}
|
18
|
+
|
19
|
+
// 解密方法
|
20
|
+
export function Decrypt(word: string) {
|
21
|
+
const decryptedStr = cryptoBase64.decode(word)
|
22
|
+
return isJSONStr(decryptedStr) ? JSON.parse(decryptedStr) : decryptedStr
|
23
|
+
}
|