feat: 学院端整体布局修改

This commit is contained in:
cgd_mac 2022-02-25 14:36:56 +08:00
parent 87564e9c81
commit 4d62c98158
3 changed files with 78 additions and 41 deletions

View File

@ -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>

View File

@ -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)

View File

@ -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>