@gx-design-vue/create-gx-cli 0.1.15 → 0.1.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/dist/index.js +62 -0
  2. package/index.js +3 -0
  3. package/package.json +22 -9
  4. package/bin/create-gx-cli +0 -5
  5. package/src/cli.js +0 -115
  6. package/src/git.js +0 -81
  7. package/src/main.js +0 -190
  8. package/template-mobile-vant-cli/.editorconfig +0 -19
  9. package/template-mobile-vant-cli/.env +0 -0
  10. package/template-mobile-vant-cli/.env.development +0 -19
  11. package/template-mobile-vant-cli/.env.pro +0 -19
  12. package/template-mobile-vant-cli/.env.production +0 -19
  13. package/template-mobile-vant-cli/.eslintignore +0 -15
  14. package/template-mobile-vant-cli/.prettierignore +0 -9
  15. package/template-mobile-vant-cli/README.md +0 -1
  16. package/template-mobile-vant-cli/build/cdn.ts +0 -5
  17. package/template-mobile-vant-cli/build/generateModifyVars.ts +0 -7
  18. package/template-mobile-vant-cli/build/optimizer.ts +0 -18
  19. package/template-mobile-vant-cli/build/plugin/autoImport.ts +0 -24
  20. package/template-mobile-vant-cli/build/plugin/html.ts +0 -26
  21. package/template-mobile-vant-cli/build/plugin/index.ts +0 -42
  22. package/template-mobile-vant-cli/build/plugin/mock.ts +0 -14
  23. package/template-mobile-vant-cli/build/plugin/viteMock/client.ts +0 -88
  24. package/template-mobile-vant-cli/build/plugin/viteMock/createMockServer.ts +0 -271
  25. package/template-mobile-vant-cli/build/plugin/viteMock/index.ts +0 -69
  26. package/template-mobile-vant-cli/build/plugin/viteMock/types.ts +0 -48
  27. package/template-mobile-vant-cli/build/plugin/viteMock/utils.ts +0 -48
  28. package/template-mobile-vant-cli/build/script/postBuild.ts +0 -14
  29. package/template-mobile-vant-cli/eslint.config.js +0 -49
  30. package/template-mobile-vant-cli/index.html +0 -24
  31. package/template-mobile-vant-cli/mock/_createProductionServer.ts +0 -19
  32. package/template-mobile-vant-cli/mock/datasSource/api/index.ts +0 -0
  33. package/template-mobile-vant-cli/mock/utils.ts +0 -9
  34. package/template-mobile-vant-cli/package.json +0 -57
  35. package/template-mobile-vant-cli/postcss.config.cjs +0 -8
  36. package/template-mobile-vant-cli/prettier.config.cjs +0 -18
  37. package/template-mobile-vant-cli/public/favicon.ico +0 -0
  38. package/template-mobile-vant-cli/public/js/flexible.js +0 -44
  39. package/template-mobile-vant-cli/src/App.vue +0 -5
  40. package/template-mobile-vant-cli/src/components/PageContainer/ProSkeleton.tsx +0 -29
  41. package/template-mobile-vant-cli/src/components/PageContainer/index.tsx +0 -115
  42. package/template-mobile-vant-cli/src/components/PageContainer/style.module.less +0 -14
  43. package/template-mobile-vant-cli/src/core/gx-design/index.ts +0 -7
  44. package/template-mobile-vant-cli/src/core/index.ts +0 -12
  45. package/template-mobile-vant-cli/src/core/vant-design/index.ts +0 -4
  46. package/template-mobile-vant-cli/src/design/config.less +0 -0
  47. package/template-mobile-vant-cli/src/design/index.less +0 -3
  48. package/template-mobile-vant-cli/src/design/reset.less +0 -155
  49. package/template-mobile-vant-cli/src/design/root.less +0 -3
  50. package/template-mobile-vant-cli/src/design/vant.less +0 -2
  51. package/template-mobile-vant-cli/src/global.less +0 -1
  52. package/template-mobile-vant-cli/src/hooks/web/index.ts +0 -5
  53. package/template-mobile-vant-cli/src/hooks/web/usePageLoading.ts +0 -58
  54. package/template-mobile-vant-cli/src/layout/BasicLayout.vue +0 -16
  55. package/template-mobile-vant-cli/src/layout/basicLayout.less +0 -11
  56. package/template-mobile-vant-cli/src/main.ts +0 -27
  57. package/template-mobile-vant-cli/src/pages/home.vue +0 -71
  58. package/template-mobile-vant-cli/src/router/index.ts +0 -25
  59. package/template-mobile-vant-cli/src/router/routes.ts +0 -20
  60. package/template-mobile-vant-cli/src/router/typings.ts +0 -8
  61. package/template-mobile-vant-cli/src/services/index.ts +0 -31
  62. package/template-mobile-vant-cli/src/settings/index.ts +0 -10
  63. package/template-mobile-vant-cli/src/store/index.ts +0 -17
  64. package/template-mobile-vant-cli/src/store/modules/global.ts +0 -30
  65. package/template-mobile-vant-cli/src/utils/crypto/base64.ts +0 -101
  66. package/template-mobile-vant-cli/src/utils/crypto/index.ts +0 -57
  67. package/template-mobile-vant-cli/src/utils/env.ts +0 -50
  68. package/template-mobile-vant-cli/src/utils/pageTitle.ts +0 -14
  69. package/template-mobile-vant-cli/src/utils/request/XHR.ts +0 -139
  70. package/template-mobile-vant-cli/src/utils/request/axiosCancel.ts +0 -69
  71. package/template-mobile-vant-cli/src/utils/request/checkStatus.ts +0 -9
  72. package/template-mobile-vant-cli/src/utils/request/index.ts +0 -142
  73. package/template-mobile-vant-cli/src/utils/request/typings.ts +0 -171
  74. package/template-mobile-vant-cli/src/utils/storage.ts +0 -198
  75. package/template-mobile-vant-cli/src/utils/util.ts +0 -27
  76. package/template-mobile-vant-cli/src/utils/validate.ts +0 -216
  77. package/template-mobile-vant-cli/tsconfig.json +0 -42
  78. package/template-mobile-vant-cli/types/ant-design-import.d.ts +0 -13
  79. package/template-mobile-vant-cli/types/auto-imports.d.ts +0 -64
  80. package/template-mobile-vant-cli/types/components.d.ts +0 -12
  81. package/template-mobile-vant-cli/types/global.d.ts +0 -39
  82. package/template-mobile-vant-cli/types/module.d.ts +0 -20
  83. package/template-mobile-vant-cli/types/plugins-auto-import.d.ts +0 -14
  84. package/template-mobile-vant-cli/types/response.d.ts +0 -15
  85. package/template-mobile-vant-cli/types/vant-import.d.ts +0 -13
  86. package/template-mobile-vant-cli/unocss.config.ts +0 -101
  87. package/template-mobile-vant-cli/vite.config.ts +0 -145
  88. package/template-mobile-vant-html/README.md +0 -4
  89. package/template-mobile-vant-html/css/global.css +0 -293
  90. package/template-mobile-vant-html/css/global.css.map +0 -1
  91. package/template-mobile-vant-html/css/global.less +0 -293
  92. package/template-mobile-vant-html/css/index.css +0 -20
  93. package/template-mobile-vant-html/css/index.css.map +0 -1
  94. package/template-mobile-vant-html/css/index.less +0 -21
  95. package/template-mobile-vant-html/image/disconnected.svg +0 -60
  96. package/template-mobile-vant-html/image/empty.svg +0 -52
  97. package/template-mobile-vant-html/image/error.svg +0 -53
  98. package/template-mobile-vant-html/image/loading.svg +0 -1
  99. package/template-mobile-vant-html/index.html +0 -91
  100. package/template-mobile-vant-html/js/index.js +0 -29
  101. package/template-mobile-vant-html/js/plugin/day.min.js +0 -1
  102. package/template-mobile-vant-html/js/plugin/fastclick.js +0 -730
  103. package/template-mobile-vant-html/js/plugin/jquery.min.js +0 -2
  104. package/template-mobile-vant-html/js/plugin/rem.js +0 -28
  105. package/template-mobile-vant-html/js/utils/appUtil.js +0 -70
  106. package/template-mobile-vant-html/js/utils/config.js +0 -3
  107. package/template-mobile-vant-html/js/utils/request.js +0 -61
  108. package/template-mobile-vant-html/js/utils/utils.js +0 -65
  109. package/template-mobile-vant-html/js/utils/validate.js +0 -292
