打包配置

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' ENV = 'development'
VUE_APP_ENV = 'development'
# 实名制管理系统/开发环境 # 实名制管理系统/开发环境
VUE_APP_BASE_API = '/dev-api' VUE_APP_BASE_API = '/dev-api'

View File

@ -3,6 +3,7 @@ VUE_APP_TITLE = 实名制管理系统
# 生产环境配置 # 生产环境配置
ENV = 'production' ENV = 'production'
VUE_APP_ENV = 'production'
# 实名制管理系统/生产环境 # 实名制管理系统/生产环境
VUE_APP_BASE_API = '/hd-realname/prod-api' VUE_APP_BASE_API = '/hd-realname/prod-api'

View File

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

View File

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

View File

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

View File

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