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" v-bind="settings"
> >
<template v-slot:rightContentRender> <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>
<!-- <template v-slot:footerRender> <!-- <template v-slot:footerRender>
<global-footer /> <global-footer />
@ -44,21 +48,21 @@ export default {
// //
collapsed: false, collapsed: false,
title: defaultSettings.title, title: defaultSettings.title,
settings: { // settings: {
// // //
layout: defaultSettings.layout, // 'sidemenu', 'topmenu' // layout: defaultSettings.layout, // 'sidemenu', 'topmenu'
// : true / : false // // : true / : false
contentWidth: defaultSettings.layout === 'sidemenu' ? false : defaultSettings.contentWidth === 'Fixed', // contentWidth: defaultSettings.layout === 'sidemenu' ? false : defaultSettings.contentWidth === 'Fixed',
// 'dark' | 'light' // // 'dark' | 'light'
theme: defaultSettings.navTheme, // theme: defaultSettings.navTheme,
// // //
primaryColor: defaultSettings.primaryColor, // primaryColor: defaultSettings.primaryColor,
fixedHeader: defaultSettings.fixedHeader, // fixedHeader: defaultSettings.fixedHeader,
fixSiderbar: defaultSettings.fixSiderbar, // fixSiderbar: defaultSettings.fixSiderbar,
colorWeak: defaultSettings.colorWeak, // colorWeak: defaultSettings.colorWeak,
hideHintAlert: false, // hideHintAlert: false,
hideCopyButton: false // hideCopyButton: false
}, // },
// //
query: {}, query: {},
// //
@ -68,8 +72,27 @@ export default {
computed: { computed: {
...mapState({ ...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 () { created () {
const routes = this.mainMenu.find(item => item.path === '/') const routes = this.mainMenu.find(item => item.path === '/')
@ -119,11 +142,10 @@ export default {
</script> </script>
<style lang="less"> <style lang="less">
@import "./BasicLayout.less"; @import './BasicLayout.less';
/*隐藏原本的图标*/ /*隐藏原本的图标*/
.ant-pro-global-header-trigger{ .ant-pro-global-header-trigger {
display: none; display: none;
} }
</style> </style>

View File

@ -13,7 +13,8 @@ const user = {
roles: [], roles: [],
buttons: [], // 按钮权限 buttons: [], // 按钮权限
info: {}, info: {},
person: {} person: {},
currentRole: {}
}, },
mutations: { mutations: {
@ -61,6 +62,7 @@ const user = {
.then(response => { .then(response => {
if (response.code === 200) { if (response.code === 200) {
const data = response.data const data = response.data
state.currentRole = data.currentRole
commit('SET_ROLES', 1) commit('SET_ROLES', 1)
commit('SET_BUTTONS', data.permissions) commit('SET_BUTTONS', data.permissions)
commit('SET_INFO', data.user) commit('SET_INFO', data.user)

View File

@ -1,15 +1,28 @@
<template> <template>
<a-card :bordered="false" style="display: flex;justify-content:center;height: 100%" > <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;"> <div style="margin:100px auto;">
<img src="~@/assets/welcome.png" class="logo" alt="logo"> <img src="~@/assets/welcome.png" class="logo" alt="logo" />
</div> </div>
</a-card> </a-card>
</div>
</template> </template>
<script> <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> </script>
<style lang="less" scoped> <style lang="less" scoped></style>
</style>