@gx-design-vue/create-gx-cli 0.1.19 → 0.1.21
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/README.md +1 -4
- package/dist/index.js +36 -48
- package/package.json +5 -3
- package/template-mobile-vant-cli/.editorconfig +19 -0
- package/template-mobile-vant-cli/.env +3 -0
- package/template-mobile-vant-cli/.env.development +17 -0
- package/template-mobile-vant-cli/.env.pro +28 -0
- package/template-mobile-vant-cli/.env.production +31 -0
- package/template-mobile-vant-cli/.eslintignore +15 -0
- package/template-mobile-vant-cli/.prettierignore +9 -0
- package/template-mobile-vant-cli/README.md +1 -0
- package/template-mobile-vant-cli/commitlint.config.cjs +32 -0
- package/template-mobile-vant-cli/config/default/defaultSettings.ts +70 -0
- package/template-mobile-vant-cli/config/default/network.ts +10 -0
- package/template-mobile-vant-cli/config/default/proxy.ts +50 -0
- package/template-mobile-vant-cli/config/default/theme.ts +3 -0
- package/template-mobile-vant-cli/config/index.ts +11 -0
- package/template-mobile-vant-cli/eslint.config.js +58 -0
- package/template-mobile-vant-cli/index.html +25 -0
- package/template-mobile-vant-cli/internal/vite-config/generate/generateModifyVars.ts +7 -0
- package/template-mobile-vant-cli/internal/vite-config/rollupOptions/index.ts +22 -0
- package/template-mobile-vant-cli/internal/vite-config/util/hash.ts +17 -0
- package/template-mobile-vant-cli/internal/vite-config/util/index.ts +132 -0
- package/template-mobile-vant-cli/internal/vite-config/vite/cdn.ts +65 -0
- package/template-mobile-vant-cli/internal/vite-config/vite/optimizer.ts +26 -0
- package/template-mobile-vant-cli/internal/vite-config/vite/plugin/appConfig.ts +91 -0
- package/template-mobile-vant-cli/internal/vite-config/vite/plugin/autoImport.ts +28 -0
- package/template-mobile-vant-cli/internal/vite-config/vite/plugin/compress.ts +31 -0
- package/template-mobile-vant-cli/internal/vite-config/vite/plugin/html.ts +32 -0
- package/template-mobile-vant-cli/internal/vite-config/vite/plugin/index.ts +74 -0
- package/template-mobile-vant-cli/internal/vite-config/vite/plugin/visualizer.ts +14 -0
- package/template-mobile-vant-cli/internal/vite-config/vite/plugin/viteNotice.ts +40 -0
- package/template-mobile-vant-cli/mock/config/permissions.ts +15 -0
- package/template-mobile-vant-cli/mock/config/user/id.ts +5 -0
- package/template-mobile-vant-cli/mock/config/user/index.ts +96 -0
- package/template-mobile-vant-cli/mock/index.ts +55 -0
- package/template-mobile-vant-cli/mock/routers/table/index.fake.ts +22 -0
- package/template-mobile-vant-cli/mock/routers/user/account.fake.ts +52 -0
- package/template-mobile-vant-cli/mock/routers/user/index.fake.ts +46 -0
- package/template-mobile-vant-cli/mock/utils/crypto.ts +21 -0
- package/template-mobile-vant-cli/mock/utils/table.ts +96 -0
- package/template-mobile-vant-cli/mock/utils/util.ts +91 -0
- package/template-mobile-vant-cli/package.json +74 -0
- package/template-mobile-vant-cli/public/css/default.css +54 -0
- package/template-mobile-vant-cli/public/favicon.ico +0 -0
- package/template-mobile-vant-cli/src/App.vue +8 -0
- package/template-mobile-vant-cli/src/assets/logo.png +0 -0
- package/template-mobile-vant-cli/src/components/PageContainer/ProSkeleton.tsx +29 -0
- package/template-mobile-vant-cli/src/components/PageContainer/index.tsx +207 -0
- package/template-mobile-vant-cli/src/components/PageContainer/style.module.less +17 -0
- package/template-mobile-vant-cli/src/components/TabsMenu/index.vue +45 -0
- package/template-mobile-vant-cli/src/core/gx-design/index.ts +7 -0
- package/template-mobile-vant-cli/src/core/index.ts +5 -0
- package/template-mobile-vant-cli/src/design/color.less +1 -0
- package/template-mobile-vant-cli/src/design/config.less +5 -0
- package/template-mobile-vant-cli/src/design/index.less +3 -0
- package/template-mobile-vant-cli/src/design/mixin.less +65 -0
- package/template-mobile-vant-cli/src/design/reset.less +39 -0
- package/template-mobile-vant-cli/src/design/root.less +3 -0
- package/template-mobile-vant-cli/src/design/vant/index.less +0 -0
- package/template-mobile-vant-cli/src/hooks/web/index.ts +5 -0
- package/template-mobile-vant-cli/src/hooks/web/usePageLoading.ts +56 -0
- package/template-mobile-vant-cli/src/layout/BasicLayout/index.vue +18 -0
- package/template-mobile-vant-cli/src/layout/BasicLayout/style.less +3 -0
- package/template-mobile-vant-cli/src/layout/UserLayout/index.vue +18 -0
- package/template-mobile-vant-cli/src/layout/UserLayout/style.module.less +36 -0
- package/template-mobile-vant-cli/src/main.ts +34 -0
- package/template-mobile-vant-cli/src/pages/Account/details.vue +13 -0
- package/template-mobile-vant-cli/src/pages/Account/index.vue +102 -0
- package/template-mobile-vant-cli/src/pages/Home/index.vue +71 -0
- package/template-mobile-vant-cli/src/pages/user/login/index.vue +76 -0
- package/template-mobile-vant-cli/src/plugins/dayjs/index.ts +3 -0
- package/template-mobile-vant-cli/src/plugins/index.ts +2 -0
- package/template-mobile-vant-cli/src/router/guard/index.ts +18 -0
- package/template-mobile-vant-cli/src/router/guard/permissions.ts +41 -0
- package/template-mobile-vant-cli/src/router/guard/stateGuard.ts +10 -0
- package/template-mobile-vant-cli/src/router/index.ts +31 -0
- package/template-mobile-vant-cli/src/router/routes/index.ts +46 -0
- package/template-mobile-vant-cli/src/router/routes/modules/dataSource.ts +32 -0
- package/template-mobile-vant-cli/src/services/index.ts +31 -0
- package/template-mobile-vant-cli/src/services/userCenter/account.ts +42 -0
- package/template-mobile-vant-cli/src/services/userCenter/index.ts +28 -0
- package/template-mobile-vant-cli/src/store/index.ts +20 -0
- package/template-mobile-vant-cli/src/store/modules/global.ts +23 -0
- package/template-mobile-vant-cli/src/store/modules/user.ts +107 -0
- package/template-mobile-vant-cli/src/utils/accessToken.ts +97 -0
- package/template-mobile-vant-cli/src/utils/crypto/index.ts +56 -0
- package/template-mobile-vant-cli/src/utils/env.ts +50 -0
- package/template-mobile-vant-cli/src/utils/pageTitle.ts +20 -0
- package/template-mobile-vant-cli/src/utils/request/XHR.ts +137 -0
- package/template-mobile-vant-cli/src/utils/request/axiosCancel.ts +69 -0
- package/template-mobile-vant-cli/src/utils/request/checkStatus.ts +25 -0
- package/template-mobile-vant-cli/src/utils/request/index.ts +155 -0
- package/template-mobile-vant-cli/src/utils/request/typings.ts +171 -0
- package/template-mobile-vant-cli/src/utils/storage.ts +215 -0
- package/template-mobile-vant-cli/src/utils/util.ts +27 -0
- package/template-mobile-vant-cli/src/utils/validate.ts +211 -0
- package/template-mobile-vant-cli/tsconfig.json +50 -0
- package/template-mobile-vant-cli/types/auto-imports.d.ts +80 -0
- package/template-mobile-vant-cli/types/components.d.ts +7 -0
- package/template-mobile-vant-cli/types/config.d.ts +56 -0
- package/template-mobile-vant-cli/types/global.d.ts +80 -0
- package/template-mobile-vant-cli/types/mock.d.ts +34 -0
- package/template-mobile-vant-cli/types/module.d.ts +61 -0
- package/template-mobile-vant-cli/types/response.d.ts +17 -0
- package/template-mobile-vant-cli/types/system.d.ts +58 -0
- package/template-mobile-vant-cli/types/vant-import.d.ts +25 -0
- package/template-mobile-vant-cli/unocss.config.ts +161 -0
- package/template-mobile-vant-cli/vite.config.ts +142 -0
- package/template-mobile-vant-html/README.md +4 -0
- package/template-mobile-vant-html/css/global.css +293 -0
- package/template-mobile-vant-html/css/global.css.map +1 -0
- package/template-mobile-vant-html/css/global.less +293 -0
- package/template-mobile-vant-html/css/index.css +20 -0
- package/template-mobile-vant-html/css/index.css.map +1 -0
- package/template-mobile-vant-html/css/index.less +21 -0
- package/template-mobile-vant-html/image/disconnected.svg +60 -0
- package/template-mobile-vant-html/image/empty.svg +52 -0
- package/template-mobile-vant-html/image/error.svg +53 -0
- package/template-mobile-vant-html/image/loading.svg +1 -0
- package/template-mobile-vant-html/index.html +91 -0
- package/template-mobile-vant-html/js/index.js +29 -0
- package/template-mobile-vant-html/js/plugin/day.min.js +1 -0
- package/template-mobile-vant-html/js/plugin/fastclick.js +730 -0
- package/template-mobile-vant-html/js/plugin/jquery.min.js +2 -0
- package/template-mobile-vant-html/js/plugin/rem.js +28 -0
- package/template-mobile-vant-html/js/utils/appUtil.js +70 -0
- package/template-mobile-vant-html/js/utils/config.js +3 -0
- package/template-mobile-vant-html/js/utils/request.js +61 -0
- package/template-mobile-vant-html/js/utils/utils.js +65 -0
- package/template-mobile-vant-html/js/utils/validate.js +292 -0
- package/template-vite-project/.env +5 -0
- package/template-vite-project/.env.development +5 -0
- package/template-vite-project/.env.pro +5 -0
- package/template-vite-project/.env.production +5 -0
- package/template-vite-project/README.md +5 -0
- package/template-vite-project/_gitignore +24 -0
- package/template-vite-project/index.html +46 -0
- package/template-vite-project/internal/proxy/index.ts +47 -0
- package/template-vite-project/internal/vite/generate/generateModifyVars.ts +9 -0
- package/template-vite-project/internal/vite/rollupOptions/index.ts +18 -0
- package/template-vite-project/internal/vite/util/hash.ts +17 -0
- package/template-vite-project/internal/vite/util/index.ts +132 -0
- package/template-vite-project/internal/vite/vite/cdn.ts +65 -0
- package/template-vite-project/internal/vite/vite/plugin/appConfig.ts +91 -0
- package/template-vite-project/internal/vite/vite/plugin/autoImport.ts +28 -0
- package/template-vite-project/internal/vite/vite/plugin/compress.ts +31 -0
- package/template-vite-project/internal/vite/vite/plugin/html.ts +24 -0
- package/template-vite-project/internal/vite/vite/plugin/index.ts +72 -0
- package/template-vite-project/internal/vite/vite/plugin/visualizer.ts +14 -0
- package/template-vite-project/internal/vite/vite/plugin/viteNotice.ts +40 -0
- package/template-vite-project/node_modules/.bin/cross-env +21 -0
- package/template-vite-project/node_modules/.bin/cross-env-shell +21 -0
- package/template-vite-project/node_modules/.bin/esbuild +21 -0
- package/template-vite-project/node_modules/.bin/jiti +21 -0
- package/template-vite-project/node_modules/.bin/lessc +21 -0
- package/template-vite-project/node_modules/.bin/parser +21 -0
- package/template-vite-project/node_modules/.bin/rollup +21 -0
- package/template-vite-project/node_modules/.bin/terser +21 -0
- package/template-vite-project/node_modules/.bin/tsc +21 -0
- package/template-vite-project/node_modules/.bin/tsserver +21 -0
- package/template-vite-project/node_modules/.bin/vite +21 -0
- package/template-vite-project/node_modules/.bin/vue-tsc +21 -0
- package/template-vite-project/node_modules/.bin/yaml +21 -0
- package/template-vite-project/package.json +38 -0
- package/template-vite-project/public/css/index.css +89 -0
- package/template-vite-project/public/css/normalize.css +396 -0
- package/template-vite-project/public/vite.svg +1 -0
- package/template-vite-project/src/App.vue +30 -0
- package/template-vite-project/src/assets/vue.svg +1 -0
- package/template-vite-project/src/components/HelloWorld.vue +41 -0
- package/template-vite-project/src/design/config.less +0 -0
- package/template-vite-project/src/design/index.less +0 -0
- package/template-vite-project/src/main.ts +14 -0
- package/template-vite-project/src/utils/env.ts +50 -0
- package/template-vite-project/tsconfig.app.json +59 -0
- package/template-vite-project/tsconfig.json +7 -0
- package/template-vite-project/tsconfig.node.json +28 -0
- package/template-vite-project/types/global.d.ts +33 -0
- package/template-vite-project/unocss.config.ts +208 -0
- package/template-vite-project/vite.config.ts +88 -0
Binary file
|
Binary file
|
@@ -0,0 +1,29 @@
|
|
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
|
@@ -0,0 +1,207 @@
|
|
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
|
@@ -0,0 +1,17 @@
|
|
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
|
+
}
|
@@ -0,0 +1,45 @@
|
|
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>
|
@@ -0,0 +1 @@
|
|
1
|
+
/* 文字颜色相关 */
|
@@ -0,0 +1,65 @@
|
|
1
|
+
//一些less函数
|
2
|
+
|
3
|
+
.scrollbar() {
|
4
|
+
&::-webkit-scrollbar {
|
5
|
+
width: 6px;
|
6
|
+
height: 6px;
|
7
|
+
}
|
8
|
+
|
9
|
+
&::-webkit-scrollbar-thumb {
|
10
|
+
background-color: rgba(50, 50, 50, 30%);
|
11
|
+
border-radius: 1em;
|
12
|
+
}
|
13
|
+
|
14
|
+
&::-webkit-scrollbar-track {
|
15
|
+
background-color: rgba(50, 50, 50, 10%);
|
16
|
+
border-radius: 1em;
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
.textOverflow() {
|
21
|
+
overflow: hidden;
|
22
|
+
text-overflow: ellipsis;
|
23
|
+
word-break: break-all;
|
24
|
+
white-space: nowrap;
|
25
|
+
}
|
26
|
+
|
27
|
+
.reset() {
|
28
|
+
box-sizing: border-box;
|
29
|
+
padding: 0;
|
30
|
+
margin: 0;
|
31
|
+
font-size: 100%;
|
32
|
+
vertical-align: baseline;
|
33
|
+
border: 0;
|
34
|
+
outline: 0;
|
35
|
+
}
|
36
|
+
|
37
|
+
.clearfix() {
|
38
|
+
&::before,
|
39
|
+
&::after {
|
40
|
+
display: table;
|
41
|
+
content: '';
|
42
|
+
height: 0;
|
43
|
+
clear: both;
|
44
|
+
font-size: 0;
|
45
|
+
visibility: hidden;
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
.centerContent() {
|
50
|
+
position: absolute;
|
51
|
+
top: 50%;
|
52
|
+
left: 50%;
|
53
|
+
z-index: 999;
|
54
|
+
transform: translate(-50%, -50%);
|
55
|
+
}
|
56
|
+
|
57
|
+
.relative() {
|
58
|
+
position: relative;
|
59
|
+
}
|
60
|
+
|
61
|
+
.overHidden() {
|
62
|
+
overflow: hidden;
|
63
|
+
text-overflow: ellipsis;
|
64
|
+
white-space: nowrap;
|
65
|
+
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
*,
|
2
|
+
*::before,
|
3
|
+
*::after {
|
4
|
+
box-sizing: border-box;
|
5
|
+
}
|
6
|
+
|
7
|
+
html {
|
8
|
+
font-size: var(--van-font-size-lg);
|
9
|
+
color-scheme: light;
|
10
|
+
}
|
11
|
+
|
12
|
+
html.dark {
|
13
|
+
background: #222;
|
14
|
+
color-scheme: dark;
|
15
|
+
}
|
16
|
+
|
17
|
+
#app {
|
18
|
+
height: 100%;
|
19
|
+
position: relative;
|
20
|
+
overflow-x: hidden;
|
21
|
+
}
|
22
|
+
|
23
|
+
::-webkit-scrollbar {
|
24
|
+
width: 0;
|
25
|
+
background: transparent;
|
26
|
+
}
|
27
|
+
|
28
|
+
.fl {
|
29
|
+
float: left;
|
30
|
+
}
|
31
|
+
|
32
|
+
.fr {
|
33
|
+
float: right;
|
34
|
+
}
|
35
|
+
|
36
|
+
.clearfix {
|
37
|
+
zoom: 1;
|
38
|
+
.clearfix()
|
39
|
+
}
|
File without changes
|
@@ -0,0 +1,56 @@
|
|
1
|
+
import type { PageLoadingTpe } from '@/components/PageContainer'
|
2
|
+
import type { Ref } from 'vue'
|
3
|
+
import { showLoadingToast } from 'vant'
|
4
|
+
import { ref, watch } from 'vue'
|
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 loadingToast = ref()
|
26
|
+
const pageLoading = ref(initValue) as Ref<T>
|
27
|
+
const loadingMessage = ref(defaultMessage)
|
28
|
+
const loadingType = ref(defaultType)
|
29
|
+
|
30
|
+
watch(() => pageLoading.value, (val) => {
|
31
|
+
if (val) {
|
32
|
+
if (loadingType.value === 'toast') {
|
33
|
+
loadingToast.value = showLoadingToast({
|
34
|
+
duration: 0,
|
35
|
+
forbidClick: true,
|
36
|
+
message: loadingMessage.value || '加载中'
|
37
|
+
})
|
38
|
+
return
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
loadingToast.value?.close()
|
43
|
+
}, {
|
44
|
+
deep: true,
|
45
|
+
immediate: true
|
46
|
+
})
|
47
|
+
|
48
|
+
const changeLoading = ({ value, type, message }: SetLoadingParams<T>) => {
|
49
|
+
pageLoading.value = value
|
50
|
+
loadingMessage.value = message
|
51
|
+
if (type)
|
52
|
+
loadingType.value = type
|
53
|
+
}
|
54
|
+
|
55
|
+
return [ pageLoading as unknown as R, changeLoading ]
|
56
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<script setup lang="ts">
|
2
|
+
import TabsMenu from '@/components/TabsMenu/index.vue'
|
3
|
+
</script>
|
4
|
+
|
5
|
+
<template>
|
6
|
+
<div :class="$style['basic-layout']">
|
7
|
+
<RouterView>
|
8
|
+
<template #default="{ Component }">
|
9
|
+
<component :is="Component" />
|
10
|
+
</template>
|
11
|
+
</RouterView>
|
12
|
+
<TabsMenu />
|
13
|
+
</div>
|
14
|
+
</template>
|
15
|
+
|
16
|
+
<style lang="less" module>
|
17
|
+
@import './style';
|
18
|
+
</style>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<script setup lang="ts">
|
2
|
+
|
3
|
+
</script>
|
4
|
+
|
5
|
+
<template>
|
6
|
+
<div :class="$style.userLayout">
|
7
|
+
<RouterView>
|
8
|
+
<template #default="{ Component }">
|
9
|
+
<component :is="Component" />
|
10
|
+
</template>
|
11
|
+
</RouterView>
|
12
|
+
</div>
|
13
|
+
<div :class="$style.layoutBg" />
|
14
|
+
</template>
|
15
|
+
|
16
|
+
<style module lang="less">
|
17
|
+
@import "./style.module";
|
18
|
+
</style>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
.userLayout {
|
2
|
+
--at-apply: relative;
|
3
|
+
}
|
4
|
+
|
5
|
+
.layoutBg {
|
6
|
+
z-index: -1;
|
7
|
+
pointer-events: none;
|
8
|
+
position: fixed;
|
9
|
+
top: 0;
|
10
|
+
left: 0;
|
11
|
+
right: 0;
|
12
|
+
bottom: 0;
|
13
|
+
transform: scale(1.5);
|
14
|
+
opacity: 0.2;
|
15
|
+
filter: blur(69px);
|
16
|
+
will-change: transform;
|
17
|
+
animation-timeline: auto;
|
18
|
+
animation-range-start: normal;
|
19
|
+
animation-range-end: normal;
|
20
|
+
background: linear-gradient(135deg, rgb(114, 46, 209) 0%, rgb(22, 119, 255) 30%, rgb(245, 34, 45) 70%, rgb(19, 194, 194) 100%) 0% 0% / 200% 200%;
|
21
|
+
animation: 10s ease 0s infinite normal none running glow;
|
22
|
+
}
|
23
|
+
|
24
|
+
@keyframes glow {
|
25
|
+
0% {
|
26
|
+
background-position: 0px -100%;
|
27
|
+
}
|
28
|
+
|
29
|
+
50% {
|
30
|
+
background-position: 200% 50%;
|
31
|
+
}
|
32
|
+
|
33
|
+
100% {
|
34
|
+
background-position: 0px -100%;
|
35
|
+
}
|
36
|
+
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import { createApp } from 'vue'
|
2
|
+
|
3
|
+
import App from './App.vue'
|
4
|
+
import { setupGlobCommon } from './core'
|
5
|
+
import { router, setupRouter } from './router'
|
6
|
+
import { setupRouterGuard } from './router/guard'
|
7
|
+
import { setupStore } from './store'
|
8
|
+
|
9
|
+
import 'virtual:uno.css'
|
10
|
+
import 'vant/es/toast/style'
|
11
|
+
import './design/index.less'
|
12
|
+
|
13
|
+
// plugins
|
14
|
+
import './plugins'
|
15
|
+
|
16
|
+
function startApp() {
|
17
|
+
const app = createApp(App)
|
18
|
+
|
19
|
+
// store
|
20
|
+
setupStore(app)
|
21
|
+
|
22
|
+
// global
|
23
|
+
setupGlobCommon(app)
|
24
|
+
|
25
|
+
// route
|
26
|
+
setupRouter(app)
|
27
|
+
|
28
|
+
// guardRoute
|
29
|
+
setupRouterGuard(router)
|
30
|
+
|
31
|
+
app.mount('#app')
|
32
|
+
}
|
33
|
+
|
34
|
+
startApp()
|