提交 63912424 编写于 作者: ibizdev's avatar ibizdev

lxm1993 发布系统代码 [TrainSys,网页端]

上级 8a03918d
......@@ -11,13 +11,14 @@
"lint:style": "stylelint 'src/**/*.scss'"
},
"dependencies": {
"@ibiz-template/command": "^0.0.1-alpha.13",
"@ibiz-template/controller": "^0.0.1-alpha.15",
"@ibiz-template/core": "^0.0.1-alpha.13",
"@ibiz-template/model": "^0.0.1-alpha.15",
"@ibiz-template/runtime": "^0.0.1-alpha.15",
"@ibiz-template/service": "^0.0.1-alpha.15",
"@ibiz-template/vue-util": "^0.0.1-alpha.15",
"@ibiz-template/command": "0.0.1-alpha.13",
"@ibiz-template/controller": "0.0.1-alpha.16",
"@ibiz-template/core": "0.0.1-alpha.16",
"@ibiz-template/model": "0.0.1-alpha.16",
"@ibiz-template/runtime": "0.0.1-alpha.16",
"@ibiz-template/service": "0.0.1-alpha.16",
"@ibiz-template/vue-util": "0.0.1-alpha.16",
"dayjs": "^1.11.5",
"ionicons": "^6.0.3",
"lodash-es": "^4.17.21",
"pinia": "^2.0.22",
......@@ -28,8 +29,7 @@
"systemjs": "^6.13.0",
"view-design": "^4.7.0",
"vue": "^2.7.10",
"vue-router": "^3.6.4",
"dayjs": "^1.11.5"
"vue-router": "^3.6.4"
},
"devDependencies": {
"@commitlint/cli": "^17.1.2",
......
......@@ -3,13 +3,13 @@ lockfileVersion: 5.4
specifiers:
'@commitlint/cli': ^17.1.2
'@commitlint/config-conventional': ^17.1.0
'@ibiz-template/command': ^0.0.1-alpha.13
'@ibiz-template/controller': ^0.0.1-alpha.15
'@ibiz-template/core': ^0.0.1-alpha.13
'@ibiz-template/model': ^0.0.1-alpha.15
'@ibiz-template/runtime': ^0.0.1-alpha.15
'@ibiz-template/service': ^0.0.1-alpha.15
'@ibiz-template/vue-util': ^0.0.1-alpha.15
'@ibiz-template/command': 0.0.1-alpha.13
'@ibiz-template/controller': 0.0.1-alpha.16
'@ibiz-template/core': 0.0.1-alpha.16
'@ibiz-template/model': 0.0.1-alpha.16
'@ibiz-template/runtime': 0.0.1-alpha.16
'@ibiz-template/service': 0.0.1-alpha.16
'@ibiz-template/vue-util': 0.0.1-alpha.16
'@types/lodash-es': ^4.17.6
'@types/node': ^18.8.3
'@types/qs': ^6.9.7
......@@ -60,12 +60,12 @@ specifiers:
dependencies:
'@ibiz-template/command': 0.0.1-alpha.13
'@ibiz-template/controller': 0.0.1-alpha.15_wvyibvgvo5rqntlnslu6kgeaua
'@ibiz-template/core': 0.0.1-alpha.13_amgpmzcbvys7f63sicqtedd4k4
'@ibiz-template/model': 0.0.1-alpha.15_amgpmzcbvys7f63sicqtedd4k4
'@ibiz-template/runtime': 0.0.1-alpha.15_xicyfd2scxwdlnm3nwj35lmm6u
'@ibiz-template/service': 0.0.1-alpha.15_ugamdxggotwkp4sabiqjh6vek4
'@ibiz-template/vue-util': 0.0.1-alpha.15_pvqgesrhqd5s4uqltz7hjmff4u
'@ibiz-template/controller': 0.0.1-alpha.16_3vyzyqdsfjj2uuejjjk5alwidq
'@ibiz-template/core': 0.0.1-alpha.16_amgpmzcbvys7f63sicqtedd4k4
'@ibiz-template/model': 0.0.1-alpha.16_amgpmzcbvys7f63sicqtedd4k4
'@ibiz-template/runtime': 0.0.1-alpha.16_hfpvjyl7tcjqp2uqrwytqjd3dq
'@ibiz-template/service': 0.0.1-alpha.16_olo3fw5kxwfldkalipgpgtirfq
'@ibiz-template/vue-util': 0.0.1-alpha.16_d55f7qedagx7tksktpnydpksnu
dayjs: 1.11.5
ionicons: 6.0.3
lodash-es: 4.17.21
......@@ -661,8 +661,8 @@ packages:
resolution: {integrity: sha512-IUD6x29nmmxdL8XbGGfBAEYlPO/+E8qHd/TI2ncgaaBFcF6M4ih7xga8l1oYuSdr+xx4mlXkAbzQFOqAQWm21g==}
dev: false
/@ibiz-template/controller/0.0.1-alpha.15_wvyibvgvo5rqntlnslu6kgeaua:
resolution: {integrity: sha512-UpujB323mASgEkCb5poRfguYnU9dWqEryCWg8/lsmBUmR/I72NUEDHwbk9dZSMJsEThxoTmVC31aXqmMbORi7g==}
/@ibiz-template/controller/0.0.1-alpha.16_3vyzyqdsfjj2uuejjjk5alwidq:
resolution: {integrity: sha512-6ES/q892/Gm+TKKOH519PV3JyBpCQMP5Hpk/qO2iYdFC5GZJFSLbD/tz9IO8YcIPA32u4bkV8otxiV7q/S+L7A==}
peerDependencies:
'@ibiz-template/core': ^0.0.1-alpha.2
'@ibiz-template/model': ^0.0.1-alpha.2
......@@ -671,18 +671,18 @@ packages:
lodash-es: ^4.17.21
qx-util: ^0.4.1
dependencies:
'@ibiz-template/core': 0.0.1-alpha.13_amgpmzcbvys7f63sicqtedd4k4
'@ibiz-template/model': 0.0.1-alpha.15_amgpmzcbvys7f63sicqtedd4k4
'@ibiz-template/runtime': 0.0.1-alpha.15_xicyfd2scxwdlnm3nwj35lmm6u
'@ibiz-template/service': 0.0.1-alpha.15_ugamdxggotwkp4sabiqjh6vek4
'@ibiz-template/core': 0.0.1-alpha.16_amgpmzcbvys7f63sicqtedd4k4
'@ibiz-template/model': 0.0.1-alpha.16_amgpmzcbvys7f63sicqtedd4k4
'@ibiz-template/runtime': 0.0.1-alpha.16_hfpvjyl7tcjqp2uqrwytqjd3dq
'@ibiz-template/service': 0.0.1-alpha.16_olo3fw5kxwfldkalipgpgtirfq
async-validator: 4.2.5
dayjs: 1.11.5
lodash-es: 4.17.21
qx-util: 0.4.1
dev: false
/@ibiz-template/core/0.0.1-alpha.13_amgpmzcbvys7f63sicqtedd4k4:
resolution: {integrity: sha512-7Vg4mWrty/aVlM63oEgMjMcYIY1lSkczb+Z6KCdkzZlfTp2LZJlNIJ4ZVw0XR0ctykDxUh91uBJNb47RgEdxQQ==}
/@ibiz-template/core/0.0.1-alpha.16_amgpmzcbvys7f63sicqtedd4k4:
resolution: {integrity: sha512-Wt1J6hUmMopF9MfXj2tMTFoNiNnhYsEL78Jjmj4f2ZPVZd5+EDBk4ricGfw5aNNB74TPoqrX/vvpIVGEAlngGA==}
peerDependencies:
lodash-es: ^4.17.21
qx-util: ^0.4.1
......@@ -696,8 +696,8 @@ packages:
- debug
dev: false
/@ibiz-template/model/0.0.1-alpha.15_amgpmzcbvys7f63sicqtedd4k4:
resolution: {integrity: sha512-ZQWSvPa+W9ecDLi3P7UcBqKCPy0rdZCmXoJiZ+pbZVpO01Xdk5BwSzuTEl8Pgz2ciIP15a25M8G8YjziZ35lhg==}
/@ibiz-template/model/0.0.1-alpha.16_amgpmzcbvys7f63sicqtedd4k4:
resolution: {integrity: sha512-QlrUeXkU9UaN6A/k2v9ElGw0n8lzD8pS/OFbc5SFcyXj9iTdKQk/wWk4qVRXKWhDOCzhAixTwxn7k+Z3bLtPAA==}
peerDependencies:
lodash-es: ^4.17.21
qx-util: ^0.4.1
......@@ -708,8 +708,8 @@ packages:
qx-util: 0.4.1
dev: false
/@ibiz-template/runtime/0.0.1-alpha.15_xicyfd2scxwdlnm3nwj35lmm6u:
resolution: {integrity: sha512-fFM8vDoyIC1eoSSfJYypwZ2aCJej6Fh4jFuIPRxZd2iEatgn+CPgAL+k5EQGFTe7qs36I4bkqV9EXZWSl/1Ocg==}
/@ibiz-template/runtime/0.0.1-alpha.16_hfpvjyl7tcjqp2uqrwytqjd3dq:
resolution: {integrity: sha512-it9CF4XEUEY5hWeiHwnMw3tW3v3IK7fxiWmRJADItUn5fs+rZnzfh/6pOKY2duj2o1yUnUzbSFrjw8owOOhx8Q==}
peerDependencies:
'@ibiz-template/core': ^0.0.1-alpha.2
'@ibiz-template/model': ^0.0.1-alpha.2
......@@ -717,28 +717,28 @@ packages:
qx-util: ^0.4.1
dependencies:
'@ibiz-template/command': 0.0.1-alpha.13
'@ibiz-template/core': 0.0.1-alpha.13_amgpmzcbvys7f63sicqtedd4k4
'@ibiz-template/model': 0.0.1-alpha.15_amgpmzcbvys7f63sicqtedd4k4
'@ibiz-template/service': 0.0.1-alpha.15_ugamdxggotwkp4sabiqjh6vek4
'@ibiz-template/core': 0.0.1-alpha.16_amgpmzcbvys7f63sicqtedd4k4
'@ibiz-template/model': 0.0.1-alpha.16_amgpmzcbvys7f63sicqtedd4k4
'@ibiz-template/service': 0.0.1-alpha.16_olo3fw5kxwfldkalipgpgtirfq
qx-util: 0.4.1
dev: false
/@ibiz-template/service/0.0.1-alpha.15_ugamdxggotwkp4sabiqjh6vek4:
resolution: {integrity: sha512-5kqvYh9bDddSNLDHb2ceDL+V0+cDd3oG3gK12RH2kyKXagP9DTRgfYbOHOmOe7eGhPolPndUDgkeP4Sbgn/N4g==}
/@ibiz-template/service/0.0.1-alpha.16_olo3fw5kxwfldkalipgpgtirfq:
resolution: {integrity: sha512-GJSk3lnvRYbylq8/di9MG6nPhVSaAR7S2GRInF0Uzj0mpqOVDr61YkdTBIvtCn1nZTSuXlu5NbfBxAhLmBaN1w==}
peerDependencies:
'@ibiz-template/core': ^0.0.1-alpha.2
'@ibiz-template/model': ^0.0.1-alpha.2
qx-util: ^0.4.1
ramda: ^0.28.0
dependencies:
'@ibiz-template/core': 0.0.1-alpha.13_amgpmzcbvys7f63sicqtedd4k4
'@ibiz-template/model': 0.0.1-alpha.15_amgpmzcbvys7f63sicqtedd4k4
'@ibiz-template/core': 0.0.1-alpha.16_amgpmzcbvys7f63sicqtedd4k4
'@ibiz-template/model': 0.0.1-alpha.16_amgpmzcbvys7f63sicqtedd4k4
qx-util: 0.4.1
ramda: 0.28.0
dev: false
/@ibiz-template/vue-util/0.0.1-alpha.15_pvqgesrhqd5s4uqltz7hjmff4u:
resolution: {integrity: sha512-eg5f/Act0cn1mRGFQz+G5kIjVSrHwqKv188EHS02y/zaa47ZTKEp69bSrWFcTK7gqR7kQIEjEDGguFw5KyGLAQ==}
/@ibiz-template/vue-util/0.0.1-alpha.16_d55f7qedagx7tksktpnydpksnu:
resolution: {integrity: sha512-xxtPlFhfyOXrH6k1rgGVNuVm9NEM96JR06Tly9cbxp4bdldsbO6+tRzk9n6DDcsbyrSacnIkUy6rHm2gXKvOPg==}
peerDependencies:
'@ibiz-template/controller': '>=0.0.1-alpha.2'
'@ibiz-template/core': '>=0.0.1-alpha.2'
......@@ -748,9 +748,9 @@ packages:
vue: ^2.7.10
vue-router: ^3.6.4
dependencies:
'@ibiz-template/controller': 0.0.1-alpha.15_wvyibvgvo5rqntlnslu6kgeaua
'@ibiz-template/core': 0.0.1-alpha.13_amgpmzcbvys7f63sicqtedd4k4
'@ibiz-template/model': 0.0.1-alpha.15_amgpmzcbvys7f63sicqtedd4k4
'@ibiz-template/controller': 0.0.1-alpha.16_3vyzyqdsfjj2uuejjjk5alwidq
'@ibiz-template/core': 0.0.1-alpha.16_amgpmzcbvys7f63sicqtedd4k4
'@ibiz-template/model': 0.0.1-alpha.16_amgpmzcbvys7f63sicqtedd4k4
qs: 6.11.0
qx-util: 0.4.1
vue: 2.7.10
......@@ -1478,7 +1478,7 @@ packages:
/axios/0.27.2:
resolution: {integrity: sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==}
dependencies:
follow-redirects: 1.15.1
follow-redirects: 1.15.2
form-data: 4.0.0
transitivePeerDependencies:
- debug
......@@ -2571,8 +2571,8 @@ packages:
resolution: {integrity: sha512-0sQoMh9s0BYsm+12Huy/rkKxVu4R1+r96YX5cG44rHV0pQ6iC3Q+mkoMFaGWObMFYQxCVT+ssG1ksneA2MI9KQ==}
dev: true
/follow-redirects/1.15.1:
resolution: {integrity: sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA==}
/follow-redirects/1.15.2:
resolution: {integrity: sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==}
engines: {node: '>=4.0'}
peerDependencies:
debug: '*'
......
var BaseUrl = '';
if (window.Environment && window.Environment.BaseUrl) {
BaseUrl = "/"+window.Environment.BaseUrl;
}
function getQueryVariable(variable) {
var query = location.search.substring(1);
var vars = query.split('&');
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split('=');
if (pair[0] == variable) {
return pair[1];
}
}
return false;
}
function getRequest(method, url, params) {
var config = { credentials: 'include' };
config.method = method;
if (params) {
if (method === 'POST') {
config.headers = { Accept: 'application/json', 'Content-Type': 'application/json;charset=utf-8' };
config.body = JSON.stringify(params);
}
}
return new Request(url, config);
}
function post(url, params) {
return fetch(this.getRequest('POST', url, params));
}
function setCookie(name, value, day, isDomain, path) {
if (day == null) {
day = 0;
}
if (isDomain == null) {
isDomain = false;
}
if (path == null) {
path = '/';
}
var domain = '';
// 设置cookie到主域下
if (isDomain) {
// 是否为ip正则
const regExpr = /^(25[0-5]|2[0-4]\d|[0-1]\d{2}|[1-9]?\d)\.(25[0-5]|2[0-4]\d|[0-1]\d{2}|[1-9]?\d)\.(25[0-5]|2[0-4]\d|[0-1]\d{2}|[1-9]?\d)\.(25[0-5]|2[0-4]\d|[0-1]\d{2}|[1-9]?\d)$/;
// 为ip时忽略
if (!regExpr.test(location.hostname)) {
const host = location.hostname;
if (host.indexOf('.') !== host.lastIndexOf('.')) {
domain = ';domain=' + host.substring(host.indexOf('.'), host.length);
}
}
}
if (day !== 0) {
//当设置的时间等于0时,不设置expires属性,cookie在浏览器关闭后删除
const expires = day * 24 * 60 * 60 * 1000;
const date = new Date(new Date().getTime() + expires);
document.cookie = name + '=' + escape(value) + ';path=' + path + ';expires=' + date.toUTCString() + domain;
} else {
document.cookie = name + '=' + escape(value) + ';path=' + path + domain;
}
}
function clearCookie(cookieName, isDomain) {
this.setCookie(cookieName, '', -1, isDomain);
}
window.onload = function() {
var infoEl = document.getElementById('redirect-info');
var errInfoEl = document.getElementById('redirect-error');
// 显示错误信息
var showError = function(info) {
errInfoEl.textContent = info;
infoEl.style.display = 'none';
errInfoEl.style.display = 'block';
};
var load = function() {
try {
var ticket = getQueryVariable('ticket');
if (!ticket) {
showError('「ticket」信息获取失败,请稍后重试!');
return;
}
var ru = getQueryVariable('RU');
if (ru) {
ru = decodeURIComponent(ru);
}
post(BaseUrl+'/v7/login', {
password: ticket,
loginname: location.origin + location.pathname + location.hash + '?RU=' + encodeURIComponent(ru),
})
.then(function(res) {
return new Promise(resolve => {
res.json().then(data =>
resolve({
ok: res.ok,
status: res.status,
data,
}),
);
});
})
.then(function(res) {
var data = res.data;
if (res.ok) {
var token = data.token;
if (token == null || token == '') {
showError('token信息获取失败,请稍后重试!');
return;
}
clearCookie('access_token', true);
setCookie('access_token', token, 0, true);
window.location.href = ru;
} else {
if (data.message) {
showError('登录失败,' + data.message);
} else {
showError('登录失败, 发生未知错误请稍后重试!');
}
}
})
.catch(function(err) {
showError('登录失败请稍后重试!');
console.error(err);
});
} catch (err) {
showError('登录失败请稍后重试!');
console.error(err);
}
};
var redirectInfoActionEl = document.getElementById('redirect-info-action');
redirectInfoActionEl.onclick = function() {
load();
};
load();
};
此差异已折叠。
......@@ -4,6 +4,7 @@ export async function attachEnvironmentConfig(): Promise<void> {
ibiz.env.baseUrl = env.BaseUrl;
ibiz.env.remoteModelUrl = env.remoteDynaPath;
ibiz.env.dcSystem = env.mockDcSystemId;
ibiz.env.casLoginUrl = env.casLoginUrl;
if (env.AppTitle) {
document.title = env.AppTitle;
}
......
import { MDViewController, ViewController } from '@ibiz-template/controller';
import { useNamespace } from '@ibiz-template/vue-util';
import { defineComponent, PropType } from 'vue';
import '@/styles/components/layout/view-base/view-base.scss';
export const ViewBase = defineComponent({
props: {
......@@ -34,13 +35,23 @@ export const ViewBase = defineComponent({
isLoading={c.viewLoading.isLoading}
scopedSlots={{
caption: () => {
if (c.complete && c.model.source.getPSSysImage()) {
return [
<app-icon icon={c.model.source.getPSSysImage()}></app-icon>,
c.caption,
];
}
return c.caption;
return (
<div class={this.ns.b('caption')}>
{c.complete && c.model.source.getPSSysImage() ? (
[
<app-icon
class={this.ns.be('caption', 'icon')}
icon={c.model.source.getPSSysImage()}
></app-icon>,
<span class={this.ns.be('caption', 'text')}>
{c.caption}
</span>,
]
) : (
<span class={this.ns.be('caption', 'text')}>{c.caption}</span>
)}
</div>
);
},
toolbar: () => {
if (c.complete && c.model.toolbar) {
......
......@@ -4,6 +4,7 @@ import {
IRouteViewData,
parseRouteViewData,
useRoute,
useRouter,
} from '@ibiz-template/vue-util';
import { Route } from 'vue-router';
import { getViewComponentName } from '@/util';
......@@ -19,6 +20,7 @@ export default defineComponent({
setup(props, ctx) {
const { proxy } = getCurrentInstance()!;
const route = useRoute(proxy) as Route;
const router = useRouter(proxy);
const viewData = ref<IRouteViewData>({});
const isLoaded = ref(false);
const viewComponentName = ref('');
......@@ -28,7 +30,11 @@ export default defineComponent({
const appModel = service.app;
if (appModel) {
// 获取视图
viewData.value = parseRouteViewData(appModel, route, props.level);
try {
viewData.value = parseRouteViewData(appModel, route, props.level);
} catch (error) {
router.push(`/${route.params.view1}/404`);
}
// 确定视图组件
viewComponentName.value = getViewComponentName(
viewData.value.viewType!,
......
......@@ -78,25 +78,27 @@ export const GridControl = defineComponent({
// 绘制作用域插槽,绘制行编辑开启开关
const columnSlots: IData = {
rowEdit: ({ index }: IData) => {
return (
<i-button
icon='md-settings'
on-click={async (event: MouseEvent) => {
event.stopPropagation();
const rowController = this.c.rows[index];
await this.c.toggleRowEdit(rowController);
}}
nativeOn-dblclick={(e: MouseEvent) => {
e.stopPropagation();
}}
></i-button>
);
if (this.c.rows[index]) {
return (
<i-button
icon='md-settings'
on-click={async (event: MouseEvent) => {
event.stopPropagation();
const rowController = this.c.rows[index];
await this.c.toggleRowEdit(rowController);
}}
nativeOn-dblclick={(e: MouseEvent) => {
e.stopPropagation();
}}
></i-button>
);
}
},
};
// 属性列自定义
this.c.model.fieldColumns.forEach(item => {
columnSlots[item.codeName] = ({ row, index }: IData) => {
if (this.c.rows.length > 0) {
if (this.c.rows[index]) {
return (
<grid-column
key={row.srfkey + item.codeName}
......@@ -111,7 +113,7 @@ export const GridControl = defineComponent({
// 操作列自定义
this.c.model.uaColumns.forEach(item => {
columnSlots[item.codeName] = ({ row, index }: IData) => {
if (this.c.rows.length > 0) {
if (this.c.rows[index]) {
return (
<grid-ua-column
key={row.srfkey + item.codeName}
......
import { OrgData } from '@ibiz-template/core';
import { ModelUtil } from '@ibiz-template/model';
import { handleUnauthorized } from '../handle-unauthorized/handle-unauthorized';
import { UnauthorizedHandler } from '../unauthorized-handler/unauthorized-handler';
/**
* 初始化模型
......@@ -12,13 +12,9 @@ import { handleUnauthorized } from '../handle-unauthorized/handle-unauthorized';
async function loadModel(): Promise<void> {
await ModelUtil.create(async modelPath => {
const url = `${ibiz.env.remoteModelUrl}${modelPath}`;
try {
const res = await ibiz.net.get(url);
if (res.ok) {
return res.data as IModel;
}
} catch (error) {
console.log(error);
const res = await ibiz.net.get(url);
if (res.ok) {
return res.data as IModel;
}
return {};
});
......@@ -71,7 +67,7 @@ async function appInit(): Promise<void> {
} catch (error) {
const { response, message } = error as IData;
if (response.status === 401) {
await handleUnauthorized();
await UnauthorizedHandler.handle();
}
console.log(`应用参数初始化失败:${message}`);
}
......
export { AuthGuard } from './auth-guard/auth-guard';
export { handleUnauthorized } from './handle-unauthorized/handle-unauthorized';
export { UnauthorizedHandler } from './unauthorized-handler/unauthorized-handler';
import qs from 'qs';
import { UrlHelper } from '@ibiz-template/core';
import router from '@/router';
/**
* 没有权限的处理器
*
* @author lxm
* @date 2022-10-11 14:10:10
* @export
* @class UnauthorizedHandler
*/
export class UnauthorizedHandler {
/**
* cas登录处理
*
* @author lxm
* @date 2022-10-11 14:10:35
* @protected
* @static
* @returns {*} {Promise<void>}
*/
protected static async casLogin(): Promise<void> {
// 登录后返回来的登录的地址
const backUrl = `${UrlHelper.appBase}/cas-login.html${qs.stringify(
{
RU: UrlHelper.fullPath,
},
{ addQueryPrefix: true },
)}`;
// 要跳转的cas的登录页和参数
const targetUrl =
ibiz.env.casLoginUrl +
qs.stringify(
{
service: backUrl,
},
{ addQueryPrefix: true },
);
// 跳转cas登录地址
window.location.href = targetUrl;
}
/**
* 普通登录处理
*
* @author lxm
* @date 2022-10-11 14:10:24
* @protected
* @static
* @returns {*} {Promise<void>}
*/
protected static async normalLogin(): Promise<void> {
const ru = window.location.hash.replace('#', '');
router.push({ path: '/login', query: { ru } });
}
/**
* 没有权限处理
*
* @author lxm
* @date 2022-10-11 14:10:50
* @static
* @returns {*} {Promise<void>}
*/
static async handle(): Promise<void> {
if (ibiz.env.casLoginUrl) {
await this.casLogin();
} else {
this.normalLogin();
}
}
}
......@@ -61,6 +61,11 @@ const router = new Router({
},
component: RouterShell,
children: [
{
path: '404',
name: '404View',
component: () => import('../views/404-view/404-view'),
},
{
path: ':view2([^=/]+)/:params2([^/]+=[^/]+)?',
props: {
......
@include b(view) {
@include set-component-css-var('view', $view);
@include b(view-caption) {
@include utils-ellipsis;
@include e(icon) {
display: inline-block;
margin: getCssVar('view-caption-icon', 'margin');
vertical-align: middle;
}
}
}
......@@ -32,7 +32,6 @@
@include flex(row, space-between);
}
@include e(caption) {
@include utils-ellipsis;
@include flex(row, flex-start, center);
max-width: getCssVar('view-layout-header', 'caption-max-width');
......@@ -40,12 +39,6 @@
font-size: getCssVar('view-layout-header', 'caption-font-size');
font-weight: getCssVar('view-layout-header', 'caption-font-weight');
color: getCssVar('view-layout-header', 'caption-color');
> img {
display: inline-block;
margin-right: 10px;
vertical-align: middle;
}
}
}
}
......@@ -90,6 +83,7 @@
padding: getCssVar('view-layout-drawer-header', 'padding');
}
@include b(view-layout-content) {
min-height: getCssVar('view-layout-drawer-content', 'min-height');
padding: getCssVar('view-layout-drawer-content', 'padding');
}
}
......@@ -108,6 +102,7 @@
padding: getCssVar('view-layout-modal-header', 'padding');
}
@include b(view-layout-content) {
min-height: getCssVar('view-layout-modal-content', 'min-height');
padding: getCssVar('view-layout-modal-content', 'padding');
}
}
......
@include b(404-view) {
@include flex(row, center, center);
width: 100%;
height: 100%;
background-color: #fff;
@include b(404-view-text) {
@include e(text1) {
margin-bottom: 20px;
}
}
}
......@@ -2,6 +2,12 @@
@include set-component-css-var('grid-ua-column', $grid-ua-column);
.ivu-btn {
color: getCssVar('grid-ua-column', 'btn-color');
background-color: getCssVar('grid-ua-column', 'btn-bg-color');
box-shadow: none;
&:hover {
color: getCssVar('grid-ua-column', 'btn-hover-color');
}
}
}
......@@ -278,7 +278,7 @@ $skeleton: map.merge(
'bg-color': rgb(190 190 190 / 20%),
// 骨架屏元素背景颜色
'transition-color': rgb(129 129 129 / 24%)
// 骨架屏元素动画效果过渡颜色,,,,,,,,,,,
// 骨架屏元素动画效果过渡颜色,,,,,,,,,,,,,,
),
$skeleton
);
......@@ -495,7 +495,16 @@ $form-druipart: map.merge(
/* 表单 end */
/* 暂时保留,后期修改 End */
/* 视图base start */
$view: () !default;
$view: map.merge(
(
'caption-icon-margin': 0 10px 0 0,
),
$view
);
/* 视图base end */
/* 视图布局 start */
$view-layout: () !default;
......@@ -549,6 +558,7 @@ $view-layout-drawer-content: () !default;
$view-layout-drawer-content: map.merge(
(
'padding': 0,
'min-height': 0,
),
$view-layout-drawer-content
);
......@@ -566,6 +576,7 @@ $view-layout-modal-content: () !default;
$view-layout-modal-content: map.merge(
(
'padding': 0,
'min-height': 0,
),
$view-layout-modal-content
);
......@@ -639,6 +650,8 @@ $grid-ua-column: () !default;
$grid-ua-column: map.merge(
(
'btn-bg-color': transparent,
'btn-hover-color': #2d8cf0,
'btn-color': #515a6e,
),
$grid-ua-column
);
......
import { HttpError, RuntimeError } from '@ibiz-template/core';
import { DefectModelError, UnsupportedModelError } from '@ibiz-template/model';
import { handleUnauthorized } from '@/guard';
import { UnauthorizedHandler } from '@/guard';
/**
* 事件处理工具
......@@ -32,7 +32,7 @@ export class ErrorHandler {
duration: 10,
});
if (err.status === 401) {
handleUnauthorized();
UnauthorizedHandler.handle();
}
} else if (err instanceof RuntimeError) {
ibiz.message.error(err.message);
......
import { defineComponent } from 'vue';
import { useNamespace, useRoute, useRouter } from '@ibiz-template/vue-util';
import { computed, defineComponent, getCurrentInstance, onMounted } from 'vue';
import '@/styles/components/views/404-view/404-view.scss';
import { Route } from 'vue-router';
export default defineComponent({
setup() {
const ns = useNamespace('404-view');
const { proxy } = getCurrentInstance()!;
const router = useRouter(proxy);
const route = useRoute(proxy) as Route;
const gotoIndexView = () => {
router.push('/');
};
onMounted(() => {
setTimeout(() => {
const el = document.querySelector('.app-loading-x') as HTMLDivElement;
if (el) {
el.style.display = 'none';
}
}, 300);
});
const isView1 = computed(() => {
return !route.params.view1;
});
return { ns, isView1, gotoIndexView };
},
render() {
return <div>404</div>;
return (
<div class={this.ns.b()}>
<img class={this.ns.b('img')} src='./assets/img/404.png' />
<div class={this.ns.b('text')}>
<div class={this.ns.be('text', 'text1')}>
抱歉,您访问的页面不存在!
</div>
{this.isView1 ? (
<div class={this.ns.be('text', 'text2')}>
您要找的页面不存在,请返回
<a on-click={this.gotoIndexView}>首页</a>
继续浏览
</div>
) : null}
</div>
</div>
);
},
});
......@@ -2,10 +2,10 @@ import { useRouter } from '@ibiz-template/vue-util';
import Vue, { ref, watch } from 'vue';
export const getView2Value = (item: IParams) => {
return (
(item.params.view2 ? `/${item.params.view2}` : '') +
(item.params.params2 ? `/${item.params.params2}` : '')
);
return item.params.view2
? (item.params.view2 ? `/${item.params.view2}` : '') +
(item.params.params2 ? `/${item.params.params2}` : '')
: '404';
};
export const getView1Value = (item: IParams) => {
......@@ -42,7 +42,7 @@ export function useIndexRouteManage(proxy: Vue) {
() => proxy.$route,
(newVal, oldVal) => {
// 只处理有二级路由,只有首页的时候不需要
if (newVal !== oldVal && newVal.params.view2) {
if (newVal !== oldVal) {
currentKey.value = getView2Value(newVal);
indexPath.value = getView1Value(newVal);
// 更新或新建对应key的全路由信息,主要是三级路由变更时会用
......
pnpm up --latest "@ibiz-template/vue-util" "@ibiz-template/service" "@ibiz-template/runtime" "@ibiz-template/model" "@ibiz-template/core" "@ibiz-template/command" "@ibiz-template/controller"
\ No newline at end of file
......@@ -485,52 +485,52 @@
resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45"
integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==
"@ibiz-template/command@^0.0.1-alpha.13":
"@ibiz-template/command@0.0.1-alpha.13", "@ibiz-template/command@^0.0.1-alpha.13":
version "0.0.1-alpha.13"
resolved "https://registry.yarnpkg.com/@ibiz-template/command/-/command-0.0.1-alpha.13.tgz#e8f07fede7fbfd3aa22eeec80ad66acf6c914d1e"
integrity sha512-IUD6x29nmmxdL8XbGGfBAEYlPO/+E8qHd/TI2ncgaaBFcF6M4ih7xga8l1oYuSdr+xx4mlXkAbzQFOqAQWm21g==
"@ibiz-template/controller@^0.0.1-alpha.15":
version "0.0.1-alpha.15"
resolved "https://registry.yarnpkg.com/@ibiz-template/controller/-/controller-0.0.1-alpha.15.tgz#ff01696798854fa02a66e0c32b687d9bfae97d60"
integrity sha512-UpujB323mASgEkCb5poRfguYnU9dWqEryCWg8/lsmBUmR/I72NUEDHwbk9dZSMJsEThxoTmVC31aXqmMbORi7g==
"@ibiz-template/controller@0.0.1-alpha.16":
version "0.0.1-alpha.16"
resolved "https://registry.yarnpkg.com/@ibiz-template/controller/-/controller-0.0.1-alpha.16.tgz#74399a69bcda3edad17a101bad1ea05e193b1f83"
integrity sha512-6ES/q892/Gm+TKKOH519PV3JyBpCQMP5Hpk/qO2iYdFC5GZJFSLbD/tz9IO8YcIPA32u4bkV8otxiV7q/S+L7A==
dependencies:
async-validator "^4.2.5"
dayjs "^1.11.5"
"@ibiz-template/core@^0.0.1-alpha.13":
version "0.0.1-alpha.13"
resolved "https://registry.yarnpkg.com/@ibiz-template/core/-/core-0.0.1-alpha.13.tgz#ce2d742fe4b703d0aba3c1836e72f88cf50e0d0a"
integrity sha512-7Vg4mWrty/aVlM63oEgMjMcYIY1lSkczb+Z6KCdkzZlfTp2LZJlNIJ4ZVw0XR0ctykDxUh91uBJNb47RgEdxQQ==
"@ibiz-template/core@0.0.1-alpha.16":
version "0.0.1-alpha.16"
resolved "https://registry.yarnpkg.com/@ibiz-template/core/-/core-0.0.1-alpha.16.tgz#d75a6cbf368ecfb7fbcf3ffd83d33e75b5ddd763"
integrity sha512-Wt1J6hUmMopF9MfXj2tMTFoNiNnhYsEL78Jjmj4f2ZPVZd5+EDBk4ricGfw5aNNB74TPoqrX/vvpIVGEAlngGA==
dependencies:
axios "^0.27.2"
pluralize "^8.0.0"
qs "^6.11.0"
"@ibiz-template/model@^0.0.1-alpha.15":
version "0.0.1-alpha.15"
resolved "https://registry.yarnpkg.com/@ibiz-template/model/-/model-0.0.1-alpha.15.tgz#c06aa42fc653e125b72e42a0650ac380ee3fd19e"
integrity sha512-ZQWSvPa+W9ecDLi3P7UcBqKCPy0rdZCmXoJiZ+pbZVpO01Xdk5BwSzuTEl8Pgz2ciIP15a25M8G8YjziZ35lhg==
"@ibiz-template/model@0.0.1-alpha.16":
version "0.0.1-alpha.16"
resolved "https://registry.yarnpkg.com/@ibiz-template/model/-/model-0.0.1-alpha.16.tgz#ad70fbb16ceeda471da5c98cc69c921279a6346f"
integrity sha512-QlrUeXkU9UaN6A/k2v9ElGw0n8lzD8pS/OFbc5SFcyXj9iTdKQk/wWk4qVRXKWhDOCzhAixTwxn7k+Z3bLtPAA==
dependencies:
"@ibiz/dynamic-model-api" "^2.0.5"
pluralize "^8.0.0"
"@ibiz-template/runtime@^0.0.1-alpha.15":
version "0.0.1-alpha.15"
resolved "https://registry.yarnpkg.com/@ibiz-template/runtime/-/runtime-0.0.1-alpha.15.tgz#333f9fb247424e0d864370e3ec24f8d6acaa756e"
integrity sha512-fFM8vDoyIC1eoSSfJYypwZ2aCJej6Fh4jFuIPRxZd2iEatgn+CPgAL+k5EQGFTe7qs36I4bkqV9EXZWSl/1Ocg==
"@ibiz-template/runtime@0.0.1-alpha.16":
version "0.0.1-alpha.16"
resolved "https://registry.yarnpkg.com/@ibiz-template/runtime/-/runtime-0.0.1-alpha.16.tgz#8a17272a4f415215dad181b602555c62260b948e"
integrity sha512-it9CF4XEUEY5hWeiHwnMw3tW3v3IK7fxiWmRJADItUn5fs+rZnzfh/6pOKY2duj2o1yUnUzbSFrjw8owOOhx8Q==
dependencies:
"@ibiz-template/command" "^0.0.1-alpha.13"
"@ibiz-template/service@^0.0.1-alpha.15":
version "0.0.1-alpha.15"
resolved "https://registry.yarnpkg.com/@ibiz-template/service/-/service-0.0.1-alpha.15.tgz#4965b905e50b323fedc16db28714885b51e0dfb6"
integrity sha512-5kqvYh9bDddSNLDHb2ceDL+V0+cDd3oG3gK12RH2kyKXagP9DTRgfYbOHOmOe7eGhPolPndUDgkeP4Sbgn/N4g==
"@ibiz-template/service@0.0.1-alpha.16":
version "0.0.1-alpha.16"
resolved "https://registry.yarnpkg.com/@ibiz-template/service/-/service-0.0.1-alpha.16.tgz#4217b273f9a068caf573dffbb8abc873c9faae15"
integrity sha512-GJSk3lnvRYbylq8/di9MG6nPhVSaAR7S2GRInF0Uzj0mpqOVDr61YkdTBIvtCn1nZTSuXlu5NbfBxAhLmBaN1w==
"@ibiz-template/vue-util@^0.0.1-alpha.15":
version "0.0.1-alpha.15"
resolved "https://registry.yarnpkg.com/@ibiz-template/vue-util/-/vue-util-0.0.1-alpha.15.tgz#d2b6ab2ed6363869bc7fdadcc342f51e76b3637b"
integrity sha512-eg5f/Act0cn1mRGFQz+G5kIjVSrHwqKv188EHS02y/zaa47ZTKEp69bSrWFcTK7gqR7kQIEjEDGguFw5KyGLAQ==
"@ibiz-template/vue-util@0.0.1-alpha.16":
version "0.0.1-alpha.16"
resolved "https://registry.yarnpkg.com/@ibiz-template/vue-util/-/vue-util-0.0.1-alpha.16.tgz#11965e9726d7e76b62e3c1764ed348f6faf723db"
integrity sha512-xxtPlFhfyOXrH6k1rgGVNuVm9NEM96JR06Tly9cbxp4bdldsbO6+tRzk9n6DDcsbyrSacnIkUy6rHm2gXKvOPg==
"@ibiz/dynamic-model-api@^2.0.5":
version "2.0.5"
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册