打包配置

This commit is contained in:
BianLzhaoMin 2025-08-28 16:20:56 +08:00
parent b6ad2a8578
commit c11f69cb1f
7 changed files with 190 additions and 157 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 = '/hd-realname/prod-api'

View File

@ -6,5 +6,7 @@ NODE_ENV = production
# 测试环境配置
ENV = 'staging'
VUE_APP_ENV = 'staging'
# 实名制管理系统/测试环境
VUE_APP_BASE_API = '/stage-api'

View File

@ -1,27 +1,46 @@
<template>
<div class="navbar">
<hamburger id="hamburger-container" :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
<hamburger
id="hamburger-container"
:is-active="sidebar.opened"
class="hamburger-container"
@toggleClick="toggleSideBar"
/>
<breadcrumb id="breadcrumb-container" class="breadcrumb-container" v-if="!topNav"/>
<top-nav id="topmenu-container" class="topmenu-container" v-if="topNav"/>
<breadcrumb
id="breadcrumb-container"
class="breadcrumb-container"
v-if="!topNav"
/>
<top-nav
id="topmenu-container"
class="topmenu-container"
v-if="topNav"
/>
<div class="right-menu">
<template v-if="device !== 'mobile'">
<search id="header-search" class="right-menu-item" />
<screenfull id="screenfull" class="right-menu-item hover-effect" />
<screenfull
id="screenfull"
class="right-menu-item hover-effect"
/>
<el-tooltip content="布局大小" effect="dark" placement="bottom">
<size-select id="size-select" class="right-menu-item hover-effect" />
<size-select
id="size-select"
class="right-menu-item hover-effect"
/>
</el-tooltip>
</template>
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
<el-dropdown
class="avatar-container right-menu-item hover-effect"
trigger="click"
>
<div class="avatar-wrapper">
<img :src="avatar" class="user-avatar">
<img :src="avatar" class="user-avatar" />
<i class="el-icon-caret-bottom" />
</div>
<el-dropdown-menu slot="dropdown">
@ -60,14 +79,10 @@ export default {
SizeSelect,
Search,
bonusGit,
bonusDoc
bonusDoc,
},
computed: {
...mapGetters([
'sidebar',
'avatar',
'device'
]),
...mapGetters(['sidebar', 'avatar', 'device']),
setting: {
get() {
return this.$store.state.settings.showSettings
@ -75,15 +90,15 @@ export default {
set(val) {
this.$store.dispatch('settings/changeSetting', {
key: 'showSettings',
value: val
value: val,
})
}
},
},
topNav: {
get() {
return this.$store.state.settings.topNav
}
}
},
},
},
methods: {
toggleSideBar() {
@ -93,14 +108,19 @@ export default {
this.$confirm('确定注销并退出系统吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$store.dispatch('LogOut').then(() => {
location.href = '/index';
type: 'warning',
})
}).catch(() => {});
}
}
.then(() => {
this.$store.dispatch('LogOut').then(() => {
location.href =
process.env.VUE_APP_ENV === 'production'
? '/hd-realname/index'
: '/index'
})
})
.catch(() => {})
},
},
}
</script>
@ -110,18 +130,18 @@ export default {
overflow: hidden;
position: relative;
background: #fff;
box-shadow: 0 1px 4px rgba(0,21,41,.08);
box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
.hamburger-container {
line-height: 46px;
height: 100%;
float: left;
cursor: pointer;
transition: background .3s;
transition: background 0.3s;
-webkit-tap-highlight-color: transparent;
&:hover {
background: rgba(0, 0, 0, .025)
background: rgba(0, 0, 0, 0.025);
}
}
@ -158,10 +178,10 @@ export default {
&.hover-effect {
cursor: pointer;
transition: background .3s;
transition: background 0.3s;
&:hover {
background: rgba(0, 0, 0, .025)
background: rgba(0, 0, 0, 0.025);
}
}
}

View File

@ -197,4 +197,5 @@ export default new Router({
mode: 'history', // 去掉url中的#
scrollBehavior: () => ({ y: 0 }),
routes: constantRoutes,
base: process.env.VUE_APP_ENV === 'production' ? '/hd-realname' : '',
})

View File

@ -167,7 +167,11 @@ service.interceptors.response.use(
.then(() => {
isRelogin.show = false
store.dispatch('LogOut').then(() => {
location.href = '/index'
// location.href = '/index'
location.href =
process.env.VUE_APP_ENV === 'production'
? '/hd-realname/index'
: '/index'
})
})
.catch(() => {

View File

@ -189,7 +189,11 @@ service.interceptors.response.use(
.then(() => {
isRelogin.show = false
store.dispatch('LogOut').then(() => {
location.href = '/index'
// location.href = '/index'
location.href =
process.env.VUE_APP_ENV === 'production'
? '/hd-realname/index'
: '/index'
})
})
.catch(() => {