@gx-design-vue/create-gx-cli 0.1.20 → 0.1.22
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/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 +21 -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
@@ -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()
|
@@ -0,0 +1,102 @@
|
|
1
|
+
<script setup lang="ts">
|
2
|
+
import multiavatar from '@multiavatar/multiavatar/esm'
|
3
|
+
|
4
|
+
const { user } = useStore()
|
5
|
+
const router = useRouter()
|
6
|
+
|
7
|
+
const svgCode = multiavatar(user.userInfo.userId)
|
8
|
+
|
9
|
+
function toDetails() {
|
10
|
+
router.push('/account/detail')
|
11
|
+
}
|
12
|
+
</script>
|
13
|
+
|
14
|
+
<template>
|
15
|
+
<g-page-container wrapperClass="h-full" bg-color="transparent" style="height: calc(100vh - var(--van-tabbar-height));">
|
16
|
+
<div class="bg" />
|
17
|
+
<div class="flex-center pt-15 pb-30">
|
18
|
+
<img src="@/assets/logo.png" class="w-60" alt="">
|
19
|
+
</div>
|
20
|
+
<div class="card flex gap-20 p-20">
|
21
|
+
<div class="w-60 h-60 rd-50% overflow-hidden flex-shrink" v-html="svgCode" @click="toDetails" />
|
22
|
+
<div class="flex-main flex-col flex justify-between">
|
23
|
+
<div class="text-14 font-bold flex items-center gap-10">
|
24
|
+
<span @click="toDetails">{{ user.userInfo.nickName }}</span>
|
25
|
+
<van-tag color="#7232dd" class="!px-8 !text-10">会员</van-tag>
|
26
|
+
</div>
|
27
|
+
<div class="flex flex-col gap-2 text-12 text-hex-999">
|
28
|
+
<div class="text-hidden-1" @click="toDetails">{{ user.userInfo.remark }}</div>
|
29
|
+
<div flex gap-10 items-center>
|
30
|
+
<van-progress class="flex-main relative top-1.5" :percentage="50" stroke-width="4" :show-pivot="false" />
|
31
|
+
<span>5/10</span>
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
</div>
|
35
|
+
</div>
|
36
|
+
<div class="card px-20 py-15">
|
37
|
+
<div class="card-item">
|
38
|
+
<span class="font-bold text-13">我的订单</span>
|
39
|
+
<van-icon class="text-hex-999 text-13" name="arrow" />
|
40
|
+
</div>
|
41
|
+
<div class="card-item">
|
42
|
+
<span class="font-bold text-13">我的地址</span>
|
43
|
+
<van-icon class="text-hex-999 text-13" name="arrow" />
|
44
|
+
</div>
|
45
|
+
</div>
|
46
|
+
</g-page-container>
|
47
|
+
</template>
|
48
|
+
|
49
|
+
<style scoped lang="less">
|
50
|
+
.card {
|
51
|
+
--at-apply: bg-hex-fff rd-6 overflow-hidden;
|
52
|
+
|
53
|
+
& +.card {
|
54
|
+
--at-apply: mt-20;
|
55
|
+
}
|
56
|
+
|
57
|
+
.card-item {
|
58
|
+
--at-apply: flex items-center justify-between bd-b-main pb-15;
|
59
|
+
|
60
|
+
& + .card-item {
|
61
|
+
--at-apply: pt-15;
|
62
|
+
}
|
63
|
+
|
64
|
+
&:last-child {
|
65
|
+
--at-apply: pb-0;
|
66
|
+
border-bottom: 0;
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}
|
70
|
+
.bg {
|
71
|
+
z-index: -1;
|
72
|
+
pointer-events: none;
|
73
|
+
position: fixed;
|
74
|
+
top: 0;
|
75
|
+
left: 0;
|
76
|
+
right: 0;
|
77
|
+
bottom: 0;
|
78
|
+
transform: scale(1.5);
|
79
|
+
opacity: 0.2;
|
80
|
+
filter: blur(69px);
|
81
|
+
will-change: transform;
|
82
|
+
animation-timeline: auto;
|
83
|
+
animation-range-start: normal;
|
84
|
+
animation-range-end: normal;
|
85
|
+
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%;
|
86
|
+
animation: 10s ease 0s infinite normal none running glow;
|
87
|
+
}
|
88
|
+
|
89
|
+
@keyframes glow {
|
90
|
+
0% {
|
91
|
+
background-position: 0px -100%;
|
92
|
+
}
|
93
|
+
|
94
|
+
50% {
|
95
|
+
background-position: 200% 50%;
|
96
|
+
}
|
97
|
+
|
98
|
+
100% {
|
99
|
+
background-position: 0px -100%;
|
100
|
+
}
|
101
|
+
}
|
102
|
+
</style>
|
@@ -0,0 +1,71 @@
|
|
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
|
+
}, 200)
|
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-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-page-container>
|
68
|
+
</template>
|
69
|
+
|
70
|
+
<style lang="less" scoped>
|
71
|
+
</style>
|
@@ -0,0 +1,76 @@
|
|
1
|
+
<script setup lang="ts">
|
2
|
+
import { reactive } from 'vue'
|
3
|
+
|
4
|
+
interface UserState {
|
5
|
+
userName: string
|
6
|
+
password: string
|
7
|
+
}
|
8
|
+
|
9
|
+
const { user } = useStore()
|
10
|
+
const router = useRouter()
|
11
|
+
|
12
|
+
const loading = ref(false)
|
13
|
+
|
14
|
+
const userForm = reactive<UserState>({
|
15
|
+
userName: 'admin',
|
16
|
+
password: 'gx.design'
|
17
|
+
})
|
18
|
+
|
19
|
+
const userRules = reactive({
|
20
|
+
userName: [ { required: true, message: '用户名是必填项!' } ],
|
21
|
+
password: [ { required: true, message: '密码是必填项!' } ]
|
22
|
+
})
|
23
|
+
|
24
|
+
const handleSubmit = async () => {
|
25
|
+
const response = await user.userLogin(toRaw(userForm))
|
26
|
+
if (response) {
|
27
|
+
router.push({ path: '/' })
|
28
|
+
}
|
29
|
+
}
|
30
|
+
</script>
|
31
|
+
|
32
|
+
<template>
|
33
|
+
<div class="h-100vh w-full pt-150 px-30">
|
34
|
+
<div class="flex items-end justify-center gap-20">
|
35
|
+
<img class="h-38" src="@/assets/logo.png" alt="logo">
|
36
|
+
<div class="bg-gradient-[to_bottom,#AE3FF5,#6EC0F9] bg-gradient-linear bg-clip-text text-28 text-transparent font-bold">
|
37
|
+
Gx Vant Mobile
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
<div class="mt-40">
|
41
|
+
<van-form validate-trigger="onSubmit">
|
42
|
+
<van-cell-group inset class="!mx-0">
|
43
|
+
<van-field
|
44
|
+
v-model="userForm.userName"
|
45
|
+
:rules="userRules.userName"
|
46
|
+
name="userName"
|
47
|
+
placeholder="用户名: admin"
|
48
|
+
/>
|
49
|
+
<van-field
|
50
|
+
v-model="userForm.password"
|
51
|
+
type="password"
|
52
|
+
:rules="userRules.password"
|
53
|
+
name="password"
|
54
|
+
placeholder="密码: gx.design"
|
55
|
+
/>
|
56
|
+
</van-cell-group>
|
57
|
+
|
58
|
+
<div class="mt-24">
|
59
|
+
<van-button
|
60
|
+
:loading="loading"
|
61
|
+
type="primary"
|
62
|
+
native-type="submit"
|
63
|
+
block
|
64
|
+
size="small"
|
65
|
+
@click="handleSubmit"
|
66
|
+
>
|
67
|
+
登录
|
68
|
+
</van-button>
|
69
|
+
</div>
|
70
|
+
</van-form>
|
71
|
+
</div>
|
72
|
+
</div>
|
73
|
+
</template>
|
74
|
+
|
75
|
+
<style scoped lang="less">
|
76
|
+
</style>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import type { MenuDataItem } from '@gx-design-vue/pro-layout'
|
2
|
+
import type { Router } from 'vue-router'
|
3
|
+
import getPageTitle from '@/utils/pageTitle'
|
4
|
+
import { createPermissionGuard } from './permissions'
|
5
|
+
import { createStateGuard } from './stateGuard'
|
6
|
+
|
7
|
+
export function setupRouterGuard(router: Router) {
|
8
|
+
createPageGuard(router)
|
9
|
+
createPermissionGuard(router)
|
10
|
+
createStateGuard(router)
|
11
|
+
}
|
12
|
+
|
13
|
+
export function createPageGuard(router: Router) {
|
14
|
+
router.afterEach((to) => {
|
15
|
+
const { meta } = to as MenuDataItem
|
16
|
+
document.title = getPageTitle(meta?.title || '')
|
17
|
+
})
|
18
|
+
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import type { Router } from 'vue-router'
|
2
|
+
import { defaultSettings } from '@gx-config'
|
3
|
+
|
4
|
+
const { loginInterception, routesWhiteList } = defaultSettings.system
|
5
|
+
|
6
|
+
export function createPermissionGuard(router: Router) {
|
7
|
+
const userStore = useStoreUser()
|
8
|
+
|
9
|
+
router.beforeEach(async (to, _, next) => {
|
10
|
+
if (loginInterception) {
|
11
|
+
const token = userStore.accessToken
|
12
|
+
if (routesWhiteList.includes(to.path)) {
|
13
|
+
if (token) {
|
14
|
+
next({ path: '/', replace: true })
|
15
|
+
}
|
16
|
+
next()
|
17
|
+
return
|
18
|
+
}
|
19
|
+
if (!token) {
|
20
|
+
userStore.resetPermissions()
|
21
|
+
next({ path: '/user/login', replace: true })
|
22
|
+
return
|
23
|
+
}
|
24
|
+
|
25
|
+
const hasUserId = userStore.userInfo.userId
|
26
|
+
|
27
|
+
if (hasUserId) {
|
28
|
+
next()
|
29
|
+
return
|
30
|
+
}
|
31
|
+
|
32
|
+
const status = await userStore.checkUserPremission()
|
33
|
+
if (status !== 1) {
|
34
|
+
userStore.resetPermissions()
|
35
|
+
next({ path: '/user/login', replace: true })
|
36
|
+
return
|
37
|
+
}
|
38
|
+
}
|
39
|
+
next()
|
40
|
+
})
|
41
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import type { App } from 'vue'
|
2
|
+
import type { RouteRecordRaw } from 'vue-router'
|
3
|
+
import { defaultSettings } from '@gx-config'
|
4
|
+
import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router'
|
5
|
+
import { routerList } from './routes'
|
6
|
+
|
7
|
+
const { routerMode } = defaultSettings.system
|
8
|
+
|
9
|
+
function handleRouterMode() {
|
10
|
+
switch (routerMode) {
|
11
|
+
case 'hash':
|
12
|
+
return createWebHashHistory()
|
13
|
+
break
|
14
|
+
case 'browser':
|
15
|
+
return createWebHistory()
|
16
|
+
break
|
17
|
+
default:
|
18
|
+
return createWebHashHistory()
|
19
|
+
break
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
23
|
+
export const router = createRouter({
|
24
|
+
history: handleRouterMode(),
|
25
|
+
routes: routerList as unknown as RouteRecordRaw[]
|
26
|
+
})
|
27
|
+
|
28
|
+
// 配置路由器
|
29
|
+
export function setupRouter(app: App<Element>) {
|
30
|
+
app.use(router)
|
31
|
+
}
|