diff --git a/package.json b/package.json index 9abeb5d..fb46873 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ }, "dependencies": { "@antv/data-set": "^0.11.4", + "animate.css": "^4.1.0", "ant-design-vue": "^1.6.2", "axios": "^0.19.2", "clipboard": "^2.0.6", diff --git a/src/App.vue b/src/App.vue index b949aed..4136d3f 100644 --- a/src/App.vue +++ b/src/App.vue @@ -19,30 +19,4 @@ export default { diff --git a/src/components/checkbox/ColorCheckbox.vue b/src/components/checkbox/ColorCheckbox.vue index b164015..90efa10 100644 --- a/src/components/checkbox/ColorCheckbox.vue +++ b/src/components/checkbox/ColorCheckbox.vue @@ -94,7 +94,7 @@ export default { required: true }, value: { - type: String, + type: [String, Number], required: true }, checked: { diff --git a/src/components/menu/Contextmenu.vue b/src/components/menu/Contextmenu.vue index 76c2b1e..c901f42 100644 --- a/src/components/menu/Contextmenu.vue +++ b/src/components/menu/Contextmenu.vue @@ -64,8 +64,8 @@ export default { .contextmenu{ position: fixed; z-index: 1; - border: 1px solid #9e9e9e; + border-radius: 4px; - box-shadow: 2px 2px 10px #aaaaaa !important; + box-shadow: -4px 4px 16px 1px #e6e6e6 !important; } diff --git a/src/components/setting/Setting.vue b/src/components/setting/Setting.vue index 99656dd..c3dc643 100644 --- a/src/components/setting/Setting.vue +++ b/src/components/setting/Setting.vue @@ -7,15 +7,8 @@ - - - - - - - - - + + @@ -62,6 +55,22 @@ + + + + 动画效果 + + {{item.alias}} + + + + 动画方向 + + {{item}} + + + + 拷贝代码 @@ -72,6 +81,7 @@ import ColorCheckbox from '../checkbox/ColorCheckbox' import ImgCheckbox from '../checkbox/ImgCheckbox' import Clipboard from 'clipboard' import themeUtil from '../../utils/themeUtil'; +import { mapState } from 'vuex' const ColorCheckboxGroup = ColorCheckbox.Group const ImgCheckboxGroup = ImgCheckbox.Group @@ -79,11 +89,19 @@ const ImgCheckboxGroup = ImgCheckbox.Group export default { name: 'Setting', components: {ImgCheckboxGroup, ImgCheckbox, ColorCheckboxGroup, ColorCheckbox, SettingItem}, - computed: { - multiPage () { - return this.$store.state.setting.multiPage + data() { + return { + animate: 0, + direction: 0, + colors: ['#f5222d', '#fa541c', '#faad14', '#13c2c2', '#52c41a', '#1d92ff', '#2f54eb', '#722ed1'], } }, + computed: { + animateCfg() { + return this.animates[this.animate] + }, + ...mapState('setting', ['animates', 'multiPage']) + }, methods: { onColorChange (values, colors) { if (colors.length > 0) { @@ -107,6 +125,14 @@ export default { }, setMultiPage (checked) { this.$store.commit('setting/setMultiPage', checked) + }, + setAnimate() { + let animation = this.animates[this.animate] + let animate = { + name: animation.name, + direction: animation.directions[this.direction] + } + this.$store.commit('setting/setAnimate', animate) } } } @@ -124,5 +150,8 @@ export default { .flex{ display: flex; } + .select-item{ + width: 80px; + } } diff --git a/src/components/transition/PageToggleTransition.vue b/src/components/transition/PageToggleTransition.vue new file mode 100644 index 0000000..2da6634 --- /dev/null +++ b/src/components/transition/PageToggleTransition.vue @@ -0,0 +1,91 @@ + + + + + diff --git a/src/config/animates.js b/src/config/animates.js new file mode 100644 index 0000000..5a90d64 --- /dev/null +++ b/src/config/animates.js @@ -0,0 +1,17 @@ +const direct_s = ['left', 'right'] +const direct_1 = ['down', 'up', 'left', 'right'] +const direct_1_b = ['downBig', 'upBig', 'leftBig', 'rightBig'] +const direct_2 = ['topLeft', 'bottomRight', 'topRight', 'bottomLeft'] +const direct_3 = ['downLeft', 'upRight', 'downRight', 'upLeft'] + +module.exports = [ + {name: 'back', alias: '后位', directions: direct_1}, + {name: 'bounce', alias: '弹跳', directions: direct_1.concat('default')}, + {name: 'fade', alias: '淡化', directions: direct_1.concat(direct_1_b).concat(direct_2).concat('default')}, + {name: 'flip', alias: '翻转', directions: ['x', 'y', 'default']}, + {name: 'lightSpeed', alias: '光速', directions: direct_s}, + {name: 'rotate', alias: '旋转', directions: direct_3.concat('default')}, + {name: 'roll', alias: '翻滚', directions: ['default']}, + {name: 'zoom', alias: '缩放', directions: direct_1.concat('default')}, + {name: 'slide', alias: '滑动', directions: direct_1}, +] diff --git a/src/config/index.js b/src/config/index.js new file mode 100644 index 0000000..db9a3df --- /dev/null +++ b/src/config/index.js @@ -0,0 +1,11 @@ +// 系统配置 +module.exports = { + themeColor: '#1890ff', + animates: require('./animates'), + footerLinks: [ + {link: 'https://pro.ant.design', name: 'Pro首页'}, + {link: 'https://github.com/iczer/vue-antd-admin', icon: 'github'}, + {link: 'https://ant.design', name: 'Ant Design'} + ], + +} diff --git a/src/layouts/GlobalLayout.vue b/src/layouts/GlobalLayout.vue index b8bc6e0..f1b8271 100644 --- a/src/layouts/GlobalLayout.vue +++ b/src/layouts/GlobalLayout.vue @@ -12,7 +12,7 @@ - + diff --git a/src/layouts/MenuView.vue b/src/layouts/MenuView.vue index 93f48a3..2da8804 100644 --- a/src/layouts/MenuView.vue +++ b/src/layouts/MenuView.vue @@ -10,25 +10,28 @@ type="editable-card" @change="changePage" @edit="editPage"> - + {{page.name}} - + - + diff --git a/src/main.js b/src/main.js index 314c325..16e5252 100644 --- a/src/main.js +++ b/src/main.js @@ -8,6 +8,7 @@ import axios from 'axios' import '@/mock' import store from './store' import PouchDB from 'pouchdb' +import 'animate.css/source/animate.css' Vue.prototype.$axios = axios Vue.config.productionTip = false diff --git a/src/pages/components/TaskCard.vue b/src/pages/components/TaskCard.vue index 9cefaa0..bcd655c 100644 --- a/src/pages/components/TaskCard.vue +++ b/src/pages/components/TaskCard.vue @@ -35,4 +35,16 @@ export default { .task-group{ margin: 0 48px; } + .dragable-ghost{ + border: 1px dashed red; + opacity: 1; + } + .dragable-chose{ + border: 1px dashed red; + opacity: 0.8; + } + .dragable-drag{ + border: 1px dashed red; + opacity: 1; + } diff --git a/src/store/modules/setting.js b/src/store/modules/setting.js index 0f3f77d..d5171c6 100644 --- a/src/store/modules/setting.js +++ b/src/store/modules/setting.js @@ -1,3 +1,4 @@ +import {footerLinks, animates} from '@/config' export default { namespaced: true, state: { @@ -6,12 +7,13 @@ export default { layout: 'side', systemName: 'Vue Antd Admin', copyright: '2018 ICZER 工作室出品', - footerLinks: [ - {link: 'https://pro.ant.design', name: 'Pro首页'}, - {link: 'https://github.com/iczer/vue-antd-admin', icon: 'github'}, - {link: 'https://ant.design', name: 'Ant Design'} - ], - multiPage: true + footerLinks: footerLinks, + multiPage: true, + animates: animates, + animate: { + name: 'back', + direction: 'left' + } }, mutations: { setDevice (state, isMobile) { @@ -25,6 +27,9 @@ export default { }, setMultiPage (state, multiPage) { state.multiPage = multiPage + }, + setAnimate (state, animate) { + state.animate = animate } } } diff --git a/src/utils/themeUtil.js b/src/utils/themeUtil.js index 3cfcbf5..6e281fb 100644 --- a/src/utils/themeUtil.js +++ b/src/utils/themeUtil.js @@ -1,9 +1,10 @@ const ThemeColorReplacer = require('webpack-theme-color-replacer') const client = require('webpack-theme-color-replacer/client') const generate = require('@ant-design/colors/lib/generate').default +const themeColor = require('../config').themeColor module.exports = { - primaryColor: '#1890ff', + primaryColor: themeColor, getThemeColors(color) { const lightens = new Array(9).fill().map((t, i) => { return ThemeColorReplacer.varyColor.lighten(color, i / 10) diff --git a/vue.config.js b/vue.config.js index 494f41b..4e97645 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,6 +1,7 @@ // let path = require('path') const ThemeColorReplacer = require('webpack-theme-color-replacer') const getThemeColors = require('./src/utils/themeUtil').getThemeColors +const themeColor = require('./src/config').themeColor module.exports = { pluginOptions: { @@ -15,7 +16,7 @@ module.exports = { config.plugins.push( new ThemeColorReplacer({ fileName: 'css/theme-colors.css', - matchColors: getThemeColors('#1890ff') + matchColors: getThemeColors(themeColor) }) ) }, diff --git a/yarn.lock b/yarn.lock index 7bf4020..a96aaf3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1620,6 +1620,11 @@ amdefine@>=0.0.4: resolved "https://registry.npm.taobao.org/amdefine/download/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" integrity sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU= +animate.css@^4.1.0: + version "4.1.0" + resolved "https://registry.npm.taobao.org/animate.css/download/animate.css-4.1.0.tgz#dec2aabe4babfc6f6777f9a5cccd132838729b50" + integrity sha1-3sKqvkur/G9nd/mlzM0TKDhym1A= + ansi-colors@^3.0.0: version "3.2.4" resolved "https://registry.npm.taobao.org/ansi-colors/download/ansi-colors-3.2.4.tgz#e3a3da4bfbae6c86a9c285625de124a234026fbf"