@gx-design-vue/create-gx-cli 0.1.16 → 0.1.18
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.
- package/dist/index.js +62 -0
- package/index.js +3 -0
- package/package.json +24 -14
- package/bin/create-gx-cli +0 -5
- package/src/cli.js +0 -115
- package/src/git.js +0 -81
- package/src/main.js +0 -190
- package/template-mobile-vant-cli/.editorconfig +0 -19
- package/template-mobile-vant-cli/.env +0 -3
- package/template-mobile-vant-cli/.env.development +0 -17
- package/template-mobile-vant-cli/.env.pro +0 -28
- package/template-mobile-vant-cli/.env.production +0 -31
- package/template-mobile-vant-cli/.eslintignore +0 -15
- package/template-mobile-vant-cli/.prettierignore +0 -9
- package/template-mobile-vant-cli/README.md +0 -1
- package/template-mobile-vant-cli/commitlint.config.cjs +0 -32
- package/template-mobile-vant-cli/config/default/defaultSettings.ts +0 -70
- package/template-mobile-vant-cli/config/default/network.ts +0 -10
- package/template-mobile-vant-cli/config/default/proxy.ts +0 -50
- package/template-mobile-vant-cli/config/default/theme.ts +0 -3
- package/template-mobile-vant-cli/config/index.ts +0 -11
- package/template-mobile-vant-cli/eslint.config.js +0 -57
- package/template-mobile-vant-cli/index.html +0 -25
- package/template-mobile-vant-cli/internal/vite-config/generate/generateModifyVars.ts +0 -7
- package/template-mobile-vant-cli/internal/vite-config/rollupOptions/index.ts +0 -22
- package/template-mobile-vant-cli/internal/vite-config/util/hash.ts +0 -17
- package/template-mobile-vant-cli/internal/vite-config/util/index.ts +0 -132
- package/template-mobile-vant-cli/internal/vite-config/vite/cdn.ts +0 -65
- package/template-mobile-vant-cli/internal/vite-config/vite/optimizer.ts +0 -26
- package/template-mobile-vant-cli/internal/vite-config/vite/plugin/appConfig.ts +0 -91
- package/template-mobile-vant-cli/internal/vite-config/vite/plugin/autoImport.ts +0 -28
- package/template-mobile-vant-cli/internal/vite-config/vite/plugin/compress.ts +0 -31
- package/template-mobile-vant-cli/internal/vite-config/vite/plugin/html.ts +0 -32
- package/template-mobile-vant-cli/internal/vite-config/vite/plugin/index.ts +0 -74
- package/template-mobile-vant-cli/internal/vite-config/vite/plugin/visualizer.ts +0 -14
- package/template-mobile-vant-cli/internal/vite-config/vite/plugin/viteNotice.ts +0 -40
- package/template-mobile-vant-cli/mock/config/permissions.ts +0 -15
- package/template-mobile-vant-cli/mock/config/user/id.ts +0 -5
- package/template-mobile-vant-cli/mock/config/user/index.ts +0 -96
- package/template-mobile-vant-cli/mock/index.ts +0 -55
- package/template-mobile-vant-cli/mock/routers/table/index.fake.ts +0 -22
- package/template-mobile-vant-cli/mock/routers/user/account.fake.ts +0 -52
- package/template-mobile-vant-cli/mock/routers/user/index.fake.ts +0 -46
- package/template-mobile-vant-cli/mock/utils/crypto.ts +0 -21
- package/template-mobile-vant-cli/mock/utils/table.ts +0 -96
- package/template-mobile-vant-cli/mock/utils/util.ts +0 -91
- package/template-mobile-vant-cli/package.json +0 -74
- package/template-mobile-vant-cli/public/css/default.css +0 -54
- package/template-mobile-vant-cli/public/favicon.ico +0 -0
- package/template-mobile-vant-cli/src/App.vue +0 -9
- package/template-mobile-vant-cli/src/assets/logo.png +0 -0
- package/template-mobile-vant-cli/src/components/PageContainer/ProSkeleton.tsx +0 -29
- package/template-mobile-vant-cli/src/components/PageContainer/index.tsx +0 -207
- package/template-mobile-vant-cli/src/components/PageContainer/style.module.less +0 -17
- package/template-mobile-vant-cli/src/components/TabsMenu/index.vue +0 -45
- package/template-mobile-vant-cli/src/core/gx-design/index.ts +0 -7
- package/template-mobile-vant-cli/src/core/index.ts +0 -5
- package/template-mobile-vant-cli/src/design/color.less +0 -1
- package/template-mobile-vant-cli/src/design/config.less +0 -5
- package/template-mobile-vant-cli/src/design/index.less +0 -3
- package/template-mobile-vant-cli/src/design/mixin.less +0 -65
- package/template-mobile-vant-cli/src/design/reset.less +0 -39
- package/template-mobile-vant-cli/src/design/root.less +0 -3
- package/template-mobile-vant-cli/src/design/vant/index.less +0 -0
- package/template-mobile-vant-cli/src/hooks/web/index.ts +0 -5
- package/template-mobile-vant-cli/src/hooks/web/usePageLoading.ts +0 -56
- package/template-mobile-vant-cli/src/layout/BasicLayout/index.vue +0 -18
- package/template-mobile-vant-cli/src/layout/BasicLayout/style.less +0 -3
- package/template-mobile-vant-cli/src/layout/UserLayout/index.vue +0 -18
- package/template-mobile-vant-cli/src/layout/UserLayout/style.module.less +0 -36
- package/template-mobile-vant-cli/src/main.ts +0 -34
- package/template-mobile-vant-cli/src/pages/Account/details.vue +0 -13
- package/template-mobile-vant-cli/src/pages/Account/index.vue +0 -102
- package/template-mobile-vant-cli/src/pages/Home/index.vue +0 -71
- package/template-mobile-vant-cli/src/pages/user/login/index.vue +0 -74
- package/template-mobile-vant-cli/src/plugins/dayjs/index.ts +0 -3
- package/template-mobile-vant-cli/src/plugins/index.ts +0 -2
- package/template-mobile-vant-cli/src/router/guard/index.ts +0 -18
- package/template-mobile-vant-cli/src/router/guard/permissions.ts +0 -41
- package/template-mobile-vant-cli/src/router/guard/stateGuard.ts +0 -10
- package/template-mobile-vant-cli/src/router/index.ts +0 -31
- package/template-mobile-vant-cli/src/router/routes/index.ts +0 -46
- package/template-mobile-vant-cli/src/router/routes/modules/dataSource.ts +0 -32
- package/template-mobile-vant-cli/src/services/index.ts +0 -31
- package/template-mobile-vant-cli/src/services/userCenter/account.ts +0 -42
- package/template-mobile-vant-cli/src/services/userCenter/index.ts +0 -28
- package/template-mobile-vant-cli/src/store/index.ts +0 -20
- package/template-mobile-vant-cli/src/store/modules/global.ts +0 -23
- package/template-mobile-vant-cli/src/store/modules/user.ts +0 -107
- package/template-mobile-vant-cli/src/utils/accessToken.ts +0 -97
- package/template-mobile-vant-cli/src/utils/crypto/index.ts +0 -56
- package/template-mobile-vant-cli/src/utils/env.ts +0 -50
- package/template-mobile-vant-cli/src/utils/pageTitle.ts +0 -20
- package/template-mobile-vant-cli/src/utils/request/XHR.ts +0 -137
- package/template-mobile-vant-cli/src/utils/request/axiosCancel.ts +0 -69
- package/template-mobile-vant-cli/src/utils/request/checkStatus.ts +0 -25
- package/template-mobile-vant-cli/src/utils/request/index.ts +0 -155
- package/template-mobile-vant-cli/src/utils/request/typings.ts +0 -171
- package/template-mobile-vant-cli/src/utils/storage.ts +0 -215
- package/template-mobile-vant-cli/src/utils/util.ts +0 -27
- package/template-mobile-vant-cli/src/utils/validate.ts +0 -211
- package/template-mobile-vant-cli/tsconfig.json +0 -50
- package/template-mobile-vant-cli/types/auto-imports.d.ts +0 -80
- package/template-mobile-vant-cli/types/components.d.ts +0 -7
- package/template-mobile-vant-cli/types/config.d.ts +0 -56
- package/template-mobile-vant-cli/types/global.d.ts +0 -80
- package/template-mobile-vant-cli/types/mock.d.ts +0 -34
- package/template-mobile-vant-cli/types/module.d.ts +0 -53
- package/template-mobile-vant-cli/types/response.d.ts +0 -17
- package/template-mobile-vant-cli/types/system.d.ts +0 -58
- package/template-mobile-vant-cli/types/vant-import.d.ts +0 -24
- package/template-mobile-vant-cli/unocss.config.ts +0 -155
- package/template-mobile-vant-cli/vite.config.ts +0 -142
- package/template-mobile-vant-html/README.md +0 -4
- package/template-mobile-vant-html/css/global.css +0 -293
- package/template-mobile-vant-html/css/global.css.map +0 -1
- package/template-mobile-vant-html/css/global.less +0 -293
- package/template-mobile-vant-html/css/index.css +0 -20
- package/template-mobile-vant-html/css/index.css.map +0 -1
- package/template-mobile-vant-html/css/index.less +0 -21
- package/template-mobile-vant-html/image/disconnected.svg +0 -60
- package/template-mobile-vant-html/image/empty.svg +0 -52
- package/template-mobile-vant-html/image/error.svg +0 -53
- package/template-mobile-vant-html/image/loading.svg +0 -1
- package/template-mobile-vant-html/index.html +0 -91
- package/template-mobile-vant-html/js/index.js +0 -29
- package/template-mobile-vant-html/js/plugin/day.min.js +0 -1
- package/template-mobile-vant-html/js/plugin/fastclick.js +0 -730
- package/template-mobile-vant-html/js/plugin/jquery.min.js +0 -2
- package/template-mobile-vant-html/js/plugin/rem.js +0 -28
- package/template-mobile-vant-html/js/utils/appUtil.js +0 -70
- package/template-mobile-vant-html/js/utils/config.js +0 -3
- package/template-mobile-vant-html/js/utils/request.js +0 -61
- package/template-mobile-vant-html/js/utils/utils.js +0 -65
- package/template-mobile-vant-html/js/utils/validate.js +0 -292
@@ -1,96 +0,0 @@
|
|
1
|
-
import { getRandomNumber } from '@gx-design-vue/pro-utils'
|
2
|
-
import dayjs from 'dayjs'
|
3
|
-
import { cloneDeep } from 'lodash-es'
|
4
|
-
import Mockjs from 'mockjs'
|
5
|
-
import { getArraryList } from './util'
|
6
|
-
|
7
|
-
export interface ListItem {
|
8
|
-
createTime: string | null;
|
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 = (index: number) => ({
|
24
|
-
id: index + 1,
|
25
|
-
uuid: getRandomNumber().uuid(10),
|
26
|
-
createTime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
27
|
-
}) as any
|
28
|
-
const list: (T & ListItem)[] = getArraryList(max, index => mockParams(index))
|
29
|
-
|
30
|
-
return list.map((item, index) => {
|
31
|
-
return {
|
32
|
-
...item,
|
33
|
-
createTime: dayjs()
|
34
|
-
.subtract(Mockjs.Random.integer(3, 60), 'day')
|
35
|
-
.subtract(Mockjs.Random.integer(2, 6), 'hour')
|
36
|
-
.subtract(Mockjs.Random.integer(1, 59), 'minute')
|
37
|
-
.subtract(Mockjs.Random.integer(1, 59), 'second')
|
38
|
-
.format('YYYY-MM-DD HH:mm:ss'),
|
39
|
-
...callbackParams?.(index)
|
40
|
-
}
|
41
|
-
})
|
42
|
-
}
|
43
|
-
|
44
|
-
export function handlePageList<T>(
|
45
|
-
dataSource: T[],
|
46
|
-
{ pageNum, pageSize, callBack }: {
|
47
|
-
pageNum: number;
|
48
|
-
pageSize: number;
|
49
|
-
callBack?: (data: T[]) => T[]
|
50
|
-
}
|
51
|
-
): T[] {
|
52
|
-
if (callBack)
|
53
|
-
dataSource = callBack?.(dataSource)
|
54
|
-
return cloneDeep(dataSource).filter(
|
55
|
-
(_, sort) => (sort < pageNum * pageSize) && (sort >= pageSize * (pageNum - 1))
|
56
|
-
)
|
57
|
-
}
|
58
|
-
|
59
|
-
export function compareToMaxTime(obj1, obj2, key, type: 0 | 1 = 0) {
|
60
|
-
const val1 = obj1[key]
|
61
|
-
const val2 = obj2[key]
|
62
|
-
let result = 0
|
63
|
-
if (dayjs(val1).isBefore(dayjs(val2))) {
|
64
|
-
result = type === 0 ? -1 : 0
|
65
|
-
} else if (dayjs(val1).isAfter(dayjs(val2))) {
|
66
|
-
result = type === 0 ? 0 : (-1)
|
67
|
-
}
|
68
|
-
return result
|
69
|
-
}
|
70
|
-
|
71
|
-
export function postDataSource<T>(
|
72
|
-
dataSource: (Omit<T, 'id' | 'createTime'> & ListItem)[],
|
73
|
-
type: 'delete' | 'add' | 'update' = 'update',
|
74
|
-
options?: { key?: string; params: Partial<(Omit<T, 'id' | 'createTime'> & ListItem)> }
|
75
|
-
) {
|
76
|
-
if (type === 'update') {
|
77
|
-
dataSource = dataSource.map((item: any) => {
|
78
|
-
// @ts-ignore
|
79
|
-
if (options?.params?.[options.key] === item[options?.key])
|
80
|
-
return { ...item, ...options?.params }
|
81
|
-
return item
|
82
|
-
})
|
83
|
-
}
|
84
|
-
if (type === 'add') {
|
85
|
-
dataSource.unshift({
|
86
|
-
...options?.params as (Omit<T, 'id' | 'createTime'> & ListItem),
|
87
|
-
id: dataSource.length + 1
|
88
|
-
})
|
89
|
-
}
|
90
|
-
if (type === 'delete') {
|
91
|
-
// @ts-ignore
|
92
|
-
dataSource = dataSource.filter(item => options?.params?.[options.key] !== item[options?.key])
|
93
|
-
}
|
94
|
-
|
95
|
-
return dataSource
|
96
|
-
}
|
@@ -1,91 +0,0 @@
|
|
1
|
-
import Mockjs from 'mockjs'
|
2
|
-
import { defaultSettings } from '@gx-config'
|
3
|
-
import { deepMerge, isObject, getRandomNumber } from '@gx-design-vue/pro-utils'
|
4
|
-
import { toLower } from 'lodash-es'
|
5
|
-
import { tokenAccount, userList } from '../config/user'
|
6
|
-
import userIds from '../config/user/id'
|
7
|
-
import { Decrypt, Encrypt } from './crypto'
|
8
|
-
|
9
|
-
const { mock, token } = defaultSettings
|
10
|
-
|
11
|
-
export function handleRandomImage(width = 50, height = 50) {
|
12
|
-
return `https://picsum.photos/${width}/${height}?random=${getRandomNumber().uuid(10)}`
|
13
|
-
}
|
14
|
-
|
15
|
-
export function getMobile() {
|
16
|
-
const mobile_prefix = [ '134', '135', '136', '137', '138', '139', '150', '151',
|
17
|
-
'152', '157', '158', '159', '130', '131', '132', '155', '156', '133', '153' ]
|
18
|
-
return getMockRandowList(mobile_prefix) + Mockjs.mock(/\d{8}/)
|
19
|
-
}
|
20
|
-
|
21
|
-
export function getTokenBuUserId(token) {
|
22
|
-
return Number(Object.keys(tokenAccount).find(item => tokenAccount[item] === token))
|
23
|
-
}
|
24
|
-
|
25
|
-
export function getToken(headers: RequestHeater): string | undefined {
|
26
|
-
return headers?.[toLower(token.name)]
|
27
|
-
}
|
28
|
-
|
29
|
-
export function tokenByUserInfo(token): UserDetails {
|
30
|
-
return Decrypt(token)
|
31
|
-
}
|
32
|
-
|
33
|
-
export function createrToken(token) {
|
34
|
-
const userInfo = userList.find(item => item.user?.userId === getTokenBuUserId(token))
|
35
|
-
return Encrypt({ userId: userInfo?.user?.userId })
|
36
|
-
}
|
37
|
-
|
38
|
-
export function checkToken(token) {
|
39
|
-
if (mock.checkToken === -1) return true
|
40
|
-
if (token) {
|
41
|
-
if (mock.checkToken === 0) return true
|
42
|
-
|
43
|
-
const useInfo: UserDetails = tokenByUserInfo(token)
|
44
|
-
return useInfo ? useInfo?.userId && userIds.some(item => useInfo?.userId === item.id) : false
|
45
|
-
}
|
46
|
-
return false
|
47
|
-
}
|
48
|
-
|
49
|
-
export const checkBackDataFun = (
|
50
|
-
config: Partial<ResponseResult>,
|
51
|
-
token: string,
|
52
|
-
merageRoot?: boolean
|
53
|
-
): ResponseResult => {
|
54
|
-
let result: Partial<ResponseResult> = {
|
55
|
-
code: 200,
|
56
|
-
data: null
|
57
|
-
}
|
58
|
-
if (isObject(config)) {
|
59
|
-
const { data } = config
|
60
|
-
if (merageRoot) {
|
61
|
-
result = deepMerge(result, config, {
|
62
|
-
omitEmpty: false,
|
63
|
-
omitNil: false
|
64
|
-
})
|
65
|
-
} else {
|
66
|
-
result.data = config
|
67
|
-
}
|
68
|
-
if (data) {
|
69
|
-
result.data = data
|
70
|
-
}
|
71
|
-
} else {
|
72
|
-
result.data = config as any
|
73
|
-
}
|
74
|
-
|
75
|
-
const invaiteToken = checkToken(token)
|
76
|
-
|
77
|
-
return deepMerge<ResponseResult>(result as unknown as ResponseResult, {
|
78
|
-
code: invaiteToken ? 200 : 401,
|
79
|
-
message: invaiteToken
|
80
|
-
? (result.message || result.code) ? 'success' : 'Request failed'
|
81
|
-
: 'Invalid token!'
|
82
|
-
})
|
83
|
-
}
|
84
|
-
|
85
|
-
export function getArraryList<T>(length: number, callback: (key: number) => T) {
|
86
|
-
return Array.from({ length }).map((_, key) => callback(key))
|
87
|
-
}
|
88
|
-
|
89
|
-
export function getMockRandowList<T = any>(data: T[]) {
|
90
|
-
return data[Mockjs.Random.integer(0, data.length - 1)] as T
|
91
|
-
}
|
@@ -1,74 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "gx-vant-mobile",
|
3
|
-
"version": "0.0.0",
|
4
|
-
"type": "module",
|
5
|
-
"scripts": {
|
6
|
-
"bootstrap": "pnpm i",
|
7
|
-
"dev": "pnpm run start:dev",
|
8
|
-
"start:dev": "cross-env VITE_APP_ENV=dev vite",
|
9
|
-
"start:pro": "cross-env VITE_APP_ENV=pro vite",
|
10
|
-
"build": "vite build",
|
11
|
-
"build:pro": "vite build --mode pro",
|
12
|
-
"report": "cross-env REPORT=true npm run build",
|
13
|
-
"preview": "vite preview",
|
14
|
-
"clean:lib": "rimraf pnpm-lock.yaml && rimraf node_modules",
|
15
|
-
"lint": "eslint .",
|
16
|
-
"lint:fix": "eslint . --fix"
|
17
|
-
},
|
18
|
-
"dependencies": {
|
19
|
-
"@gx-design-vue/pro-hooks": "^0.2.0-beta.43",
|
20
|
-
"@gx-design-vue/pro-utils": "^0.2.0-beta.61",
|
21
|
-
"@multiavatar/multiavatar": "^1.0.7",
|
22
|
-
"@vueuse/core": "^12.0.0",
|
23
|
-
"@vueuse/shared": "^12.0.0",
|
24
|
-
"axios": "^1.6.7",
|
25
|
-
"crypto-js": "^4.1.1",
|
26
|
-
"dayjs": "^1.11.13",
|
27
|
-
"lodash-es": "^4.17.21",
|
28
|
-
"pinia": "^2.2.6",
|
29
|
-
"qs": "^6.11.0",
|
30
|
-
"unocss": "^0.65.1",
|
31
|
-
"vant": "^4.9.15",
|
32
|
-
"vue": "^3.5.13",
|
33
|
-
"vue-router": "^4.5.0"
|
34
|
-
},
|
35
|
-
"devDependencies": {
|
36
|
-
"@antfu/eslint-config": "^3.11.2",
|
37
|
-
"@types/mockjs": "^1.0.10",
|
38
|
-
"@commitlint/cli": "^19.5.0",
|
39
|
-
"@commitlint/config-conventional": "^19.5.0",
|
40
|
-
"@iconify-json/carbon": "^1.2.5",
|
41
|
-
"@types/lodash-es": "^4.17.10",
|
42
|
-
"@types/node": "^22.8.4",
|
43
|
-
"@types/qs": "^6.9.7",
|
44
|
-
"@unocss/preset-rem-to-px": "^0.65.3",
|
45
|
-
"@vant/auto-import-resolver": "^1.2.1",
|
46
|
-
"@vitejs/plugin-legacy": "^6.0.0",
|
47
|
-
"@vitejs/plugin-vue": "^5.2.1",
|
48
|
-
"@vitejs/plugin-vue-jsx": "^4.1.1",
|
49
|
-
"mockjs": "^1.1.0",
|
50
|
-
"autoprefixer": "^10.4.5",
|
51
|
-
"bundle-require": "^5.0.0",
|
52
|
-
"cross-env": "^7.0.3",
|
53
|
-
"husky": "^9.1.6",
|
54
|
-
"less": "^4.1.3",
|
55
|
-
"postcss": "^8.4.35",
|
56
|
-
"postcss-html": "^1.6.0",
|
57
|
-
"postcss-less": "^6.0.0",
|
58
|
-
"postcss-mobile-forever": "^4.3.1",
|
59
|
-
"postcss-pxtorem": "^6.0.0",
|
60
|
-
"prettier": "^3.3.3",
|
61
|
-
"rimraf": "^6.0.1",
|
62
|
-
"rollup-plugin-external-globals": "^0.13.0",
|
63
|
-
"rollup-plugin-visualizer": "^5.12.0",
|
64
|
-
"typescript": "^5.3.3",
|
65
|
-
"unplugin-auto-import": "^0.19.0",
|
66
|
-
"unplugin-turbo-console": "^1.10.4",
|
67
|
-
"unplugin-vue-components": "^0.28.0",
|
68
|
-
"vite": "^6.0.3",
|
69
|
-
"vite-plugin-compression": "0.5.1",
|
70
|
-
"vite-plugin-fake-server": "^2.1.4",
|
71
|
-
"vite-plugin-html": "^3.2.2",
|
72
|
-
"vue-tsc": "^2.1.6"
|
73
|
-
}
|
74
|
-
}
|
@@ -1,54 +0,0 @@
|
|
1
|
-
:root {
|
2
|
-
--van-base-font: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Segoe UI, Arial, Roboto, "PingFang SC", "miui", "Hiragino Sans GB", "Microsoft Yahei", sans-serif;
|
3
|
-
}
|
4
|
-
|
5
|
-
body {
|
6
|
-
font-family: var(--van-base-font);
|
7
|
-
}
|
8
|
-
|
9
|
-
.gx-toast-loading {
|
10
|
-
position: fixed;
|
11
|
-
top: 0;
|
12
|
-
left: 0;
|
13
|
-
width: 100%;
|
14
|
-
height: 100%;
|
15
|
-
display: flex;
|
16
|
-
justify-content: center;
|
17
|
-
align-items: center;
|
18
|
-
text-align: center;
|
19
|
-
z-index: 9999999999;
|
20
|
-
}
|
21
|
-
.gx-toast-loading .gx-toast-loading-cont {
|
22
|
-
display: flex;
|
23
|
-
flex-direction: column;
|
24
|
-
justify-content: center;
|
25
|
-
align-items: center;
|
26
|
-
box-sizing: content-box;
|
27
|
-
width: min(23.467vw, 140.8px);
|
28
|
-
min-height: min(23.467vw, 140.8px);
|
29
|
-
max-width: 70%;
|
30
|
-
padding: min(4.267vw, 25.6px);
|
31
|
-
border-radius: min(2.133vw, 12.8px);
|
32
|
-
background-clip: padding-box;
|
33
|
-
color: #fff;
|
34
|
-
background-color: rgba(58, 58, 58, 0.9);
|
35
|
-
font-size: min(3.733vw, 22.4px);
|
36
|
-
line-height: min(5.333vw, 32px);
|
37
|
-
}
|
38
|
-
.gx-toast-loading .gx-toast-loading-cont .gx-toast-svg {
|
39
|
-
margin: 0;
|
40
|
-
width: min(8vw, 48px);
|
41
|
-
height: min(8vw, 48px);
|
42
|
-
display: inline-block;
|
43
|
-
animation: spinner-anime 1s linear infinite;
|
44
|
-
}
|
45
|
-
.gx-toast-loading .gx-toast-loading-cont .gx-toast-svg-text {
|
46
|
-
display: inline-block;
|
47
|
-
margin-top: min(2.133vw, 12.8px);
|
48
|
-
}
|
49
|
-
|
50
|
-
@keyframes spinner-anime {
|
51
|
-
100% {
|
52
|
-
transform: rotate(360deg);
|
53
|
-
}
|
54
|
-
}
|
Binary file
|
Binary file
|
@@ -1,29 +0,0 @@
|
|
1
|
-
import type { FunctionalComponent } from 'vue'
|
2
|
-
import { Skeleton } from 'vant'
|
3
|
-
import styles from './style.module.less'
|
4
|
-
|
5
|
-
import 'vant/es/skeleton/style'
|
6
|
-
|
7
|
-
const Proskeleton: FunctionalComponent<{ line: number; loading: boolean }> = (props, { slots }) => {
|
8
|
-
const renderMapItem = () => {
|
9
|
-
const show: any[] = []
|
10
|
-
for (let i = 0; i < props.line; i += 1) {
|
11
|
-
show.push(
|
12
|
-
<div class={styles.skeletonItem}>
|
13
|
-
<Skeleton row={3} loading />
|
14
|
-
</div>
|
15
|
-
)
|
16
|
-
}
|
17
|
-
return show
|
18
|
-
}
|
19
|
-
|
20
|
-
return (
|
21
|
-
<>
|
22
|
-
{
|
23
|
-
props.loading ? renderMapItem() : <>{ slots.default?.() }</>
|
24
|
-
}
|
25
|
-
</>
|
26
|
-
)
|
27
|
-
}
|
28
|
-
|
29
|
-
export default Proskeleton
|
@@ -1,207 +0,0 @@
|
|
1
|
-
import type { SetLoadingParams } from '@gx-mobile/hooks/web/usePageLoading'
|
2
|
-
import type { NavBarProps } from 'vant'
|
3
|
-
import { classNames, getSlot, getSlotVNode, isFunction, VueNode, WithFalse } from '@gx-design-vue/pro-utils'
|
4
|
-
import { usePageLoading } from '@gx-mobile/hooks/web'
|
5
|
-
import { useScroll } from '@vueuse/core'
|
6
|
-
import { Icon, NavBar } from 'vant'
|
7
|
-
import { defineComponent, ref, type SlotsType, Teleport, toRefs, watch } from 'vue'
|
8
|
-
import ProSkeleton from './ProSkeleton'
|
9
|
-
import styles from './style.module.less'
|
10
|
-
import 'vant/es/nav-bar/style'
|
11
|
-
|
12
|
-
export type PageLoadingTpe = 'toast' | 'skeleton'
|
13
|
-
|
14
|
-
type ChangeLoadingParams<T> = Omit<SetLoadingParams<T>, 'type'> & {
|
15
|
-
hiddenSlot?: boolean;
|
16
|
-
}
|
17
|
-
|
18
|
-
const PageContainer = defineComponent({
|
19
|
-
name: 'GPageContainer',
|
20
|
-
inheritAttrs: false,
|
21
|
-
props: {
|
22
|
-
loading: {
|
23
|
-
type: Boolean as VuePropType<boolean>,
|
24
|
-
default: false
|
25
|
-
},
|
26
|
-
nav: {
|
27
|
-
type: [ Boolean, Function, Object, Array ] as VuePropType<WithFalse<VueNode>>,
|
28
|
-
default: false
|
29
|
-
},
|
30
|
-
navProps: Object as VuePropType<NavBarProps>,
|
31
|
-
backTop: {
|
32
|
-
type: [ Boolean, Function, Object, Array ] as VuePropType<WithFalse<VueNode>>,
|
33
|
-
default: false
|
34
|
-
},
|
35
|
-
wrapperClass: String as VuePropType<string>,
|
36
|
-
backTopProps: {
|
37
|
-
type: Object as VuePropType<{
|
38
|
-
style: CSSProperties;
|
39
|
-
count: number;
|
40
|
-
}>,
|
41
|
-
default: () => ({
|
42
|
-
count: 300
|
43
|
-
})
|
44
|
-
},
|
45
|
-
hiddenSlot: {
|
46
|
-
type: Boolean as VuePropType<boolean>,
|
47
|
-
default: true
|
48
|
-
},
|
49
|
-
loadingMsg: {
|
50
|
-
type: String as VuePropType<string>,
|
51
|
-
default: '加载中'
|
52
|
-
},
|
53
|
-
loadingType: {
|
54
|
-
type: String as VuePropType<PageLoadingTpe>,
|
55
|
-
default: 'toast'
|
56
|
-
},
|
57
|
-
bgColor: {
|
58
|
-
type: String as VuePropType<string>,
|
59
|
-
default: 'var(--van-gray-1)'
|
60
|
-
},
|
61
|
-
onNavClickLeft: Function as VuePropType<() => void>,
|
62
|
-
'onUpdate:loading': Function as VuePropType<(val: boolean) => void>,
|
63
|
-
onScroll: Function as VuePropType<(value: number) => void>
|
64
|
-
},
|
65
|
-
slots: Object as SlotsType<{
|
66
|
-
default(): void
|
67
|
-
backTop(): void
|
68
|
-
nav(props: NavBarProps): void
|
69
|
-
}>,
|
70
|
-
emits: [ 'update:loading', 'scroll', 'navClickLeft' ],
|
71
|
-
setup(props, { attrs, slots, expose, emit }) {
|
72
|
-
const route = useRoute() as unknown as AppRouteModule
|
73
|
-
const router = useRouter()
|
74
|
-
const { loading: loadingRef, loadingType, loadingMsg, hiddenSlot } = toRefs(props)
|
75
|
-
|
76
|
-
const backTopEl = ref()
|
77
|
-
const viewScrollRoot = ref()
|
78
|
-
const initStatus = ref(true)
|
79
|
-
const showBackTop = ref(false)
|
80
|
-
const hiddenSlotRef = ref(props.hiddenSlot)
|
81
|
-
|
82
|
-
const navTitle = computed(() => route.meta?.name ?? route.meta?.title as string)
|
83
|
-
|
84
|
-
const { y } = useScroll(viewScrollRoot, {
|
85
|
-
behavior: 'smooth'
|
86
|
-
})
|
87
|
-
|
88
|
-
const [ loading, setLoading ] = usePageLoading({
|
89
|
-
defaultType: loadingType.value,
|
90
|
-
defaultMessage: loadingMsg.value,
|
91
|
-
defaultLoading: loadingRef.value
|
92
|
-
})
|
93
|
-
|
94
|
-
watch(() => loading.value, (val) => {
|
95
|
-
if (initStatus.value && val) initStatus.value = false
|
96
|
-
emit('update:loading', val)
|
97
|
-
}, {
|
98
|
-
deep: true,
|
99
|
-
immediate: true
|
100
|
-
})
|
101
|
-
|
102
|
-
watch(() => loadingRef.value, (val) => {
|
103
|
-
if (loadingType.value === 'toast') {
|
104
|
-
setLoading({
|
105
|
-
value: val,
|
106
|
-
type: loadingType.value,
|
107
|
-
message: loadingMsg.value
|
108
|
-
})
|
109
|
-
} else if (initStatus.value || !val) {
|
110
|
-
setLoading({
|
111
|
-
value: val,
|
112
|
-
type: loadingType.value,
|
113
|
-
message: loadingMsg.value
|
114
|
-
})
|
115
|
-
}
|
116
|
-
})
|
117
|
-
|
118
|
-
watch(() => hiddenSlot.value, (val) => {
|
119
|
-
hiddenSlotRef.value = val
|
120
|
-
}, {
|
121
|
-
immediate: true
|
122
|
-
})
|
123
|
-
|
124
|
-
watch(() => y.value, (val) => {
|
125
|
-
showBackTop.value = val > props.backTopProps?.count
|
126
|
-
props.onScroll?.(val)
|
127
|
-
})
|
128
|
-
|
129
|
-
onMounted(() => {
|
130
|
-
viewScrollRoot.value = document.querySelector('#basic-layout-content')
|
131
|
-
backTopEl.value = document.querySelector('#basic-layout-back-top')
|
132
|
-
})
|
133
|
-
|
134
|
-
const changeLoading = ({
|
135
|
-
value,
|
136
|
-
message,
|
137
|
-
hiddenSlot
|
138
|
-
}: ChangeLoadingParams<boolean>) => {
|
139
|
-
if (loadingType.value === 'toast') {
|
140
|
-
hiddenSlotRef.value = !!hiddenSlot
|
141
|
-
setLoading({ value, message, type: loadingType.value })
|
142
|
-
}
|
143
|
-
}
|
144
|
-
|
145
|
-
function navClickLeft() {
|
146
|
-
if (props.onNavClickLeft) {
|
147
|
-
props.onNavClickLeft()
|
148
|
-
} else {
|
149
|
-
router.back()
|
150
|
-
}
|
151
|
-
}
|
152
|
-
|
153
|
-
expose({
|
154
|
-
toggleLoading: changeLoading,
|
155
|
-
setScrollTop: (val: number) => y.value = val
|
156
|
-
})
|
157
|
-
|
158
|
-
return () => {
|
159
|
-
const navProps = {
|
160
|
-
fixed: true,
|
161
|
-
placeholder: true,
|
162
|
-
leftArrow: true,
|
163
|
-
title: navTitle.value,
|
164
|
-
...(props.navProps || {})
|
165
|
-
} as NavBarProps
|
166
|
-
const navSlot = getSlot(slots, props, 'nav')
|
167
|
-
const backTopRender = getSlotVNode(slots, props, 'backTop')
|
168
|
-
return (
|
169
|
-
<div class={styles.pageContainer} style={{ backgroundColor: props.bgColor, ...(attrs?.style as any || {}) }}>
|
170
|
-
{props.nav !== false && (
|
171
|
-
<>
|
172
|
-
{isFunction(navSlot)
|
173
|
-
? navSlot?.({ ...navProps })
|
174
|
-
: (
|
175
|
-
<NavBar{...navProps} onClickLeft={() => navClickLeft()} />
|
176
|
-
)}
|
177
|
-
</>
|
178
|
-
)}
|
179
|
-
<div class={classNames(styles.pageContainerWrapper, props.wrapperClass || '')}>
|
180
|
-
{
|
181
|
-
loadingType.value === 'skeleton'
|
182
|
-
? (
|
183
|
-
<ProSkeleton line={3} loading={loading.value}>
|
184
|
-
{slots.default?.()}
|
185
|
-
</ProSkeleton>
|
186
|
-
)
|
187
|
-
: ((!loading.value || !hiddenSlotRef.value) && <>{slots.default?.()}</>)
|
188
|
-
}
|
189
|
-
</div>
|
190
|
-
{
|
191
|
-
!!backTopEl.value && showBackTop.value && props.backTop !== false && (
|
192
|
-
<Teleport to="#basic-layout-back-top">
|
193
|
-
{backTopRender || (
|
194
|
-
<div class={styles.pageBackTop} onClick={() => y.value = 0} style={props.backTopProps?.style}>
|
195
|
-
<Icon name="back-top" class="relative top-1.5px" />
|
196
|
-
</div>
|
197
|
-
)}
|
198
|
-
</Teleport>
|
199
|
-
)
|
200
|
-
}
|
201
|
-
</div>
|
202
|
-
)
|
203
|
-
}
|
204
|
-
}
|
205
|
-
})
|
206
|
-
|
207
|
-
export default PageContainer
|
@@ -1,17 +0,0 @@
|
|
1
|
-
.pageContainer {
|
2
|
-
width: 100%;
|
3
|
-
min-height: calc(100vh - var(--van-tabbar-height));
|
4
|
-
padding: 15px;
|
5
|
-
|
6
|
-
.pageContainerWrapper {
|
7
|
-
position: relative;
|
8
|
-
}
|
9
|
-
|
10
|
-
.skeletonItem + .skeletonItem {
|
11
|
-
margin-top: 50px;
|
12
|
-
}
|
13
|
-
}
|
14
|
-
|
15
|
-
.pageBackTop {
|
16
|
-
--at-apply: rd-50\% overflow-hidden flex-center bg-[#4187f2] text-20px text-[#fff] w-45px h-45px right-20px bottom-60px absolute z-100;
|
17
|
-
}
|
@@ -1,45 +0,0 @@
|
|
1
|
-
<script setup lang="ts">
|
2
|
-
import { cloneDeep } from 'lodash-es'
|
3
|
-
|
4
|
-
const route = useRoute() as unknown as AppRouteModule
|
5
|
-
const router = useRouter()
|
6
|
-
|
7
|
-
function getMenuState() {
|
8
|
-
const menuState = {
|
9
|
-
data: [] as AppRouteModule[],
|
10
|
-
map: new Map<string, AppRouteModule>()
|
11
|
-
}
|
12
|
-
router.getRoutes().forEach((item: AppRouteModule) => {
|
13
|
-
if (item.meta?.isMenu) {
|
14
|
-
menuState.data.push(item)
|
15
|
-
menuState.map.set(item.name as string, item)
|
16
|
-
}
|
17
|
-
})
|
18
|
-
return cloneDeep(menuState)
|
19
|
-
}
|
20
|
-
|
21
|
-
const menuState = reactive(getMenuState())
|
22
|
-
|
23
|
-
const selectKey = computed<string>(() => route.meta?.menuSelectKey ?? route.name as string)
|
24
|
-
|
25
|
-
const handleSelect = path => router.push(path)
|
26
|
-
</script>
|
27
|
-
|
28
|
-
<template>
|
29
|
-
<van-tabbar :model-value="selectKey" placeholder>
|
30
|
-
<van-tabbar-item
|
31
|
-
v-for="item in menuState.data"
|
32
|
-
:key="item.name"
|
33
|
-
replace
|
34
|
-
:name="item.name as string"
|
35
|
-
:icon="item.meta?.icon"
|
36
|
-
@click="handleSelect(item.path)"
|
37
|
-
>
|
38
|
-
{{ item.meta?.name ?? item.meta?.title }}
|
39
|
-
</van-tabbar-item>
|
40
|
-
</van-tabbar>
|
41
|
-
</template>
|
42
|
-
|
43
|
-
<style scoped lang="less">
|
44
|
-
|
45
|
-
</style>
|
@@ -1 +0,0 @@
|
|
1
|
-
/* 文字颜色相关 */
|