Commit 8b2d0f2a authored by jiaxu.yan's avatar jiaxu.yan

feat; 上线提交

parent f47576a9
......@@ -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'
......
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 });
......@@ -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);
......
......@@ -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 (
......
......@@ -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));
};
......
......@@ -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) {
......
......@@ -18,7 +18,7 @@ export default defineApplicationConfig({
server: {
proxy: {
'/api': {
target: 'https://dev.unitj.cn',
target: 'http://172.72.253.25:8088',
// target: 'http://58.223.177.48:8088',
changeOrigin: true,
// ws: false,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment