integration/src/layout/index.vue

157 lines
3.5 KiB
Vue
Raw Normal View History

2025-12-27 16:44:06 +08:00
<template>
<div v-if="!inIframe" :class="classObj" class="app-wrapper">
<div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside" />
<!-- todo 后续加入全局头部 -->
<Banner />
<sidebar class="sidebar-container" />
<div class="main-container">
<div :class="{'fixed-header':fixedHeader}">
<navbar />
</div>
<app-main />
2025-12-29 20:30:20 +08:00
<footer>© {{ new Date().getFullYear() }} 内蒙古自治区市场监督管理局 | 技术支持广东众望通科技股份有限公司
2025-12-27 16:44:06 +08:00
<span v-if="currentUpgrade" style="cursor:pointer" @click="toVersion">
版本号v{{ currentUpgrade.version }}
<span v-if="logNew" class="back">new</span>
</span>
</footer>
</div>
<!-- <ReportEntry :show.sync="showReport" />-->
</div>
<div v-else :class="classObj" class="app-wrapper">
<app-main />
</div>
</template>
<script>
import Banner from '@/layout/components/Banner'
import { Navbar, Sidebar, AppMain } from './components'
import ResizeMixin from './mixin/ResizeHandler'
import ReportEntry from '@/components/ReportEntry'
export default {
name: 'Layout',
components: {
Navbar,
Sidebar,
AppMain,
Banner,
ReportEntry
},
mixins: [ResizeMixin],
data() {
return {
currentUpgrade: null,
logNew: false,
showReport: false
}
},
computed: {
inIframe() {
return window.top !== window.self
},
sidebar() {
return this.$store.state.app.sidebar
},
device() {
return this.$store.state.app.device
},
fixedHeader() {
return this.$store.state.settings.fixedHeader
},
classObj() {
return {
hideSidebar: !this.sidebar.opened,
openSidebar: this.sidebar.opened,
withoutAnimation: this.sidebar.withoutAnimation,
mobile: this.device === 'mobile'
}
}
},
mounted() {
this.findNewVersionLog()
},
methods: {
findNewVersionLog() {
// 查询最新的版本号日志
this.currentUpgrade = {
'upgradeId': '1.1.0',
'version': '1.1.0'
}
const version = localStorage.getItem('version')
if (version !== this.currentUpgrade.version) {
this.logNew = true
}
},
handleClickOutside() {
this.$store.dispatch('app/closeSideBar', { withoutAnimation: false })
},
toVersion() {
localStorage.setItem('version', this.currentUpgrade.version)
this.logNew = false
const { href } = this.$router.resolve({
path: '/versionLog'
})
window.open(href, '_blank')
}
}
}
</script>
<style lang="scss" scoped>
@import "~@/styles/mixin.scss";
@import "~@/styles/variables.scss";
.app-wrapper {
@include clearfix;
position: relative;
height: 100%;
width: 100%;
&.mobile.openSidebar {
position: fixed;
top: 0;
}
}
.drawer-bg {
background: #000;
opacity: 0.3;
width: 100%;
top: 0;
height: 100%;
position: absolute;
z-index: 999;
}
.fixed-header {
position: fixed;
top: 86px;
right: 0;
z-index: 9;
width: calc(100% - #{$sideBarWidth});
transition: width 0.28s;
}
.hideSidebar .fixed-header {
width: calc(100% - 54px);
}
.mobile .fixed-header {
width: 100%;
}
footer {
text-align: center;
font-size: 13px;
line-height: 30px;
background-color: #f4f8f9;
width: 100%;
.back{
font-size: 8px;
background-color: red;
color: #fff;
border-radius: 50px;
padding: 1px 3px;
position: absolute;
line-height: 15px;
}
}
</style>