From 4a77da9283d77841b75224e1a36707d63d14bf89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E9=99=8C?= Date: Sat, 29 Jul 2023 20:58:35 +0800 Subject: [PATCH] no message --- .env.development | 8 +------- .env.production | 5 +---- src/layout/components/userbar.vue | 2 +- src/utils/request.js | 4 +++- vue.config.js | 3 +-- 5 files changed, 7 insertions(+), 15 deletions(-) diff --git a/.env.development b/.env.development index 145f3ae..1953aec 100644 --- a/.env.development +++ b/.env.development @@ -4,11 +4,5 @@ NODE_ENV = development # 标题 VUE_APP_TITLE = Ansnid -# 接口地址 -VUE_APP_API_BASEURL = https://www.fastmock.site/mock/5039c4361c39a7e3252c5b55971f1bd3/api - # 本地端口 -VUE_APP_PORT = 2800 - -# 是否开启代理 -VUE_APP_PROXY = false \ No newline at end of file +VUE_APP_PORT = 2800 \ No newline at end of file diff --git a/.env.production b/.env.production index e8136d8..d8aeb42 100644 --- a/.env.production +++ b/.env.production @@ -2,7 +2,4 @@ NODE_ENV = production # 标题 -VUE_APP_TITLE = Ansnid - -# 接口地址 -VUE_APP_API_BASEURL = https://www.fastmock.site/mock/5039c4361c39a7e3252c5b55971f1bd3/api \ No newline at end of file +VUE_APP_TITLE = Ansnid \ No newline at end of file diff --git a/src/layout/components/userbar.vue b/src/layout/components/userbar.vue index 4cd299d..608b555 100644 --- a/src/layout/components/userbar.vue +++ b/src/layout/components/userbar.vue @@ -156,7 +156,7 @@ type: 'warning', confirmButtonText: '退出', confirmButtonClass: 'el-button--danger' - }).then(() => { + }).then(() => { this.$router.replace({ path: '/login', query: { redirect: this.$route.fullPath } diff --git a/src/utils/request.js b/src/utils/request.js index c1e9b19..c9e74a9 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -47,6 +47,8 @@ axios.interceptors.response.use( message: error.response.data.message || "Status:500,服务器发生错误!" }); } else if (error.response.status == 401) { + + if (!MessageBox_401_show) { MessageBox_401_show = true ElMessageBox.confirm('当前用户已被登出或无权限访问当前资源,请尝试重新登录后再操作。', '无权限访问', { @@ -62,7 +64,7 @@ axios.interceptors.response.use( router.replace({ path: '/login', query: { - redirect: router.currentRoute.fullPath + redirect: router.currentRoute._value.fullPath } }); }).catch(() => {}) diff --git a/vue.config.js b/vue.config.js index db52259..8aacc6e 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,10 +1,9 @@ const { defineConfig } = require('@vue/cli-service') - module.exports = defineConfig({ //设置为空打包后不分更目录还是多级目录 - publicPath: 'https://x--mo.com:8888/admin/', + publicPath: process.env.NODE_ENV === 'production' ? 'https://x--mo.com:8888/admin/' : './', //build编译后存放静态文件的目录 assetsDir: "static", // build编译后不生成资源MAP文件