正在显示
19 个修改的文件
包含
1836 行增加
和
1 行删除
| @@ -12751,6 +12751,11 @@ | @@ -12751,6 +12751,11 @@ | ||
| 12751 | "resolved": "https://registry.npmjs.org/vue/-/vue-2.6.10.tgz", | 12751 | "resolved": "https://registry.npmjs.org/vue/-/vue-2.6.10.tgz", |
| 12752 | "integrity": "sha512-ImThpeNU9HbdZL3utgMCq0oiMzAkt1mcgy3/E6zWC/G6AaQoeuFdsl9nDhTDU3X1R6FK7nsIUuRACVcjI+A2GQ==" | 12752 | "integrity": "sha512-ImThpeNU9HbdZL3utgMCq0oiMzAkt1mcgy3/E6zWC/G6AaQoeuFdsl9nDhTDU3X1R6FK7nsIUuRACVcjI+A2GQ==" |
| 12753 | }, | 12753 | }, |
| 12754 | + "vue-count-to": { | ||
| 12755 | + "version": "1.0.13", | ||
| 12756 | + "resolved": "https://registry.npmjs.org/vue-count-to/-/vue-count-to-1.0.13.tgz", | ||
| 12757 | + "integrity": "sha512-6R4OVBVNtQTlcbXu6SJ8ENR35M2/CdWt3Jmv57jOUM+1ojiFmjVGvZPH8DfHpMDSA+ITs+EW5V6qthADxeyYOQ==" | ||
| 12758 | + }, | ||
| 12754 | "vue-hot-reload-api": { | 12759 | "vue-hot-reload-api": { |
| 12755 | "version": "2.3.3", | 12760 | "version": "2.3.3", |
| 12756 | "resolved": "https://registry.npmjs.org/vue-hot-reload-api/-/vue-hot-reload-api-2.3.3.tgz", | 12761 | "resolved": "https://registry.npmjs.org/vue-hot-reload-api/-/vue-hot-reload-api-2.3.3.tgz", |
| @@ -26,6 +26,7 @@ | @@ -26,6 +26,7 @@ | ||
| 26 | "nprogress": "^0.2.0", | 26 | "nprogress": "^0.2.0", |
| 27 | "script-loader": "^0.7.2", | 27 | "script-loader": "^0.7.2", |
| 28 | "vue": "^2.2.2", | 28 | "vue": "^2.2.2", |
| 29 | + "vue-count-to": "^1.0.13", | ||
| 29 | "vue-i18n": "^8.14.0", | 30 | "vue-i18n": "^8.14.0", |
| 30 | "vue-router": "^2.3.0", | 31 | "vue-router": "^2.3.0", |
| 31 | "vuex": "^2.0.0-rc.6", | 32 | "vuex": "^2.0.0-rc.6", |
src/api/remote-search.js
0 → 100644
| 1 | +import request from '@/utils/request' | ||
| 2 | + | ||
| 3 | +export function searchUser(name) { | ||
| 4 | + return request({ | ||
| 5 | + url: '/vue-element-admin/search/user', | ||
| 6 | + method: 'get', | ||
| 7 | + params: { name } | ||
| 8 | + }) | ||
| 9 | +} | ||
| 10 | + | ||
| 11 | +export function transactionList(query) { | ||
| 12 | + return request({ | ||
| 13 | + url: '/vue-element-admin/transaction/list', | ||
| 14 | + method: 'get', | ||
| 15 | + params: query | ||
| 16 | + }) | ||
| 17 | +} |
src/components/GithubCorner/index.vue
0 → 100644
| 1 | +<template> | ||
| 2 | +<!-- href="https://github.com/PanJiaChen/vue-element-admin"--> | ||
| 3 | + <a target="_blank" class="github-corner" aria-label="View source on Github"> | ||
| 4 | + <svg | ||
| 5 | + width="80" | ||
| 6 | + height="80" | ||
| 7 | + viewBox="0 0 250 250" | ||
| 8 | + style="fill:#40c9c6; color:#fff;" | ||
| 9 | + aria-hidden="true" | ||
| 10 | + > | ||
| 11 | + <path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z" /> | ||
| 12 | + <path | ||
| 13 | + d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" | ||
| 14 | + fill="currentColor" | ||
| 15 | + style="transform-origin: 130px 106px;" | ||
| 16 | + class="octo-arm" | ||
| 17 | + /> | ||
| 18 | + <path | ||
| 19 | + d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" | ||
| 20 | + fill="currentColor" | ||
| 21 | + class="octo-body" | ||
| 22 | + /> | ||
| 23 | + </svg> | ||
| 24 | + </a> | ||
| 25 | +</template> | ||
| 26 | + | ||
| 27 | +<style scoped> | ||
| 28 | +.github-corner:hover .octo-arm { | ||
| 29 | + animation: octocat-wave 560ms ease-in-out | ||
| 30 | +} | ||
| 31 | + | ||
| 32 | +@keyframes octocat-wave { | ||
| 33 | + 0%, | ||
| 34 | + 100% { | ||
| 35 | + transform: rotate(0) | ||
| 36 | + } | ||
| 37 | + 20%, | ||
| 38 | + 60% { | ||
| 39 | + transform: rotate(-25deg) | ||
| 40 | + } | ||
| 41 | + 40%, | ||
| 42 | + 80% { | ||
| 43 | + transform: rotate(10deg) | ||
| 44 | + } | ||
| 45 | +} | ||
| 46 | + | ||
| 47 | +@media (max-width:500px) { | ||
| 48 | + .github-corner:hover .octo-arm { | ||
| 49 | + animation: none | ||
| 50 | + } | ||
| 51 | + .github-corner .octo-arm { | ||
| 52 | + animation: octocat-wave 560ms ease-in-out | ||
| 53 | + } | ||
| 54 | +} | ||
| 55 | +</style> |
src/components/PanThumb/index.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div :style="{zIndex:zIndex,height:height,width:width}" class="pan-item"> | ||
| 3 | + <div class="pan-info"> | ||
| 4 | + <div class="pan-info-roles-container"> | ||
| 5 | + <slot /> | ||
| 6 | + </div> | ||
| 7 | + </div> | ||
| 8 | + <!-- eslint-disable-next-line --> | ||
| 9 | + <div :style="{backgroundImage: `url(${image})`}" class="pan-thumb"></div> | ||
| 10 | + </div> | ||
| 11 | +</template> | ||
| 12 | + | ||
| 13 | +<script> | ||
| 14 | +export default { | ||
| 15 | + name: 'PanThumb', | ||
| 16 | + props: { | ||
| 17 | + image: { | ||
| 18 | + type: String, | ||
| 19 | + required: true | ||
| 20 | + }, | ||
| 21 | + zIndex: { | ||
| 22 | + type: Number, | ||
| 23 | + default: 1 | ||
| 24 | + }, | ||
| 25 | + width: { | ||
| 26 | + type: String, | ||
| 27 | + default: '150px' | ||
| 28 | + }, | ||
| 29 | + height: { | ||
| 30 | + type: String, | ||
| 31 | + default: '150px' | ||
| 32 | + } | ||
| 33 | + } | ||
| 34 | +} | ||
| 35 | +</script> | ||
| 36 | + | ||
| 37 | +<style scoped> | ||
| 38 | +.pan-item { | ||
| 39 | + width: 200px; | ||
| 40 | + height: 200px; | ||
| 41 | + border-radius: 50%; | ||
| 42 | + display: inline-block; | ||
| 43 | + position: relative; | ||
| 44 | + cursor: default; | ||
| 45 | + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); | ||
| 46 | +} | ||
| 47 | + | ||
| 48 | +.pan-info-roles-container { | ||
| 49 | + padding: 20px; | ||
| 50 | + text-align: center; | ||
| 51 | +} | ||
| 52 | + | ||
| 53 | +.pan-thumb { | ||
| 54 | + width: 100%; | ||
| 55 | + height: 100%; | ||
| 56 | + background-position: center center; | ||
| 57 | + background-size: cover; | ||
| 58 | + border-radius: 50%; | ||
| 59 | + overflow: hidden; | ||
| 60 | + position: absolute; | ||
| 61 | + transform-origin: 95% 40%; | ||
| 62 | + transition: all 0.3s ease-in-out; | ||
| 63 | +} | ||
| 64 | + | ||
| 65 | +/* .pan-thumb:after { | ||
| 66 | + content: ''; | ||
| 67 | + width: 8px; | ||
| 68 | + height: 8px; | ||
| 69 | + position: absolute; | ||
| 70 | + border-radius: 50%; | ||
| 71 | + top: 40%; | ||
| 72 | + left: 95%; | ||
| 73 | + margin: -4px 0 0 -4px; | ||
| 74 | + background: radial-gradient(ellipse at center, rgba(14, 14, 14, 1) 0%, rgba(125, 126, 125, 1) 100%); | ||
| 75 | + box-shadow: 0 0 1px rgba(255, 255, 255, 0.9); | ||
| 76 | +} */ | ||
| 77 | + | ||
| 78 | +.pan-info { | ||
| 79 | + position: absolute; | ||
| 80 | + width: inherit; | ||
| 81 | + height: inherit; | ||
| 82 | + border-radius: 50%; | ||
| 83 | + overflow: hidden; | ||
| 84 | + box-shadow: inset 0 0 0 5px rgba(0, 0, 0, 0.05); | ||
| 85 | +} | ||
| 86 | + | ||
| 87 | +.pan-info h3 { | ||
| 88 | + color: #fff; | ||
| 89 | + text-transform: uppercase; | ||
| 90 | + position: relative; | ||
| 91 | + letter-spacing: 2px; | ||
| 92 | + font-size: 18px; | ||
| 93 | + margin: 0 60px; | ||
| 94 | + padding: 22px 0 0 0; | ||
| 95 | + height: 85px; | ||
| 96 | + font-family: 'Open Sans', Arial, sans-serif; | ||
| 97 | + text-shadow: 0 0 1px #fff, 0 1px 2px rgba(0, 0, 0, 0.3); | ||
| 98 | +} | ||
| 99 | + | ||
| 100 | +.pan-info p { | ||
| 101 | + color: #fff; | ||
| 102 | + padding: 10px 5px; | ||
| 103 | + font-style: italic; | ||
| 104 | + margin: 0 30px; | ||
| 105 | + font-size: 12px; | ||
| 106 | + border-top: 1px solid rgba(255, 255, 255, 0.5); | ||
| 107 | +} | ||
| 108 | + | ||
| 109 | +.pan-info p a { | ||
| 110 | + display: block; | ||
| 111 | + color: #333; | ||
| 112 | + width: 80px; | ||
| 113 | + height: 80px; | ||
| 114 | + background: rgba(255, 255, 255, 0.3); | ||
| 115 | + border-radius: 50%; | ||
| 116 | + color: #fff; | ||
| 117 | + font-style: normal; | ||
| 118 | + font-weight: 700; | ||
| 119 | + text-transform: uppercase; | ||
| 120 | + font-size: 9px; | ||
| 121 | + letter-spacing: 1px; | ||
| 122 | + padding-top: 24px; | ||
| 123 | + margin: 7px auto 0; | ||
| 124 | + font-family: 'Open Sans', Arial, sans-serif; | ||
| 125 | + opacity: 0; | ||
| 126 | + transition: transform 0.3s ease-in-out 0.2s, opacity 0.3s ease-in-out 0.2s, background 0.2s linear 0s; | ||
| 127 | + transform: translateX(60px) rotate(90deg); | ||
| 128 | +} | ||
| 129 | + | ||
| 130 | +.pan-info p a:hover { | ||
| 131 | + background: rgba(255, 255, 255, 0.5); | ||
| 132 | +} | ||
| 133 | + | ||
| 134 | +.pan-item:hover .pan-thumb { | ||
| 135 | + transform: rotate(-110deg); | ||
| 136 | +} | ||
| 137 | + | ||
| 138 | +.pan-item:hover .pan-info p a { | ||
| 139 | + opacity: 1; | ||
| 140 | + transform: translateX(0px) rotate(0deg); | ||
| 141 | +} | ||
| 142 | +</style> |
src/components/TextHoverEffect/Mallki.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <a :class="className" class="link--mallki" href="#"> | ||
| 3 | + {{ text }} | ||
| 4 | + <span :data-letters="text" /> | ||
| 5 | + <span :data-letters="text" /> | ||
| 6 | + </a> | ||
| 7 | +</template> | ||
| 8 | + | ||
| 9 | +<script> | ||
| 10 | +export default { | ||
| 11 | + props: { | ||
| 12 | + className: { | ||
| 13 | + type: String, | ||
| 14 | + default: '' | ||
| 15 | + }, | ||
| 16 | + text: { | ||
| 17 | + type: String, | ||
| 18 | + default: 'vue-element-admin' | ||
| 19 | + } | ||
| 20 | + } | ||
| 21 | +} | ||
| 22 | +</script> | ||
| 23 | + | ||
| 24 | +<style> | ||
| 25 | +/* Mallki */ | ||
| 26 | + | ||
| 27 | +.link--mallki { | ||
| 28 | + font-weight: 800; | ||
| 29 | + color: #4dd9d5; | ||
| 30 | + font-family: 'Dosis', sans-serif; | ||
| 31 | + -webkit-transition: color 0.5s 0.25s; | ||
| 32 | + transition: color 0.5s 0.25s; | ||
| 33 | + overflow: hidden; | ||
| 34 | + position: relative; | ||
| 35 | + display: inline-block; | ||
| 36 | + line-height: 1; | ||
| 37 | + outline: none; | ||
| 38 | + text-decoration: none; | ||
| 39 | +} | ||
| 40 | + | ||
| 41 | +.link--mallki:hover { | ||
| 42 | + -webkit-transition: none; | ||
| 43 | + transition: none; | ||
| 44 | + color: transparent; | ||
| 45 | +} | ||
| 46 | + | ||
| 47 | +.link--mallki::before { | ||
| 48 | + content: ''; | ||
| 49 | + width: 100%; | ||
| 50 | + height: 6px; | ||
| 51 | + margin: -3px 0 0 0; | ||
| 52 | + background: #3888fa; | ||
| 53 | + position: absolute; | ||
| 54 | + left: 0; | ||
| 55 | + top: 50%; | ||
| 56 | + -webkit-transform: translate3d(-100%, 0, 0); | ||
| 57 | + transform: translate3d(-100%, 0, 0); | ||
| 58 | + -webkit-transition: -webkit-transform 0.4s; | ||
| 59 | + transition: transform 0.4s; | ||
| 60 | + -webkit-transition-timing-function: cubic-bezier(0.7, 0, 0.3, 1); | ||
| 61 | + transition-timing-function: cubic-bezier(0.7, 0, 0.3, 1); | ||
| 62 | +} | ||
| 63 | + | ||
| 64 | +.link--mallki:hover::before { | ||
| 65 | + -webkit-transform: translate3d(100%, 0, 0); | ||
| 66 | + transform: translate3d(100%, 0, 0); | ||
| 67 | +} | ||
| 68 | + | ||
| 69 | +.link--mallki span { | ||
| 70 | + position: absolute; | ||
| 71 | + height: 50%; | ||
| 72 | + width: 100%; | ||
| 73 | + left: 0; | ||
| 74 | + top: 0; | ||
| 75 | + overflow: hidden; | ||
| 76 | +} | ||
| 77 | + | ||
| 78 | +.link--mallki span::before { | ||
| 79 | + content: attr(data-letters); | ||
| 80 | + color: red; | ||
| 81 | + position: absolute; | ||
| 82 | + left: 0; | ||
| 83 | + width: 100%; | ||
| 84 | + color: #3888fa; | ||
| 85 | + -webkit-transition: -webkit-transform 0.5s; | ||
| 86 | + transition: transform 0.5s; | ||
| 87 | +} | ||
| 88 | + | ||
| 89 | +.link--mallki span:nth-child(2) { | ||
| 90 | + top: 50%; | ||
| 91 | +} | ||
| 92 | + | ||
| 93 | +.link--mallki span:first-child::before { | ||
| 94 | + top: 0; | ||
| 95 | + -webkit-transform: translate3d(0, 100%, 0); | ||
| 96 | + transform: translate3d(0, 100%, 0); | ||
| 97 | +} | ||
| 98 | + | ||
| 99 | +.link--mallki span:nth-child(2)::before { | ||
| 100 | + bottom: 0; | ||
| 101 | + -webkit-transform: translate3d(0, -100%, 0); | ||
| 102 | + transform: translate3d(0, -100%, 0); | ||
| 103 | +} | ||
| 104 | + | ||
| 105 | +.link--mallki:hover span::before { | ||
| 106 | + -webkit-transition-delay: 0.3s; | ||
| 107 | + transition-delay: 0.3s; | ||
| 108 | + -webkit-transform: translate3d(0, 0, 0); | ||
| 109 | + transform: translate3d(0, 0, 0); | ||
| 110 | + -webkit-transition-timing-function: cubic-bezier(0.2, 1, 0.3, 1); | ||
| 111 | + transition-timing-function: cubic-bezier(0.2, 1, 0.3, 1); | ||
| 112 | +} | ||
| 113 | +</style> |
| 1 | import Login from './views/Login.vue' | 1 | import Login from './views/Login.vue' |
| 2 | import NotFound from './views/404.vue' | 2 | import NotFound from './views/404.vue' |
| 3 | import Home from './views/Home.vue' | 3 | import Home from './views/Home.vue' |
| 4 | -import Main from './views/Main.vue' | 4 | +import Main from './views/dashboard/index' |
| 5 | // import Table from './views/nav1/Table.vue' | 5 | // import Table from './views/nav1/Table.vue' |
| 6 | import Role from './views/nav1/role.vue' | 6 | import Role from './views/nav1/role.vue' |
| 7 | import Perm from './views/nav1/perm.vue' | 7 | import Perm from './views/nav1/perm.vue' |
src/views/dashboard/components/BarChart.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div :class="className" :style="{height:height,width:width}" /> | ||
| 3 | +</template> | ||
| 4 | + | ||
| 5 | +<script> | ||
| 6 | +import echarts from 'echarts' | ||
| 7 | +require('echarts/theme/macarons') // echarts theme | ||
| 8 | +import resize from './mixins/resize' | ||
| 9 | + | ||
| 10 | +const animationDuration = 6000 | ||
| 11 | + | ||
| 12 | +export default { | ||
| 13 | + mixins: [resize], | ||
| 14 | + props: { | ||
| 15 | + className: { | ||
| 16 | + type: String, | ||
| 17 | + default: 'chart' | ||
| 18 | + }, | ||
| 19 | + width: { | ||
| 20 | + type: String, | ||
| 21 | + default: '100%' | ||
| 22 | + }, | ||
| 23 | + height: { | ||
| 24 | + type: String, | ||
| 25 | + default: '300px' | ||
| 26 | + } | ||
| 27 | + }, | ||
| 28 | + data() { | ||
| 29 | + return { | ||
| 30 | + chart: null | ||
| 31 | + } | ||
| 32 | + }, | ||
| 33 | + mounted() { | ||
| 34 | + this.$nextTick(() => { | ||
| 35 | + this.initChart() | ||
| 36 | + }) | ||
| 37 | + }, | ||
| 38 | + beforeDestroy() { | ||
| 39 | + if (!this.chart) { | ||
| 40 | + return | ||
| 41 | + } | ||
| 42 | + this.chart.dispose() | ||
| 43 | + this.chart = null | ||
| 44 | + }, | ||
| 45 | + methods: { | ||
| 46 | + initChart() { | ||
| 47 | + this.chart = echarts.init(this.$el, 'macarons') | ||
| 48 | + | ||
| 49 | + this.chart.setOption({ | ||
| 50 | + tooltip: { | ||
| 51 | + trigger: 'axis', | ||
| 52 | + axisPointer: { // 坐标轴指示器,坐标轴触发有效 | ||
| 53 | + type: 'shadow' // 默认为直线,可选为:'line' | 'shadow' | ||
| 54 | + } | ||
| 55 | + }, | ||
| 56 | + grid: { | ||
| 57 | + top: 10, | ||
| 58 | + left: '2%', | ||
| 59 | + right: '2%', | ||
| 60 | + bottom: '3%', | ||
| 61 | + containLabel: true | ||
| 62 | + }, | ||
| 63 | + xAxis: [{ | ||
| 64 | + type: 'category', | ||
| 65 | + data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], | ||
| 66 | + axisTick: { | ||
| 67 | + alignWithLabel: true | ||
| 68 | + } | ||
| 69 | + }], | ||
| 70 | + yAxis: [{ | ||
| 71 | + type: 'value', | ||
| 72 | + axisTick: { | ||
| 73 | + show: false | ||
| 74 | + } | ||
| 75 | + }], | ||
| 76 | + series: [{ | ||
| 77 | + name: 'pageA', | ||
| 78 | + type: 'bar', | ||
| 79 | + stack: 'vistors', | ||
| 80 | + barWidth: '60%', | ||
| 81 | + data: [79, 52, 200, 334, 390, 330, 220], | ||
| 82 | + animationDuration | ||
| 83 | + }, { | ||
| 84 | + name: 'pageB', | ||
| 85 | + type: 'bar', | ||
| 86 | + stack: 'vistors', | ||
| 87 | + barWidth: '60%', | ||
| 88 | + data: [80, 52, 200, 334, 390, 330, 220], | ||
| 89 | + animationDuration | ||
| 90 | + }, { | ||
| 91 | + name: 'pageC', | ||
| 92 | + type: 'bar', | ||
| 93 | + stack: 'vistors', | ||
| 94 | + barWidth: '60%', | ||
| 95 | + data: [30, 52, 200, 334, 390, 330, 220], | ||
| 96 | + animationDuration | ||
| 97 | + }] | ||
| 98 | + }) | ||
| 99 | + } | ||
| 100 | + } | ||
| 101 | +} | ||
| 102 | +</script> |
src/views/dashboard/components/BoxCard.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <el-card class="box-card-component" style="margin-left:8px;"> | ||
| 3 | + <div slot="header" class="box-card-header"> | ||
| 4 | + <img src="https://wpimg.wallstcn.com/e7d23d71-cf19-4b90-a1cc-f56af8c0903d.png"> | ||
| 5 | + </div> | ||
| 6 | + <div style="position:relative;"> | ||
| 7 | + <pan-thumb :image="avatar" class="panThumb" /> | ||
| 8 | + <mallki class-name="mallki-text" text="vue-element-admin" /> | ||
| 9 | + <div style="padding-top:35px;" class="progress-item"> | ||
| 10 | + <span>Vue</span> | ||
| 11 | + <el-progress :percentage="70" /> | ||
| 12 | + </div> | ||
| 13 | + <div class="progress-item"> | ||
| 14 | + <span>JavaScript</span> | ||
| 15 | + <el-progress :percentage="18" /> | ||
| 16 | + </div> | ||
| 17 | + <div class="progress-item"> | ||
| 18 | + <span>Css</span> | ||
| 19 | + <el-progress :percentage="12" /> | ||
| 20 | + </div> | ||
| 21 | + <div class="progress-item"> | ||
| 22 | + <span>ESLint</span> | ||
| 23 | + <el-progress :percentage="100" status="success" /> | ||
| 24 | + </div> | ||
| 25 | + </div> | ||
| 26 | + </el-card> | ||
| 27 | +</template> | ||
| 28 | + | ||
| 29 | +<script> | ||
| 30 | +import { mapGetters } from 'vuex' | ||
| 31 | +import PanThumb from '../../../components/PanThumb' | ||
| 32 | +import Mallki from '../../../components/TextHoverEffect/Mallki' | ||
| 33 | + | ||
| 34 | +export default { | ||
| 35 | + components: { PanThumb, Mallki }, | ||
| 36 | + | ||
| 37 | + filters: { | ||
| 38 | + statusFilter(status) { | ||
| 39 | + const statusMap = { | ||
| 40 | + success: 'success', | ||
| 41 | + pending: 'danger' | ||
| 42 | + } | ||
| 43 | + return statusMap[status] | ||
| 44 | + } | ||
| 45 | + }, | ||
| 46 | + data() { | ||
| 47 | + return { | ||
| 48 | + statisticsData: { | ||
| 49 | + article_count: 1024, | ||
| 50 | + pageviews_count: 1024 | ||
| 51 | + } | ||
| 52 | + } | ||
| 53 | + }, | ||
| 54 | + computed: { | ||
| 55 | + ...mapGetters([ | ||
| 56 | + 'name', | ||
| 57 | + 'avatar', | ||
| 58 | + 'roles' | ||
| 59 | + ]) | ||
| 60 | + } | ||
| 61 | +} | ||
| 62 | +</script> | ||
| 63 | + | ||
| 64 | +<style lang="scss" > | ||
| 65 | +.box-card-component{ | ||
| 66 | + .el-card__header { | ||
| 67 | + padding: 0px!important; | ||
| 68 | + } | ||
| 69 | +} | ||
| 70 | +</style> | ||
| 71 | +<style lang="scss" scoped> | ||
| 72 | +.box-card-component { | ||
| 73 | + .box-card-header { | ||
| 74 | + position: relative; | ||
| 75 | + height: 220px; | ||
| 76 | + img { | ||
| 77 | + width: 100%; | ||
| 78 | + height: 100%; | ||
| 79 | + transition: all 0.2s linear; | ||
| 80 | + &:hover { | ||
| 81 | + transform: scale(1.1, 1.1); | ||
| 82 | + filter: contrast(130%); | ||
| 83 | + } | ||
| 84 | + } | ||
| 85 | + } | ||
| 86 | + .mallki-text { | ||
| 87 | + position: absolute; | ||
| 88 | + top: 0px; | ||
| 89 | + right: 0px; | ||
| 90 | + font-size: 20px; | ||
| 91 | + font-weight: bold; | ||
| 92 | + } | ||
| 93 | + .panThumb { | ||
| 94 | + z-index: 100; | ||
| 95 | + height: 70px!important; | ||
| 96 | + width: 70px!important; | ||
| 97 | + position: absolute!important; | ||
| 98 | + top: -45px; | ||
| 99 | + left: 0px; | ||
| 100 | + border: 5px solid #ffffff; | ||
| 101 | + background-color: #fff; | ||
| 102 | + margin: auto; | ||
| 103 | + box-shadow: none!important; | ||
| 104 | + /deep/ .pan-info { | ||
| 105 | + box-shadow: none!important; | ||
| 106 | + } | ||
| 107 | + } | ||
| 108 | + .progress-item { | ||
| 109 | + margin-bottom: 10px; | ||
| 110 | + font-size: 14px; | ||
| 111 | + } | ||
| 112 | + @media only screen and (max-width: 1510px){ | ||
| 113 | + .mallki-text{ | ||
| 114 | + display: none; | ||
| 115 | + } | ||
| 116 | + } | ||
| 117 | +} | ||
| 118 | +</style> |
src/views/dashboard/components/LineChart.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div :class="className" :style="{height:height,width:width}" /> | ||
| 3 | +</template> | ||
| 4 | + | ||
| 5 | +<script> | ||
| 6 | +import echarts from 'echarts' | ||
| 7 | +require('echarts/theme/macarons') // echarts theme | ||
| 8 | +import resize from './mixins/resize' | ||
| 9 | + | ||
| 10 | +export default { | ||
| 11 | + mixins: [resize], | ||
| 12 | + props: { | ||
| 13 | + className: { | ||
| 14 | + type: String, | ||
| 15 | + default: 'chart' | ||
| 16 | + }, | ||
| 17 | + width: { | ||
| 18 | + type: String, | ||
| 19 | + default: '100%' | ||
| 20 | + }, | ||
| 21 | + height: { | ||
| 22 | + type: String, | ||
| 23 | + default: '350px' | ||
| 24 | + }, | ||
| 25 | + autoResize: { | ||
| 26 | + type: Boolean, | ||
| 27 | + default: true | ||
| 28 | + }, | ||
| 29 | + chartData: { | ||
| 30 | + type: Object, | ||
| 31 | + required: true | ||
| 32 | + } | ||
| 33 | + }, | ||
| 34 | + data() { | ||
| 35 | + return { | ||
| 36 | + chart: null | ||
| 37 | + } | ||
| 38 | + }, | ||
| 39 | + watch: { | ||
| 40 | + chartData: { | ||
| 41 | + deep: true, | ||
| 42 | + handler(val) { | ||
| 43 | + this.setOptions(val) | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | + }, | ||
| 47 | + mounted() { | ||
| 48 | + this.$nextTick(() => { | ||
| 49 | + this.initChart() | ||
| 50 | + }) | ||
| 51 | + }, | ||
| 52 | + beforeDestroy() { | ||
| 53 | + if (!this.chart) { | ||
| 54 | + return | ||
| 55 | + } | ||
| 56 | + this.chart.dispose() | ||
| 57 | + this.chart = null | ||
| 58 | + }, | ||
| 59 | + methods: { | ||
| 60 | + initChart() { | ||
| 61 | + this.chart = echarts.init(this.$el, 'macarons') | ||
| 62 | + this.setOptions(this.chartData) | ||
| 63 | + }, | ||
| 64 | + setOptions({ expectedData, actualData } = {}) { | ||
| 65 | + this.chart.setOption({ | ||
| 66 | + xAxis: { | ||
| 67 | + data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], | ||
| 68 | + boundaryGap: false, | ||
| 69 | + axisTick: { | ||
| 70 | + show: false | ||
| 71 | + } | ||
| 72 | + }, | ||
| 73 | + grid: { | ||
| 74 | + left: 10, | ||
| 75 | + right: 10, | ||
| 76 | + bottom: 20, | ||
| 77 | + top: 30, | ||
| 78 | + containLabel: true | ||
| 79 | + }, | ||
| 80 | + tooltip: { | ||
| 81 | + trigger: 'axis', | ||
| 82 | + axisPointer: { | ||
| 83 | + type: 'cross' | ||
| 84 | + }, | ||
| 85 | + padding: [5, 10] | ||
| 86 | + }, | ||
| 87 | + yAxis: { | ||
| 88 | + axisTick: { | ||
| 89 | + show: false | ||
| 90 | + } | ||
| 91 | + }, | ||
| 92 | + legend: { | ||
| 93 | + data: ['expected', 'actual'] | ||
| 94 | + }, | ||
| 95 | + series: [{ | ||
| 96 | + name: 'expected', itemStyle: { | ||
| 97 | + normal: { | ||
| 98 | + color: '#FF005A', | ||
| 99 | + lineStyle: { | ||
| 100 | + color: '#FF005A', | ||
| 101 | + width: 2 | ||
| 102 | + } | ||
| 103 | + } | ||
| 104 | + }, | ||
| 105 | + smooth: true, | ||
| 106 | + type: 'line', | ||
| 107 | + data: expectedData, | ||
| 108 | + animationDuration: 2800, | ||
| 109 | + animationEasing: 'cubicInOut' | ||
| 110 | + }, | ||
| 111 | + { | ||
| 112 | + name: 'actual', | ||
| 113 | + smooth: true, | ||
| 114 | + type: 'line', | ||
| 115 | + itemStyle: { | ||
| 116 | + normal: { | ||
| 117 | + color: '#3888fa', | ||
| 118 | + lineStyle: { | ||
| 119 | + color: '#3888fa', | ||
| 120 | + width: 2 | ||
| 121 | + }, | ||
| 122 | + areaStyle: { | ||
| 123 | + color: '#f3f8ff' | ||
| 124 | + } | ||
| 125 | + } | ||
| 126 | + }, | ||
| 127 | + data: actualData, | ||
| 128 | + animationDuration: 2800, | ||
| 129 | + animationEasing: 'quadraticOut' | ||
| 130 | + }] | ||
| 131 | + }) | ||
| 132 | + } | ||
| 133 | + } | ||
| 134 | +} | ||
| 135 | +</script> |
| 1 | +<template> | ||
| 2 | + <el-row :gutter="15" class="panel-group"> | ||
| 3 | + | ||
| 4 | + <el-col :span="5" class="card-panel-col"> | ||
| 5 | + <div class="card-panel" @click="handleSetLineChartData('newVisitis')"> | ||
| 6 | + <div class="card-panel-icon-wrapper icon-people"> | ||
| 7 | +<!-- <svg-icon icon-class="peoples" class-name="card-panel-icon" />--> | ||
| 8 | + <i class="el-icon-user-solid" style="font-size: 60px;"></i> | ||
| 9 | + </div> | ||
| 10 | + <div class="card-panel-description"> | ||
| 11 | + <div class="card-panel-text"> | ||
| 12 | + New Visits | ||
| 13 | + </div> | ||
| 14 | + <count-to :start-val="0" :end-val="102400" :duration="2600" class="card-panel-num" /> | ||
| 15 | + </div> | ||
| 16 | + </div> | ||
| 17 | + </el-col> | ||
| 18 | + | ||
| 19 | +<!-- :xs="12" :sm="12" :lg="6"--> | ||
| 20 | + <el-col :span="5" class="card-panel-col"> | ||
| 21 | + <div class="card-panel" @click="handleSetLineChartData('messages')"> | ||
| 22 | + <div class="card-panel-icon-wrapper icon-message"> | ||
| 23 | +<!-- <svg-icon icon-class="message" class-name="card-panel-icon" />--> | ||
| 24 | + <i class="el-icon-message" style="font-size: 60px;"></i> | ||
| 25 | + </div> | ||
| 26 | + <div class="card-panel-description"> | ||
| 27 | + <div class="card-panel-text"> | ||
| 28 | + Messages | ||
| 29 | + </div> | ||
| 30 | + <count-to :start-val="0" :end-val="81212" :duration="3000" class="card-panel-num" /> | ||
| 31 | + </div> | ||
| 32 | + </div> | ||
| 33 | + </el-col> | ||
| 34 | + | ||
| 35 | + <el-col :span="5" class="card-panel-col"> | ||
| 36 | + <div class="card-panel" @click="handleSetLineChartData('purchases')"> | ||
| 37 | + <div class="card-panel-icon-wrapper icon-money"> | ||
| 38 | +<!-- <svg-icon icon-class="money" class-name="card-panel-icon" />--> | ||
| 39 | + <i class="el-icon-money" style="font-size: 60px;"></i> | ||
| 40 | + </div> | ||
| 41 | + <div class="card-panel-description"> | ||
| 42 | + <div class="card-panel-text"> | ||
| 43 | + Purchases | ||
| 44 | + </div> | ||
| 45 | + <count-to :start-val="0" :end-val="9280" :duration="3200" class="card-panel-num" /> | ||
| 46 | + </div> | ||
| 47 | + </div> | ||
| 48 | + </el-col> | ||
| 49 | + <el-col :span="5" class="card-panel-col"> | ||
| 50 | + <div class="card-panel" @click="handleSetLineChartData('shoppings')"> | ||
| 51 | + <div class="card-panel-icon-wrapper icon-shopping"> | ||
| 52 | +<!-- <svg-icon icon-class="shopping" class-name="card-panel-icon" />--> | ||
| 53 | + <i class="el-icon-shopping-cart-2" style="font-size: 60px;"></i> | ||
| 54 | + </div> | ||
| 55 | + <div class="card-panel-description"> | ||
| 56 | + <div class="card-panel-text"> | ||
| 57 | + Shoppings | ||
| 58 | + </div> | ||
| 59 | + <count-to :start-val="0" :end-val="13600" :duration="3600" class="card-panel-num" /> | ||
| 60 | + </div> | ||
| 61 | + </div> | ||
| 62 | + </el-col> | ||
| 63 | + </el-row> | ||
| 64 | +</template> | ||
| 65 | + | ||
| 66 | +<script> | ||
| 67 | +import CountTo from 'vue-count-to' | ||
| 68 | +// import '../../../icons' | ||
| 69 | +export default { | ||
| 70 | + components: { | ||
| 71 | + CountTo | ||
| 72 | + }, | ||
| 73 | + methods: { | ||
| 74 | + handleSetLineChartData(type) { | ||
| 75 | + this.$emit('handleSetLineChartData', type) | ||
| 76 | + } | ||
| 77 | + } | ||
| 78 | +} | ||
| 79 | +</script> | ||
| 80 | + | ||
| 81 | +<style lang="scss" scoped> | ||
| 82 | +.panel-group { | ||
| 83 | + margin-top: 18px; | ||
| 84 | + | ||
| 85 | + .card-panel-col { | ||
| 86 | + margin-bottom: 32px; | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + .card-panel { | ||
| 90 | + height: 108px; | ||
| 91 | + cursor: pointer; | ||
| 92 | + font-size: 12px; | ||
| 93 | + position: relative; | ||
| 94 | + overflow: hidden; | ||
| 95 | + color: #666; | ||
| 96 | + background: #fff; | ||
| 97 | + box-shadow: 4px 4px 40px rgba(0, 0, 0, .05); | ||
| 98 | + border-color: rgba(0, 0, 0, .05); | ||
| 99 | + | ||
| 100 | + &:hover { | ||
| 101 | + .card-panel-icon-wrapper { | ||
| 102 | + color: #fff; | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + .icon-people { | ||
| 106 | + background: #40c9c6; | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + .icon-message { | ||
| 110 | + background: #36a3f7; | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + .icon-money { | ||
| 114 | + background: #f4516c; | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + .icon-shopping { | ||
| 118 | + background: #34bfa3 | ||
| 119 | + } | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + .icon-people { | ||
| 123 | + color: #40c9c6; | ||
| 124 | + } | ||
| 125 | + | ||
| 126 | + .icon-message { | ||
| 127 | + color: #36a3f7; | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + .icon-money { | ||
| 131 | + color: #f4516c; | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + .icon-shopping { | ||
| 135 | + color: #34bfa3 | ||
| 136 | + } | ||
| 137 | + | ||
| 138 | + .card-panel-icon-wrapper { | ||
| 139 | + float: left; | ||
| 140 | + margin: 14px 0 0 14px; | ||
| 141 | + padding: 16px; | ||
| 142 | + transition: all 0.38s ease-out; | ||
| 143 | + border-radius: 6px; | ||
| 144 | + } | ||
| 145 | + | ||
| 146 | + .card-panel-icon { | ||
| 147 | + float: left; | ||
| 148 | + font-size: 48px; | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + .card-panel-description { | ||
| 152 | + float: right; | ||
| 153 | + font-weight: bold; | ||
| 154 | + margin: 26px; | ||
| 155 | + margin-left: 0px; | ||
| 156 | + | ||
| 157 | + .card-panel-text { | ||
| 158 | + line-height: 18px; | ||
| 159 | + color: rgba(0, 0, 0, 0.45); | ||
| 160 | + font-size: 16px; | ||
| 161 | + margin-bottom: 12px; | ||
| 162 | + } | ||
| 163 | + | ||
| 164 | + .card-panel-num { | ||
| 165 | + font-size: 20px; | ||
| 166 | + } | ||
| 167 | + } | ||
| 168 | + } | ||
| 169 | +} | ||
| 170 | + | ||
| 171 | +@media (max-width:550px) { | ||
| 172 | + .card-panel-description { | ||
| 173 | + display: none; | ||
| 174 | + } | ||
| 175 | + | ||
| 176 | + .card-panel-icon-wrapper { | ||
| 177 | + float: none !important; | ||
| 178 | + width: 100%; | ||
| 179 | + height: 100%; | ||
| 180 | + margin: 0 !important; | ||
| 181 | + | ||
| 182 | + .svg-icon { | ||
| 183 | + display: block; | ||
| 184 | + margin: 14px auto !important; | ||
| 185 | + float: none !important; | ||
| 186 | + } | ||
| 187 | + } | ||
| 188 | +} | ||
| 189 | +</style> |
src/views/dashboard/components/PieChart.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div :class="className" :style="{height:height,width:width}" /> | ||
| 3 | +</template> | ||
| 4 | + | ||
| 5 | +<script> | ||
| 6 | +import echarts from 'echarts' | ||
| 7 | +require('echarts/theme/macarons') // echarts theme | ||
| 8 | +import resize from './mixins/resize' | ||
| 9 | + | ||
| 10 | +export default { | ||
| 11 | + mixins: [resize], | ||
| 12 | + props: { | ||
| 13 | + className: { | ||
| 14 | + type: String, | ||
| 15 | + default: 'chart' | ||
| 16 | + }, | ||
| 17 | + width: { | ||
| 18 | + type: String, | ||
| 19 | + default: '100%' | ||
| 20 | + }, | ||
| 21 | + height: { | ||
| 22 | + type: String, | ||
| 23 | + default: '300px' | ||
| 24 | + } | ||
| 25 | + }, | ||
| 26 | + data() { | ||
| 27 | + return { | ||
| 28 | + chart: null | ||
| 29 | + } | ||
| 30 | + }, | ||
| 31 | + mounted() { | ||
| 32 | + this.$nextTick(() => { | ||
| 33 | + this.initChart() | ||
| 34 | + }) | ||
| 35 | + }, | ||
| 36 | + beforeDestroy() { | ||
| 37 | + if (!this.chart) { | ||
| 38 | + return | ||
| 39 | + } | ||
| 40 | + this.chart.dispose() | ||
| 41 | + this.chart = null | ||
| 42 | + }, | ||
| 43 | + methods: { | ||
| 44 | + initChart() { | ||
| 45 | + this.chart = echarts.init(this.$el, 'macarons') | ||
| 46 | + | ||
| 47 | + this.chart.setOption({ | ||
| 48 | + tooltip: { | ||
| 49 | + trigger: 'item', | ||
| 50 | + formatter: '{a} <br/>{b} : {c} ({d}%)' | ||
| 51 | + }, | ||
| 52 | + legend: { | ||
| 53 | + left: 'center', | ||
| 54 | + bottom: '10', | ||
| 55 | + data: ['Industries', 'Technology', 'Forex', 'Gold', 'Forecasts'] | ||
| 56 | + }, | ||
| 57 | + series: [ | ||
| 58 | + { | ||
| 59 | + name: 'WEEKLY WRITE ARTICLES', | ||
| 60 | + type: 'pie', | ||
| 61 | + roseType: 'radius', | ||
| 62 | + radius: [15, 95], | ||
| 63 | + center: ['50%', '38%'], | ||
| 64 | + data: [ | ||
| 65 | + { value: 320, name: 'Industries' }, | ||
| 66 | + { value: 240, name: 'Technology' }, | ||
| 67 | + { value: 149, name: 'Forex' }, | ||
| 68 | + { value: 100, name: 'Gold' }, | ||
| 69 | + { value: 59, name: 'Forecasts' } | ||
| 70 | + ], | ||
| 71 | + animationEasing: 'cubicInOut', | ||
| 72 | + animationDuration: 2600 | ||
| 73 | + } | ||
| 74 | + ] | ||
| 75 | + }) | ||
| 76 | + } | ||
| 77 | + } | ||
| 78 | +} | ||
| 79 | +</script> |
| 1 | +<template> | ||
| 2 | + <div :class="className" :style="{height:height,width:width}" /> | ||
| 3 | +</template> | ||
| 4 | + | ||
| 5 | +<script> | ||
| 6 | +import echarts from 'echarts' | ||
| 7 | +require('echarts/theme/macarons') // echarts theme | ||
| 8 | +import resize from './mixins/resize' | ||
| 9 | + | ||
| 10 | +const animationDuration = 3000 | ||
| 11 | + | ||
| 12 | +export default { | ||
| 13 | + mixins: [resize], | ||
| 14 | + props: { | ||
| 15 | + className: { | ||
| 16 | + type: String, | ||
| 17 | + default: 'chart' | ||
| 18 | + }, | ||
| 19 | + width: { | ||
| 20 | + type: String, | ||
| 21 | + default: '100%' | ||
| 22 | + }, | ||
| 23 | + height: { | ||
| 24 | + type: String, | ||
| 25 | + default: '300px' | ||
| 26 | + } | ||
| 27 | + }, | ||
| 28 | + data() { | ||
| 29 | + return { | ||
| 30 | + chart: null | ||
| 31 | + } | ||
| 32 | + }, | ||
| 33 | + mounted() { | ||
| 34 | + this.$nextTick(() => { | ||
| 35 | + this.initChart() | ||
| 36 | + }) | ||
| 37 | + }, | ||
| 38 | + beforeDestroy() { | ||
| 39 | + if (!this.chart) { | ||
| 40 | + return | ||
| 41 | + } | ||
| 42 | + this.chart.dispose() | ||
| 43 | + this.chart = null | ||
| 44 | + }, | ||
| 45 | + methods: { | ||
| 46 | + initChart() { | ||
| 47 | + this.chart = echarts.init(this.$el, 'macarons') | ||
| 48 | + | ||
| 49 | + this.chart.setOption({ | ||
| 50 | + tooltip: { | ||
| 51 | + trigger: 'axis', | ||
| 52 | + axisPointer: { // 坐标轴指示器,坐标轴触发有效 | ||
| 53 | + type: 'shadow' // 默认为直线,可选为:'line' | 'shadow' | ||
| 54 | + } | ||
| 55 | + }, | ||
| 56 | + radar: { | ||
| 57 | + radius: '66%', | ||
| 58 | + center: ['50%', '42%'], | ||
| 59 | + splitNumber: 8, | ||
| 60 | + splitArea: { | ||
| 61 | + areaStyle: { | ||
| 62 | + color: 'rgba(127,95,132,.3)', | ||
| 63 | + opacity: 1, | ||
| 64 | + shadowBlur: 45, | ||
| 65 | + shadowColor: 'rgba(0,0,0,.5)', | ||
| 66 | + shadowOffsetX: 0, | ||
| 67 | + shadowOffsetY: 15 | ||
| 68 | + } | ||
| 69 | + }, | ||
| 70 | + indicator: [ | ||
| 71 | + { name: 'Sales', max: 10000 }, | ||
| 72 | + { name: 'Administration', max: 20000 }, | ||
| 73 | + { name: 'Information Technology', max: 20000 }, | ||
| 74 | + { name: 'Customer Support', max: 20000 }, | ||
| 75 | + { name: 'Development', max: 20000 }, | ||
| 76 | + { name: 'Marketing', max: 20000 } | ||
| 77 | + ] | ||
| 78 | + }, | ||
| 79 | + legend: { | ||
| 80 | + left: 'center', | ||
| 81 | + bottom: '10', | ||
| 82 | + data: ['Allocated Budget', 'Expected Spending', 'Actual Spending'] | ||
| 83 | + }, | ||
| 84 | + series: [{ | ||
| 85 | + type: 'radar', | ||
| 86 | + symbolSize: 0, | ||
| 87 | + areaStyle: { | ||
| 88 | + normal: { | ||
| 89 | + shadowBlur: 13, | ||
| 90 | + shadowColor: 'rgba(0,0,0,.2)', | ||
| 91 | + shadowOffsetX: 0, | ||
| 92 | + shadowOffsetY: 10, | ||
| 93 | + opacity: 1 | ||
| 94 | + } | ||
| 95 | + }, | ||
| 96 | + data: [ | ||
| 97 | + { | ||
| 98 | + value: [5000, 7000, 12000, 11000, 15000, 14000], | ||
| 99 | + name: 'Allocated Budget' | ||
| 100 | + }, | ||
| 101 | + { | ||
| 102 | + value: [4000, 9000, 15000, 15000, 13000, 11000], | ||
| 103 | + name: 'Expected Spending' | ||
| 104 | + }, | ||
| 105 | + { | ||
| 106 | + value: [5500, 11000, 12000, 15000, 12000, 12000], | ||
| 107 | + name: 'Actual Spending' | ||
| 108 | + } | ||
| 109 | + ], | ||
| 110 | + animationDuration: animationDuration | ||
| 111 | + }] | ||
| 112 | + }) | ||
| 113 | + } | ||
| 114 | + } | ||
| 115 | +} | ||
| 116 | +</script> |
| 1 | +<template> | ||
| 2 | + <li :class="{ completed: todo.done, editing: editing }" class="todo"> | ||
| 3 | + <div class="view"> | ||
| 4 | + <input | ||
| 5 | + :checked="todo.done" | ||
| 6 | + class="toggle" | ||
| 7 | + type="checkbox" | ||
| 8 | + @change="toggleTodo( todo)" | ||
| 9 | + > | ||
| 10 | + <label @dblclick="editing = true" v-text="todo.text" /> | ||
| 11 | + <button class="destroy" @click="deleteTodo( todo )" /> | ||
| 12 | + </div> | ||
| 13 | + <input | ||
| 14 | + v-show="editing" | ||
| 15 | + v-focus="editing" | ||
| 16 | + :value="todo.text" | ||
| 17 | + class="edit" | ||
| 18 | + @keyup.enter="doneEdit" | ||
| 19 | + @keyup.esc="cancelEdit" | ||
| 20 | + @blur="doneEdit" | ||
| 21 | + > | ||
| 22 | + </li> | ||
| 23 | +</template> | ||
| 24 | + | ||
| 25 | +<script> | ||
| 26 | +export default { | ||
| 27 | + name: 'Todo', | ||
| 28 | + directives: { | ||
| 29 | + focus(el, { value }, { context }) { | ||
| 30 | + if (value) { | ||
| 31 | + context.$nextTick(() => { | ||
| 32 | + el.focus() | ||
| 33 | + }) | ||
| 34 | + } | ||
| 35 | + } | ||
| 36 | + }, | ||
| 37 | + props: { | ||
| 38 | + todo: { | ||
| 39 | + type: Object, | ||
| 40 | + default: function() { | ||
| 41 | + return {} | ||
| 42 | + } | ||
| 43 | + } | ||
| 44 | + }, | ||
| 45 | + data() { | ||
| 46 | + return { | ||
| 47 | + editing: false | ||
| 48 | + } | ||
| 49 | + }, | ||
| 50 | + methods: { | ||
| 51 | + deleteTodo(todo) { | ||
| 52 | + this.$emit('deleteTodo', todo) | ||
| 53 | + }, | ||
| 54 | + editTodo({ todo, value }) { | ||
| 55 | + this.$emit('editTodo', { todo, value }) | ||
| 56 | + }, | ||
| 57 | + toggleTodo(todo) { | ||
| 58 | + this.$emit('toggleTodo', todo) | ||
| 59 | + }, | ||
| 60 | + doneEdit(e) { | ||
| 61 | + const value = e.target.value.trim() | ||
| 62 | + const { todo } = this | ||
| 63 | + if (!value) { | ||
| 64 | + this.deleteTodo({ | ||
| 65 | + todo | ||
| 66 | + }) | ||
| 67 | + } else if (this.editing) { | ||
| 68 | + this.editTodo({ | ||
| 69 | + todo, | ||
| 70 | + value | ||
| 71 | + }) | ||
| 72 | + this.editing = false | ||
| 73 | + } | ||
| 74 | + }, | ||
| 75 | + cancelEdit(e) { | ||
| 76 | + e.target.value = this.todo.text | ||
| 77 | + this.editing = false | ||
| 78 | + } | ||
| 79 | + } | ||
| 80 | +} | ||
| 81 | +</script> |
| 1 | +.todoapp { | ||
| 2 | + font: 14px 'Helvetica Neue', Helvetica, Arial, sans-serif; | ||
| 3 | + line-height: 1.4em; | ||
| 4 | + color: #4d4d4d; | ||
| 5 | + min-width: 230px; | ||
| 6 | + max-width: 550px; | ||
| 7 | + margin: 0 auto ; | ||
| 8 | + -webkit-font-smoothing: antialiased; | ||
| 9 | + -moz-osx-font-smoothing: grayscale; | ||
| 10 | + font-weight: 300; | ||
| 11 | + background: #fff; | ||
| 12 | + z-index: 1; | ||
| 13 | + position: relative; | ||
| 14 | + button { | ||
| 15 | + margin: 0; | ||
| 16 | + padding: 0; | ||
| 17 | + border: 0; | ||
| 18 | + background: none; | ||
| 19 | + font-size: 100%; | ||
| 20 | + vertical-align: baseline; | ||
| 21 | + font-family: inherit; | ||
| 22 | + font-weight: inherit; | ||
| 23 | + color: inherit; | ||
| 24 | + -webkit-appearance: none; | ||
| 25 | + appearance: none; | ||
| 26 | + -webkit-font-smoothing: antialiased; | ||
| 27 | + -moz-osx-font-smoothing: grayscale; | ||
| 28 | + } | ||
| 29 | + :focus { | ||
| 30 | + outline: 0; | ||
| 31 | + } | ||
| 32 | + .hidden { | ||
| 33 | + display: none; | ||
| 34 | + } | ||
| 35 | + .todoapp { | ||
| 36 | + background: #fff; | ||
| 37 | + margin: 130px 0 40px 0; | ||
| 38 | + position: relative; | ||
| 39 | + box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2), 0 25px 50px 0 rgba(0, 0, 0, 0.1); | ||
| 40 | + } | ||
| 41 | + .todoapp input::-webkit-input-placeholder { | ||
| 42 | + font-style: italic; | ||
| 43 | + font-weight: 300; | ||
| 44 | + color: #e6e6e6; | ||
| 45 | + } | ||
| 46 | + .todoapp input::-moz-placeholder { | ||
| 47 | + font-style: italic; | ||
| 48 | + font-weight: 300; | ||
| 49 | + color: #e6e6e6; | ||
| 50 | + } | ||
| 51 | + .todoapp input::input-placeholder { | ||
| 52 | + font-style: italic; | ||
| 53 | + font-weight: 300; | ||
| 54 | + color: #e6e6e6; | ||
| 55 | + } | ||
| 56 | + .todoapp h1 { | ||
| 57 | + position: absolute; | ||
| 58 | + top: -155px; | ||
| 59 | + width: 100%; | ||
| 60 | + font-size: 100px; | ||
| 61 | + font-weight: 100; | ||
| 62 | + text-align: center; | ||
| 63 | + color: rgba(175, 47, 47, 0.15); | ||
| 64 | + -webkit-text-rendering: optimizeLegibility; | ||
| 65 | + -moz-text-rendering: optimizeLegibility; | ||
| 66 | + text-rendering: optimizeLegibility; | ||
| 67 | + } | ||
| 68 | + .new-todo, | ||
| 69 | + .edit { | ||
| 70 | + position: relative; | ||
| 71 | + margin: 0; | ||
| 72 | + width: 100%; | ||
| 73 | + font-size: 18px; | ||
| 74 | + font-family: inherit; | ||
| 75 | + font-weight: inherit; | ||
| 76 | + line-height: 1.4em; | ||
| 77 | + border: 0; | ||
| 78 | + color: inherit; | ||
| 79 | + padding: 6px; | ||
| 80 | + border: 1px solid #999; | ||
| 81 | + box-shadow: inset 0 -1px 5px 0 rgba(0, 0, 0, 0.2); | ||
| 82 | + box-sizing: border-box; | ||
| 83 | + -webkit-font-smoothing: antialiased; | ||
| 84 | + -moz-osx-font-smoothing: grayscale; | ||
| 85 | + } | ||
| 86 | + .new-todo { | ||
| 87 | + padding: 10px 16px 16px 60px; | ||
| 88 | + border: none; | ||
| 89 | + background: rgba(0, 0, 0, 0.003); | ||
| 90 | + box-shadow: inset 0 -2px 1px rgba(0, 0, 0, 0.03); | ||
| 91 | + } | ||
| 92 | + .main { | ||
| 93 | + position: relative; | ||
| 94 | + z-index: 2; | ||
| 95 | + border-top: 1px solid #e6e6e6; | ||
| 96 | + } | ||
| 97 | + .toggle-all { | ||
| 98 | + text-align: center; | ||
| 99 | + border: none; | ||
| 100 | + /* Mobile Safari */ | ||
| 101 | + opacity: 0; | ||
| 102 | + position: absolute; | ||
| 103 | + } | ||
| 104 | + .toggle-all+label { | ||
| 105 | + width: 60px; | ||
| 106 | + height: 34px; | ||
| 107 | + font-size: 0; | ||
| 108 | + position: absolute; | ||
| 109 | + top: -52px; | ||
| 110 | + left: -13px; | ||
| 111 | + -webkit-transform: rotate(90deg); | ||
| 112 | + transform: rotate(90deg); | ||
| 113 | + } | ||
| 114 | + .toggle-all+label:before { | ||
| 115 | + content: '❯'; | ||
| 116 | + font-size: 22px; | ||
| 117 | + color: #e6e6e6; | ||
| 118 | + padding: 10px 27px 10px 27px; | ||
| 119 | + } | ||
| 120 | + .toggle-all:checked+label:before { | ||
| 121 | + color: #737373; | ||
| 122 | + } | ||
| 123 | + .todo-list { | ||
| 124 | + margin: 0; | ||
| 125 | + padding: 0; | ||
| 126 | + list-style: none; | ||
| 127 | + } | ||
| 128 | + .todo-list li { | ||
| 129 | + position: relative; | ||
| 130 | + font-size: 24px; | ||
| 131 | + border-bottom: 1px solid #ededed; | ||
| 132 | + } | ||
| 133 | + .todo-list li:last-child { | ||
| 134 | + border-bottom: none; | ||
| 135 | + } | ||
| 136 | + .todo-list li.editing { | ||
| 137 | + border-bottom: none; | ||
| 138 | + padding: 0; | ||
| 139 | + } | ||
| 140 | + .todo-list li.editing .edit { | ||
| 141 | + display: block; | ||
| 142 | + width: 506px; | ||
| 143 | + padding: 12px 16px; | ||
| 144 | + margin: 0 0 0 43px; | ||
| 145 | + } | ||
| 146 | + .todo-list li.editing .view { | ||
| 147 | + display: none; | ||
| 148 | + } | ||
| 149 | + .todo-list li .toggle { | ||
| 150 | + text-align: center; | ||
| 151 | + width: 40px; | ||
| 152 | + /* auto, since non-WebKit browsers doesn't support input styling */ | ||
| 153 | + height: auto; | ||
| 154 | + position: absolute; | ||
| 155 | + top: 0; | ||
| 156 | + bottom: 0; | ||
| 157 | + margin: auto 0; | ||
| 158 | + border: none; | ||
| 159 | + /* Mobile Safari */ | ||
| 160 | + -webkit-appearance: none; | ||
| 161 | + appearance: none; | ||
| 162 | + } | ||
| 163 | + .todo-list li .toggle { | ||
| 164 | + opacity: 0; | ||
| 165 | + } | ||
| 166 | + .todo-list li .toggle+label { | ||
| 167 | + /* | ||
| 168 | + Firefox requires `#` to be escaped - https://bugzilla.mozilla.org/show_bug.cgi?id=922433 | ||
| 169 | + IE and Edge requires *everything* to be escaped to render, so we do that instead of just the `#` - https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/7157459/ | ||
| 170 | + */ | ||
| 171 | + background-image: url('data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2240%22%20height%3D%2240%22%20viewBox%3D%22-10%20-18%20100%20135%22%3E%3Ccircle%20cx%3D%2250%22%20cy%3D%2250%22%20r%3D%2250%22%20fill%3D%22none%22%20stroke%3D%22%23ededed%22%20stroke-width%3D%223%22/%3E%3C/svg%3E'); | ||
| 172 | + background-repeat: no-repeat; | ||
| 173 | + background-position: center left; | ||
| 174 | + background-size: 36px; | ||
| 175 | + } | ||
| 176 | + .todo-list li .toggle:checked+label { | ||
| 177 | + background-size: 36px; | ||
| 178 | + background-image: url('data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2240%22%20height%3D%2240%22%20viewBox%3D%22-10%20-18%20100%20135%22%3E%3Ccircle%20cx%3D%2250%22%20cy%3D%2250%22%20r%3D%2250%22%20fill%3D%22none%22%20stroke%3D%22%23bddad5%22%20stroke-width%3D%223%22/%3E%3Cpath%20fill%3D%22%235dc2af%22%20d%3D%22M72%2025L42%2071%2027%2056l-4%204%2020%2020%2034-52z%22/%3E%3C/svg%3E'); | ||
| 179 | + } | ||
| 180 | + .todo-list li label { | ||
| 181 | + word-break: break-all; | ||
| 182 | + padding: 15px 15px 15px 50px; | ||
| 183 | + display: block; | ||
| 184 | + line-height: 1.0; | ||
| 185 | + font-size: 14px; | ||
| 186 | + transition: color 0.4s; | ||
| 187 | + } | ||
| 188 | + .todo-list li.completed label { | ||
| 189 | + color: #d9d9d9; | ||
| 190 | + text-decoration: line-through; | ||
| 191 | + } | ||
| 192 | + .todo-list li .destroy { | ||
| 193 | + display: none; | ||
| 194 | + position: absolute; | ||
| 195 | + top: 0; | ||
| 196 | + right: 10px; | ||
| 197 | + bottom: 0; | ||
| 198 | + width: 40px; | ||
| 199 | + height: 40px; | ||
| 200 | + margin: auto 0; | ||
| 201 | + font-size: 30px; | ||
| 202 | + color: #cc9a9a; | ||
| 203 | + transition: color 0.2s ease-out; | ||
| 204 | + cursor: pointer; | ||
| 205 | + } | ||
| 206 | + .todo-list li .destroy:hover { | ||
| 207 | + color: #af5b5e; | ||
| 208 | + } | ||
| 209 | + .todo-list li .destroy:after { | ||
| 210 | + content: '×'; | ||
| 211 | + } | ||
| 212 | + .todo-list li:hover .destroy { | ||
| 213 | + display: block; | ||
| 214 | + } | ||
| 215 | + .todo-list li .edit { | ||
| 216 | + display: none; | ||
| 217 | + } | ||
| 218 | + .todo-list li.editing:last-child { | ||
| 219 | + margin-bottom: -1px; | ||
| 220 | + } | ||
| 221 | + .footer { | ||
| 222 | + color: #777; | ||
| 223 | + position: relative; | ||
| 224 | + padding: 10px 15px; | ||
| 225 | + height: 40px; | ||
| 226 | + text-align: center; | ||
| 227 | + border-top: 1px solid #e6e6e6; | ||
| 228 | + } | ||
| 229 | + .footer:before { | ||
| 230 | + content: ''; | ||
| 231 | + position: absolute; | ||
| 232 | + right: 0; | ||
| 233 | + bottom: 0; | ||
| 234 | + left: 0; | ||
| 235 | + height: 40px; | ||
| 236 | + overflow: hidden; | ||
| 237 | + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2), 0 8px 0 -3px #f6f6f6, 0 9px 1px -3px rgba(0, 0, 0, 0.2), 0 16px 0 -6px #f6f6f6, 0 17px 2px -6px rgba(0, 0, 0, 0.2); | ||
| 238 | + } | ||
| 239 | + .todo-count { | ||
| 240 | + float: left; | ||
| 241 | + text-align: left; | ||
| 242 | + } | ||
| 243 | + .todo-count strong { | ||
| 244 | + font-weight: 300; | ||
| 245 | + } | ||
| 246 | + .filters { | ||
| 247 | + margin: 0; | ||
| 248 | + padding: 0; | ||
| 249 | + position: relative; | ||
| 250 | + z-index: 1; | ||
| 251 | + list-style: none; | ||
| 252 | + } | ||
| 253 | + .filters li { | ||
| 254 | + display: inline; | ||
| 255 | + } | ||
| 256 | + .filters li a { | ||
| 257 | + color: inherit; | ||
| 258 | + font-size: 12px; | ||
| 259 | + padding: 3px 7px; | ||
| 260 | + text-decoration: none; | ||
| 261 | + border: 1px solid transparent; | ||
| 262 | + border-radius: 3px; | ||
| 263 | + } | ||
| 264 | + .filters li a:hover { | ||
| 265 | + border-color: rgba(175, 47, 47, 0.1); | ||
| 266 | + } | ||
| 267 | + .filters li a.selected { | ||
| 268 | + border-color: rgba(175, 47, 47, 0.2); | ||
| 269 | + } | ||
| 270 | + .clear-completed, | ||
| 271 | + html .clear-completed:active { | ||
| 272 | + float: right; | ||
| 273 | + position: relative; | ||
| 274 | + line-height: 20px; | ||
| 275 | + text-decoration: none; | ||
| 276 | + cursor: pointer; | ||
| 277 | + } | ||
| 278 | + .clear-completed:hover { | ||
| 279 | + text-decoration: underline; | ||
| 280 | + } | ||
| 281 | + .info { | ||
| 282 | + margin: 65px auto 0; | ||
| 283 | + color: #bfbfbf; | ||
| 284 | + font-size: 10px; | ||
| 285 | + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); | ||
| 286 | + text-align: center; | ||
| 287 | + } | ||
| 288 | + .info p { | ||
| 289 | + line-height: 1; | ||
| 290 | + } | ||
| 291 | + .info a { | ||
| 292 | + color: inherit; | ||
| 293 | + text-decoration: none; | ||
| 294 | + font-weight: 400; | ||
| 295 | + } | ||
| 296 | + .info a:hover { | ||
| 297 | + text-decoration: underline; | ||
| 298 | + } | ||
| 299 | + /* | ||
| 300 | + Hack to remove background from Mobile Safari. | ||
| 301 | + Can't use it globally since it destroys checkboxes in Firefox | ||
| 302 | +*/ | ||
| 303 | + @media screen and (-webkit-min-device-pixel-ratio:0) { | ||
| 304 | + .toggle-all, | ||
| 305 | + .todo-list li .toggle { | ||
| 306 | + background: none; | ||
| 307 | + } | ||
| 308 | + .todo-list li .toggle { | ||
| 309 | + height: 40px; | ||
| 310 | + } | ||
| 311 | + } | ||
| 312 | + @media (max-width: 430px) { | ||
| 313 | + .footer { | ||
| 314 | + height: 50px; | ||
| 315 | + } | ||
| 316 | + .filters { | ||
| 317 | + bottom: 10px; | ||
| 318 | + } | ||
| 319 | + } | ||
| 320 | +} |
| 1 | +<template> | ||
| 2 | + <section class="todoapp"> | ||
| 3 | + <!-- header --> | ||
| 4 | + <header class="header"> | ||
| 5 | + <input class="new-todo" autocomplete="off" placeholder="Todo List" @keyup.enter="addTodo"> | ||
| 6 | + </header> | ||
| 7 | + <!-- main section --> | ||
| 8 | + <section v-show="todos.length" class="main"> | ||
| 9 | + <input id="toggle-all" :checked="allChecked" class="toggle-all" type="checkbox" @change="toggleAll({ done: !allChecked })"> | ||
| 10 | + <label for="toggle-all" /> | ||
| 11 | + <ul class="todo-list"> | ||
| 12 | + <todo | ||
| 13 | + v-for="(todo, index) in filteredTodos" | ||
| 14 | + :key="index" | ||
| 15 | + :todo="todo" | ||
| 16 | + @toggleTodo="toggleTodo" | ||
| 17 | + @editTodo="editTodo" | ||
| 18 | + @deleteTodo="deleteTodo" | ||
| 19 | + /> | ||
| 20 | + </ul> | ||
| 21 | + </section> | ||
| 22 | + <!-- footer --> | ||
| 23 | + <footer v-show="todos.length" class="footer"> | ||
| 24 | + <span class="todo-count"> | ||
| 25 | + <strong>{{ remaining }}</strong> | ||
| 26 | + {{ remaining | pluralize('item') }} left | ||
| 27 | + </span> | ||
| 28 | + <ul class="filters"> | ||
| 29 | + <li v-for="(val, key) in filters" :key="key"> | ||
| 30 | + <a :class="{ selected: visibility === key }" @click.prevent="visibility = key">{{ key | capitalize }}</a> | ||
| 31 | + </li> | ||
| 32 | + </ul> | ||
| 33 | + <!-- <button class="clear-completed" v-show="todos.length > remaining" @click="clearCompleted"> | ||
| 34 | + Clear completed | ||
| 35 | + </button> --> | ||
| 36 | + </footer> | ||
| 37 | + </section> | ||
| 38 | +</template> | ||
| 39 | + | ||
| 40 | +<script> | ||
| 41 | +import Todo from './Todo.vue' | ||
| 42 | + | ||
| 43 | +const STORAGE_KEY = 'todos' | ||
| 44 | +const filters = { | ||
| 45 | + all: todos => todos, | ||
| 46 | + active: todos => todos.filter(todo => !todo.done), | ||
| 47 | + completed: todos => todos.filter(todo => todo.done) | ||
| 48 | +} | ||
| 49 | +const defalutList = [ | ||
| 50 | + { text: 'star this repository', done: false }, | ||
| 51 | + { text: 'fork this repository', done: false }, | ||
| 52 | + { text: 'follow author', done: false }, | ||
| 53 | + { text: 'vue-element-admin', done: true }, | ||
| 54 | + { text: 'vue', done: true }, | ||
| 55 | + { text: 'element-ui', done: true }, | ||
| 56 | + { text: 'axios', done: true }, | ||
| 57 | + { text: 'webpack', done: true } | ||
| 58 | +] | ||
| 59 | +export default { | ||
| 60 | + components: { Todo }, | ||
| 61 | + filters: { | ||
| 62 | + pluralize: (n, w) => n === 1 ? w : w + 's', | ||
| 63 | + capitalize: s => s.charAt(0).toUpperCase() + s.slice(1) | ||
| 64 | + }, | ||
| 65 | + data() { | ||
| 66 | + return { | ||
| 67 | + visibility: 'all', | ||
| 68 | + filters, | ||
| 69 | + // todos: JSON.parse(window.localStorage.getItem(STORAGE_KEY)) || defalutList | ||
| 70 | + todos: defalutList | ||
| 71 | + } | ||
| 72 | + }, | ||
| 73 | + computed: { | ||
| 74 | + allChecked() { | ||
| 75 | + return this.todos.every(todo => todo.done) | ||
| 76 | + }, | ||
| 77 | + filteredTodos() { | ||
| 78 | + return filters[this.visibility](this.todos) | ||
| 79 | + }, | ||
| 80 | + remaining() { | ||
| 81 | + return this.todos.filter(todo => !todo.done).length | ||
| 82 | + } | ||
| 83 | + }, | ||
| 84 | + methods: { | ||
| 85 | + setLocalStorage() { | ||
| 86 | + window.localStorage.setItem(STORAGE_KEY, JSON.stringify(this.todos)) | ||
| 87 | + }, | ||
| 88 | + addTodo(e) { | ||
| 89 | + const text = e.target.value | ||
| 90 | + if (text.trim()) { | ||
| 91 | + this.todos.push({ | ||
| 92 | + text, | ||
| 93 | + done: false | ||
| 94 | + }) | ||
| 95 | + this.setLocalStorage() | ||
| 96 | + } | ||
| 97 | + e.target.value = '' | ||
| 98 | + }, | ||
| 99 | + toggleTodo(val) { | ||
| 100 | + val.done = !val.done | ||
| 101 | + this.setLocalStorage() | ||
| 102 | + }, | ||
| 103 | + deleteTodo(todo) { | ||
| 104 | + this.todos.splice(this.todos.indexOf(todo), 1) | ||
| 105 | + this.setLocalStorage() | ||
| 106 | + }, | ||
| 107 | + editTodo({ todo, value }) { | ||
| 108 | + todo.text = value | ||
| 109 | + this.setLocalStorage() | ||
| 110 | + }, | ||
| 111 | + clearCompleted() { | ||
| 112 | + this.todos = this.todos.filter(todo => !todo.done) | ||
| 113 | + this.setLocalStorage() | ||
| 114 | + }, | ||
| 115 | + toggleAll({ done }) { | ||
| 116 | + this.todos.forEach(todo => { | ||
| 117 | + todo.done = done | ||
| 118 | + this.setLocalStorage() | ||
| 119 | + }) | ||
| 120 | + } | ||
| 121 | + } | ||
| 122 | +} | ||
| 123 | +</script> | ||
| 124 | + | ||
| 125 | +<style lang="scss"> | ||
| 126 | + @import './index.scss'; | ||
| 127 | +</style> |
| 1 | +<template> | ||
| 2 | + <el-table :data="list" style="width: 100%;padding-top: 15px;"> | ||
| 3 | + <el-table-column label="Order_No" min-width="200"> | ||
| 4 | + <template slot-scope="scope"> | ||
| 5 | + {{ scope.row.order_no | orderNoFilter }} | ||
| 6 | + </template> | ||
| 7 | + </el-table-column> | ||
| 8 | + <el-table-column label="Price" width="195" align="center"> | ||
| 9 | + <template slot-scope="scope"> | ||
| 10 | + ¥{{ scope.row.price | toThousandFilter }} | ||
| 11 | + </template> | ||
| 12 | + </el-table-column> | ||
| 13 | + <el-table-column label="Status" width="100" align="center"> | ||
| 14 | + <template slot-scope="{row}"> | ||
| 15 | + <el-tag :type="row.status | statusFilter"> | ||
| 16 | + {{ row.status }} | ||
| 17 | + </el-tag> | ||
| 18 | + </template> | ||
| 19 | + </el-table-column> | ||
| 20 | + </el-table> | ||
| 21 | +</template> | ||
| 22 | + | ||
| 23 | +<script> | ||
| 24 | +import { transactionList } from '@/api/remote-search' | ||
| 25 | + | ||
| 26 | +export default { | ||
| 27 | + filters: { | ||
| 28 | + statusFilter(status) { | ||
| 29 | + const statusMap = { | ||
| 30 | + success: 'success', | ||
| 31 | + pending: 'danger' | ||
| 32 | + } | ||
| 33 | + return statusMap[status] | ||
| 34 | + }, | ||
| 35 | + orderNoFilter(str) { | ||
| 36 | + return str.substring(0, 30) | ||
| 37 | + } | ||
| 38 | + }, | ||
| 39 | + data() { | ||
| 40 | + return { | ||
| 41 | + list: null | ||
| 42 | + } | ||
| 43 | + }, | ||
| 44 | + created() { | ||
| 45 | + this.fetchData() | ||
| 46 | + }, | ||
| 47 | + methods: { | ||
| 48 | + fetchData() { | ||
| 49 | + transactionList().then(response => { | ||
| 50 | + this.list = response.data.items.slice(0, 8) | ||
| 51 | + }) | ||
| 52 | + } | ||
| 53 | + } | ||
| 54 | +} | ||
| 55 | +</script> |
| 1 | +import { debounce } from '@/utils' | ||
| 2 | + | ||
| 3 | +export default { | ||
| 4 | + data() { | ||
| 5 | + return { | ||
| 6 | + $_sidebarElm: null, | ||
| 7 | + $_resizeHandler: null | ||
| 8 | + } | ||
| 9 | + }, | ||
| 10 | + mounted() { | ||
| 11 | + this.$_resizeHandler = debounce(() => { | ||
| 12 | + if (this.chart) { | ||
| 13 | + this.chart.resize() | ||
| 14 | + } | ||
| 15 | + }, 100) | ||
| 16 | + this.$_initResizeEvent() | ||
| 17 | + this.$_initSidebarResizeEvent() | ||
| 18 | + }, | ||
| 19 | + beforeDestroy() { | ||
| 20 | + this.$_destroyResizeEvent() | ||
| 21 | + this.$_destroySidebarResizeEvent() | ||
| 22 | + }, | ||
| 23 | + // to fixed bug when cached by keep-alive | ||
| 24 | + // https://github.com/PanJiaChen/vue-element-admin/issues/2116 | ||
| 25 | + activated() { | ||
| 26 | + this.$_initResizeEvent() | ||
| 27 | + this.$_initSidebarResizeEvent() | ||
| 28 | + }, | ||
| 29 | + deactivated() { | ||
| 30 | + this.$_destroyResizeEvent() | ||
| 31 | + this.$_destroySidebarResizeEvent() | ||
| 32 | + }, | ||
| 33 | + methods: { | ||
| 34 | + // use $_ for mixins properties | ||
| 35 | + // https://vuejs.org/v2/style-guide/index.html#Private-property-names-essential | ||
| 36 | + $_initResizeEvent() { | ||
| 37 | + window.addEventListener('resize', this.$_resizeHandler) | ||
| 38 | + }, | ||
| 39 | + $_destroyResizeEvent() { | ||
| 40 | + window.removeEventListener('resize', this.$_resizeHandler) | ||
| 41 | + }, | ||
| 42 | + $_sidebarResizeHandler(e) { | ||
| 43 | + if (e.propertyName === 'width') { | ||
| 44 | + this.$_resizeHandler() | ||
| 45 | + } | ||
| 46 | + }, | ||
| 47 | + $_initSidebarResizeEvent() { | ||
| 48 | + this.$_sidebarElm = document.getElementsByClassName('sidebar-container')[0] | ||
| 49 | + this.$_sidebarElm && this.$_sidebarElm.addEventListener('transitionend', this.$_sidebarResizeHandler) | ||
| 50 | + }, | ||
| 51 | + $_destroySidebarResizeEvent() { | ||
| 52 | + this.$_sidebarElm && this.$_sidebarElm.removeEventListener('transitionend', this.$_sidebarResizeHandler) | ||
| 53 | + } | ||
| 54 | + } | ||
| 55 | +} |
src/views/dashboard/index.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div class="dashboard-editor-container"> | ||
| 3 | + <github-corner class="github-corner" /> | ||
| 4 | + | ||
| 5 | + <panel-group @handleSetLineChartData="handleSetLineChartData" /> | ||
| 6 | + | ||
| 7 | + <el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;"> | ||
| 8 | + <line-chart :chart-data="lineChartData" /> | ||
| 9 | + </el-row> | ||
| 10 | + | ||
| 11 | + <el-row :gutter="20"> | ||
| 12 | + <el-col :span="7"> | ||
| 13 | + <div class="chart-wrapper"> | ||
| 14 | + <raddar-chart /> | ||
| 15 | + </div> | ||
| 16 | + </el-col> | ||
| 17 | +<!-- :xs="24" :sm="24" :lg="8"--> | ||
| 18 | + <el-col :span="7"> | ||
| 19 | + <div class="chart-wrapper"> | ||
| 20 | + <pie-chart /> | ||
| 21 | + </div> | ||
| 22 | + </el-col> | ||
| 23 | + <el-col :span="7"> | ||
| 24 | + <div class="chart-wrapper"> | ||
| 25 | + <bar-chart /> | ||
| 26 | + </div> | ||
| 27 | + </el-col> | ||
| 28 | + </el-row> | ||
| 29 | + | ||
| 30 | +<!-- <el-row :gutter="8">--> | ||
| 31 | +<!-- <el-col :xs="{span: 24}" :sm="{span: 24}" :md="{span: 24}" :lg="{span: 12}" :xl="{span: 12}" style="padding-right:8px;margin-bottom:30px;">--> | ||
| 32 | +<!-- <transaction-table />--> | ||
| 33 | +<!-- </el-col>--> | ||
| 34 | +<!-- <el-col :xs="{span: 24}" :sm="{span: 12}" :md="{span: 12}" :lg="{span: 6}" :xl="{span: 6}" style="margin-bottom:30px;">--> | ||
| 35 | +<!-- <todo-list />--> | ||
| 36 | +<!-- </el-col>--> | ||
| 37 | +<!-- <el-col :xs="{span: 24}" :sm="{span: 12}" :md="{span: 12}" :lg="{span: 6}" :xl="{span: 6}" style="margin-bottom:30px;">--> | ||
| 38 | +<!-- <box-card />--> | ||
| 39 | +<!-- </el-col>--> | ||
| 40 | +<!-- </el-row>--> | ||
| 41 | + </div> | ||
| 42 | +</template> | ||
| 43 | + | ||
| 44 | +<script> | ||
| 45 | + import GithubCorner from '../../components/GithubCorner' | ||
| 46 | + import PanelGroup from './components/PanelGroup' | ||
| 47 | + import LineChart from './components/LineChart' | ||
| 48 | + import RaddarChart from './components/RaddarChart' | ||
| 49 | + import PieChart from './components/PieChart' | ||
| 50 | + import BarChart from './components/BarChart' | ||
| 51 | + import TransactionTable from './components/TransactionTable' | ||
| 52 | + import TodoList from './components/TodoList' | ||
| 53 | + import BoxCard from './components/BoxCard' | ||
| 54 | + | ||
| 55 | + const lineChartData = { | ||
| 56 | + newVisitis: { | ||
| 57 | + expectedData: [100, 120, 161, 134, 105, 160, 165], | ||
| 58 | + actualData: [120, 82, 91, 154, 162, 140, 145] | ||
| 59 | + }, | ||
| 60 | + messages: { | ||
| 61 | + expectedData: [200, 192, 120, 144, 160, 130, 140], | ||
| 62 | + actualData: [180, 160, 151, 106, 145, 150, 130] | ||
| 63 | + }, | ||
| 64 | + purchases: { | ||
| 65 | + expectedData: [80, 100, 121, 104, 105, 90, 100], | ||
| 66 | + actualData: [120, 90, 100, 138, 142, 130, 130] | ||
| 67 | + }, | ||
| 68 | + shoppings: { | ||
| 69 | + expectedData: [130, 140, 141, 142, 145, 150, 160], | ||
| 70 | + actualData: [120, 82, 91, 154, 162, 140, 130] | ||
| 71 | + } | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + export default { | ||
| 75 | + name: 'DashboardAdmin', | ||
| 76 | + components: { | ||
| 77 | + GithubCorner, | ||
| 78 | + PanelGroup, | ||
| 79 | + LineChart, | ||
| 80 | + RaddarChart, | ||
| 81 | + PieChart, | ||
| 82 | + BarChart, | ||
| 83 | + TransactionTable, | ||
| 84 | + TodoList, | ||
| 85 | + BoxCard | ||
| 86 | + }, | ||
| 87 | + data() { | ||
| 88 | + return { | ||
| 89 | + lineChartData: lineChartData.newVisitis | ||
| 90 | + } | ||
| 91 | + }, | ||
| 92 | + methods: { | ||
| 93 | + handleSetLineChartData(type) { | ||
| 94 | + this.lineChartData = lineChartData[type] | ||
| 95 | + } | ||
| 96 | + } | ||
| 97 | + } | ||
| 98 | +</script> | ||
| 99 | + | ||
| 100 | +<style lang="scss" scoped> | ||
| 101 | + .dashboard-editor-container { | ||
| 102 | + padding: 32px; | ||
| 103 | + background-color: rgb(240, 242, 245); | ||
| 104 | + position: relative; | ||
| 105 | + | ||
| 106 | + .github-corner { | ||
| 107 | + position: absolute; | ||
| 108 | + top: 0px; | ||
| 109 | + border: 0; | ||
| 110 | + right: 0; | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + .chart-wrapper { | ||
| 114 | + background: #fff; | ||
| 115 | + padding: 16px 16px 0; | ||
| 116 | + margin-bottom: 32px; | ||
| 117 | + } | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + @media (max-width:1024px) { | ||
| 121 | + .chart-wrapper { | ||
| 122 | + padding: 6px; | ||
| 123 | + } | ||
| 124 | + } | ||
| 125 | +</style> |
-
请 注册 或 登录 后发表评论