@gx-design-vue/create-gx-cli 0.1.16 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +62 -0
- package/index.js +3 -0
- package/package.json +22 -9
- 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,65 +0,0 @@
|
|
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,39 +0,0 @@
|
|
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
|
@@ -1,56 +0,0 @@
|
|
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
|
-
}
|
@@ -1,18 +0,0 @@
|
|
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>
|
@@ -1,18 +0,0 @@
|
|
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>
|
@@ -1,36 +0,0 @@
|
|
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,34 +0,0 @@
|
|
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()
|
@@ -1,102 +0,0 @@
|
|
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>
|
@@ -1,71 +0,0 @@
|
|
1
|
-
<script setup lang="ts">
|
2
|
-
import { isBoolean } from '@gx-design-vue/pro-utils'
|
3
|
-
|
4
|
-
const loading = ref(false)
|
5
|
-
const pageContainer = ref()
|
6
|
-
const loadingMsg = ref('加载中')
|
7
|
-
const hiddenSlot = ref(true)
|
8
|
-
|
9
|
-
const init = (val?: boolean) => {
|
10
|
-
loadingMsg.value = '加载中'
|
11
|
-
loading.value = true
|
12
|
-
|
13
|
-
if (isBoolean(val))
|
14
|
-
hiddenSlot.value = val
|
15
|
-
|
16
|
-
setTimeout(() => {
|
17
|
-
loading.value = false
|
18
|
-
}, 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>
|
@@ -1,74 +0,0 @@
|
|
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>
|
@@ -1,18 +0,0 @@
|
|
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
|
-
}
|
@@ -1,41 +0,0 @@
|
|
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
|
-
}
|
@@ -1,31 +0,0 @@
|
|
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
|
-
}
|