@gx-design-vue/create-gx-cli 0.1.3 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. package/README.md +5 -12
  2. package/package.json +3 -2
  3. package/template-mobile-vant-cli/.editorconfig +19 -0
  4. package/template-mobile-vant-cli/.env +0 -0
  5. package/template-mobile-vant-cli/.env.development +19 -0
  6. package/template-mobile-vant-cli/.env.pro +19 -0
  7. package/template-mobile-vant-cli/.env.production +19 -0
  8. package/template-mobile-vant-cli/.eslintignore +15 -0
  9. package/template-mobile-vant-cli/.prettierignore +9 -0
  10. package/template-mobile-vant-cli/build/cdn.ts +5 -0
  11. package/template-mobile-vant-cli/build/generateModifyVars.ts +7 -0
  12. package/template-mobile-vant-cli/build/optimizer.ts +18 -0
  13. package/template-mobile-vant-cli/build/plugin/autoImport.ts +24 -0
  14. package/template-mobile-vant-cli/build/plugin/html.ts +26 -0
  15. package/template-mobile-vant-cli/build/plugin/index.ts +42 -0
  16. package/template-mobile-vant-cli/build/plugin/mock.ts +14 -0
  17. package/template-mobile-vant-cli/build/plugin/viteMock/client.ts +88 -0
  18. package/template-mobile-vant-cli/build/plugin/viteMock/createMockServer.ts +271 -0
  19. package/template-mobile-vant-cli/build/plugin/viteMock/index.ts +69 -0
  20. package/template-mobile-vant-cli/build/plugin/viteMock/types.ts +48 -0
  21. package/template-mobile-vant-cli/build/plugin/viteMock/utils.ts +48 -0
  22. package/template-mobile-vant-cli/build/script/postBuild.ts +14 -0
  23. package/template-mobile-vant-cli/eslint.config.js +49 -0
  24. package/template-mobile-vant-cli/index.html +24 -0
  25. package/template-mobile-vant-cli/mock/_createProductionServer.ts +19 -0
  26. package/template-mobile-vant-cli/mock/datasSource/api/index.ts +0 -0
  27. package/template-mobile-vant-cli/mock/utils.ts +9 -0
  28. package/template-mobile-vant-cli/package.json +57 -0
  29. package/template-mobile-vant-cli/postcss.config.cjs +8 -0
  30. package/template-mobile-vant-cli/prettier.config.cjs +18 -0
  31. package/template-mobile-vant-cli/public/favicon.ico +0 -0
  32. package/template-mobile-vant-cli/public/js/flexible.js +44 -0
  33. package/template-mobile-vant-cli/src/App.vue +5 -0
  34. package/template-mobile-vant-cli/src/components/PageContainer/ProSkeleton.tsx +29 -0
  35. package/template-mobile-vant-cli/src/components/PageContainer/index.tsx +115 -0
  36. package/template-mobile-vant-cli/src/components/PageContainer/style.module.less +14 -0
  37. package/template-mobile-vant-cli/src/core/gx-design/index.ts +7 -0
  38. package/template-mobile-vant-cli/src/core/index.ts +12 -0
  39. package/template-mobile-vant-cli/src/core/vant-design/index.ts +4 -0
  40. package/template-mobile-vant-cli/src/design/config.less +0 -0
  41. package/template-mobile-vant-cli/src/design/index.less +3 -0
  42. package/template-mobile-vant-cli/src/design/reset.less +155 -0
  43. package/template-mobile-vant-cli/src/design/root.less +3 -0
  44. package/template-mobile-vant-cli/src/design/vant.less +2 -0
  45. package/template-mobile-vant-cli/src/global.less +1 -0
  46. package/template-mobile-vant-cli/src/hooks/web/index.ts +5 -0
  47. package/template-mobile-vant-cli/src/hooks/web/usePageLoading.ts +58 -0
  48. package/template-mobile-vant-cli/src/layout/BasicLayout.vue +16 -0
  49. package/template-mobile-vant-cli/src/layout/basicLayout.less +11 -0
  50. package/template-mobile-vant-cli/src/main.ts +27 -0
  51. package/template-mobile-vant-cli/src/pages/home.vue +71 -0
  52. package/template-mobile-vant-cli/src/router/index.ts +25 -0
  53. package/template-mobile-vant-cli/src/router/routes.ts +20 -0
  54. package/template-mobile-vant-cli/src/router/typings.ts +8 -0
  55. package/template-mobile-vant-cli/src/services/index.ts +31 -0
  56. package/template-mobile-vant-cli/src/settings/index.ts +10 -0
  57. package/template-mobile-vant-cli/src/store/index.ts +17 -0
  58. package/template-mobile-vant-cli/src/store/modules/global.ts +30 -0
  59. package/template-mobile-vant-cli/src/utils/crypto/base64.ts +101 -0
  60. package/template-mobile-vant-cli/src/utils/crypto/index.ts +57 -0
  61. package/template-mobile-vant-cli/src/utils/env.ts +50 -0
  62. package/template-mobile-vant-cli/src/utils/pageTitle.ts +14 -0
  63. package/template-mobile-vant-cli/src/utils/request/XHR.ts +139 -0
  64. package/template-mobile-vant-cli/src/utils/request/axiosCancel.ts +69 -0
  65. package/template-mobile-vant-cli/src/utils/request/checkStatus.ts +9 -0
  66. package/template-mobile-vant-cli/src/utils/request/index.ts +142 -0
  67. package/template-mobile-vant-cli/src/utils/request/typings.ts +171 -0
  68. package/template-mobile-vant-cli/src/utils/storage.ts +198 -0
  69. package/template-mobile-vant-cli/src/utils/util.ts +27 -0
  70. package/template-mobile-vant-cli/src/utils/validate.ts +216 -0
  71. package/template-mobile-vant-cli/tsconfig.json +42 -0
  72. package/template-mobile-vant-cli/types/ant-design-import.d.ts +13 -0
  73. package/template-mobile-vant-cli/types/auto-imports.d.ts +64 -0
  74. package/template-mobile-vant-cli/types/components.d.ts +12 -0
  75. package/template-mobile-vant-cli/types/global.d.ts +39 -0
  76. package/template-mobile-vant-cli/types/module.d.ts +20 -0
  77. package/template-mobile-vant-cli/types/plugins-auto-import.d.ts +14 -0
  78. package/template-mobile-vant-cli/types/response.d.ts +15 -0
  79. package/template-mobile-vant-cli/types/vant-import.d.ts +13 -0
  80. package/template-mobile-vant-cli/unocss.config.ts +101 -0
  81. package/template-mobile-vant-cli/vite.config.ts +145 -0
  82. package/template-mobile-vant-html/css/global.css +293 -0
  83. package/template-mobile-vant-html/css/global.css.map +1 -0
  84. package/template-mobile-vant-html/css/global.less +293 -0
  85. package/template-mobile-vant-html/css/index.css +20 -0
  86. package/template-mobile-vant-html/css/index.css.map +1 -0
  87. package/template-mobile-vant-html/css/index.less +21 -0
  88. package/template-mobile-vant-html/image/disconnected.svg +60 -0
  89. package/template-mobile-vant-html/image/empty.svg +52 -0
  90. package/template-mobile-vant-html/image/error.svg +53 -0
  91. package/template-mobile-vant-html/image/loading.svg +1 -0
  92. package/template-mobile-vant-html/index.html +91 -0
  93. package/template-mobile-vant-html/js/index.js +29 -0
  94. package/template-mobile-vant-html/js/plugin/day.min.js +1 -0
  95. package/template-mobile-vant-html/js/plugin/fastclick.js +730 -0
  96. package/template-mobile-vant-html/js/plugin/jquery.min.js +2 -0
  97. package/template-mobile-vant-html/js/plugin/rem.js +28 -0
  98. package/template-mobile-vant-html/js/utils/appUtil.js +70 -0
  99. package/template-mobile-vant-html/js/utils/config.js +3 -0
  100. package/template-mobile-vant-html/js/utils/request.js +61 -0
  101. package/template-mobile-vant-html/js/utils/utils.js +65 -0
  102. package/template-mobile-vant-html/js/utils/validate.js +292 -0
