This commit is contained in:
duanxiaohai 2024-09-27 13:28:07 +08:00
parent 8385634bd8
commit c56d90ecfa
13 changed files with 314 additions and 23 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View File

@ -17,10 +17,22 @@ const router = createRouter({
component: () => import("../view/guide.vue"),
},
{
name: "权限",
name: "权限",
path: "/error/noPermission",
component: () => import("../view/error/noPermission.vue"),
},
{
name: "404",
path: "/404",
component: () => import("../views/error/404.vue"),
meta: { page_id: 7, page_name: "404" },
},
{
name: "500",
path: "/500",
component: () => import("../views/error/500.vue"),
meta: { page_id: 8, page_name: "500" },
},
{
path: "/home",
component: () => import("../view/home.vue"),

View File

@ -1,9 +1,8 @@
import axios from "axios";
import { ElMessage } from "element-plus";
import tools from "@/utils/tools";
import dd from "gdt-jsapi";
import router from "../router";
// axios.defaults.baseURL = '/api'
axios.defaults.timeout = 120000;
@ -31,31 +30,27 @@ axios.interceptors.response.use(
if (error.response) {
if (error.response.status == 401) {
ElMessage.error("请重新登录!");
// console.log(error.response,"响应拦截器失败")
// window.location.href = '/#/login?returnURL=' + window.location.href
// window.location.href =
// "http://220.191.238.50:996/api/login?returnURL=" +
// window.location.href;
// const cookies = document.cookie.split(";");
// for (let i = 0; i < cookies.length; i++) {
// const cookie = cookies[i];
// const eqPos = cookie.indexOf("=");
// const name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
// document.cookie =
// name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/;";
// }
router.replace({
path: "/guide",
});
} else if (error.response.status == 403) {
ElMessage.error("Status:403资源不可用");
router.replace({
path: "/403",
});
} else if (error.response.status == 404) {
ElMessage.error("Status:404正在请求不存在的服务器记录");
router.replace({
path: "/404",
});
} else if (error.response.status == 500) {
ElMessage.error({
title: "请求错误",
message: "Status:500服务器发生错误",
});
router.replace({
path: "/500",
});
} else {
ElMessage.error(`Status:${error.response.status},未知错误!`);
}

85
src/view/error/401.vue Normal file
View File

@ -0,0 +1,85 @@
<template>
<div class="error_main">
<img class="error_main_img" src="@/assets/errorImg/error3.png" alt="" />
<div class="error_main_content">请求未验证请联系管理员</div>
<div class="unit">
<div>
<!-- 应用归属单位 -->
应用归属单位
</div>
<div>
<!-- 象山县委宣传部 -->
象山县城市建设投资集团有限公司
</div>
</div>
<div class="unit">
<div>
<!-- 应用管理员 -->
应用管理员
</div>
<div>
<!-- 陈金裕 -->
姚杰
</div>
</div>
<div class="unit">
<div>
<!-- 联系方式 -->
联系方式
</div>
<div>
<!-- 13806654654 -->
15888067199
</div>
</div>
</div>
</template>
<style lang="scss">
.error_main {
width: 100%;
max-width: 500px;
padding: 30px 30px 0;
box-sizing: border-box;
display: flex;
align-items: center;
flex-direction: column;
margin: 0 auto;
.error_main_img {
width: 300px;
height: 300px;
}
.error_main_content {
text-align: center;
margin-top: 5px;
font-size: 14px;
padding: 0 60px;
box-sizing: border-box;
color: #666874;
font-weight: 500;
margin-bottom: 26px;
line-height: 48px;
}
.unit {
display: flex;
// padding: 16px;
height: 58px;
width: 100%;
font-size: 14px;
justify-content: space-between;
box-sizing: border-box;
font-weight: 500;
color: #666874;
align-items: center;
div:nth-child(2) {
color: #32333b;
}
}
}
</style>

87
src/view/error/403.vue Normal file
View File

@ -0,0 +1,87 @@
<template>
<div class="error_main">
<img class="error_main_img" src="@/assets/errorImg/error3.png" alt="" />
<div class="error_main_content">
抱歉您暂无当前页面的访问权限请联系管理员
</div>
<div class="unit">
<div>
<!-- 应用归属单位 -->
应用归属单位
</div>
<div>
<!-- 象山县委宣传部 -->
象山县城市建设投资集团有限公司
</div>
</div>
<div class="unit">
<div>
<!-- 应用管理员 -->
应用管理员
</div>
<div>
<!-- 陈金裕 -->
姚杰
</div>
</div>
<div class="unit">
<div>
<!-- 联系方式 -->
联系方式
</div>
<div>
<!-- 13806654654 -->
15888067199
</div>
</div>
</div>
</template>
<style lang="scss">
.error_main {
width: 100%;
max-width: 500px;
padding: 30px 30px 0;
box-sizing: border-box;
display: flex;
align-items: center;
flex-direction: column;
margin: 0 auto;
.error_main_img {
width: 300px;
height: 300px;
}
.error_main_content {
text-align: center;
margin-top: 5px;
font-size: 14px;
padding: 0 60px;
box-sizing: border-box;
color: #666874;
font-weight: 500;
margin-bottom: 26px;
line-height: 48px;
}
.unit {
display: flex;
// padding: 16px;
height: 58px;
width: 100%;
font-size: 14px;
justify-content: space-between;
box-sizing: border-box;
font-weight: 500;
color: #666874;
align-items: center;
div:nth-child(2) {
color: #32333b;
}
}
}
</style>

55
src/view/error/404.vue Normal file
View File

@ -0,0 +1,55 @@
<template>
<div class="error_main">
<img class="error_main_img" src="@/assets/errorImg/error1.png" alt="" />
<div class="error_main_content">抱歉访问资源不存在</div>
</div>
</template>
<style lang="scss">
.error_main {
width: 100%;
max-width: 500px;
padding: 30px 30px 0;
box-sizing: border-box;
display: flex;
align-items: center;
flex-direction: column;
margin: 0 auto;
.error_main_img {
width: 300px;
height: 300px;
}
.error_main_content {
text-align: center;
margin-top: 5px;
font-size: 14px;
padding: 0 60px;
box-sizing: border-box;
color: #666874;
font-weight: 500;
margin-bottom: 26px;
line-height: 48px;
}
.unit {
display: flex;
// padding: 16px;
height: 58px;
width: 100%;
font-size: 14px;
justify-content: space-between;
box-sizing: border-box;
font-weight: 500;
color: #666874;
align-items: center;
div:nth-child(2) {
color: #32333b;
}
}
}
</style>

56
src/view/error/500.vue Normal file
View File

@ -0,0 +1,56 @@
<template>
<div class="error_main">
<img class="error_main_img" src="@/assets/errorImg/error2.png" alt="" />
<div class="error_main_content">
抱歉系统错误您可以选择尝试清除缓存或联系管理员
</div>
</div>
</template>
<style lang="scss">
.error_main {
width: 100%;
max-width: 500px;
padding: 30px 30px 0;
box-sizing: border-box;
display: flex;
align-items: center;
flex-direction: column;
margin: 0 auto;
.error_main_img {
width: 300px;
height: 300px;
}
.error_main_content {
text-align: center;
margin-top: 5px;
font-size: 14px;
padding: 0 60px;
box-sizing: border-box;
color: #666874;
font-weight: 500;
margin-bottom: 26px;
line-height: 48px;
}
.unit {
display: flex;
// padding: 16px;
height: 58px;
width: 100%;
font-size: 14px;
justify-content: space-between;
box-sizing: border-box;
font-weight: 500;
color: #666874;
align-items: center;
div:nth-child(2) {
color: #32333b;
}
}
}
</style>

View File

@ -1,6 +1,6 @@
<template>
<div class="error_main">
<img class="error_main_img" src="@/assets/errorimg/error3.png" alt="" />
<img class="error_main_img" src="@/assets/errorImg/error3.png" alt="" />
<div class="error_main_content">账号没权限请联系管理员</div>
</div>

View File

@ -159,10 +159,11 @@ const login = () => {
})
.catch((err) => {
console.log(err);
var token = getCookie("lytoken");
// var token = '6b0e380b4a8f46baae4923f83faf670d';
// var token = getCookie("lytoken");
var token = '6b0e380b4a8f46baae4923f83faf670d';
router.push({
path: `/error/noPermission`,
});
// console.log('token', token)
if (!token) {
window.location.href =