打包配置

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,43 +1,62 @@
<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"
class="right-menu-item hover-effect"
/>
<el-tooltip content="布局大小" effect="dark" placement="bottom">
<size-select
id="size-select"
class="right-menu-item hover-effect"
/>
</el-tooltip>
</template>
<screenfull id="screenfull" class="right-menu-item hover-effect" /> <el-dropdown
class="avatar-container right-menu-item hover-effect"
<el-tooltip content="布局大小" effect="dark" placement="bottom"> trigger="click"
<size-select id="size-select" class="right-menu-item hover-effect" /> >
</el-tooltip> <div class="avatar-wrapper">
<img :src="avatar" class="user-avatar" />
</template> <i class="el-icon-caret-bottom" />
</div>
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click"> <el-dropdown-menu slot="dropdown">
<div class="avatar-wrapper"> <router-link to="/user/profile">
<img :src="avatar" class="user-avatar"> <el-dropdown-item>个人中心</el-dropdown-item>
<i class="el-icon-caret-bottom" /> </router-link>
<el-dropdown-item @click.native="setting = true">
<span>布局设置</span>
</el-dropdown-item>
<el-dropdown-item divided @click.native="logout">
<span>退出登录</span>
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div> </div>
<el-dropdown-menu slot="dropdown">
<router-link to="/user/profile">
<el-dropdown-item>个人中心</el-dropdown-item>
</router-link>
<el-dropdown-item @click.native="setting = true">
<span>布局设置</span>
</el-dropdown-item>
<el-dropdown-item divided @click.native="logout">
<span>退出登录</span>
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div> </div>
</div>
</template> </template>
<script> <script>
@ -52,143 +71,144 @@ import bonusGit from '@/components/bonus/Git'
import bonusDoc from '@/components/bonus/Doc' import bonusDoc from '@/components/bonus/Doc'
export default { export default {
components: { components: {
Breadcrumb, Breadcrumb,
TopNav, TopNav,
Hamburger, Hamburger,
Screenfull, Screenfull,
SizeSelect, SizeSelect,
Search, Search,
bonusGit, bonusGit,
bonusDoc bonusDoc,
},
computed: {
...mapGetters([
'sidebar',
'avatar',
'device'
]),
setting: {
get() {
return this.$store.state.settings.showSettings
},
set(val) {
this.$store.dispatch('settings/changeSetting', {
key: 'showSettings',
value: val
})
}
}, },
topNav: { computed: {
get() { ...mapGetters(['sidebar', 'avatar', 'device']),
return this.$store.state.settings.topNav setting: {
} get() {
} return this.$store.state.settings.showSettings
}, },
methods: { set(val) {
toggleSideBar() { this.$store.dispatch('settings/changeSetting', {
this.$store.dispatch('app/toggleSideBar') key: 'showSettings',
value: val,
})
},
},
topNav: {
get() {
return this.$store.state.settings.topNav
},
},
},
methods: {
toggleSideBar() {
this.$store.dispatch('app/toggleSideBar')
},
async logout() {
this.$confirm('确定注销并退出系统吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
this.$store.dispatch('LogOut').then(() => {
location.href =
process.env.VUE_APP_ENV === 'production'
? '/hd-realname/index'
: '/index'
})
})
.catch(() => {})
},
}, },
async logout() {
this.$confirm('确定注销并退出系统吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$store.dispatch('LogOut').then(() => {
location.href = '/index';
})
}).catch(() => {});
}
}
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.navbar { .navbar {
height: 50px; height: 50px;
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;
transition: background .3s;
-webkit-tap-highlight-color:transparent;
&:hover {
background: rgba(0, 0, 0, .025)
}
}
.breadcrumb-container {
float: left;
}
.topmenu-container {
position: absolute;
left: 50px;
}
.errLog-container {
display: inline-block;
vertical-align: top;
}
.right-menu {
float: right;
height: 100%;
line-height: 50px;
&:focus {
outline: none;
}
.right-menu-item {
display: inline-block;
padding: 0 8px;
height: 100%;
font-size: 18px;
color: #5a5e66;
vertical-align: text-bottom;
&.hover-effect {
cursor: pointer; cursor: pointer;
transition: background .3s; transition: background 0.3s;
-webkit-tap-highlight-color: transparent;
&:hover { &:hover {
background: rgba(0, 0, 0, .025) background: rgba(0, 0, 0, 0.025);
} }
}
} }
.avatar-container { .breadcrumb-container {
margin-right: 30px; float: left;
}
.avatar-wrapper {
margin-top: 5px; .topmenu-container {
position: relative; position: absolute;
left: 50px;
.user-avatar { }
cursor: pointer;
width: 40px; .errLog-container {
height: 40px; display: inline-block;
border-radius: 10px; vertical-align: top;
} }
.el-icon-caret-bottom { .right-menu {
cursor: pointer; float: right;
position: absolute; height: 100%;
right: -20px; line-height: 50px;
top: 25px;
font-size: 12px; &:focus {
} outline: none;
} }
.right-menu-item {
display: inline-block;
padding: 0 8px;
height: 100%;
font-size: 18px;
color: #5a5e66;
vertical-align: text-bottom;
&.hover-effect {
cursor: pointer;
transition: background 0.3s;
&:hover {
background: rgba(0, 0, 0, 0.025);
}
}
}
.avatar-container {
margin-right: 30px;
.avatar-wrapper {
margin-top: 5px;
position: relative;
.user-avatar {
cursor: pointer;
width: 40px;
height: 40px;
border-radius: 10px;
}
.el-icon-caret-bottom {
cursor: pointer;
position: absolute;
right: -20px;
top: 25px;
font-size: 12px;
}
}
}
} }
}
} }
</style> </style>

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(() => {