@@ -1,58 +0,0 @@
1
- import type { Ref } from 'vue'
2
- import { ref, watch } from 'vue'
3
- import { closeToast, showLoadingToast } from 'vant'
4
- import type { PageLoadingTpe } from '@/components/PageContainer'
5
-
6
- export interface SetLoadingParams<T> {
7
- value: T;
8
- type?: PageLoadingTpe;
9
- message?: string
10
- }
11
-
12
- type ChangeLoadingFn<T> = ({ value, type, message }: SetLoadingParams<T>) => void
13
-
14
- export default function usePageLoading<T, R = Ref<T>>({
15
- defaultType,
16
- defaultMessage,
17
- defaultLoading
18
- }: {
19
- defaultType?: PageLoadingTpe;
20
- defaultMessage?: string;
21
- defaultLoading?: T | (() => T);
22
- }): [ R, ChangeLoadingFn<T> ] {
23
- const initValue: T = typeof defaultLoading === 'function' ? (defaultLoading as any)() : defaultLoading
24
-
25
- const pageLoading = ref(initValue) as Ref<T>
26
-
27
- const loadingMessage = ref(defaultMessage)
28
-
29
- const loadingType = ref(defaultType)
30
-
31
- watch(() => pageLoading.value, (val) => {
32
- if (val) {
33
- if (loadingType.value === 'toast') {
34
- showLoadingToast({
35
- duration: 0,
36
- forbidClick: true,
37
- message: loadingMessage.value || '加载中'
38
- })
39
- } else {
40
- closeToast()
41
- }
42
- } else {
43
- closeToast()
44
- }
45
- }, {
46
- deep: true,
47
- immediate: true
48
- })
49
-
50
- const changeLoading = ({ value, type, message }: SetLoadingParams<T>) => {
51
- pageLoading.value = value
52
- loadingMessage.value = message
53
- if (type)
54
- loadingType.value = type
55
- }
56
-
57
- return [ pageLoading as unknown as R, changeLoading ]
58
- }
@@ -1,16 +0,0 @@
1
- <script setup lang="ts">
2
- </script>
3
-
4
- <template>
5
- <div :class="$style['basic-layout']">
6
- <RouterView>
7
- <template #default="{ Component }">
8
- <component :is="Component" />
9
- </template>
10
- </RouterView>
11
- </div>
12
- </template>
13
-
14
- <style lang="less" module>
15
- @import './basicLayout';
16
- </style>
@@ -1,11 +0,0 @@
1
- .basic-layout {
2
- height: 100%;
3
- }
4
-
5
- @media screen and (min-width: 800px) {
6
- .basic-layout {
7
- width: 10rem;
8
- max-width: 10rem;
9
- margin: 0 auto;
10
- }
11
- }
@@ -1,27 +0,0 @@
1
- import { createApp } from 'vue'
2
- import { setupRouter } from '@/router'
3
- import { setupStore } from './store'
4
- import { setupGlobCommon } from './core'
5
- import App from './App.vue'
6
-
7
- import 'uno.css'
8
-
9
- import 'vant/es/toast/style'
10
-
11
- import './global.less'
12
-
13
- function startApp() {
14
- const app = createApp(App)
15
-
16
- // 配置store
17
- setupStore(app)
18
-
19
- // 配置路由
20
- setupRouter(app)
21
-
22
- setupGlobCommon(app)
23
-
24
- app.mount('#app')
25
- }
26
-
27
- startApp()
@@ -1,71 +0,0 @@
1
- <script setup lang="ts">
2
- import { isBoolean } from '@gx-design-vue/pro-utils'
3
-
4
- const loading = ref(false)
5
- const pageContainer = ref()
6
- const loadingMsg = ref('加载中')
7
- const hiddenSlot = ref(true)
8
-
9
- const init = (val?: boolean) => {
10
- loadingMsg.value = '加载中'
11
- loading.value = true
12
-
13
- if (isBoolean(val))
14
- hiddenSlot.value = val
15
-
16
- setTimeout(() => {
17
- loading.value = false
18
- }, 1000)
19
- }
20
-
21
- onMounted(() => {
22
- init()
23
- })
24
-
25
- const changeLoading = (message: string) => {
26
- loadingMsg.value = message
27
- loading.value = true
28
- hiddenSlot.value = false
29
-
30
- setTimeout(() => {
31
- loading.value = false
32
- }, 1000)
33
- }
34
-
35
- const toggleLoading = (hiddenSlot: boolean, message?: string) => {
36
- pageContainer.value?.toggleLoading({
37
- value: true,
38
- hiddenSlot,
39
- message
40
- })
41
-
42
- setTimeout(() => {
43
- pageContainer.value?.toggleLoading({
44
- value: false,
45
- hiddenSlot
46
- })
47
- }, 1000)
48
- }
49
- </script>
50
-
51
- <template>
52
- <g-pro-page-container
53
- ref="pageContainer"
54
- v-model:loading="loading"
55
- :loadingMsg="loadingMsg"
56
- :hiddenSlot="hiddenSlot"
57
- >
58
- <div style="display: flex;flex-direction: column;gap: 20px;">
59
- <p>以下刷新只针对toast</p>
60
- <van-button @click="init(true)">刷新(隐藏子组件)</van-button>
61
- <van-button @click="init(false)">刷新(不隐藏子组件)</van-button>
62
- <van-button @click="changeLoading('切换中')">切换loading提示语</van-button>
63
- <van-button @click="toggleLoading(true)">刷新-调用方法-隐藏</van-button>
64
- <van-button @click="toggleLoading(false)">刷新-调用方法-不隐藏</van-button>
65
- <van-button @click="toggleLoading(false, '切换中')">刷新-调用方法-不隐藏-切换提示语</van-button>
66
- </div>
67
- </g-pro-page-container>
68
- </template>
69
-
70
- <style lang="less" scoped>
71
- </style>
@@ -1,25 +0,0 @@
1
- import type { App } from 'vue'
2
- import type { RouteRecordRaw } from 'vue-router'
3
- import { createRouter, createWebHashHistory } from 'vue-router'
4
- import settings from '@/settings'
5
- import getPageTitle from '@/utils/pageTitle'
6
- import { constantRoutes } from './routes'
7
-
8
- export const router = createRouter({
9
- history: createWebHashHistory(),
10
- routes: constantRoutes as unknown as RouteRecordRaw[]
11
- })
12
-
13
- const doRouterPermission = () => {
14
- router.afterEach((to) => {
15
- const { meta }: any = to
16
- document.title = getPageTitle(settings.title, meta.title || '')
17
- })
18
- }
19
-
20
- // 配置路由器
21
- export function setupRouter(app: App<Element>) {
22
- app.use(router)
23
-
24
- doRouterPermission()
25
- }
@@ -1,20 +0,0 @@
1
- import type { AppRouteModule } from './typings'
2
- import BasicLayout from '@/layout/BasicLayout.vue'
3
-
4
- export const constantRoutes: AppRouteModule[] = [
5
- {
6
- path: '/',
7
- component: BasicLayout,
8
- redirect: '/home',
9
- children: [
10
- {
11
- path: '/home',
12
- name: 'Home',
13
- meta: {
14
- title: '首页'
15
- },
16
- component: () => import('@/pages/home.vue')
17
- }
18
- ]
19
- }
20
- ]
@@ -1,8 +0,0 @@
1
- import type { RouteRecordRaw } from 'vue-router'
2
-
3
- interface AppRouteRecordRaw {
4
- hidden?: boolean;
5
- homePage?: number;
6
- }
7
-
8
- export type AppRouteModule = AppRouteRecordRaw & RouteRecordRaw
@@ -1,31 +0,0 @@
1
- import request from '@/utils/request'
2
-
3
- // get 请求
4
- export function getMock(params) {
5
- return request({
6
- url: '/get/mock',
7
- method: 'get',
8
- isMock: true,
9
- params
10
- })
11
- }
12
-
13
- // post 请求
14
- export function postMock(data) {
15
- return request({
16
- url: '/post/mock',
17
- method: 'post',
18
- isMock: true,
19
- data
20
- })
21
- }
22
-
23
- // formData 请求
24
- export function formDataMock(data) {
25
- return request({
26
- url: '/formData/mock',
27
- method: 'post',
28
- isMock: true,
29
- data
30
- })
31
- }
@@ -1,10 +0,0 @@
1
- export default {
2
- title: 'gx-design-mobile',
3
- tokenName: 'token',
4
- contentType: 'application/json;charset=UTF-8',
5
- requestPrefix: '',
6
- // 最长请求时间
7
- requestTimeout: 10000,
8
- // 操作正常code,支持String、Array、int多种类型
9
- successCode: [ 200, 0 ]
10
- }
@@ -1,17 +0,0 @@
1
- import type { App } from 'vue'
2
- import { createPinia } from 'pinia'
3
- import { useStoreGlobal } from './modules/global'
4
-
5
- export {
6
- useStoreGlobal
7
- }
8
-
9
- export function useStore() {
10
- return {
11
- global: useStoreGlobal()
12
- }
13
- }
14
-
15
- export function setupStore(app: App<Element>) {
16
- app.use(createPinia())
17
- }
@@ -1,30 +0,0 @@
1
- import { reactive, toRefs } from 'vue'
2
- import { defineStore } from 'pinia'
3
- import { deepCopy } from '@gx-design-vue/pro-utils'
4
-
5
- /**
6
- * @Author gx12358
7
- * @DateTime 2022/1/11
8
- * @lastTime 2022/1/11
9
- * @description store-global 全局属性
10
- */
11
- export interface GlobalState {
12
- token?: string; // app token
13
- }
14
-
15
- type GlobalStateKey = keyof GlobalState
16
-
17
- export const useStoreGlobal = defineStore('global', () => {
18
- const state = reactive<GlobalState>({
19
- token: ''
20
- })
21
-
22
- const setGlobalData: (params: Partial<Record<GlobalStateKey, GlobalState[GlobalStateKey]>>) => void = (params) => {
23
- Object.assign(state, deepCopy(params))
24
- }
25
-
26
- return {
27
- ...toRefs(state),
28
- setGlobalData
29
- }
30
- })
@@ -1,101 +0,0 @@
1
- export default class Base64 {
2
- _keyStr: string
3
-
4
- constructor() {
5
- this._keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
6
- }
7
-
8
- _utf8_encode(string: string) {
9
- string = string.replace(/\r\n/g, '\n')
10
- let utftext = ''
11
- for (let n = 0; n < string.length; n++) {
12
- const c = string.charCodeAt(n)
13
- if (c < 128) {
14
- utftext += String.fromCharCode(c)
15
- } else if ((c > 127) && (c < 2048)) {
16
- utftext += String.fromCharCode((c >> 6) | 192)
17
- utftext += String.fromCharCode((c & 63) | 128)
18
- } else {
19
- utftext += String.fromCharCode((c >> 12) | 224)
20
- utftext += String.fromCharCode(((c >> 6) & 63) | 128)
21
- utftext += String.fromCharCode((c & 63) | 128)
22
- }
23
- }
24
- return utftext
25
- }
26
-
27
- _utf8_decode(utftext: string) {
28
- let string = ''
29
- let i = 0
30
- let c = 0
31
- let c1 = 0
32
- let c2 = 0
33
- while (i < utftext.length) {
34
- c = utftext.charCodeAt(i)
35
- if (c < 128) {
36
- string += String.fromCharCode(c)
37
- i++
38
- } else if ((c > 191) && (c < 224)) {
39
- c1 = utftext.charCodeAt(i + 1)
40
- string += String.fromCharCode(((c & 31) << 6) | (c1 & 63))
41
- i += 2
42
- } else {
43
- c1 = utftext.charCodeAt(i + 1)
44
- c2 = utftext.charCodeAt(i + 2)
45
- string += String.fromCharCode(((c & 15) << 12) | ((c1 & 63) << 6) | (c2 & 63))
46
- i += 3
47
- }
48
- }
49
- return string
50
- }
51
-
52
- encode(input: string) {
53
- let output = ''
54
- let chr1, chr2, chr3, enc1, enc2, enc3, enc4
55
- let i = 0
56
- input = this._utf8_encode(input)
57
- while (i < input.length) {
58
- chr1 = input.charCodeAt(i++)
59
- chr2 = input.charCodeAt(i++)
60
- chr3 = input.charCodeAt(i++)
61
- enc1 = chr1 >> 2
62
- enc2 = ((chr1 & 3) << 4) | (chr2 >> 4)
63
- enc3 = ((chr2 & 15) << 2) | (chr3 >> 6)
64
- enc4 = chr3 & 63
65
- if (Number.isNaN(chr2)) {
66
- enc3 = enc4 = 64
67
- } else if (Number.isNaN(chr3)) {
68
- enc4 = 64
69
- }
70
- output = output + this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + this._keyStr.charAt(
71
- enc3) + this._keyStr.charAt(enc4)
72
- }
73
- return output
74
- }
75
-
76
- decode(input: string) {
77
- let output = ''
78
- let chr1, chr2, chr3
79
- let enc1, enc2, enc3, enc4
80
- let i = 0
81
- input = input.replace(/[^A-Za-z0-9+/=]/g, '')
82
- while (i < input.length) {
83
- enc1 = this._keyStr.indexOf(input.charAt(i++))
84
- enc2 = this._keyStr.indexOf(input.charAt(i++))
85
- enc3 = this._keyStr.indexOf(input.charAt(i++))
86
- enc4 = this._keyStr.indexOf(input.charAt(i++))
87
- chr1 = (enc1 << 2) | (enc2 >> 4)
88
- chr2 = ((enc2 & 15) << 4) | (enc3 >> 2)
89
- chr3 = ((enc3 & 3) << 6) | enc4
90
- output = output + String.fromCharCode(chr1)
91
- if (enc3 !== 64) {
92
- output = output + String.fromCharCode(chr2)
93
- }
94
- if (enc4 !== 64) {
95
- output = output + String.fromCharCode(chr3)
96
- }
97
- }
98
- output = this._utf8_decode(output)
99
- return output
100
- }
101
- }
@@ -1,57 +0,0 @@
1
- import 'crypto-js/enc-utf8'
2
- import 'crypto-js/tripledes'
3
- import 'crypto-js/sha1'
4
- import * as CryptoJS from 'crypto-js/core'
5
- import CryptoProJS from 'crypto-js'
6
- import { isJSONStr } from '@/utils/validate'
7
- import { isArray, isObject } from '@gx-design-vue/pro-utils'
8
-
9
- const key = '1234123412ABCDEF' // 十六位十六进制数作为密钥
10
-
11
- /**
12
- * 登录密码加密
13
- * @param password
14
- * @returns {string}
15
- */
16
- export const encodePassword = (password: string) => {
17
- const key = CryptoProJS.enc.Utf8.parse('8QONwyJtHesysWpM')
18
- const passwordENC = CryptoProJS.AES.encrypt(password, key, {
19
- mode: CryptoProJS.mode.ECB,
20
- padding: CryptoProJS.pad.Pkcs7
21
- })
22
- const encodePW = passwordENC.ciphertext.toString()
23
- return encodePW
24
- }
25
-
26
- // 加密方法
27
- export function Encrypt(word) {
28
- let str: string | object = word
29
- if (isObject(word) || isArray(word)) {
30
- str = JSON.stringify(word)
31
- }
32
- const keyHex = CryptoJS.enc.Utf8.parse(key)
33
- const ivHex = CryptoJS.enc.Utf8.parse(key)
34
- const encrypted = CryptoJS.DES.encrypt(str, keyHex, {
35
- iv: ivHex,
36
- mode: CryptoJS.mode.CBC,
37
- padding: CryptoJS.pad.Pkcs7
38
- })
39
- return CryptoJS.enc.Base64.stringify(encrypted.ciphertext)
40
- }
41
-
42
- // 解密方法
43
- export function Decrypt(word) {
44
- const keyHex = CryptoJS.enc.Utf8.parse(key)
45
- const ivHex = CryptoJS.enc.Utf8.parse(key)
46
- const decrypted = CryptoJS.DES.decrypt({
47
- ciphertext: CryptoJS.enc.Base64.parse(word)
48
- }, keyHex, {
49
- iv: ivHex,
50
- mode: CryptoJS.mode.CBC,
51
- padding: CryptoJS.pad.Pkcs7
52
- })
53
- const decryptedStr = decrypted.toString(CryptoJS.enc.Utf8)
54
- return isJSONStr(decryptedStr.toString())
55
- ? JSON.parse(decryptedStr.toString())
56
- : decryptedStr.toString()
57
- }
@@ -1,50 +0,0 @@
1
- /**
2
- * @Author gx12358
3
- * @DateTime 2022/4/1
4
- * @lastTime 2022/4/1
5
- * @description 环境:本地开发环境
6
- */
7
- export function isDev(): boolean {
8
- return typeViteEnv('VITE_APP_ENV') === 'dev'
9
- }
10
-
11
- /**
12
- * @Author gx12358
13
- * @DateTime 2022/4/1
14
- * @lastTime 2022/4/1
15
- * @description 环境:正式
16
- */
17
- export function isPro(): boolean {
18
- return typeViteEnv('VITE_USE_MODE') === 'pro'
19
- }
20
-
21
- /**
22
- * @Author gx12358
23
- * @DateTime 2022/4/1
24
- * @lastTime 2022/4/1
25
- * @description 环境:非本地开发环境
26
- */
27
- export function isBuild(): boolean {
28
- return typeViteEnv('VITE_NODE_ENV') === 'production'
29
- }
30
-
31
- /**
32
- * @Author gx12358
33
- * @DateTime 2022/4/1
34
- * @lastTime 2022/4/1
35
- * @description 当前联调环境
36
- */
37
- export function currentMode() {
38
- return typeViteEnv('VITE_USE_MODE')
39
- }
40
-
41
- export function typeViteEnv<T extends keyof ViteEnv>(key: T): ViteEnv[T] | undefined {
42
- let value: any = (import.meta as any).env[key]
43
-
44
- if (value && typeof value === 'string') {
45
- value = value.replace(/\\n/g, '\n') as ViteEnv[T]
46
- value = value === 'true' ? true : value === 'false' ? false : value
47
- }
48
-
49
- return value
50
- }
@@ -1,14 +0,0 @@
1
- /**
2
- * @author gx12358 2539306317@qq.com
3
- * @description 设置标题
4
- * @param pageTitle
5
- * @returns {string}
6
- */
7
- export default function getPageTitle(title: string, pageTitle: string) {
8
- const newTitles: string[] = []
9
- if (pageTitle)
10
- newTitles.push(pageTitle)
11
- if (title)
12
- newTitles.push(title)
13
- return newTitles.join('-')
14
- }