feat: 学院端整体布局修改
This commit is contained in:
parent
87564e9c81
commit
4d62c98158
|
@ -12,7 +12,11 @@
|
|||
v-bind="settings"
|
||||
>
|
||||
<template v-slot:rightContentRender>
|
||||
<right-content :top-menu="settings.layout === 'topmenu'" :is-mobile="isMobile" :theme="settings.theme" />
|
||||
<right-content
|
||||
:top-menu="settings.layout === 'topmenu'"
|
||||
:is-mobile="isMobile"
|
||||
:theme="settings.theme"
|
||||
/>
|
||||
</template>
|
||||
<!-- <template v-slot:footerRender>
|
||||
<global-footer />
|
||||
|
@ -44,21 +48,21 @@ export default {
|
|||
// 侧栏收起状态
|
||||
collapsed: false,
|
||||
title: defaultSettings.title,
|
||||
settings: {
|
||||
// 布局类型
|
||||
layout: defaultSettings.layout, // 'sidemenu', 'topmenu'
|
||||
// 定宽: true / 流式: false
|
||||
contentWidth: defaultSettings.layout === 'sidemenu' ? false : defaultSettings.contentWidth === 'Fixed',
|
||||
// 主题 'dark' | 'light'
|
||||
theme: defaultSettings.navTheme,
|
||||
// 主色调
|
||||
primaryColor: defaultSettings.primaryColor,
|
||||
fixedHeader: defaultSettings.fixedHeader,
|
||||
fixSiderbar: defaultSettings.fixSiderbar,
|
||||
colorWeak: defaultSettings.colorWeak,
|
||||
hideHintAlert: false,
|
||||
hideCopyButton: false
|
||||
},
|
||||
// settings: {
|
||||
// // 布局类型
|
||||
// layout: defaultSettings.layout, // 'sidemenu', 'topmenu'
|
||||
// // 定宽: true / 流式: false
|
||||
// contentWidth: defaultSettings.layout === 'sidemenu' ? false : defaultSettings.contentWidth === 'Fixed',
|
||||
// // 主题 'dark' | 'light'
|
||||
// theme: defaultSettings.navTheme,
|
||||
// // 主色调
|
||||
// primaryColor: defaultSettings.primaryColor,
|
||||
// fixedHeader: defaultSettings.fixedHeader,
|
||||
// fixSiderbar: defaultSettings.fixSiderbar,
|
||||
// colorWeak: defaultSettings.colorWeak,
|
||||
// hideHintAlert: false,
|
||||
// hideCopyButton: false
|
||||
// },
|
||||
// 媒体查询
|
||||
query: {},
|
||||
// 是否手机模式
|
||||
|
@ -68,19 +72,38 @@ export default {
|
|||
computed: {
|
||||
...mapState({
|
||||
// 动态主路由
|
||||
mainMenu: state => state.permission.addRouters
|
||||
})
|
||||
mainMenu: state => state.permission.addRouters,
|
||||
currentRole: state => state.user.currentRole
|
||||
}),
|
||||
settings: function () {
|
||||
const code = this.currentRole && this.currentRole.code
|
||||
return {
|
||||
// 布局类型
|
||||
layout: code === 'student' ? 'topmenu' : defaultSettings.layout, // 'sidemenu', 'topmenu'
|
||||
// 定宽: true / 流式: false
|
||||
contentWidth: code === 'student' ? true : (defaultSettings.layout === 'sidemenu' ? false : defaultSettings.contentWidth === 'Fixed'),
|
||||
// 主题 'dark' | 'light'
|
||||
theme: defaultSettings.navTheme,
|
||||
// 主色调
|
||||
primaryColor: defaultSettings.primaryColor,
|
||||
fixedHeader: defaultSettings.fixedHeader,
|
||||
fixSiderbar: defaultSettings.fixSiderbar,
|
||||
colorWeak: defaultSettings.colorWeak,
|
||||
hideHintAlert: false,
|
||||
hideCopyButton: false
|
||||
}
|
||||
}
|
||||
},
|
||||
created () {
|
||||
const routes = this.mainMenu.find(item => item.path === '/')
|
||||
this.menus = (routes && routes.children) || []
|
||||
// 处理侧栏收起状态
|
||||
this.$watch('collapsed', () => {
|
||||
this.$store.commit(SIDEBAR_TYPE, this.collapsed)
|
||||
})
|
||||
this.$watch('isMobile', () => {
|
||||
this.$store.commit(TOGGLE_MOBILE_TYPE, this.isMobile)
|
||||
})
|
||||
const routes = this.mainMenu.find(item => item.path === '/')
|
||||
this.menus = (routes && routes.children) || []
|
||||
// 处理侧栏收起状态
|
||||
this.$watch('collapsed', () => {
|
||||
this.$store.commit(SIDEBAR_TYPE, this.collapsed)
|
||||
})
|
||||
this.$watch('isMobile', () => {
|
||||
this.$store.commit(TOGGLE_MOBILE_TYPE, this.isMobile)
|
||||
})
|
||||
},
|
||||
mounted () {
|
||||
const userAgent = navigator.userAgent
|
||||
|
@ -119,11 +142,10 @@ export default {
|
|||
</script>
|
||||
|
||||
<style lang="less">
|
||||
@import "./BasicLayout.less";
|
||||
@import './BasicLayout.less';
|
||||
|
||||
/*隐藏原本的图标*/
|
||||
.ant-pro-global-header-trigger{
|
||||
display: none;
|
||||
.ant-pro-global-header-trigger {
|
||||
display: none;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
|
@ -13,7 +13,8 @@ const user = {
|
|||
roles: [],
|
||||
buttons: [], // 按钮权限
|
||||
info: {},
|
||||
person: {}
|
||||
person: {},
|
||||
currentRole: {}
|
||||
},
|
||||
|
||||
mutations: {
|
||||
|
@ -61,6 +62,7 @@ const user = {
|
|||
.then(response => {
|
||||
if (response.code === 200) {
|
||||
const data = response.data
|
||||
state.currentRole = data.currentRole
|
||||
commit('SET_ROLES', 1)
|
||||
commit('SET_BUTTONS', data.permissions)
|
||||
commit('SET_INFO', data.user)
|
||||
|
|
|
@ -1,15 +1,28 @@
|
|||
<template>
|
||||
<a-card :bordered="false" style="display: flex;justify-content:center;height: 100%" >
|
||||
<div style="margin:100px auto;">
|
||||
<img src="~@/assets/welcome.png" class="logo" alt="logo">
|
||||
</div>
|
||||
</a-card>
|
||||
<div>
|
||||
<Myhome v-if="currentRole && currentRole.code === 'student'"></Myhome>
|
||||
<a-card v-else :bordered="false" style="display: flex;justify-content:center;height: 100%">
|
||||
<div style="margin:100px auto;">
|
||||
<img src="~@/assets/welcome.png" class="logo" alt="logo" />
|
||||
</div>
|
||||
</a-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { mapState } from 'vuex'
|
||||
import Myhome from '@/views/myhome/index.vue'
|
||||
export default {
|
||||
components: { Myhome },
|
||||
data () {
|
||||
return {}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
currentRole: state => state.user.currentRole
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
</style>
|
||||
<style lang="less" scoped></style>
|
||||
|
|
Loading…
Reference in New Issue