@@ -0,0 +1,198 @@
1
+ import dayjs from 'dayjs'
2
+ import { isPro, typeViteEnv } from '@/utils/env'
3
+ import { Decrypt, Encrypt } from '@/utils/crypto'
4
+ import { isJSONStr } from '@/utils/validate'
5
+ import { isObject } from '@gx-design-vue/pro-utils'
6
+
7
+ export type StorageKey = 'localStorage' | 'sessionStorage' | 'cookie'
8
+
9
+ function isEncryption(status: boolean) {
10
+ return isPro() ? status : false
11
+ }
12
+
13
+ function handleStorageValue(value: string) {
14
+ if (isJSONStr(value))
15
+ return JSON.parse(value)
16
+ return value
17
+ }
18
+
19
+ /**
20
+ * @Author gx12358
21
+ * @DateTime 2019/12/3
22
+ * @lastTime 2019/12/3
23
+ * @description 设置Local-key的规则
24
+ */
25
+ export function getStorageKey(key: string, originKey?: boolean) {
26
+ const { pkg } = __APP_INFO__
27
+ return originKey ? key : `${pkg.name}_${pkg.version}_${typeViteEnv('VITE_APP_ENV') === 'dev'
28
+ ? 'development'
29
+ : typeViteEnv('VITE_USE_MODE')}_${key}`
30
+ }
31
+
32
+ /**
33
+ * @Author gx12358
34
+ * @DateTime 2019/12/3
35
+ * @lastTime 2019/12/3
36
+ * @description 获取Storage
37
+ */
38
+ export function getStorage({
39
+ key,
40
+ encryption = true,
41
+ type = 'localStorage',
42
+ originKey
43
+ }: { key: string, encryption?: boolean, type?: StorageKey, originKey?: boolean }) {
44
+ const storageValue = type === 'localStorage'
45
+ ? localStorage.getItem(getStorageKey(key, originKey)) : type === 'sessionStorage'
46
+ ? sessionStorage.getItem(getStorageKey(key, originKey))
47
+ : getCookie(
48
+ getStorageKey(key, originKey))
49
+ const result: string | LocalResult = storageValue
50
+ ? isEncryption(encryption) ? Decrypt(storageValue) : handleStorageValue(storageValue) : ''
51
+ if (result && isObject(result)) {
52
+ if (result.expired) {
53
+ const expiredStatus = dayjs().diff(dayjs(result.time)) >= result.expired
54
+ if (expiredStatus) {
55
+ removeStorage(key, type)
56
+ return ''
57
+ }
58
+ }
59
+ }
60
+ return result?.['value'] || result || ''
61
+ }
62
+
63
+ /**
64
+ * @Author gx12358
65
+ * @DateTime 2019/12/3
66
+ * @lastTime 2019/12/3
67
+ * @description 设置Storage
68
+ */
69
+ export function setStorage({
70
+ key,
71
+ value,
72
+ expired,
73
+ originKey,
74
+ encryption = true,
75
+ type = 'local'
76
+ }: {
77
+ key: string;
78
+ value: any;
79
+ originKey?: boolean;
80
+ expired?: number;
81
+ encryption?: boolean;
82
+ type?: string;
83
+ }) {
84
+ const result: LocalResult = originKey ? value : {
85
+ value,
86
+ time: dayjs().format('YYYY-MM-DD HH:mm:ss'),
87
+ expired: expired || 0
88
+ }
89
+ const storageValue = isEncryption(encryption) ? Encrypt(JSON.stringify(result)) : JSON.stringify(
90
+ result)
91
+ if (type === 'local')
92
+ localStorage.setItem(getStorageKey(key, originKey), storageValue)
93
+ sessionStorage.setItem(getStorageKey(key, originKey), storageValue)
94
+ }
95
+
96
+ /**
97
+ * @Author gx12358
98
+ * @DateTime 2019/12/3
99
+ * @lastTime 2019/12/3
100
+ * @description 删除Storage
101
+ */
102
+ export function removeStorage(key: string, type = 'local', originKey?: boolean) {
103
+ if (type === 'local')
104
+ localStorage.removeItem(getStorageKey(key, originKey))
105
+ sessionStorage.removeItem(getStorageKey(key, originKey))
106
+ }
107
+
108
+ /**
109
+ * @Author gx12358
110
+ * @DateTime 2019-09-24
111
+ * @lastTime 2019-09-24
112
+ * @description 获取Cookie-name
113
+ */
114
+ function getCookies(cname: string) {
115
+ const name = `${cname}=`
116
+ const decodedCookie = decodeURIComponent(document.cookie)
117
+ const ca = decodedCookie.split(';')
118
+ for (let i = 0; i < ca.length; i += 1) {
119
+ let c = ca[i]
120
+ while (c.charAt(0) === ' ') {
121
+ c = c.substring(1)
122
+ }
123
+ if (c.indexOf(name) === 0) {
124
+ return decodeURIComponent(c.substring(name.length, c.length))
125
+ }
126
+ }
127
+ return ''
128
+ }
129
+
130
+ /**
131
+ * @Author gx12358
132
+ * @DateTime 2019-09-24
133
+ * @lastTime 2019-09-24
134
+ * @description 获取Cookiedomin
135
+ */
136
+ function GetCookieDomain() {
137
+ let host = location.hostname
138
+ const ip = /^(\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])$/
139
+ if (ip.test(host) === true || host === 'localhost')
140
+ return host
141
+ const regex = /([^]*).*/
142
+ const match = host.match(regex)
143
+ if (typeof match !== 'undefined' && match !== null) {
144
+ const someIndex = 1
145
+ host = match[someIndex]
146
+ }
147
+ if (typeof host !== 'undefined' && host !== null) {
148
+ const strAry = host.split('.')
149
+ if (strAry.length > 1) {
150
+ host = `${strAry[strAry.length - 2]}.${strAry[strAry.length - 1]}`
151
+ }
152
+ }
153
+ return `.${host}`
154
+ }
155
+
156
+ /**
157
+ * @Author gx12358
158
+ * @DateTime 2019-09-24
159
+ * @lastTime 2019-09-24
160
+ * @description 设置Cookie
161
+ */
162
+ export function setCookie(cname: string, cvalue: string, exdays?: number) {
163
+ const d = new Date()
164
+ d.setTime(d.getTime() + (exdays || 365) * 24 * 60 * 60 * 1000)
165
+ const expires = `=${d.toUTCString()}`
166
+ document.cookie = `${cname}=${encodeURIComponent(
167
+ cvalue
168
+ )}; expires=${expires}; domain=${GetCookieDomain()}; path=/`
169
+ }
170
+
171
+ /**
172
+ * @Author gx12358
173
+ * @DateTime 2019-09-24
174
+ * @lastTime 2019-09-24
175
+ * @description 获取Cookie
176
+ */
177
+ export function getCookie(cname: string) {
178
+ const result = getCookies(cname)
179
+ if (result === '') {
180
+ return ''
181
+ }
182
+ return decodeURIComponent(result)
183
+ }
184
+
185
+ /**
186
+ * @Author gx12358
187
+ * @DateTime 2019-09-24
188
+ * @lastTime 2019-09-24
189
+ * @description 删除Cookie
190
+ */
191
+ export function delCookie(name: string) {
192
+ const exp = new Date()
193
+ exp.setTime(exp.getTime() - 1)
194
+ const cval = getCookies(name)
195
+ if (cval !== null) {
196
+ document.cookie = `${name}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; domain=${GetCookieDomain()}; path=/`
197
+ }
198
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @Author gx12358
3
+ * @DateTime 2021/11/3
4
+ * @lastTime 2021/11/3
5
+ * @description get参数处理
6
+ */
7
+ export function tansParams(params) {
8
+ let result = ''
9
+ for (const propName of Object.keys(params)) {
10
+ const value = params[propName]
11
+ const part = encodeURIComponent(propName) + '='
12
+ if (value !== null && typeof (value) !== 'undefined' && value !== '') {
13
+ if (typeof value === 'object') {
14
+ for (const key of Object.keys(value)) {
15
+ if (value[key] !== null && typeof (value[key]) !== 'undefined') {
16
+ const params = propName + '[' + key + ']'
17
+ const subPart = encodeURIComponent(params) + '='
18
+ result += subPart + encodeURIComponent(value[key]) + '&'
19
+ }
20
+ }
21
+ } else {
22
+ result += part + encodeURIComponent(value) + '&'
23
+ }
24
+ }
25
+ }
26
+ return result
27
+ }
@@ -0,0 +1,216 @@
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
+ }
@@ -0,0 +1,42 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "module": "ESNext",
5
+ "moduleResolution": "Node",
6
+ "forceConsistentCasingInFileNames": true,
7
+ "allowSyntheticDefaultImports": true,
8
+ "strictFunctionTypes": false,
9
+ "jsx": "preserve",
10
+ "baseUrl": "./",
11
+ "allowJs": true,
12
+ "sourceMap": true,
13
+ "esModuleInterop": true,
14
+ "resolveJsonModule": true,
15
+ "noUnusedLocals": true,
16
+ "noUnusedParameters": true,
17
+ "experimentalDecorators": true,
18
+ "lib": ["DOM", "ESNext"],
19
+ "types": ["vite/client"],
20
+ "skipLibCheck": true,
21
+ "paths": {
22
+ "@/*": ["src/*"],
23
+ "@gx-mobile/hooks/*": ["src/hooks/*"],
24
+ "@gx-vuex": ["src/store/index.ts"]
25
+ }
26
+ },
27
+ "include": [
28
+ "tests/**/*.ts",
29
+ "src/**/*.ts",
30
+ "src/**/*.less",
31
+ "src/**/*.d.ts",
32
+ "src/**/*.tsx",
33
+ "src/**/*.vue",
34
+ "types/*.d.ts",
35
+ "types/*.ts",
36
+ "build/**/*.ts",
37
+ "build/**/*.d.ts",
38
+ "mock/**/*.ts",
39
+ "vite.config.ts"
40
+ ],
41
+ "exclude": ["node_modules", "tests/server/**/*.ts", "dist", "**/*.js", ".history"]
42
+ }
@@ -0,0 +1,13 @@
1
+ // generated by unplugin-vue-components
2
+ // We suggest you to commit this file into source control
3
+ // Read more: https://github.com/vuejs/core/pull/3399
4
+ import '@vue/runtime-core'
5
+
6
+ export {}
7
+
8
+ declare module '@vue/runtime-core' {
9
+ export interface GlobalComponents {
10
+ RouterLink: typeof import('vue-router')['RouterLink']
11
+ RouterView: typeof import('vue-router')['RouterView']
12
+ }
13
+ }
@@ -0,0 +1,64 @@
1
+ // Generated by 'unplugin-auto-import'
2
+ export {}
3
+ declare global {
4
+ const EffectScope: typeof import('vue')['EffectScope']
5
+ const computed: typeof import('vue')['computed']
6
+ const createApp: typeof import('vue')['createApp']
7
+ const customRef: typeof import('vue')['customRef']
8
+ const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
9
+ const defineComponent: typeof import('vue')['defineComponent']
10
+ const effectScope: typeof import('vue')['effectScope']
11
+ const getCurrentInstance: typeof import('vue')['getCurrentInstance']
12
+ const getCurrentScope: typeof import('vue')['getCurrentScope']
13
+ const h: typeof import('vue')['h']
14
+ const inject: typeof import('vue')['inject']
15
+ const isProxy: typeof import('vue')['isProxy']
16
+ const isReactive: typeof import('vue')['isReactive']
17
+ const isReadonly: typeof import('vue')['isReadonly']
18
+ const isRef: typeof import('vue')['isRef']
19
+ const markRaw: typeof import('vue')['markRaw']
20
+ const nextTick: typeof import('vue')['nextTick']
21
+ const onActivated: typeof import('vue')['onActivated']
22
+ const onBeforeMount: typeof import('vue')['onBeforeMount']
23
+ const onBeforeRouteLeave: typeof import('vue-router')['onBeforeRouteLeave']
24
+ const onBeforeRouteUpdate: typeof import('vue-router')['onBeforeRouteUpdate']
25
+ const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
26
+ const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
27
+ const onDeactivated: typeof import('vue')['onDeactivated']
28
+ const onErrorCaptured: typeof import('vue')['onErrorCaptured']
29
+ const onMounted: typeof import('vue')['onMounted']
30
+ const onRenderTracked: typeof import('vue')['onRenderTracked']
31
+ const onRenderTriggered: typeof import('vue')['onRenderTriggered']
32
+ const onScopeDispose: typeof import('vue')['onScopeDispose']
33
+ const onServerPrefetch: typeof import('vue')['onServerPrefetch']
34
+ const onUnmounted: typeof import('vue')['onUnmounted']
35
+ const onUpdated: typeof import('vue')['onUpdated']
36
+ const provide: typeof import('vue')['provide']
37
+ const reactive: typeof import('vue')['reactive']
38
+ const readonly: typeof import('vue')['readonly']
39
+ const ref: typeof import('vue')['ref']
40
+ const resolveComponent: typeof import('vue')['resolveComponent']
41
+ const resolveDirective: typeof import('vue')['resolveDirective']
42
+ const setupStore: typeof import('../src/store/index')['setupStore']
43
+ const shallowReactive: typeof import('vue')['shallowReactive']
44
+ const shallowReadonly: typeof import('vue')['shallowReadonly']
45
+ const shallowRef: typeof import('vue')['shallowRef']
46
+ const toRaw: typeof import('vue')['toRaw']
47
+ const toRef: typeof import('vue')['toRef']
48
+ const toRefs: typeof import('vue')['toRefs']
49
+ const triggerRef: typeof import('vue')['triggerRef']
50
+ const unref: typeof import('vue')['unref']
51
+ const useAttrs: typeof import('vue')['useAttrs']
52
+ const useCssModule: typeof import('vue')['useCssModule']
53
+ const useCssVars: typeof import('vue')['useCssVars']
54
+ const useLink: typeof import('vue-router')['useLink']
55
+ const useRoute: typeof import('vue-router')['useRoute']
56
+ const useRouter: typeof import('vue-router')['useRouter']
57
+ const useSlots: typeof import('vue')['useSlots']
58
+ const useStore: typeof import('../src/store/index')['useStore']
59
+ const useStoreGlobal: typeof import('../src/store/index')['useStoreGlobal']
60
+ const watch: typeof import('vue')['watch']
61
+ const watchEffect: typeof import('vue')['watchEffect']
62
+ const watchPostEffect: typeof import('vue')['watchPostEffect']
63
+ const watchSyncEffect: typeof import('vue')['watchSyncEffect']
64
+ }
@@ -0,0 +1,12 @@
1
+ // generated by unplugin-vue-components
2
+ // We suggest you to commit this file into source control
3
+ // Read more: https://github.com/vuejs/vue-next/pull/3399
4
+ import '@vue/runtime-core'
5
+
6
+ export {}
7
+
8
+ declare module '@vue/runtime-core' {
9
+ export interface GlobalComponents {
10
+ GProPageContainer: typeof import('./../src/components/PageContainer')['default']
11
+ }
12
+ }
@@ -0,0 +1,39 @@
1
+ import type { PropType, CSSProperties as VueCSSProperties } from 'vue'
2
+ import type { CSSObject as ProCssObject } from 'ant-design-vue'
3
+
4
+ declare global {
5
+ const __APP_INFO__: {
6
+ pkg: {
7
+ name: string;
8
+ version: string;
9
+ dependencies: RecordType;
10
+ devDependencies: RecordType;
11
+ };
12
+ lastBuildTime: string;
13
+ }
14
+
15
+ declare interface LocalResult {
16
+ value: any;
17
+ time: string;
18
+ expired: number;
19
+ }
20
+
21
+ declare type VuePropType<T> = PropType<T>
22
+ declare type CSSObject = ProCssObject
23
+ declare type CSSProperties = VueCSSProperties
24
+
25
+ declare type RecordType<T = string, K = any> = Record<T, K>
26
+
27
+ declare interface ViteEnv {
28
+ VITE_USE_MODE: string;
29
+ VITE_USE_CDN: boolean;
30
+ VITE_USE_MOCK: boolean;
31
+ VITE_USE_V_CONSOLE: boolean;
32
+ VITE_NODE_ENV: string;
33
+ VITE_BASE_URL: string;
34
+ VITE_APP_ENV: string;
35
+ VITE_DROP_CONSOLE: boolean;
36
+ }
37
+
38
+ declare type ViteEnvKey = keyof ViteEnv
39
+ }
@@ -0,0 +1,20 @@
1
+ declare module '*.svg'
2
+ declare module '*.png'
3
+ declare module '*.jpg'
4
+ declare module '*.jpeg'
5
+ declare module '*.gif'
6
+ declare module '*.bmp'
7
+ declare module '*.tiff'
8
+
9
+ /// <reference types="vite/client" />
10
+ declare module '*.vue' {
11
+ import type { DefineComponent } from 'vue'
12
+
13
+ const Component: DefineComponent<Record<any, any>, Record<any, any>, any>
14
+ export default component
15
+ }
16
+
17
+ declare module 'virtual:*' {
18
+ const result: any
19
+ export default result
20
+ }
@@ -0,0 +1,14 @@
1
+ // generated by unplugin-vue-components
2
+ // We suggest you to commit this file into source control
3
+ // Read more: https://github.com/vuejs/core/pull/3399
4
+ import '@vue/runtime-core'
5
+
6
+ export {}
7
+
8
+ declare module '@vue/runtime-core' {
9
+ export interface GlobalComponents {
10
+ RouterLink: typeof import('vue-router')['RouterLink']
11
+ RouterView: typeof import('vue-router')['RouterView']
12
+ VanButton: typeof import('vant/es')['Button']
13
+ }
14
+ }
@@ -0,0 +1,15 @@
1
+ declare interface DefaultResult<T> {
2
+ code: number;
3
+ msg?: string;
4
+ message?: string;
5
+ data?: T;
6
+ }
7
+
8
+ declare type ResponseResult<T = any, R = undefined> = R extends undefined
9
+ ? DefaultResult<T>
10
+ : DefaultResult<T> & R
11
+
12
+ declare interface PageResult<T> {
13
+ list: T[];
14
+ totalCount: number;
15
+ }
@@ -0,0 +1,13 @@
1
+ // generated by unplugin-vue-components
2
+ // We suggest you to commit this file into source control
3
+ // Read more: https://github.com/vuejs/core/pull/3399
4
+ import '@vue/runtime-core'
5
+
6
+ export {}
7
+
8
+ declare module '@vue/runtime-core' {
9
+ export interface GlobalComponents {
10
+ RouterLink: typeof import('vue-router')['RouterLink']
11
+ RouterView: typeof import('vue-router')['RouterView']
12
+ }
13
+ }