@gx-design-vue/create-gx-cli 0.1.12 → 0.1.13
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 +10 -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,198 +0,0 @@
|
|
1
|
-
import { h } from 'vue'
|
2
|
-
import { defaultSettings } from '@gx-config'
|
3
|
-
import { isFunction, isNumber, isObject, scrollTo } from '@gx-design-vue/pro-utils'
|
4
|
-
|
5
|
-
export interface NumberToShow {
|
6
|
-
numberValue: string;
|
7
|
-
countStr: string;
|
8
|
-
joinStr: string;
|
9
|
-
}
|
10
|
-
|
11
|
-
const { viewScrollRoot } = defaultSettings
|
12
|
-
|
13
|
-
export const TransformVNode = (props: { node: any; class?: string }) => {
|
14
|
-
return h(isFunction(props.node) ? props.node?.(props.class) : props.node)
|
15
|
-
}
|
16
|
-
|
17
|
-
export function timeFix() {
|
18
|
-
const time = new Date()
|
19
|
-
const hour = time.getHours()
|
20
|
-
return hour < 9 ? '早上好' : hour <= 11 ? '上午好' : hour <= 13 ? '中午好' : hour < 20
|
21
|
-
? '下午好'
|
22
|
-
: '晚上好'
|
23
|
-
}
|
24
|
-
|
25
|
-
/**
|
26
|
-
* @Author gaoxiang
|
27
|
-
* @DateTime 2020/7/23
|
28
|
-
* @lastTime 2020/7/23
|
29
|
-
* @description 去除空格
|
30
|
-
*/
|
31
|
-
export function trim(str: string, isGlobal?: boolean) {
|
32
|
-
if (typeof str === 'undefined' || str.length === 0)
|
33
|
-
return ''
|
34
|
-
let result
|
35
|
-
result = str.replace(/(^\s+)|(\s+$)/g, '')
|
36
|
-
if (isGlobal) {
|
37
|
-
result = result.replace(/\s/g, '')
|
38
|
-
}
|
39
|
-
return result
|
40
|
-
}
|
41
|
-
|
42
|
-
/**
|
43
|
-
* @Author gx12358
|
44
|
-
* @DateTime 2021/11/3
|
45
|
-
* @lastTime 2021/11/3
|
46
|
-
* @description get参数处理
|
47
|
-
*/
|
48
|
-
export function tansParams(params) {
|
49
|
-
let result = ''
|
50
|
-
for (const propName of Object.keys(params)) {
|
51
|
-
const value = params[propName]
|
52
|
-
const part = encodeURIComponent(propName) + '='
|
53
|
-
if (value !== null && typeof (value) !== 'undefined' && value !== '') {
|
54
|
-
if (typeof value === 'object') {
|
55
|
-
for (const key of Object.keys(value)) {
|
56
|
-
if (value[key] !== null && typeof (value[key]) !== 'undefined') {
|
57
|
-
const params = propName + '[' + key + ']'
|
58
|
-
const subPart = encodeURIComponent(params) + '='
|
59
|
-
result += subPart + encodeURIComponent(value[key]) + '&'
|
60
|
-
}
|
61
|
-
}
|
62
|
-
} else {
|
63
|
-
result += part + encodeURIComponent(value) + '&'
|
64
|
-
}
|
65
|
-
}
|
66
|
-
}
|
67
|
-
return result
|
68
|
-
}
|
69
|
-
|
70
|
-
/**
|
71
|
-
* @Author gx12358
|
72
|
-
* @DateTime 2022/10/11
|
73
|
-
* @lastTime 2022/10/11
|
74
|
-
* @description 判断元素到上一个元素的距离
|
75
|
-
*/
|
76
|
-
export function handleOffsetTop(targetNode: HTMLInputElement) {
|
77
|
-
let totalLeft = 0
|
78
|
-
let totalTop = 0
|
79
|
-
if (!targetNode)
|
80
|
-
return { left: totalLeft, top: totalTop }
|
81
|
-
let parentNode = <HTMLElement>targetNode.offsetParent
|
82
|
-
// 首先把自己本身的相加
|
83
|
-
totalLeft += targetNode.offsetLeft
|
84
|
-
totalTop += targetNode.offsetTop
|
85
|
-
// 现在开始一级一级往上查找,只要没有遇到body,我们就把父级参照物的边框和偏移相加
|
86
|
-
while (parentNode) {
|
87
|
-
if (navigator.userAgent.includes('MSIE 8.0')) {
|
88
|
-
// 不是IE8我们才进行累加父级参照物的边框
|
89
|
-
totalTop += parentNode.clientTop
|
90
|
-
totalLeft += parentNode.clientLeft
|
91
|
-
}
|
92
|
-
// 把父级参照物的偏移相加
|
93
|
-
totalTop += parentNode.offsetTop
|
94
|
-
totalLeft += parentNode.offsetLeft
|
95
|
-
parentNode = <HTMLElement>parentNode.offsetParent
|
96
|
-
}
|
97
|
-
return { left: totalLeft, top: totalTop }
|
98
|
-
}
|
99
|
-
|
100
|
-
/**
|
101
|
-
* @Author gx12358
|
102
|
-
* @DateTime 2022/10/11
|
103
|
-
* @lastTime 2022/10/11
|
104
|
-
* @description 滚动到固定位置
|
105
|
-
*/
|
106
|
-
export function scrollToContainer(options: { count: number; root?: string; duration?: number }) {
|
107
|
-
if (!isObject(options))
|
108
|
-
return
|
109
|
-
scrollTo(options.count || 0, {
|
110
|
-
getContainer: () => document.querySelector(options?.root || viewScrollRoot) as HTMLInputElement,
|
111
|
-
duration: options?.duration || 200
|
112
|
-
})
|
113
|
-
}
|
114
|
-
|
115
|
-
/**
|
116
|
-
* @Author gx12358
|
117
|
-
* @DateTime 2022/6/20
|
118
|
-
* @lastTime 2022/6/20
|
119
|
-
* @description 转换数字
|
120
|
-
*/
|
121
|
-
export function toConvertNumberShow(
|
122
|
-
number: number,
|
123
|
-
options?: { toChinese?: boolean; fixed?: number; showStr?: boolean; unit?: string; }
|
124
|
-
): NumberToShow {
|
125
|
-
const fixedNum = options?.fixed || 2
|
126
|
-
const countStr = options?.unit || (
|
127
|
-
options?.showStr === undefined || options?.showStr
|
128
|
-
? options?.toChinese === undefined || options?.toChinese
|
129
|
-
? number < 100000000 ? '万' : '亿'
|
130
|
-
: number < 100000000 ? 'w' : 'e'
|
131
|
-
: ''
|
132
|
-
)
|
133
|
-
if (!isNumber(number) || options?.unit)
|
134
|
-
return {
|
135
|
-
numberValue: `${number}`,
|
136
|
-
countStr,
|
137
|
-
joinStr: `${number}${countStr}`
|
138
|
-
}
|
139
|
-
if (number < 10000)
|
140
|
-
return {
|
141
|
-
numberValue: `${number}`,
|
142
|
-
countStr,
|
143
|
-
joinStr: `${number}${countStr}`
|
144
|
-
}
|
145
|
-
|
146
|
-
if (options?.fixed) {
|
147
|
-
const numStr = (number / (number < 100000000 ? 10000 : 100000000)).toFixed(1).split('.')[0]
|
148
|
-
const numFixed = (number / (number < 100000000 ? 10000 : 100000000)).toFixed(1).split('.')[1]
|
149
|
-
|
150
|
-
if (numFixed === '0')
|
151
|
-
return {
|
152
|
-
numberValue: `${numStr}`,
|
153
|
-
countStr,
|
154
|
-
joinStr: `${numStr}${countStr}`
|
155
|
-
}
|
156
|
-
}
|
157
|
-
const match = fixedNum === 1 ? /^\d+(?:\.\d{0,1})?/ : /^\d+(?:\.\d{0,2})?/
|
158
|
-
const numberValue = number < 100000000 ? number / 10000 : number / 100000000
|
159
|
-
|
160
|
-
return {
|
161
|
-
numberValue: `${(numberValue).toString().match(match)}`,
|
162
|
-
countStr,
|
163
|
-
joinStr: `${(numberValue).toString().match(match)}${countStr}`
|
164
|
-
}
|
165
|
-
}
|
166
|
-
|
167
|
-
/**
|
168
|
-
* @Author gx12358
|
169
|
-
* @DateTime 2022/8/4
|
170
|
-
* @lastTime 2022/8/4
|
171
|
-
* @description 数字转中文
|
172
|
-
*/
|
173
|
-
export function toChinesNum(num: number) {
|
174
|
-
num = num || 0
|
175
|
-
const changeNum = [ '零', '一', '二', '三', '四', '五', '六', '七', '八', '九' ]
|
176
|
-
const unit = [ '', '十', '百', '千', '万' ]
|
177
|
-
num = Number.parseInt(`${num}`)
|
178
|
-
const getWan = (temp) => {
|
179
|
-
const strArr = temp.toString().split('').reverse()
|
180
|
-
let newNum = ''
|
181
|
-
for (let i = 0; i < strArr.length; i++) {
|
182
|
-
newNum = (i === 0 && strArr[i] === '0'
|
183
|
-
? ''
|
184
|
-
: i > 0 && strArr[i] === '0' && strArr[i - 1] === '0'
|
185
|
-
? ''
|
186
|
-
: (num < 20 && i > 0 ? '' : changeNum[strArr[i]]) + (strArr[i] === '0'
|
187
|
-
? unit[0]
|
188
|
-
: unit[i])) + newNum
|
189
|
-
}
|
190
|
-
return newNum
|
191
|
-
}
|
192
|
-
const overWan = Math.floor(num / 10000)
|
193
|
-
let noWan: any = num % 10000
|
194
|
-
if (noWan.toString().length < 4) {
|
195
|
-
noWan = '0' + noWan
|
196
|
-
}
|
197
|
-
return overWan ? getWan(overWan) + '万' + getWan(noWan) : getWan(num)
|
198
|
-
}
|
@@ -1,216 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @author gx12358 2539306317@qq.com
|
3
|
-
* @description 判读是否为外链
|
4
|
-
* @param path
|
5
|
-
* @returns {boolean}
|
6
|
-
*/
|
7
|
-
export function isExternal(path) {
|
8
|
-
return /^(https?:|mailto:|tel:)/.test(path)
|
9
|
-
}
|
10
|
-
|
11
|
-
/**
|
12
|
-
* @author gx12358 2539306317@qq.com
|
13
|
-
* @description 判断是否是名称
|
14
|
-
* @param value
|
15
|
-
* @returns {boolean}
|
16
|
-
*/
|
17
|
-
export function isName(value) {
|
18
|
-
const reg = /^[\u4e00-\u9fa5a-zA-Z0-9]+$/
|
19
|
-
return reg.test(value)
|
20
|
-
}
|
21
|
-
|
22
|
-
/**
|
23
|
-
* @author gx12358 2539306317@qq.com
|
24
|
-
* @description 判断是否为IP
|
25
|
-
* @param ip
|
26
|
-
* @returns {boolean}
|
27
|
-
*/
|
28
|
-
export function isIP(ip) {
|
29
|
-
const reg = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/
|
30
|
-
return reg.test(ip)
|
31
|
-
}
|
32
|
-
|
33
|
-
/**
|
34
|
-
* @author gx12358 2539306317@qq.com
|
35
|
-
* @description 判断是否是传统网站
|
36
|
-
* @param url
|
37
|
-
* @returns {boolean}
|
38
|
-
*/
|
39
|
-
export function isUrl(url) {
|
40
|
-
const reg = /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/
|
41
|
-
return reg.test(url)
|
42
|
-
}
|
43
|
-
|
44
|
-
/**
|
45
|
-
* @author gx12358 2539306317@qq.com
|
46
|
-
* @description 判断是否是小写字母
|
47
|
-
* @param value
|
48
|
-
* @returns {boolean}
|
49
|
-
*/
|
50
|
-
export function isLowerCase(value) {
|
51
|
-
const reg = /^[a-z]+$/
|
52
|
-
return reg.test(value)
|
53
|
-
}
|
54
|
-
|
55
|
-
/**
|
56
|
-
* @author gx12358 2539306317@qq.com
|
57
|
-
* @description 判断是否是大写字母
|
58
|
-
* @param value
|
59
|
-
* @returns {boolean}
|
60
|
-
*/
|
61
|
-
export function isUpperCase(value) {
|
62
|
-
const reg = /^[A-Z]+$/
|
63
|
-
return reg.test(value)
|
64
|
-
}
|
65
|
-
|
66
|
-
/**
|
67
|
-
* @author gx12358 2539306317@qq.com
|
68
|
-
* @description 判断是否是大写字母开头
|
69
|
-
* @param value
|
70
|
-
* @returns {boolean}
|
71
|
-
*/
|
72
|
-
export function isAlphabets(value) {
|
73
|
-
const reg = /^[A-Za-z]+$/
|
74
|
-
return reg.test(value)
|
75
|
-
}
|
76
|
-
|
77
|
-
/**
|
78
|
-
* @author gx12358 2539306317@qq.com
|
79
|
-
* @description 判断是否是端口号
|
80
|
-
* @param value
|
81
|
-
* @returns {boolean}
|
82
|
-
*/
|
83
|
-
export function isPort(value) {
|
84
|
-
const reg = /^([0-9]|[1-9]\d|[1-9]\d{2}|[1-9]\d{3}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[0-5])$/
|
85
|
-
return reg.test(value)
|
86
|
-
}
|
87
|
-
|
88
|
-
/**
|
89
|
-
* @author gx12358 2539306317@qq.com
|
90
|
-
* @description 判断是否是手机号
|
91
|
-
* @param value
|
92
|
-
* @returns {boolean}
|
93
|
-
*/
|
94
|
-
export function isPhone(value = '', backReg?: boolean) {
|
95
|
-
const reg = /^1\d{10}$/
|
96
|
-
return backReg ? reg : reg.test(value)
|
97
|
-
}
|
98
|
-
|
99
|
-
/**
|
100
|
-
* @author gx12358 2539306317@qq.com
|
101
|
-
* @description 判断是否是身份证号(第二代)
|
102
|
-
* @param value
|
103
|
-
* @returns {boolean}
|
104
|
-
*/
|
105
|
-
export function isIdCard(value) {
|
106
|
-
const reg = /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/
|
107
|
-
return reg.test(value)
|
108
|
-
}
|
109
|
-
|
110
|
-
/**
|
111
|
-
* @author gx12358 2539306317@qq.com
|
112
|
-
* @description 判断是否是邮箱
|
113
|
-
* @param value
|
114
|
-
* @returns {boolean}
|
115
|
-
*/
|
116
|
-
export function isEmail(value = '', backReg?: boolean) {
|
117
|
-
const reg = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/
|
118
|
-
return backReg ? reg : reg.test(value)
|
119
|
-
}
|
120
|
-
|
121
|
-
/**
|
122
|
-
* @author gx12358 2539306317@qq.com
|
123
|
-
* @description 判断是否中文
|
124
|
-
* @param value
|
125
|
-
* @returns {boolean}
|
126
|
-
*/
|
127
|
-
export function isChina(value) {
|
128
|
-
const reg = /^[\u4E00-\u9FA5]{2,4}$/
|
129
|
-
return reg.test(value)
|
130
|
-
}
|
131
|
-
|
132
|
-
/**
|
133
|
-
* @author gx12358 2539306317@qq.com
|
134
|
-
* @description 判断是否为空
|
135
|
-
* @param value
|
136
|
-
* @returns {boolean}
|
137
|
-
*/
|
138
|
-
export function isBlank(value) {
|
139
|
-
return (value == null || false || value === '' || value.trim() === '' || value.toLocaleLowerCase()
|
140
|
-
.trim() === 'null')
|
141
|
-
}
|
142
|
-
|
143
|
-
/**
|
144
|
-
* @author gx12358 2539306317@qq.com
|
145
|
-
* @description 判断是否为固话
|
146
|
-
* @param value
|
147
|
-
* @returns {boolean}
|
148
|
-
*/
|
149
|
-
export function isTel(value) {
|
150
|
-
const reg = /^(400|800)([0-9\\-]{7,10})|(([0-9]{4}|[0-9]{3})([- ])?)?([0-9]{7,8})(([- 转])*([0-9]{1,4}))?$/
|
151
|
-
return reg.test(value)
|
152
|
-
}
|
153
|
-
|
154
|
-
/**
|
155
|
-
* @author gx12358 2539306317@qq.com
|
156
|
-
* @description 判断经度 -180.0~+180.0(整数部分为0~180,必须输入1到5位小数)
|
157
|
-
* @param value
|
158
|
-
* @returns {boolean}
|
159
|
-
*/
|
160
|
-
export function isLongitude(value) {
|
161
|
-
const reg = /^[-|+]?(0?\d{1,2}\.\d{1,5}|1[0-7]?\d{1}\.\d{1,5}|180\.0{1,5})$/
|
162
|
-
return reg.test(value)
|
163
|
-
}
|
164
|
-
|
165
|
-
/**
|
166
|
-
* @author gx12358 2539306317@qq.com
|
167
|
-
* @description 判断纬度 -90.0~+90.0(整数部分为0~90,必须输入1到5位小数)
|
168
|
-
* @param value
|
169
|
-
* @returns {boolean}
|
170
|
-
*/
|
171
|
-
export function isLatitude(value) {
|
172
|
-
const reg = /^[-|+]?([0-8]?\d{1}\.\d{1,5}|90\.0{1,5})$/
|
173
|
-
return reg.test(value)
|
174
|
-
}
|
175
|
-
|
176
|
-
/**
|
177
|
-
* @author gx12358 2539306317@qq.com
|
178
|
-
* @description rtsp校验,只要有rtsp://
|
179
|
-
* @param value
|
180
|
-
* @returns {boolean}
|
181
|
-
*/
|
182
|
-
export function isRTSP(value) {
|
183
|
-
const reg = /^rtsp:\/\/([a-z]{0,10}:.{0,10}@)?(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/
|
184
|
-
const reg1 = /^rtsp:\/\/([a-z]{0,10}:.{0,10}@)?(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5]):[0-9]{1,5}/
|
185
|
-
const reg2 = /^rtsp:\/\/([a-z]{0,10}:.{0,10}@)?(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\//
|
186
|
-
return reg.test(value) || reg1.test(value) || reg2.test(value)
|
187
|
-
}
|
188
|
-
|
189
|
-
/**
|
190
|
-
* @Author gaoxiang
|
191
|
-
* @DateTime 2020/11/4
|
192
|
-
* @lastTime 2020/11/4
|
193
|
-
* @description 判断是否是JSON字符串
|
194
|
-
*/
|
195
|
-
export function isJSONStr(str: any) {
|
196
|
-
if (typeof str === 'string') {
|
197
|
-
try {
|
198
|
-
const obj = JSON.parse(str)
|
199
|
-
if (typeof obj === 'object' && obj) {
|
200
|
-
return true
|
201
|
-
} else {
|
202
|
-
return false
|
203
|
-
}
|
204
|
-
} catch (e) {
|
205
|
-
return false
|
206
|
-
}
|
207
|
-
}
|
208
|
-
return false
|
209
|
-
}
|
210
|
-
|
211
|
-
export function checkURL(URL) {
|
212
|
-
const str = URL
|
213
|
-
const Expression = /http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- .\/?%&=]*)?/
|
214
|
-
const objExp = new RegExp(Expression)
|
215
|
-
return objExp.test(str)
|
216
|
-
}
|
@@ -1,76 +0,0 @@
|
|
1
|
-
<script setup lang="ts">
|
2
|
-
import type { CSSProperties } from 'vue'
|
3
|
-
import { ref, watch } from 'vue'
|
4
|
-
import { getPrefixCls } from '@gx-design-vue/pro-utils'
|
5
|
-
import { useProConfigContext } from '@gx-design-vue/pro-provider'
|
6
|
-
|
7
|
-
const props = withDefaults(defineProps<{
|
8
|
-
frameSrc: string;
|
9
|
-
}>(), {
|
10
|
-
frameSrc: ''
|
11
|
-
})
|
12
|
-
|
13
|
-
const { global } = useStore()
|
14
|
-
const { token } = useProConfigContext()
|
15
|
-
|
16
|
-
const prefixCls = getPrefixCls({
|
17
|
-
suffixCls: 'iframe-page',
|
18
|
-
isPor: true
|
19
|
-
})
|
20
|
-
|
21
|
-
const frameRef = ref<HTMLIFrameElement>()
|
22
|
-
const loading = ref(true)
|
23
|
-
|
24
|
-
const publicHeight = computed(
|
25
|
-
() =>
|
26
|
-
token.value.layout?.header.heightLayoutHeader + 24 * 2 + (
|
27
|
-
global.globalLayout.showTabsBar ? global.globalLayout.fixedMultiTab ? 62 : 46 : 0
|
28
|
-
)
|
29
|
-
)
|
30
|
-
|
31
|
-
const frameStyle = reactive({
|
32
|
-
height: `${window.innerHeight - publicHeight.value}px`,
|
33
|
-
borderRadius: '8px'
|
34
|
-
} as CSSProperties)
|
35
|
-
|
36
|
-
watch(
|
37
|
-
() => props.frameSrc,
|
38
|
-
(_) => {
|
39
|
-
loading.value = true
|
40
|
-
},
|
41
|
-
{
|
42
|
-
deep: true,
|
43
|
-
immediate: true
|
44
|
-
}
|
45
|
-
)
|
46
|
-
|
47
|
-
const calcHeight = () => (frameStyle.height = `${window.innerHeight - publicHeight.value}px`)
|
48
|
-
|
49
|
-
onMounted(() => {
|
50
|
-
window.addEventListener('resize', calcHeight)
|
51
|
-
})
|
52
|
-
|
53
|
-
onUnmounted(() => {
|
54
|
-
window.removeEventListener('resize', calcHeight)
|
55
|
-
})
|
56
|
-
|
57
|
-
const hideLoading = () => {
|
58
|
-
loading.value = false
|
59
|
-
}
|
60
|
-
</script>
|
61
|
-
|
62
|
-
<template>
|
63
|
-
<g-pro-page-container :use-page-card="false">
|
64
|
-
<div :class="prefixCls" :style="frameStyle">
|
65
|
-
<a-spin :spinning="loading" size="large" :style="frameStyle">
|
66
|
-
<iframe
|
67
|
-
:src="frameSrc"
|
68
|
-
:class="[`${prefixCls}-main`]"
|
69
|
-
:style="frameStyle"
|
70
|
-
ref="frameRef"
|
71
|
-
@load="hideLoading"
|
72
|
-
/>
|
73
|
-
</a-spin>
|
74
|
-
</div>
|
75
|
-
</g-pro-page-container>
|
76
|
-
</template>
|
@@ -1,109 +0,0 @@
|
|
1
|
-
<script setup lang="ts">
|
2
|
-
import { h, reactive } from 'vue'
|
3
|
-
import { useRoute, useRouter } from 'vue-router'
|
4
|
-
import { LockOutlined, UserOutlined } from '@ant-design/icons-vue'
|
5
|
-
import { GProFormCheckbox, GProFormLogin, GProFormPassword, GProFormText } from '@gx-design-vue/pro-form'
|
6
|
-
import { GlobalFooter } from '@gx-design-vue/pro-layout'
|
7
|
-
import Logo from '@/assets/logo.png'
|
8
|
-
|
9
|
-
interface UserState {
|
10
|
-
userName: string
|
11
|
-
password: string
|
12
|
-
}
|
13
|
-
|
14
|
-
interface loginState {
|
15
|
-
redirect: string
|
16
|
-
dependencies: Record<string, any>
|
17
|
-
devDependencies: Record<string, any>
|
18
|
-
}
|
19
|
-
|
20
|
-
const { pkg } = __APP_INFO__
|
21
|
-
|
22
|
-
const userOutlined = h(UserOutlined)
|
23
|
-
const lockOutlined = h(LockOutlined)
|
24
|
-
|
25
|
-
const store = useStore()
|
26
|
-
const route = useRoute()
|
27
|
-
const router = useRouter()
|
28
|
-
|
29
|
-
const userForm = reactive({
|
30
|
-
userName: 'admin',
|
31
|
-
password: 'gx.design',
|
32
|
-
autoLogin: true
|
33
|
-
} as UserState)
|
34
|
-
|
35
|
-
const userRules = reactive({
|
36
|
-
userName: [{ required: true, message: '用户名是必填项!' }],
|
37
|
-
password: [{ required: true, message: '密码是必填项!' }]
|
38
|
-
})
|
39
|
-
|
40
|
-
const state: loginState = reactive({
|
41
|
-
redirect: '/',
|
42
|
-
dependencies: pkg.dependencies,
|
43
|
-
devDependencies: pkg.devDependencies
|
44
|
-
})
|
45
|
-
|
46
|
-
watch(
|
47
|
-
() => route.fullPath,
|
48
|
-
() => {
|
49
|
-
state.redirect = (route.query?.redirect as string) || '/'
|
50
|
-
},
|
51
|
-
{
|
52
|
-
deep: true,
|
53
|
-
immediate: true
|
54
|
-
}
|
55
|
-
)
|
56
|
-
const handleRoute = () => {
|
57
|
-
return state.redirect === '/exception/404' || state.redirect === '/exception/403'
|
58
|
-
? '/'
|
59
|
-
: state.redirect
|
60
|
-
}
|
61
|
-
|
62
|
-
const handleSubmit = async (value) => {
|
63
|
-
const response: any = await store.user.userLogin({ ...value })
|
64
|
-
if (response) {
|
65
|
-
router.push({ path: handleRoute() })
|
66
|
-
}
|
67
|
-
}
|
68
|
-
</script>
|
69
|
-
|
70
|
-
<template>
|
71
|
-
<div :class="$style['login-container']">
|
72
|
-
<div :class="$style.content">
|
73
|
-
<GProFormLogin
|
74
|
-
style="margin-top: 40px"
|
75
|
-
:model="userForm"
|
76
|
-
:rules="userRules"
|
77
|
-
:logo="Logo"
|
78
|
-
title="GX Pro Admin"
|
79
|
-
@submit="handleSubmit"
|
80
|
-
>
|
81
|
-
<template #subTitle>
|
82
|
-
<p>GX Pro Admin 是一套基于</p>
|
83
|
-
vue({{ state.dependencies.vue }}) + ant-design-vue({{
|
84
|
-
state.dependencies['ant-design-vue']
|
85
|
-
}}) 开发的一套后台系统1111
|
86
|
-
</template>
|
87
|
-
<GProFormText
|
88
|
-
name="userName"
|
89
|
-
:fieldProps="{ size: 'large', prefix: userOutlined }"
|
90
|
-
placeholder="用户名: admin"
|
91
|
-
/>
|
92
|
-
<GProFormPassword
|
93
|
-
name="password"
|
94
|
-
:fieldProps="{ size: 'large', prefix: lockOutlined }"
|
95
|
-
placeholder="密码: gx.design"
|
96
|
-
/>
|
97
|
-
<div class="mb-[24px]">
|
98
|
-
<GProFormCheckbox noStyle name="autoLogin">自动登录</GProFormCheckbox>
|
99
|
-
<a class="float-right">忘记密码</a>
|
100
|
-
</div>
|
101
|
-
</GProFormLogin>
|
102
|
-
</div>
|
103
|
-
<GlobalFooter />
|
104
|
-
</div>
|
105
|
-
</template>
|
106
|
-
|
107
|
-
<style lang="less" module>
|
108
|
-
@import './style';
|
109
|
-
</style>
|
@@ -1,38 +0,0 @@
|
|
1
|
-
.login-container {
|
2
|
-
display: flex;
|
3
|
-
flex-direction: column;
|
4
|
-
height: 100vh;
|
5
|
-
overflow: auto;
|
6
|
-
background: #f0f2f5;
|
7
|
-
}
|
8
|
-
|
9
|
-
.content {
|
10
|
-
flex: 1;
|
11
|
-
padding: 32px 0;
|
12
|
-
}
|
13
|
-
|
14
|
-
.icon {
|
15
|
-
margin-left: 8px;
|
16
|
-
font-size: 24px;
|
17
|
-
color: rgba(0, 0, 0, 0.2);
|
18
|
-
vertical-align: middle;
|
19
|
-
cursor: pointer;
|
20
|
-
transition: color 0.3s;
|
21
|
-
|
22
|
-
&:hover {
|
23
|
-
color: #1677ff;
|
24
|
-
}
|
25
|
-
}
|
26
|
-
|
27
|
-
@media (min-width: 768px) {
|
28
|
-
.login-container {
|
29
|
-
background-image: url(/src/assets/login_images/login_background.svg);
|
30
|
-
background-repeat: no-repeat;
|
31
|
-
background-position: center 110px;
|
32
|
-
background-size: 100%;
|
33
|
-
}
|
34
|
-
|
35
|
-
.content {
|
36
|
-
padding: 32px 0 24px;
|
37
|
-
}
|
38
|
-
}
|