@gx-design-vue/create-gx-cli 0.1.15 → 0.1.16
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/package.json +1 -1
- package/src/main.js +7 -7
- package/template-mobile-vant-cli/.env +3 -0
- package/template-mobile-vant-cli/.env.development +4 -6
- package/template-mobile-vant-cli/.env.pro +16 -7
- package/template-mobile-vant-cli/.env.production +21 -9
- 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 +10 -2
- package/template-mobile-vant-cli/index.html +22 -21
- package/template-mobile-vant-cli/{build → internal/vite-config/generate}/generateModifyVars.ts +1 -1
- 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/{build → internal/vite-config/vite}/optimizer.ts +9 -1
- package/template-mobile-vant-cli/internal/vite-config/vite/plugin/appConfig.ts +91 -0
- package/template-mobile-vant-cli/{build → internal/vite-config/vite}/plugin/autoImport.ts +7 -3
- 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 +51 -34
- package/template-mobile-vant-cli/public/css/default.css +54 -0
- package/template-mobile-vant-cli/src/App.vue +6 -2
- package/template-mobile-vant-cli/src/assets/logo.png +0 -0
- package/template-mobile-vant-cli/src/components/PageContainer/ProSkeleton.tsx +1 -1
- package/template-mobile-vant-cli/src/components/PageContainer/index.tsx +108 -16
- package/template-mobile-vant-cli/src/components/PageContainer/style.module.less +5 -2
- package/template-mobile-vant-cli/src/components/TabsMenu/index.vue +45 -0
- package/template-mobile-vant-cli/src/core/gx-design/index.ts +1 -1
- package/template-mobile-vant-cli/src/core/index.ts +0 -7
- 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 +1 -1
- package/template-mobile-vant-cli/src/design/mixin.less +65 -0
- package/template-mobile-vant-cli/src/design/reset.less +16 -132
- package/template-mobile-vant-cli/src/hooks/web/usePageLoading.ts +7 -9
- package/template-mobile-vant-cli/src/layout/{BasicLayout.vue → BasicLayout/index.vue} +3 -1
- 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 +16 -9
- 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.vue → Home/index.vue} +5 -5
- package/template-mobile-vant-cli/src/pages/user/login/index.vue +74 -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 +21 -15
- 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/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 +4 -1
- package/template-mobile-vant-cli/src/store/modules/global.ts +6 -13
- 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 +3 -4
- package/template-mobile-vant-cli/src/utils/env.ts +2 -2
- package/template-mobile-vant-cli/src/utils/pageTitle.ts +12 -6
- package/template-mobile-vant-cli/src/utils/request/XHR.ts +9 -11
- package/template-mobile-vant-cli/src/utils/request/axiosCancel.ts +5 -5
- package/template-mobile-vant-cli/src/utils/request/checkStatus.ts +18 -2
- package/template-mobile-vant-cli/src/utils/request/index.ts +36 -23
- package/template-mobile-vant-cli/src/utils/storage.ts +49 -32
- package/template-mobile-vant-cli/src/utils/validate.ts +31 -36
- package/template-mobile-vant-cli/tsconfig.json +17 -9
- package/template-mobile-vant-cli/types/auto-imports.d.ts +18 -2
- package/template-mobile-vant-cli/types/components.d.ts +2 -7
- package/template-mobile-vant-cli/types/config.d.ts +56 -0
- package/template-mobile-vant-cli/types/global.d.ts +62 -21
- package/template-mobile-vant-cli/types/mock.d.ts +34 -0
- package/template-mobile-vant-cli/types/module.d.ts +33 -0
- package/template-mobile-vant-cli/types/response.d.ts +3 -1
- package/template-mobile-vant-cli/types/system.d.ts +58 -0
- package/template-mobile-vant-cli/types/vant-import.d.ts +16 -5
- package/template-mobile-vant-cli/unocss.config.ts +120 -66
- package/template-mobile-vant-cli/vite.config.ts +78 -81
- package/template-mobile-vant-cli/build/cdn.ts +0 -5
- package/template-mobile-vant-cli/build/plugin/html.ts +0 -26
- package/template-mobile-vant-cli/build/plugin/index.ts +0 -42
- package/template-mobile-vant-cli/build/plugin/mock.ts +0 -14
- package/template-mobile-vant-cli/build/plugin/viteMock/client.ts +0 -88
- package/template-mobile-vant-cli/build/plugin/viteMock/createMockServer.ts +0 -271
- package/template-mobile-vant-cli/build/plugin/viteMock/index.ts +0 -69
- package/template-mobile-vant-cli/build/plugin/viteMock/types.ts +0 -48
- package/template-mobile-vant-cli/build/plugin/viteMock/utils.ts +0 -48
- package/template-mobile-vant-cli/build/script/postBuild.ts +0 -14
- package/template-mobile-vant-cli/mock/_createProductionServer.ts +0 -19
- package/template-mobile-vant-cli/mock/utils.ts +0 -9
- package/template-mobile-vant-cli/postcss.config.cjs +0 -8
- package/template-mobile-vant-cli/prettier.config.cjs +0 -18
- package/template-mobile-vant-cli/public/js/flexible.js +0 -44
- package/template-mobile-vant-cli/src/core/vant-design/index.ts +0 -4
- package/template-mobile-vant-cli/src/design/vant.less +0 -2
- package/template-mobile-vant-cli/src/global.less +0 -1
- package/template-mobile-vant-cli/src/layout/basicLayout.less +0 -11
- package/template-mobile-vant-cli/src/router/routes.ts +0 -20
- package/template-mobile-vant-cli/src/router/typings.ts +0 -8
- package/template-mobile-vant-cli/src/settings/index.ts +0 -10
- package/template-mobile-vant-cli/src/utils/crypto/base64.ts +0 -101
- package/template-mobile-vant-cli/types/ant-design-import.d.ts +0 -13
- package/template-mobile-vant-cli/types/plugins-auto-import.d.ts +0 -14
- /package/template-mobile-vant-cli/{mock/datasSource/api/index.ts → src/design/vant/index.less} +0 -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
|
+
}
|
@@ -1,134 +1,28 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
table,
|
5
|
-
tr,
|
6
|
-
td,
|
7
|
-
th,
|
8
|
-
h1,
|
9
|
-
h2,
|
10
|
-
h3,
|
11
|
-
h4,
|
12
|
-
h5,
|
13
|
-
h6,
|
14
|
-
form,
|
15
|
-
input,
|
16
|
-
button,
|
17
|
-
label,
|
18
|
-
select,
|
19
|
-
textarea,
|
20
|
-
p,
|
21
|
-
u,
|
22
|
-
i,
|
23
|
-
em,
|
24
|
-
ul,
|
25
|
-
ol,
|
26
|
-
li,
|
27
|
-
dl,
|
28
|
-
dd,
|
29
|
-
dt,
|
30
|
-
img,
|
31
|
-
article,
|
32
|
-
aside,
|
33
|
-
details,
|
34
|
-
figcaption,
|
35
|
-
figure,
|
36
|
-
footer,
|
37
|
-
header,
|
38
|
-
menu,
|
39
|
-
nav,
|
40
|
-
section,
|
41
|
-
pre {
|
1
|
+
*,
|
2
|
+
*::before,
|
3
|
+
*::after {
|
42
4
|
box-sizing: border-box;
|
43
|
-
margin: 0;
|
44
|
-
padding: 0;
|
45
|
-
font-size: 100%;
|
46
|
-
vertical-align: baseline;
|
47
|
-
border: 0;
|
48
|
-
outline: 0;
|
49
5
|
}
|
50
6
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
h1,
|
56
|
-
h2,
|
57
|
-
h3,
|
58
|
-
h4,
|
59
|
-
h5,
|
60
|
-
h6 {
|
61
|
-
font-size: 100%;
|
62
|
-
}
|
63
|
-
|
64
|
-
table {
|
65
|
-
border-collapse: collapse;
|
66
|
-
border-spacing: 0;
|
67
|
-
width: 100%;
|
68
|
-
}
|
69
|
-
|
70
|
-
a,
|
71
|
-
input,
|
72
|
-
select,
|
73
|
-
textarea,
|
74
|
-
area,
|
75
|
-
button {
|
76
|
-
outline: none;
|
77
|
-
font-family: inherit;
|
78
|
-
font-size: inherit;
|
79
|
-
border: none;
|
80
|
-
background: none;
|
81
|
-
color: inherit;
|
82
|
-
}
|
83
|
-
|
84
|
-
a {
|
85
|
-
text-decoration: none;
|
86
|
-
}
|
87
|
-
|
88
|
-
a:hover {
|
89
|
-
text-decoration: none;
|
90
|
-
}
|
91
|
-
|
92
|
-
textarea {
|
93
|
-
overflow: auto;
|
94
|
-
resize: none;
|
7
|
+
html {
|
8
|
+
font-size: var(--van-font-size-lg);
|
9
|
+
color-scheme: light;
|
95
10
|
}
|
96
11
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
cursor: pointer;
|
101
|
-
-webkit-appearance: none;
|
12
|
+
html.dark {
|
13
|
+
background: #222;
|
14
|
+
color-scheme: dark;
|
102
15
|
}
|
103
16
|
|
104
|
-
|
105
|
-
body {
|
106
|
-
overflow-x: hidden;
|
107
|
-
width: 100%;
|
17
|
+
#app {
|
108
18
|
height: 100%;
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
* {
|
113
|
-
-webkit-overflow-scrolling: touch;
|
114
|
-
}
|
115
|
-
|
116
|
-
html {
|
117
|
-
-webkit-tap-highlight-color: transparent;
|
19
|
+
position: relative;
|
20
|
+
overflow-x: hidden;
|
118
21
|
}
|
119
22
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
padding-bottom: env(safe-area-inset-bottom);
|
124
|
-
|
125
|
-
#app {
|
126
|
-
height: 100%;
|
127
|
-
-webkit-font-smoothing: antialiased;
|
128
|
-
-moz-osx-font-smoothing: grayscale;
|
129
|
-
overflow-x: hidden;
|
130
|
-
box-sizing: border-box;
|
131
|
-
}
|
23
|
+
::-webkit-scrollbar {
|
24
|
+
width: 0;
|
25
|
+
background: transparent;
|
132
26
|
}
|
133
27
|
|
134
28
|
.fl {
|
@@ -141,15 +35,5 @@ body {
|
|
141
35
|
|
142
36
|
.clearfix {
|
143
37
|
zoom: 1;
|
144
|
-
|
145
|
-
&::after {
|
146
|
-
display: table;
|
147
|
-
content: ' ';
|
148
|
-
}
|
149
|
-
&::after {
|
150
|
-
clear: both;
|
151
|
-
height: 0;
|
152
|
-
font-size: 0;
|
153
|
-
visibility: hidden;
|
154
|
-
}
|
38
|
+
.clearfix()
|
155
39
|
}
|
@@ -1,7 +1,7 @@
|
|
1
|
+
import type { PageLoadingTpe } from '@/components/PageContainer'
|
1
2
|
import type { Ref } from 'vue'
|
3
|
+
import { showLoadingToast } from 'vant'
|
2
4
|
import { ref, watch } from 'vue'
|
3
|
-
import { closeToast, showLoadingToast } from 'vant'
|
4
|
-
import type { PageLoadingTpe } from '@/components/PageContainer'
|
5
5
|
|
6
6
|
export interface SetLoadingParams<T> {
|
7
7
|
value: T;
|
@@ -22,26 +22,24 @@ export default function usePageLoading<T, R = Ref<T>>({
|
|
22
22
|
}): [ R, ChangeLoadingFn<T> ] {
|
23
23
|
const initValue: T = typeof defaultLoading === 'function' ? (defaultLoading as any)() : defaultLoading
|
24
24
|
|
25
|
+
const loadingToast = ref()
|
25
26
|
const pageLoading = ref(initValue) as Ref<T>
|
26
|
-
|
27
27
|
const loadingMessage = ref(defaultMessage)
|
28
|
-
|
29
28
|
const loadingType = ref(defaultType)
|
30
29
|
|
31
30
|
watch(() => pageLoading.value, (val) => {
|
32
31
|
if (val) {
|
33
32
|
if (loadingType.value === 'toast') {
|
34
|
-
showLoadingToast({
|
33
|
+
loadingToast.value = showLoadingToast({
|
35
34
|
duration: 0,
|
36
35
|
forbidClick: true,
|
37
36
|
message: loadingMessage.value || '加载中'
|
38
37
|
})
|
39
|
-
|
40
|
-
closeToast()
|
38
|
+
return
|
41
39
|
}
|
42
|
-
} else {
|
43
|
-
closeToast()
|
44
40
|
}
|
41
|
+
|
42
|
+
loadingToast.value?.close()
|
45
43
|
}, {
|
46
44
|
deep: true,
|
47
45
|
immediate: true
|
@@ -1,4 +1,5 @@
|
|
1
1
|
<script setup lang="ts">
|
2
|
+
import TabsMenu from '@/components/TabsMenu/index.vue'
|
2
3
|
</script>
|
3
4
|
|
4
5
|
<template>
|
@@ -8,9 +9,10 @@
|
|
8
9
|
<component :is="Component" />
|
9
10
|
</template>
|
10
11
|
</RouterView>
|
12
|
+
<TabsMenu />
|
11
13
|
</div>
|
12
14
|
</template>
|
13
15
|
|
14
16
|
<style lang="less" module>
|
15
|
-
@import './
|
17
|
+
@import './style';
|
16
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.layouBg" />
|
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
|
+
.layouBg {
|
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
|
+
}
|
@@ -1,25 +1,32 @@
|
|
1
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
2
|
|
7
|
-
import '
|
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
8
|
|
9
|
+
import 'virtual:uno.css'
|
9
10
|
import 'vant/es/toast/style'
|
11
|
+
import './design/index.less'
|
10
12
|
|
11
|
-
|
13
|
+
// plugins
|
14
|
+
import './plugins'
|
12
15
|
|
13
16
|
function startApp() {
|
14
17
|
const app = createApp(App)
|
15
18
|
|
16
|
-
//
|
19
|
+
// store
|
17
20
|
setupStore(app)
|
18
21
|
|
19
|
-
//
|
22
|
+
// global
|
23
|
+
setupGlobCommon(app)
|
24
|
+
|
25
|
+
// route
|
20
26
|
setupRouter(app)
|
21
27
|
|
22
|
-
|
28
|
+
// guardRoute
|
29
|
+
setupRouterGuard(router)
|
23
30
|
|
24
31
|
app.mount('#app')
|
25
32
|
}
|
@@ -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>
|
@@ -15,7 +15,7 @@ const init = (val?: boolean) => {
|
|
15
15
|
|
16
16
|
setTimeout(() => {
|
17
17
|
loading.value = false
|
18
|
-
},
|
18
|
+
}, 200)
|
19
19
|
}
|
20
20
|
|
21
21
|
onMounted(() => {
|
@@ -26,7 +26,7 @@ const changeLoading = (message: string) => {
|
|
26
26
|
loadingMsg.value = message
|
27
27
|
loading.value = true
|
28
28
|
hiddenSlot.value = false
|
29
|
-
|
29
|
+
|
30
30
|
setTimeout(() => {
|
31
31
|
loading.value = false
|
32
32
|
}, 1000)
|
@@ -38,7 +38,7 @@ const toggleLoading = (hiddenSlot: boolean, message?: string) => {
|
|
38
38
|
hiddenSlot,
|
39
39
|
message
|
40
40
|
})
|
41
|
-
|
41
|
+
|
42
42
|
setTimeout(() => {
|
43
43
|
pageContainer.value?.toggleLoading({
|
44
44
|
value: false,
|
@@ -49,7 +49,7 @@ const toggleLoading = (hiddenSlot: boolean, message?: string) => {
|
|
49
49
|
</script>
|
50
50
|
|
51
51
|
<template>
|
52
|
-
<g-
|
52
|
+
<g-page-container
|
53
53
|
ref="pageContainer"
|
54
54
|
v-model:loading="loading"
|
55
55
|
:loadingMsg="loadingMsg"
|
@@ -64,7 +64,7 @@ const toggleLoading = (hiddenSlot: boolean, message?: string) => {
|
|
64
64
|
<van-button @click="toggleLoading(false)">刷新-调用方法-不隐藏</van-button>
|
65
65
|
<van-button @click="toggleLoading(false, '切换中')">刷新-调用方法-不隐藏-切换提示语</van-button>
|
66
66
|
</div>
|
67
|
-
</g-
|
67
|
+
</g-page-container>
|
68
68
|
</template>
|
69
69
|
|
70
70
|
<style lang="less" scoped>
|
@@ -0,0 +1,74 @@
|
|
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 flex flex-col items-center pt-150">
|
34
|
+
<img class="h-40" src="@/assets/logo.png" alt="logo">
|
35
|
+
<div class="mt-50 w-75%">
|
36
|
+
<van-form validate-trigger="onSubmit">
|
37
|
+
<div class="overflow-hidden rounded-3xl">
|
38
|
+
<van-field
|
39
|
+
v-model="userForm.userName"
|
40
|
+
:rules="userRules.userName"
|
41
|
+
name="userName"
|
42
|
+
placeholder="用户名: admin"
|
43
|
+
/>
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div class="mt-24 overflow-hidden rounded-3xl">
|
47
|
+
<van-field
|
48
|
+
v-model="userForm.password"
|
49
|
+
type="password"
|
50
|
+
:rules="userRules.password"
|
51
|
+
name="password"
|
52
|
+
placeholder="密码: gx.design"
|
53
|
+
/>
|
54
|
+
</div>
|
55
|
+
|
56
|
+
<div class="mt-24">
|
57
|
+
<van-button
|
58
|
+
:loading="loading"
|
59
|
+
type="primary"
|
60
|
+
native-type="submit"
|
61
|
+
round
|
62
|
+
block
|
63
|
+
@click="handleSubmit"
|
64
|
+
>
|
65
|
+
登录
|
66
|
+
</van-button>
|
67
|
+
</div>
|
68
|
+
</van-form>
|
69
|
+
</div>
|
70
|
+
</div>
|
71
|
+
</template>
|
72
|
+
|
73
|
+
<style scoped lang="less">
|
74
|
+
</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
|
+
}
|