Merge remote-tracking branch 'origin/develop' into local-test
All checks were successful
CI / Docker-Build (push) Successful in 2m34s
All checks were successful
CI / Docker-Build (push) Successful in 2m34s
This commit is contained in:
commit
f229298359
@ -67,6 +67,7 @@ export class ApiError {
|
|||||||
// for each client)
|
// for each client)
|
||||||
const api = axios.create({ baseURL: getHttpBase() });
|
const api = axios.create({ baseURL: getHttpBase() });
|
||||||
let isOpenDialog = false; // 认证弹窗是否打开
|
let isOpenDialog = false; // 认证弹窗是否打开
|
||||||
|
let quanXianDialog = false; // 权限提示弹窗是否打开
|
||||||
|
|
||||||
const CancelToken = axios.CancelToken;
|
const CancelToken = axios.CancelToken;
|
||||||
const source = CancelToken.source();
|
const source = CancelToken.source();
|
||||||
@ -107,6 +108,23 @@ export default boot(({ app, router }) => {
|
|||||||
.onCancel(() => {
|
.onCancel(() => {
|
||||||
isOpenDialog = false;
|
isOpenDialog = false;
|
||||||
});
|
});
|
||||||
|
} else if (
|
||||||
|
err.response &&
|
||||||
|
err.response.status === 403 &&
|
||||||
|
!quanXianDialog
|
||||||
|
) {
|
||||||
|
quanXianDialog = true;
|
||||||
|
Dialog.create({
|
||||||
|
title: '无权限',
|
||||||
|
message: '你没有该页面访问权限',
|
||||||
|
persistent: true,
|
||||||
|
})
|
||||||
|
.onOk(() => {
|
||||||
|
quanXianDialog = false;
|
||||||
|
})
|
||||||
|
.onCancel(() => {
|
||||||
|
quanXianDialog = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return Promise.reject(ApiError.from(err));
|
return Promise.reject(ApiError.from(err));
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,8 @@ enum Type {
|
|||||||
'动力学',
|
'动力学',
|
||||||
'半实物列车',
|
'半实物列车',
|
||||||
'列车PC仿真',
|
'列车PC仿真',
|
||||||
|
'联锁通信服务',
|
||||||
|
'计轴区段通信服务',
|
||||||
}
|
}
|
||||||
const columns: QTable['columns'] = [
|
const columns: QTable['columns'] = [
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { RouteRecordRaw } from 'vue-router';
|
import { RouteRecordRaw } from 'vue-router';
|
||||||
|
|
||||||
export const admin = '1'; // 超级管理员
|
// export const admin = '1'; // 超级管理员
|
||||||
export const user = '2'; // 普通用户
|
// export const user = '2'; // 普通用户
|
||||||
|
|
||||||
export const routes: RouteRecordRaw[] = [
|
export const routes: RouteRecordRaw[] = [
|
||||||
{
|
{
|
||||||
@ -35,7 +35,6 @@ export const asyncRoutes: RouteRecordRaw[] = [
|
|||||||
name: 'sysManage',
|
name: 'sysManage',
|
||||||
component: () => import('layouts/MainLayout.vue'),
|
component: () => import('layouts/MainLayout.vue'),
|
||||||
meta: {
|
meta: {
|
||||||
roles: [admin],
|
|
||||||
label: '系统管理',
|
label: '系统管理',
|
||||||
icon: 'dataset',
|
icon: 'dataset',
|
||||||
},
|
},
|
||||||
@ -74,7 +73,6 @@ export const asyncRoutes: RouteRecordRaw[] = [
|
|||||||
name: 'dataManage',
|
name: 'dataManage',
|
||||||
component: () => import('layouts/MainLayout.vue'),
|
component: () => import('layouts/MainLayout.vue'),
|
||||||
meta: {
|
meta: {
|
||||||
roles: [admin],
|
|
||||||
label: '数据管理',
|
label: '数据管理',
|
||||||
icon: 'list_alt',
|
icon: 'list_alt',
|
||||||
},
|
},
|
||||||
@ -140,7 +138,6 @@ export const asyncRoutes: RouteRecordRaw[] = [
|
|||||||
name: 'testManage',
|
name: 'testManage',
|
||||||
component: () => import('layouts/MainLayout.vue'),
|
component: () => import('layouts/MainLayout.vue'),
|
||||||
meta: {
|
meta: {
|
||||||
roles: [admin, user],
|
|
||||||
label: '测试管理',
|
label: '测试管理',
|
||||||
icon: 'format_list_bulleted',
|
icon: 'format_list_bulleted',
|
||||||
},
|
},
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import { PathItem } from 'src/api/AuthApi';
|
import { PathItem } from 'src/api/AuthApi';
|
||||||
import { AuthInfo, getCurrentUserInfo } from 'src/api/UserApi';
|
import { AuthInfo, getCurrentUserInfo } from 'src/api/UserApi';
|
||||||
import { MethodType } from 'src/components/AuthData';
|
// import { MethodType } from 'src/components/AuthData';
|
||||||
import { asyncRoutes, admin } from 'src/router/routes';
|
import { asyncRoutes } from 'src/router/routes';
|
||||||
import { RouteRecordRaw } from 'vue-router';
|
import { RouteRecordRaw } from 'vue-router';
|
||||||
|
|
||||||
export const useAuthStore = defineStore('auth', {
|
export const useAuthStore = defineStore('auth', {
|
||||||
@ -43,28 +43,28 @@ export const useAuthStore = defineStore('auth', {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getHasAuth(path: string, method: MethodType): boolean {
|
// getHasAuth(path: string, method: MethodType): boolean {
|
||||||
if (this.currentRolesList.includes(admin)) {
|
// // if (this.currentRolesList.includes(admin)) {
|
||||||
return true;
|
// // return true;
|
||||||
}
|
// // }
|
||||||
let s = false;
|
// let s = false;
|
||||||
const someP = this.currentPathsList.some((item) => {
|
// const someP = this.currentPathsList.some((item) => {
|
||||||
const p = '^' + item.path;
|
// const p = '^' + item.path;
|
||||||
const regP = new RegExp(p);
|
// const regP = new RegExp(p);
|
||||||
const hasP = regP.test(path);
|
// const hasP = regP.test(path);
|
||||||
let hasM = false;
|
// let hasM = false;
|
||||||
if (item.method == '*') {
|
// if (item.method == '*') {
|
||||||
hasM = true;
|
// hasM = true;
|
||||||
} else {
|
// } else {
|
||||||
hasM = item.method.includes(method);
|
// hasM = item.method.includes(method);
|
||||||
}
|
// }
|
||||||
return hasP && hasM;
|
// return hasP && hasM;
|
||||||
});
|
// });
|
||||||
if (someP) {
|
// if (someP) {
|
||||||
s = true;
|
// s = true;
|
||||||
}
|
// }
|
||||||
return s;
|
// return s;
|
||||||
},
|
// },
|
||||||
GenerateRoutes() {
|
GenerateRoutes() {
|
||||||
// 生成动态路由
|
// 生成动态路由
|
||||||
function hasPermission(metaRoles: string[], roles: string[]): boolean {
|
function hasPermission(metaRoles: string[], roles: string[]): boolean {
|
||||||
|
Loading…
Reference in New Issue
Block a user