@gx-design-vue/create-gx-cli 0.1.12 → 0.1.14
Sign up to get free protection for your applications and to get access to all the features.
- package/bin/create-gx-cli +3 -2
- package/package.json +4 -4
- package/src/cli.js +9 -7
- package/src/git.js +8 -5
- package/src/main.js +29 -16
- package/template-mobile-vant-cli/package.json +5 -5
- package/template-gx-design-thin/.editorconfig +0 -19
- package/template-gx-design-thin/.env +0 -4
- package/template-gx-design-thin/.env.development +0 -15
- package/template-gx-design-thin/.env.production +0 -28
- package/template-gx-design-thin/.eslintignore +0 -16
- package/template-gx-design-thin/.prettierignore +0 -9
- package/template-gx-design-thin/LICENSE +0 -21
- package/template-gx-design-thin/README.md +0 -112
- package/template-gx-design-thin/build/constant.ts +0 -1
- package/template-gx-design-thin/build/generate/generateModifyVars.ts +0 -14
- package/template-gx-design-thin/build/rollupOptions/index.ts +0 -22
- package/template-gx-design-thin/build/util/hash.ts +0 -17
- package/template-gx-design-thin/build/util/index.ts +0 -131
- package/template-gx-design-thin/build/vite/cdn.ts +0 -63
- package/template-gx-design-thin/build/vite/optimizer.ts +0 -26
- package/template-gx-design-thin/build/vite/plugin/appConfig.ts +0 -91
- package/template-gx-design-thin/build/vite/plugin/autoImport.ts +0 -26
- package/template-gx-design-thin/build/vite/plugin/compress.ts +0 -31
- package/template-gx-design-thin/build/vite/plugin/html.ts +0 -39
- package/template-gx-design-thin/build/vite/plugin/index.ts +0 -75
- package/template-gx-design-thin/build/vite/plugin/mock.ts +0 -14
- package/template-gx-design-thin/build/vite/plugin/pwa.ts +0 -31
- package/template-gx-design-thin/build/vite/plugin/visualizer.ts +0 -14
- package/template-gx-design-thin/build/vite/plugin/viteMock/client.ts +0 -88
- package/template-gx-design-thin/build/vite/plugin/viteMock/createMockServer.ts +0 -271
- package/template-gx-design-thin/build/vite/plugin/viteMock/index.ts +0 -69
- package/template-gx-design-thin/build/vite/plugin/viteMock/types.ts +0 -48
- package/template-gx-design-thin/build/vite/plugin/viteMock/utils.ts +0 -48
- package/template-gx-design-thin/build/vite/plugin/viteNotice.ts +0 -40
- package/template-gx-design-thin/commitlint.config.cjs +0 -32
- package/template-gx-design-thin/config/default/defaultSettings.ts +0 -78
- package/template-gx-design-thin/config/default/network.ts +0 -10
- package/template-gx-design-thin/config/default/proxy.ts +0 -47
- package/template-gx-design-thin/config/default/theme.ts +0 -3
- package/template-gx-design-thin/config/index.ts +0 -11
- package/template-gx-design-thin/eslint.config.js +0 -51
- package/template-gx-design-thin/index.html +0 -42
- package/template-gx-design-thin/mock/_createProductionServer.ts +0 -19
- package/template-gx-design-thin/mock/_util.ts +0 -33
- package/template-gx-design-thin/mock/config/menu.ts +0 -21
- package/template-gx-design-thin/mock/config/user.ts +0 -123
- package/template-gx-design-thin/mock/datasSource/system/menu.ts +0 -10
- package/template-gx-design-thin/mock/datasSource/user/account.ts +0 -30
- package/template-gx-design-thin/mock/datasSource/user/index.ts +0 -47
- package/template-gx-design-thin/mock/util/crypto.ts +0 -23
- package/template-gx-design-thin/mock/util/table.ts +0 -92
- package/template-gx-design-thin/mock/util/utils.ts +0 -73
- package/template-gx-design-thin/package.json +0 -129
- package/template-gx-design-thin/pnpm-lock.yaml +0 -12575
- package/template-gx-design-thin/prettier.config.cjs +0 -18
- package/template-gx-design-thin/public/resource/css/index.css +0 -119
- package/template-gx-design-thin/public/resource/css/normalize.css +0 -396
- 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 +0 -1
- 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 +0 -42
- 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 +0 -1
- package/template-gx-design-thin/src/assets/logo.png +0 -0
- package/template-gx-design-thin/src/assets/menu_font/iconfont.css +0 -94
- package/template-gx-design-thin/src/assets/menu_font/iconfont.eot +0 -0
- package/template-gx-design-thin/src/assets/menu_font/iconfont.js +0 -1
- package/template-gx-design-thin/src/assets/menu_font/iconfont.json +0 -142
- package/template-gx-design-thin/src/assets/menu_font/iconfont.svg +0 -1
- 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 +0 -94
- package/template-gx-design-thin/src/assets/public_icon/iconfont.css +0 -42
- package/template-gx-design-thin/src/assets/public_icon/iconfont.eot +0 -0
- package/template-gx-design-thin/src/assets/public_icon/iconfont.js +0 -1
- package/template-gx-design-thin/src/assets/public_icon/iconfont.json +0 -51
- package/template-gx-design-thin/src/assets/public_icon/iconfont.svg +0 -1
- 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 +0 -42
- package/template-gx-design-thin/src/assets/public_images/nodata.svg +0 -1
- package/template-gx-design-thin/src/common/global.ts +0 -4
- package/template-gx-design-thin/src/components/GDesign/Result/index.tsx +0 -144
- package/template-gx-design-thin/src/components/GDesign/Result/style.less +0 -140
- package/template-gx-design-thin/src/components/GDesign/utils/index.ts +0 -7
- package/template-gx-design-thin/src/components/GlobalLayout/Confirm/index.ts +0 -21
- package/template-gx-design-thin/src/components/GlobalLayout/Empty/index.vue +0 -18
- package/template-gx-design-thin/src/components/GlobalLayout/RightContent/index.tsx +0 -126
- package/template-gx-design-thin/src/components/GlobalLayout/RightContent/style.ts +0 -77
- package/template-gx-design-thin/src/components/GlobalLayout/Spin/index.tsx +0 -30
- package/template-gx-design-thin/src/components/PageLoading/index.tsx +0 -51
- package/template-gx-design-thin/src/components/index.ts +0 -6
- package/template-gx-design-thin/src/core/ant-design/index.ts +0 -10
- package/template-gx-design-thin/src/core/gx-admin-design/index.ts +0 -6
- package/template-gx-design-thin/src/core/gx-design/index.ts +0 -6
- package/template-gx-design-thin/src/core/gx-pro-design/index.ts +0 -8
- package/template-gx-design-thin/src/core/index.ts +0 -84
- package/template-gx-design-thin/src/design/ant-design/index.less +0 -4
- package/template-gx-design-thin/src/design/ant-design/layout.less +0 -22
- package/template-gx-design-thin/src/design/ant-design/menu.less +0 -48
- package/template-gx-design-thin/src/design/ant-design/spin.less +0 -23
- package/template-gx-design-thin/src/design/ant-design/tooltip.less +0 -7
- package/template-gx-design-thin/src/design/color.less +0 -1
- package/template-gx-design-thin/src/design/config.less +0 -5
- package/template-gx-design-thin/src/design/imageEditor.less +0 -180
- package/template-gx-design-thin/src/design/index.less +0 -95
- package/template-gx-design-thin/src/design/mixin.less +0 -65
- package/template-gx-design-thin/src/design/normalize.less +0 -391
- package/template-gx-design-thin/src/design/root.less +0 -3
- package/template-gx-design-thin/src/hooks/core/index.ts +0 -3
- package/template-gx-design-thin/src/hooks/core/useRequest/index.ts +0 -118
- package/template-gx-design-thin/src/hooks/event/index.ts +0 -3
- package/template-gx-design-thin/src/hooks/event/useClipboard.ts +0 -15
- package/template-gx-design-thin/src/hooks/web/index.ts +0 -5
- package/template-gx-design-thin/src/hooks/web/useThemeStyle.ts +0 -16
- package/template-gx-design-thin/src/layout/BasicLayout.vue +0 -123
- package/template-gx-design-thin/src/layout/BlankLayout.vue +0 -5
- package/template-gx-design-thin/src/layout/ContentView.vue +0 -50
- package/template-gx-design-thin/src/layout/IframeView.vue +0 -1
- package/template-gx-design-thin/src/layout/UserLayout.vue +0 -7
- package/template-gx-design-thin/src/main.ts +0 -34
- package/template-gx-design-thin/src/plugins/index.ts +0 -2
- package/template-gx-design-thin/src/router/guard/index.ts +0 -83
- package/template-gx-design-thin/src/router/guard/permissions.ts +0 -70
- package/template-gx-design-thin/src/router/guard/stateGuard.ts +0 -10
- package/template-gx-design-thin/src/router/helper/routeHelper.ts +0 -223
- package/template-gx-design-thin/src/router/helper/utils.ts +0 -19
- package/template-gx-design-thin/src/router/index.ts +0 -31
- package/template-gx-design-thin/src/router/routes/index.ts +0 -86
- package/template-gx-design-thin/src/router/routes/modules/dataSource.ts +0 -12
- package/template-gx-design-thin/src/services/common/index.ts +0 -11
- package/template-gx-design-thin/src/services/systemCenter/index.ts +0 -1
- package/template-gx-design-thin/src/services/systemCenter/menu.ts +0 -9
- package/template-gx-design-thin/src/services/userCenter/account.ts +0 -42
- package/template-gx-design-thin/src/services/userCenter/index.ts +0 -28
- package/template-gx-design-thin/src/store/index.ts +0 -32
- package/template-gx-design-thin/src/store/modules/dict.ts +0 -28
- package/template-gx-design-thin/src/store/modules/global.ts +0 -42
- package/template-gx-design-thin/src/store/modules/permission.ts +0 -19
- package/template-gx-design-thin/src/store/modules/routes.ts +0 -113
- package/template-gx-design-thin/src/store/modules/tabsRouter.ts +0 -76
- package/template-gx-design-thin/src/store/modules/user.ts +0 -136
- package/template-gx-design-thin/src/utils/accessToken.ts +0 -80
- package/template-gx-design-thin/src/utils/crypto/base64.ts +0 -101
- package/template-gx-design-thin/src/utils/crypto/index.ts +0 -57
- package/template-gx-design-thin/src/utils/env.ts +0 -50
- package/template-gx-design-thin/src/utils/fetchFile.ts +0 -81
- package/template-gx-design-thin/src/utils/index.ts +0 -123
- package/template-gx-design-thin/src/utils/pageTitle.ts +0 -20
- package/template-gx-design-thin/src/utils/request/XHR.ts +0 -139
- package/template-gx-design-thin/src/utils/request/axiosCancel.ts +0 -69
- package/template-gx-design-thin/src/utils/request/checkStatus.ts +0 -25
- package/template-gx-design-thin/src/utils/request/index.ts +0 -144
- package/template-gx-design-thin/src/utils/request/typings.ts +0 -171
- package/template-gx-design-thin/src/utils/storage.ts +0 -199
- package/template-gx-design-thin/src/utils/uploadFile.ts +0 -27
- package/template-gx-design-thin/src/utils/util.ts +0 -198
- package/template-gx-design-thin/src/utils/validate.ts +0 -216
- package/template-gx-design-thin/src/views/Iframe/index.vue +0 -76
- package/template-gx-design-thin/src/views/Page/one.vue +0 -13
- package/template-gx-design-thin/src/views/Page/two.vue +0 -13
- package/template-gx-design-thin/src/views/exception/403/index.vue +0 -7
- package/template-gx-design-thin/src/views/exception/404/index.vue +0 -9
- package/template-gx-design-thin/src/views/user/login/index.vue +0 -109
- package/template-gx-design-thin/src/views/user/login/style.less +0 -38
- package/template-gx-design-thin/tsconfig.json +0 -46
- package/template-gx-design-thin/types/ant-design-import.d.ts +0 -99
- package/template-gx-design-thin/types/auto-imports.d.ts +0 -81
- package/template-gx-design-thin/types/components.d.ts +0 -24
- package/template-gx-design-thin/types/config.d.ts +0 -44
- package/template-gx-design-thin/types/global.d.ts +0 -97
- package/template-gx-design-thin/types/mock.d.ts +0 -16
- package/template-gx-design-thin/types/module.d.ts +0 -20
- package/template-gx-design-thin/types/response.d.ts +0 -15
- package/template-gx-design-thin/unocss.config.ts +0 -101
- package/template-gx-design-thin/vite.config.ts +0 -120
- package/template-gx-design-thin/yarn.lock +0 -9492
@@ -1,51 +0,0 @@
|
|
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
|
-
})
|
@@ -1,42 +0,0 @@
|
|
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>
|
@@ -1,19 +0,0 @@
|
|
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
|
-
}
|
@@ -1,33 +0,0 @@
|
|
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
|
-
}
|
@@ -1,21 +0,0 @@
|
|
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: 'PageOne',
|
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: [] }))
|
@@ -1,123 +0,0 @@
|
|
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
|
-
}
|
@@ -1,30 +0,0 @@
|
|
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
|
-
]
|
@@ -1,47 +0,0 @@
|
|
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
|
-
]
|
@@ -1,23 +0,0 @@
|
|
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
|
-
}
|
@@ -1,92 +0,0 @@
|
|
1
|
-
import mockjs from 'mockjs'
|
2
|
-
import { cloneDeep } from 'lodash-es'
|
3
|
-
import dayjs from 'dayjs'
|
4
|
-
|
5
|
-
const { Random, mock } = mockjs
|
6
|
-
|
7
|
-
export interface ListItem {
|
8
|
-
createTime: string;
|
9
|
-
id: number;
|
10
|
-
}
|
11
|
-
|
12
|
-
export interface ListSearchParams {
|
13
|
-
pageNum?: number;
|
14
|
-
pageSize?: number;
|
15
|
-
sord?: 'asc' | 'desc';
|
16
|
-
sidx?: 'createTime';
|
17
|
-
}
|
18
|
-
|
19
|
-
export function initContent<T>(
|
20
|
-
max,
|
21
|
-
callbackParams?: (key: number) => Omit<T, 'id' | 'createTime'> & Partial<ListItem>
|
22
|
-
): (Omit<T, 'id' | 'createTime'> & ListItem)[] {
|
23
|
-
const mockParams = {}
|
24
|
-
mockParams[`data|${max}`] = [
|
25
|
-
{
|
26
|
-
'id|+1': 1
|
27
|
-
}
|
28
|
-
]
|
29
|
-
const list: { data: (T & ListItem)[] } = mock(mockParams)
|
30
|
-
|
31
|
-
return list.data.map((item, index) => {
|
32
|
-
return {
|
33
|
-
...item,
|
34
|
-
createTime: dayjs()
|
35
|
-
.subtract(Random.integer(3, 60), 'day')
|
36
|
-
.subtract(Random.integer(2, 6), 'hour')
|
37
|
-
.subtract(Random.integer(1, 59), 'minute')
|
38
|
-
.subtract(Random.integer(1, 59), 'second')
|
39
|
-
.format('YYYY-MM-DD HH:mm:ss'),
|
40
|
-
...callbackParams?.(index)
|
41
|
-
}
|
42
|
-
})
|
43
|
-
}
|
44
|
-
|
45
|
-
export function handlePageList<T>(
|
46
|
-
dataSource: T[],
|
47
|
-
{ pageNum, pageSize, callBack }: {
|
48
|
-
pageNum: number;
|
49
|
-
pageSize: number;
|
50
|
-
callBack?: (data: T[]) => T[]
|
51
|
-
}
|
52
|
-
): T[] {
|
53
|
-
if (callBack)
|
54
|
-
dataSource = callBack?.(dataSource)
|
55
|
-
return cloneDeep(dataSource).filter(
|
56
|
-
(_, sort) => (sort < pageNum * pageSize) && (sort >= pageSize * (pageNum - 1))
|
57
|
-
)
|
58
|
-
}
|
59
|
-
|
60
|
-
export function compareToMaxTime(obj1, obj2, key, type: 0 | 1 = 0) {
|
61
|
-
const val1 = obj1[key]
|
62
|
-
const val2 = obj2[key]
|
63
|
-
let result = 0
|
64
|
-
if (dayjs(val1).isBefore(dayjs(val2))) {
|
65
|
-
result = type === 0 ? -1 : 0
|
66
|
-
} else if (dayjs(val1).isAfter(dayjs(val2))) {
|
67
|
-
result = type === 0 ? 0 : (-1)
|
68
|
-
}
|
69
|
-
return result
|
70
|
-
}
|
71
|
-
|
72
|
-
export function postDataSource<T>(
|
73
|
-
dataSource: (Omit<T, 'id' | 'createTime'> & ListItem)[],
|
74
|
-
type: 'delete' | 'add' | 'update' = 'update',
|
75
|
-
options?: { key?: string; params: Partial<(Omit<T, 'id' | 'createTime'> & ListItem)> }
|
76
|
-
) {
|
77
|
-
if (type === 'update')
|
78
|
-
dataSource = dataSource.map((item: any) => {
|
79
|
-
if (options?.params?.[options.key] === item[options?.key])
|
80
|
-
return { ...item, ...options?.params }
|
81
|
-
return item
|
82
|
-
})
|
83
|
-
if (type === 'add')
|
84
|
-
dataSource.unshift({
|
85
|
-
...options?.params as (Omit<T, 'id' | 'createTime'> & ListItem),
|
86
|
-
id: dataSource.length + 1
|
87
|
-
})
|
88
|
-
if (type === 'delete')
|
89
|
-
dataSource = dataSource.filter(item => options?.params?.[options.key] !== item[options?.key])
|
90
|
-
|
91
|
-
return dataSource
|
92
|
-
}
|
@@ -1,73 +0,0 @@
|
|
1
|
-
import mockjs from 'mockjs'
|
2
|
-
import { defaultSettings } from '@gx-config'
|
3
|
-
import type { UserDetails } from '@gx-mock/config/user'
|
4
|
-
import { tokenAccount, defaultUser } from '@gx-mock/config/user'
|
5
|
-
import { Decrypt, Encrypt } from '@gx-mock/util/crypto'
|
6
|
-
import { getRandomNumber } from '@gx-design-vue/pro-utils'
|
7
|
-
import { checkBackDataFun, getRequestToken } from '@gx-mock/_util'
|
8
|
-
|
9
|
-
const { Random } = mockjs
|
10
|
-
|
11
|
-
const { mockPrefixUrl, checkMockToken } = defaultSettings
|
12
|
-
|
13
|
-
export function getTokenBuUserId(token) {
|
14
|
-
return Number(Object.keys(tokenAccount).find(item => tokenAccount[item] === token))
|
15
|
-
}
|
16
|
-
|
17
|
-
export function createrToken(_) {
|
18
|
-
const userInfo = defaultUser
|
19
|
-
return Encrypt({ userId: userInfo.user.userId })
|
20
|
-
}
|
21
|
-
|
22
|
-
export function getTokeUserInfo(token): UserDetails {
|
23
|
-
return Decrypt(token)
|
24
|
-
}
|
25
|
-
|
26
|
-
export function handleRandomImage(width = 50, height = 50) {
|
27
|
-
return `https://picsum.photos/${width}/${height}?random=${getRandomNumber().uuid(10)}`
|
28
|
-
}
|
29
|
-
|
30
|
-
export function checkToken(token) {
|
31
|
-
if (token) {
|
32
|
-
const useInfo: UserDetails = getTokeUserInfo(token)
|
33
|
-
return useInfo ? useInfo?.userId : false
|
34
|
-
}
|
35
|
-
|
36
|
-
return !checkMockToken
|
37
|
-
}
|
38
|
-
|
39
|
-
export function getArraryList<T>(length: number, callback: (key: number) => T) {
|
40
|
-
return Array.from({ length }).map((_, key) => callback(key))
|
41
|
-
}
|
42
|
-
|
43
|
-
export function getMockRequest<T = Recordable, R = Record<any, any>, D = undefined>({
|
44
|
-
url,
|
45
|
-
timeout,
|
46
|
-
method,
|
47
|
-
carryToken = true,
|
48
|
-
callback
|
49
|
-
}: {
|
50
|
-
url: string;
|
51
|
-
carryToken?: boolean;
|
52
|
-
timeout?: number;
|
53
|
-
method: MockMethod['method'];
|
54
|
-
callback?: (res: MockResponse<T, D>, token?: string) => Partial<R>;
|
55
|
-
}): MockMethod {
|
56
|
-
return {
|
57
|
-
url: `${mockPrefixUrl}${url}`,
|
58
|
-
timeout,
|
59
|
-
method,
|
60
|
-
response: (request) => {
|
61
|
-
if (carryToken) {
|
62
|
-
const token = getRequestToken(request)
|
63
|
-
return checkBackDataFun(token, callback?.(request, token) || {})
|
64
|
-
}
|
65
|
-
|
66
|
-
return callback?.(request)
|
67
|
-
}
|
68
|
-
}
|
69
|
-
}
|
70
|
-
|
71
|
-
export function getMockRandowList<T = any>(data: T[]) {
|
72
|
-
return data[Random.integer(0, data.length - 1)] as T
|
73
|
-
}
|