提交 48b58e78 编写于 作者: Neuromancer255's avatar Neuromancer255

错误提示中转页解决模态不能正确显示错误页

上级 321467ad
......@@ -109,5 +109,9 @@ export const AppComponents = {
v.component('app-list-index-text',() => import('@/components/app-list-index-text/app-list-index-text.vue'));
// 富文本(模态)
v.component('app-rich-text',() => import('@/components/app-rich-text/app-rich-text.vue'));
// 500错误提示页
v.component('app-500',() => import('@/components/500/500.vue'));
// 404错误提示页
v.component('app-404',() => import('@/components/404/404.vue'));
},
};
\ No newline at end of file
......@@ -25,18 +25,13 @@ export default class App404 extends Vue {
* 返回上一步
*/
public back() {
if (window.history.length <= 1) {
this.$router.push({ path: "/" });
return false;
} else {
this.$router.go(-1);
}
this.$emit("close",['back'])
}
/**
* 返回首页
*/
public backindex() {
this.$router.push({ path: "/" });
this.$emit("close",['goIndex'])
}
}
</script>
......
......@@ -25,18 +25,13 @@ export default class App404 extends Vue {
* 返回上一步
*/
public back() {
if (window.history.length <= 1) {
this.$router.push({ path: "/" });
return false;
} else {
this.$router.go(-1);
}
this.$emit("close",['back'])
}
/**
* 返回首页
*/
public backindex() {
this.$router.push({ path: "/" });
this.$emit("close",['goIndex'])
}
}
</script>
......
<template>
<div></div>
</template>
<script lang="ts">
import {
Vue,
Component,
Prop,
Provide,
Emit,
Watch
} from "vue-property-decorator";
@Component({
components: {}
})
export default class MiddleMan extends Vue{
public created(){
let errorPage = this.$route.params.errorPage;
switch(Number(errorPage)){
case 404:this.openPopupModal({ viewname: 'app-404', title: '404'}, {}, {});break;
case 500:this.openPopupModal({ viewname: 'app-500', title: '500'}, {}, {});break;
}
}
/**
* 模态打开错误提示页面
*
* @type {string}
* @memberof AppRichTextEditor
*/
private async openPopupModal(view: any, context: any, param: any): Promise<any> {
const result: any = await this.$appmodal.openModal(view, context, param);
if (result || Object.is(result.ret, 'OK')) {
if (result.datas[0] === 'back') {
if (window.history.length <= 1) {
this.$router.push({ path: "/" });
} else {
this.$router.go(-1);
}
}
if (result.datas[0] === 'goIndex') {
this.$router.push({ path: "/" });
}
}
}
}
</script>
<style>
</style>
\ No newline at end of file
......@@ -114,10 +114,10 @@ export class Interceptors {
}
if (res.status === 404) {
Loading.hidden();
this.router.push({ path: '/404' });
this.router.push({ name:'errorTransfer', params:{errorPage:res.status} });
} else if (res.status === 500) {
Loading.hidden();
this.router.push({ path: '/500' });
this.router.push({ name:'errorTransfer', params:{errorPage:res.status} });
}
return Promise.reject(res);
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册