配置文件更改

This commit is contained in:
cwchen 2025-09-25 14:13:28 +08:00
parent 096dae3c14
commit a351302a7e
6 changed files with 37 additions and 6 deletions

View File

@ -3,6 +3,7 @@ VUE_APP_TITLE = 档案预归档管理系统
# 开发环境配置
ENV = 'development'
VUE_APP_ENV = 'development'
# 档案预归档管理系统/开发环境
VUE_APP_BASE_API = '/dev-api'

View File

@ -3,6 +3,7 @@ VUE_APP_TITLE = 档案预归档管理系统
# 生产环境配置
ENV = 'production'
VUE_APP_ENV = 'production'
# 档案预归档管理系统/生产环境
VUE_APP_BASE_API = '/prod-api'
VUE_APP_BASE_API = '/smart-archiving-api'

View File

@ -102,7 +102,7 @@ export default {
type: 'warning'
}).then(() => {
this.$store.dispatch('LogOut').then(() => {
location.href = '/index'
location.href = process.env.VUE_APP_ENV === 'production'? '/smart-archiving/index': '/index'
})
}).catch(() => {})
}

View File

@ -255,5 +255,6 @@ Router.prototype.replace = function push(location) {
export default new Router({
mode: 'history', // 去掉url中的#
scrollBehavior: () => ({ y: 0 }),
routes: constantRoutes
routes: constantRoutes,
base: process.env.VUE_APP_ENV === 'production'? '/smart-archiving': ''
})

View File

@ -47,7 +47,8 @@ service.interceptors.request.use(
repeatSubmit = false,
skipReplayProtection = false
} = headers
console.error(process.env.NODE_ENV);
// 设置请求头
config.headers['encryptRequest'] = systemConfig.requestConfig.encryptRequest && encryptRequest ? 'true' : 'false'
config.headers['checkIntegrity'] = systemConfig.requestConfig.checkIntegrity && checkIntegrity ? 'true' : 'false'
@ -242,6 +243,33 @@ service.interceptors.response.use(
) {
return res.data
}
console.log(msg);
// 账号在其他设备登录的安全提示(基于后端返回信息关键词识别)
const otherDeviceLogin = /检测到您的账号已在其他设备登录/.test(String(msg || ''))
if (otherDeviceLogin) {
if (!isRelogin.show) {
isRelogin.show = true
MessageBox.alert(
'检测到您的账号已在其他设备登录,当前会话已下线。如非本人操作,请立即修改密码。',
'安全提示',
{
confirmButtonText: '重新登录',
type: 'warning',
callback: () => {
isRelogin.show = false
store.dispatch('LogOut').then(() => {
location.href =
process.env.VUE_APP_ENV === 'production'
? '/smart-archiving/index'
: '/index'
})
},
},
)
}
return Promise.reject('账号在其他设备登录,已强制下线。')
}
if (code === 401) {
if (!isRelogin.show) {
const currentPath = window.location.pathname

View File

@ -10,7 +10,7 @@ const CompressionPlugin = require('compression-webpack-plugin')
const name = process.env.VUE_APP_TITLE || '档案预归档管理系统' // 网页标题
// const baseUrl = 'http://localhost:8080' // 后端接口
const baseUrl = 'http://192.168.0.39:8080' // 后端接口-福
const baseUrl = 'http://192.168.0.39:8080'
const port = process.env.port || process.env.npm_config_port || 80 // 端口
@ -21,7 +21,7 @@ module.exports = {
// 部署生产环境和开发环境下的URL。
// 默认情况下Vue CLI 会假设你的应用是被部署在一个域名的根路径上
// 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。
publicPath: process.env.NODE_ENV === "production" ? "/" : "/",
publicPath: process.env.NODE_ENV === "production" ? "/smart-archiving/" : "/",
// 在npm run build 或 yarn build 时 生成文件的目录名称要和baseUrl的生产环境路径一致默认dist
outputDir: 'dist',
// 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)