Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
web-project
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
紫光云
web-project
Commits
8b2d0f2a
Commit
8b2d0f2a
authored
Jul 01, 2024
by
jiaxu.yan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat; 上线提交
parent
f47576a9
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
13 additions
and
9 deletions
+13
-9
.env.production
.env.production
+1
-1
role.ts
src/api/role.ts
+1
-1
index.ts
src/router/guard/index.ts
+2
-0
permissionGuard.ts
src/router/guard/permissionGuard.ts
+3
-2
permission.ts
src/store/modules/permission.ts
+1
-0
user.ts
src/store/modules/user.ts
+4
-4
vite.config.ts
vite.config.ts
+1
-1
No files found.
.env.production
View file @
8b2d0f2a
...
...
@@ -12,7 +12,7 @@ VITE_BUILD_COMPRESS = 'gzip'
# Basic interface address SPA
# VITE_GLOB_API_URL = https://dev.unitj.cn
VITE_GLOB_API_URL =
http://172.72.253.25:8088/
VITE_GLOB_API_URL =
''
# File upload address, optional
# It can be forwarded by nginx or write the actual address directly
VITE_GLOB_UPLOAD_URL = '/system/file/add'
...
...
src/api/role.ts
View file @
8b2d0f2a
import
{
defHttp
}
from
'@/utils/http/axios'
;
enum
Api
{
GetList
=
'/
eam/utils
/getUserMenu'
,
GetList
=
'/
pro/menu
/getUserMenu'
,
}
export
const
getList
=
()
=>
defHttp
.
get
<
any
>
({
url
:
Api
.
GetList
});
src/router/guard/index.ts
View file @
8b2d0f2a
...
...
@@ -16,6 +16,8 @@ import { createParamMenuGuard } from './paramMenuGuard';
// Don't change the order of creation
export
function
setupRouterGuard
(
router
:
Router
)
{
const
userStore
=
useUserStoreWithOut
();
userStore
.
setToken
(
'c061d9c2-a0f2-44c8-a869-cad99e9c1fea'
);
createPageGuard
(
router
);
createPageLoadingGuard
(
router
);
createHttpGuard
(
router
);
...
...
src/router/guard/permissionGuard.ts
View file @
8b2d0f2a
...
...
@@ -4,9 +4,9 @@ import { usePermissionStoreWithOut } from '@/store/modules/permission';
import
{
usePermissionStore
}
from
'@/store/modules/permission'
;
import
{
PageEnum
}
from
'@/enums/pageEnum'
;
import
{
useUserStoreWithOut
}
from
'@/store/modules/user'
;
import
{
setAuthCache
}
from
'@/utils/auth'
;
import
{
PAGE_NOT_FOUND_ROUTE
}
from
'@/router/routes/basic'
;
import
{
TOKEN_KEY
}
from
'@/enums/cacheEnum'
;
import
{
RootRoute
}
from
'@/router/routes'
;
const
LOGIN_PATH
=
PageEnum
.
BASE_LOGIN
;
...
...
@@ -17,6 +17,7 @@ const whitePathList: PageEnum[] = [LOGIN_PATH];
export
function
createPermissionGuard
(
router
:
Router
)
{
const
userStore
=
useUserStoreWithOut
();
userStore
.
setToken
(
'c061d9c2-a0f2-44c8-a869-cad99e9c1fea'
);
const
permissionStore
=
usePermissionStoreWithOut
();
router
.
beforeEach
(
async
(
to
,
from
,
next
)
=>
{
if
(
...
...
src/store/modules/permission.ts
View file @
8b2d0f2a
...
...
@@ -125,6 +125,7 @@ export const usePermissionStore = defineStore({
const
{
roles
}
=
meta
||
{};
if
(
!
roles
)
return
true
;
// 进行角色权限判断
console
.
log
(
roleList
);
return
roleList
.
some
((
role
)
=>
roles
.
includes
(
role
));
};
...
...
src/store/modules/user.ts
View file @
8b2d0f2a
...
...
@@ -32,7 +32,7 @@ export const useUserStore = defineStore({
// user info
userInfo
:
null
,
// token
token
:
undefined
,
token
:
'c061d9c2-a0f2-44c8-a869-cad99e9c1fea'
,
// roleList
roleList
:
[],
// Whether the login expired
...
...
@@ -42,9 +42,8 @@ export const useUserStore = defineStore({
}),
getters
:
{
getUserInfo
(
state
):
UserInfo
{
if
(
import
.
meta
.
env
.
MODE
===
'production'
)
{
setAuthCache
(
TOKEN_KEY
,
'c061d9c2-a0f2-44c8-a869-cad99e9c1fea'
);
}
console
.
log
(
'UserInfo'
);
setAuthCache
(
TOKEN_KEY
,
'c061d9c2-a0f2-44c8-a869-cad99e9c1fea'
);
return
state
.
userInfo
||
getAuthCache
<
UserInfo
>
(
USER_INFO_KEY
)
||
{};
},
getToken
():
string
{
...
...
@@ -107,6 +106,7 @@ export const useUserStore = defineStore({
async
afterLoginAction
(
goHome
?:
boolean
):
Promise
<
GetUserInfoModel
|
null
>
{
// if (!this.getToken) return null;
// get user info
setAuthCache
(
TOKEN_KEY
,
'c061d9c2-a0f2-44c8-a869-cad99e9c1fea'
);
const
userInfo
=
await
this
.
getUserInfoAction
();
const
sessionTimeout
=
this
.
sessionTimeout
;
if
(
sessionTimeout
)
{
...
...
vite.config.ts
View file @
8b2d0f2a
...
...
@@ -18,7 +18,7 @@ export default defineApplicationConfig({
server
:
{
proxy
:
{
'/api'
:
{
target
:
'http
s://dev.unitj.cn
'
,
target
:
'http
://172.72.253.25:8088
'
,
// target: 'http://58.223.177.48:8088',
changeOrigin
:
true
,
// ws: false,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment