| | |
| | | |
| | | <script> |
| | | import enquireScreen from './utils/device' |
| | | import {mapState} from 'vuex' |
| | | |
| | | export default { |
| | | name: 'App', |
| | |
| | | enquireScreen(isMobile => { |
| | | _this.$store.commit('setting/setDevice', isMobile) |
| | | }) |
| | | }, |
| | | mounted() { |
| | | this.setWeekModeTheme(this.weekMode) |
| | | }, |
| | | watch: { |
| | | weekMode(val) { |
| | | this.setWeekModeTheme(val) |
| | | } |
| | | }, |
| | | computed: { |
| | | ...mapState('setting', ['weekMode']) |
| | | }, |
| | | methods: { |
| | | setWeekModeTheme(weekMode) { |
| | | if (weekMode) { |
| | | document.body.classList.add('week-mode') |
| | | } else { |
| | | document.body.classList.remove('week-mode') |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | |
| | | <a-list :split="false"> |
| | | <a-list-item> |
| | | 色弱模式 |
| | | <a-switch slot="actions" size="small" /> |
| | | <a-switch :checked="weekMode" slot="actions" size="small" @change="setWeekMode" /> |
| | | </a-list-item> |
| | | <a-list-item> |
| | | 显示抽屉按钮 |
| | |
| | | directions() { |
| | | return this.animates.find(item => item.name == this.animate).directions |
| | | }, |
| | | ...mapState('setting', ['animates', 'multiPage']) |
| | | ...mapState('setting', ['animates', 'multiPage', 'weekMode']) |
| | | }, |
| | | methods: { |
| | | onColorChange (values, colors) { |
| | |
| | | setMultiPage (checked) { |
| | | this.$store.commit('setting/setMultiPage', checked) |
| | | }, |
| | | setWeekMode(checked) { |
| | | this.$store.commit('setting/setWeekMode', checked) |
| | | }, |
| | | setAnimate() { |
| | | this.direction = this.directions[0] |
| | | let animate = { |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import {animates} from '@/config' |
| | | import animates from '@/config/animates' |
| | | |
| | | export default { |
| | | name: 'PageToggleTransition', |
| | |
| | | animate: { |
| | | type: String, |
| | | validator(value) { |
| | | return animates.find(item => item.name == value) != -1 |
| | | return animates.findIndex(item => item.name == value) != -1 |
| | | }, |
| | | default: 'bounce' |
| | | }, |
| | |
| | | // 系统配置 |
| | | module.exports = { |
| | | themeColor: '#1890ff', |
| | | animates: require('./animates'), |
| | | theme: 'dark', |
| | | layout: 'side', |
| | | weekMode: false, |
| | | multiPage: false, |
| | | systemName: 'Vue Antd Admin', |
| | | copyright: '2018 ICZER 工作室出品', |
| | | animate: { |
| | | name: 'bounce', |
| | | direction: 'left' |
| | | }, |
| | | footerLinks: [ |
| | | {link: 'https://pro.ant.design', name: 'Pro首页'}, |
| | | {link: 'https://github.com/iczer/vue-antd-admin', icon: 'github'}, |
| | |
| | | </div> |
| | | </a-layout-content> |
| | | <a-layout-footer style="padding: 0px"> |
| | | <global-footer :link-list="linkList" :copyright="copyright" /> |
| | | <global-footer :link-list="footerLinks" :copyright="copyright" /> |
| | | </a-layout-footer> |
| | | </a-layout> |
| | | </a-layout> |
| | |
| | | <template> |
| | | <a-dropdown :trigger="['click']"> |
| | | <template slot="overlay"> |
| | | <a-spin :spinning="loadding"> |
| | | <div slot="overlay"> |
| | | <a-spin :spinning="loading"> |
| | | <a-tabs :tabBarStyle="{textAlign: 'center'}" :style="{backgroundColor: 'white', width: '297px'}"> |
| | | <a-tab-pane tab="通知" key="1" :style="{padding: '0 24px'}"> |
| | | <a-list> |
| | |
| | | </a-tab-pane> |
| | | </a-tabs> |
| | | </a-spin> |
| | | </template> |
| | | </div> |
| | | <span @click="fetchNotice" class="header-notice"> |
| | | <a-badge count="12"> |
| | | <a-icon :class="['header-notice-icon', theme]" type="bell" /> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import {mapState} from 'vuex' |
| | | export default { |
| | | name: 'HeaderNotice', |
| | | data () { |
| | | return { |
| | | loadding: false |
| | | loading: false |
| | | } |
| | | }, |
| | | computed: { |
| | | theme () { |
| | | return this.$store.state.setting.layout === 'side' ? 'light' : this.$store.state.setting.theme |
| | | } |
| | | ...mapState('setting', ['layout', 'theme']), |
| | | theme() { |
| | | return this.layout == 'side' ? 'light' : this.theme |
| | | }, |
| | | }, |
| | | methods: { |
| | | fetchNotice () { |
| | | if (this.loadding) { |
| | | this.loadding = false |
| | | if (this.loading) { |
| | | this.loading = false |
| | | return |
| | | } |
| | | this.loadding = true |
| | | setTimeout(() => { |
| | | this.loadding = false |
| | | }, 2000) |
| | | }, 1000) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="less"> |
| | | <style lang="less" scoped> |
| | | .header-notice{ |
| | | display: inline-block; |
| | | transition: all 0.3s; |
| | |
| | | <template> |
| | | <a-dropdown style="display: inline-block; height: 100%; vertical-align: initial" > |
| | | <a-dropdown class="header-avatar"> |
| | | <span style="cursor: pointer"> |
| | | <a-avatar class="avatar" size="small" shape="circle" :src="currUser.avatar"/> |
| | | <span>{{currUser.name}}</span> |
| | | <a-avatar class="avatar" size="small" shape="circle" :src="user.avatar"/> |
| | | <span>{{user.name}}</span> |
| | | </span> |
| | | <a-menu style="width: 150px" slot="overlay"> |
| | | <a-menu :class="['avatar-menu']" slot="overlay"> |
| | | <a-menu-item> |
| | | <a-icon type="user" /> |
| | | <span>个人中心</span> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import {mapState} from 'vuex' |
| | | |
| | | export default { |
| | | name: 'HeaderAvatar', |
| | | computed: { |
| | | currUser () { |
| | | return this.$store.state.account.user |
| | | } |
| | | ...mapState('setting', ['weekMode']), |
| | | ...mapState('account', ['user']), |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="less" scoped> |
| | | <style lang="less"> |
| | | .header-avatar{ |
| | | display: inline-block; |
| | | height: 100%; |
| | | vertical-align: initial; |
| | | } |
| | | .avatar{ |
| | | margin: 20px 4px 20px 0; |
| | | color: #1890ff; |
| | | background: hsla(0,0%,100%,.85); |
| | | vertical-align: middle; |
| | | } |
| | | .avatar-menu{ |
| | | width: 150px; |
| | | } |
| | | </style> |
| | |
| | | import {footerLinks, animates, themeColor} from '@/config' |
| | | import config from '@/config' |
| | | export default { |
| | | namespaced: true, |
| | | state: { |
| | | isMobile: false, |
| | | theme: 'dark', |
| | | themeColor, |
| | | layout: 'side', |
| | | systemName: 'Vue Antd Admin', |
| | | copyright: '2018 ICZER 工作室出品', |
| | | footerLinks: footerLinks, |
| | | multiPage: true, |
| | | animates: animates, |
| | | animate: { |
| | | name: 'bounce', |
| | | direction: 'left' |
| | | } |
| | | animates: require('@/config/animates'), |
| | | ...config |
| | | }, |
| | | mutations: { |
| | | setDevice (state, isMobile) { |
| | |
| | | }, |
| | | setThemeColor (state, color) { |
| | | state.themeColor = color |
| | | }, |
| | | setWeekMode(state, weekMode) { |
| | | state.weekMode = weekMode |
| | | } |
| | | } |
| | | } |
| | |
| | | @import "color"; |
| | | @import "style"; |
New file |
| | |
| | | .week-mode{ |
| | | overflow: hidden; |
| | | filter: invert(80%); |
| | | } |