@yyp92-cli/template-vue-mobile 1.3.0 → 1.4.0
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/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -20,20 +20,30 @@ router.beforeEach((to, from, next) => {
|
|
|
20
20
|
const menus = localCache.getCache(MENUS) ?? []
|
|
21
21
|
const token = localCache.getCache(LOGIN_TOKEN)
|
|
22
22
|
|
|
23
|
-
if (
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
next({
|
|
31
|
-
path: menus[0]?.path || '/'
|
|
32
|
-
})
|
|
23
|
+
if (!token) {
|
|
24
|
+
// 直接允许通过,不重复重定向
|
|
25
|
+
if (to.path === '/login') {
|
|
26
|
+
next()
|
|
27
|
+
return
|
|
33
28
|
}
|
|
29
|
+
|
|
30
|
+
next({
|
|
31
|
+
path: '/login',
|
|
32
|
+
query: {
|
|
33
|
+
redirect: to.path
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
return
|
|
37
|
+
}
|
|
38
|
+
else if (to.path === '/') {
|
|
39
|
+
next({
|
|
40
|
+
path: menus[0]?.path || '/'
|
|
41
|
+
})
|
|
42
|
+
return
|
|
34
43
|
}
|
|
35
44
|
else if (!['/403', '/login'].includes(to.path) && !permission.includes(to.path) && getLocalPromission(routes).includes(to.path)) {
|
|
36
|
-
|
|
45
|
+
next('/403')
|
|
46
|
+
return
|
|
37
47
|
}
|
|
38
48
|
else {
|
|
39
49
|
next()
|
|
@@ -23,7 +23,7 @@ const useLoginStore = defineStore(
|
|
|
23
23
|
actions: {
|
|
24
24
|
async loginAccountAction(account: any) {
|
|
25
25
|
try {
|
|
26
|
-
|
|
26
|
+
await new Promise((resolve) => {
|
|
27
27
|
const userInfo = {
|
|
28
28
|
username: account.username
|
|
29
29
|
}
|
|
@@ -40,7 +40,11 @@ const useLoginStore = defineStore(
|
|
|
40
40
|
|
|
41
41
|
localCache.setCache(MENUS, menus)
|
|
42
42
|
localCache.setCache(PERMISSION, promissions)
|
|
43
|
-
|
|
43
|
+
|
|
44
|
+
setTimeout(() => {
|
|
45
|
+
resolve(true)
|
|
46
|
+
}, 5000)
|
|
47
|
+
})
|
|
44
48
|
}
|
|
45
49
|
catch(error) {
|
|
46
50
|
return error
|
package/template/vite.config.ts
CHANGED
|
@@ -9,6 +9,7 @@ import Components from 'unplugin-vue-components/vite'
|
|
|
9
9
|
import { VantResolver } from '@vant/auto-import-resolver'
|
|
10
10
|
|
|
11
11
|
|
|
12
|
+
|
|
12
13
|
// https://vite.dev/config/
|
|
13
14
|
export default defineConfig({
|
|
14
15
|
base:'./',
|
|
@@ -31,10 +32,20 @@ export default defineConfig({
|
|
|
31
32
|
plugins: [
|
|
32
33
|
vue(),
|
|
33
34
|
AutoImport({
|
|
34
|
-
resolvers: [
|
|
35
|
+
resolvers: [
|
|
36
|
+
VantResolver({
|
|
37
|
+
importStyle: 'css'
|
|
38
|
+
})
|
|
39
|
+
],
|
|
40
|
+
dts: 'auto-imports.d.ts',
|
|
35
41
|
}),
|
|
36
42
|
Components({
|
|
37
|
-
resolvers: [
|
|
43
|
+
resolvers: [
|
|
44
|
+
VantResolver({
|
|
45
|
+
importStyle: 'css'
|
|
46
|
+
})
|
|
47
|
+
],
|
|
48
|
+
dts: 'components.d.ts',
|
|
38
49
|
})
|
|
39
50
|
],
|
|
40
51
|
|