diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 5eba7eb3..26a5584a 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -58,8 +58,10 @@ const devWebpackConfig = merge(baseWebpackConfig, { inject: true, favicon: resolve('favicon.ico'), title: 'vue-element-admin', - path: config.dev.assetsPublicPath + config.dev.assetsSubDirectory - }) + templateParameters: { + BASE_URL: config.dev.assetsPublicPath + config.dev.assetsSubDirectory, + }, + }), ] }) diff --git a/build/webpack.prod.conf.js b/build/webpack.prod.conf.js index 01f85732..946a134a 100644 --- a/build/webpack.prod.conf.js +++ b/build/webpack.prod.conf.js @@ -56,7 +56,9 @@ const webpackConfig = merge(baseWebpackConfig, { inject: true, favicon: resolve('favicon.ico'), title: 'vue-element-admin', - path: config.build.assetsPublicPath + config.build.assetsSubDirectory, + templateParameters: { + BASE_URL: config.build.assetsPublicPath + config.build.assetsSubDirectory, + }, minify: { removeComments: true, collapseWhitespace: true, diff --git a/index.html b/index.html index 489d1a53..7a7ecacf 100644 --- a/index.html +++ b/index.html @@ -8,7 +8,7 @@ vue-element-admin - +
diff --git a/package.json b/package.json index fa817767..06ac63d0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-element-admin", - "version": "3.8.1", + "version": "3.9.1", "description": "A magical vue admin. Typical templates for enterprise applications. Newest development stack of vue. Lots of awesome features", "author": "Pan ", "license": "MIT", @@ -10,7 +10,8 @@ "build:sit": "cross-env NODE_ENV=production env_config=sit node build/build.js", "lint": "eslint --ext .js,.vue src", "test": "npm run lint", - "precommit": "lint-staged" + "precommit": "lint-staged", + "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml" }, "lint-staged": { "src/**/*.{js,vue}": [ @@ -93,6 +94,7 @@ "node-sass": "^4.7.2", "optimize-css-assets-webpack-plugin": "5.0.0", "ora": "3.0.0", + "path-to-regexp": "2.4.0", "portfinder": "1.0.13", "postcss-import": "11.1.0", "postcss-loader": "2.1.6", @@ -105,6 +107,7 @@ "serve-static": "1.13.2", "shelljs": "0.8.2", "svg-sprite-loader": "3.8.0", + "svgo": "1.0.5", "uglifyjs-webpack-plugin": "1.2.7", "url-loader": "1.0.1", "vue-loader": "15.3.0", diff --git a/src/assets/echarts-macarons.js b/src/assets/echarts-macarons.js deleted file mode 100644 index 0678ef83..00000000 --- a/src/assets/echarts-macarons.js +++ /dev/null @@ -1,199 +0,0 @@ -/* eslint-disable */ -(function (root, factory) { - if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module. - define(['exports', 'echarts'], factory); - } else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') { - // CommonJS - factory(exports, require('echarts')); - } else { - // Browser globals - factory({}, root.echarts); - } -}(this, function (exports, echarts) { - var log = function (msg) { - if (typeof console !== 'undefined') { - console && console.error && console.error(msg); - } - }; - if (!echarts) { - log('ECharts is not Loaded'); - return; - } - - var colorPalette = [ - '#2ec7c9','#b6a2de','#5ab1ef','#ffb980','#d87a80', - '#8d98b3','#e5cf0d','#97b552','#95706d','#dc69aa', - '#07a2a4','#9a7fd1','#588dd5','#f5994e','#c05050', - '#59678c','#c9ab00','#7eb00a','#6f5553','#c14089' - ]; - - - var theme = { - color: colorPalette, - - title: { - textStyle: { - fontWeight: 'normal', - color: '#008acd' - } - }, - - visualMap: { - itemWidth: 15, - color: ['#5ab1ef','#e0ffff'] - }, - - toolbox: { - iconStyle: { - normal: { - borderColor: colorPalette[0] - } - } - }, - - tooltip: { - backgroundColor: 'rgba(50,50,50,0.5)', - axisPointer : { - type : 'line', - lineStyle : { - color: '#008acd' - }, - crossStyle: { - color: '#008acd' - }, - shadowStyle : { - color: 'rgba(200,200,200,0.2)' - } - } - }, - - dataZoom: { - dataBackgroundColor: '#efefff', - fillerColor: 'rgba(182,162,222,0.2)', - handleColor: '#008acd' - }, - - grid: { - borderColor: '#eee' - }, - - categoryAxis: { - axisLine: { - lineStyle: { - color: '#008acd' - } - }, - splitLine: { - lineStyle: { - color: ['#eee'] - } - } - }, - - valueAxis: { - axisLine: { - lineStyle: { - color: '#008acd' - } - }, - splitArea : { - show : true, - areaStyle : { - color: ['rgba(250,250,250,0.1)','rgba(200,200,200,0.1)'] - } - }, - splitLine: { - lineStyle: { - color: ['#eee'] - } - } - }, - - timeline : { - lineStyle : { - color : '#008acd' - }, - controlStyle : { - normal : { color : '#008acd'}, - emphasis : { color : '#008acd'} - }, - symbol : 'emptyCircle', - symbolSize : 3 - }, - - line: { - smooth : true, - symbol: 'emptyCircle', - symbolSize: 3 - }, - - candlestick: { - itemStyle: { - normal: { - color: '#d87a80', - color0: '#2ec7c9', - lineStyle: { - color: '#d87a80', - color0: '#2ec7c9' - } - } - } - }, - - scatter: { - symbol: 'circle', - symbolSize: 4 - }, - - map: { - label: { - normal: { - textStyle: { - color: '#d87a80' - } - } - }, - itemStyle: { - normal: { - borderColor: '#eee', - areaColor: '#ddd' - }, - emphasis: { - areaColor: '#fe994e' - } - } - }, - - graph: { - color: colorPalette - }, - - gauge : { - axisLine: { - lineStyle: { - color: [[0.2, '#2ec7c9'],[0.8, '#5ab1ef'],[1, '#d87a80']], - width: 10 - } - }, - axisTick: { - splitNumber: 10, - length :15, - lineStyle: { - color: 'auto' - } - }, - splitLine: { - length :22, - lineStyle: { - color: 'auto' - } - }, - pointer : { - width : 5 - } - } - }; - - echarts.registerTheme('macarons', theme); -})); diff --git a/src/components/Breadcrumb/index.vue b/src/components/Breadcrumb/index.vue index ec84cb31..32a8fb69 100644 --- a/src/components/Breadcrumb/index.vue +++ b/src/components/Breadcrumb/index.vue @@ -11,6 +11,7 @@ \ No newline at end of file + \ No newline at end of file diff --git a/src/icons/svg/bug.svg b/src/icons/svg/bug.svg index a12a9394..05a150dc 100644 --- a/src/icons/svg/bug.svg +++ b/src/icons/svg/bug.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/icons/svg/chart.svg b/src/icons/svg/chart.svg index b1b31336..27728fb0 100644 --- a/src/icons/svg/chart.svg +++ b/src/icons/svg/chart.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/icons/svg/clipboard.svg b/src/icons/svg/clipboard.svg index cf1c9b0c..90923ff6 100644 --- a/src/icons/svg/clipboard.svg +++ b/src/icons/svg/clipboard.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/icons/svg/component.svg b/src/icons/svg/component.svg index a8008c84..207ada34 100644 --- a/src/icons/svg/component.svg +++ b/src/icons/svg/component.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/icons/svg/dashboard.svg b/src/icons/svg/dashboard.svg index bee42507..5317d370 100644 --- a/src/icons/svg/dashboard.svg +++ b/src/icons/svg/dashboard.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/icons/svg/documentation.svg b/src/icons/svg/documentation.svg index 405c2ad7..70431228 100644 --- a/src/icons/svg/documentation.svg +++ b/src/icons/svg/documentation.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/icons/svg/drag.svg b/src/icons/svg/drag.svg index 819c8d50..4185d3ce 100644 --- a/src/icons/svg/drag.svg +++ b/src/icons/svg/drag.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/icons/svg/edit.svg b/src/icons/svg/edit.svg index 5c77d97a..0306a867 100644 --- a/src/icons/svg/edit.svg +++ b/src/icons/svg/edit.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/icons/svg/email.svg b/src/icons/svg/email.svg index 8a87e147..055e5013 100644 --- a/src/icons/svg/email.svg +++ b/src/icons/svg/email.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/icons/svg/example.svg b/src/icons/svg/example.svg index 681422ea..46f42b53 100644 --- a/src/icons/svg/example.svg +++ b/src/icons/svg/example.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/icons/svg/excel.svg b/src/icons/svg/excel.svg index e5dd5cec..59d54b2c 100644 --- a/src/icons/svg/excel.svg +++ b/src/icons/svg/excel.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/icons/svg/eye.svg b/src/icons/svg/eye.svg index 194aa45c..16ed2d87 100644 --- a/src/icons/svg/eye.svg +++ b/src/icons/svg/eye.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/icons/svg/form.svg b/src/icons/svg/form.svg index 79716f06..dcbaa185 100644 --- a/src/icons/svg/form.svg +++ b/src/icons/svg/form.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/icons/svg/guide 2.svg b/src/icons/svg/guide 2.svg new file mode 100644 index 00000000..d053bd73 --- /dev/null +++ b/src/icons/svg/guide 2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/guide.svg b/src/icons/svg/guide.svg index 9bae3394..b2710017 100644 --- a/src/icons/svg/guide.svg +++ b/src/icons/svg/guide.svg @@ -1 +1 @@ - + \ No newline at end of file diff --git a/src/icons/svg/icon.svg b/src/icons/svg/icon.svg index 906af96a..82be8eee 100644 --- a/src/icons/svg/icon.svg +++ b/src/icons/svg/icon.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/icons/svg/international.svg b/src/icons/svg/international.svg index 6912767d..e9b56eee 100644 --- a/src/icons/svg/international.svg +++ b/src/icons/svg/international.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/icons/svg/language.svg b/src/icons/svg/language.svg index 2baf7431..96d00288 100644 --- a/src/icons/svg/language.svg +++ b/src/icons/svg/language.svg @@ -1 +1 @@ - + \ No newline at end of file diff --git a/src/icons/svg/link.svg b/src/icons/svg/link.svg index 11037e6f..07090147 100644 --- a/src/icons/svg/link.svg +++ b/src/icons/svg/link.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/icons/svg/list.svg b/src/icons/svg/list.svg index c45f4591..20259edd 100644 --- a/src/icons/svg/list.svg +++ b/src/icons/svg/list.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/icons/svg/lock.svg b/src/icons/svg/lock.svg index 37c60701..74fee543 100644 --- a/src/icons/svg/lock.svg +++ b/src/icons/svg/lock.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/icons/svg/message.svg b/src/icons/svg/message.svg index d807b002..14ca8172 100644 --- a/src/icons/svg/message.svg +++ b/src/icons/svg/message.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/icons/svg/money.svg b/src/icons/svg/money.svg index d4fcb9ca..c1580de1 100644 --- a/src/icons/svg/money.svg +++ b/src/icons/svg/money.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/icons/svg/nested.svg b/src/icons/svg/nested.svg index f5641979..06713a86 100644 --- a/src/icons/svg/nested.svg +++ b/src/icons/svg/nested.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/icons/svg/password.svg b/src/icons/svg/password.svg index 920b500b..e291d85d 100644 --- a/src/icons/svg/password.svg +++ b/src/icons/svg/password.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/icons/svg/people.svg b/src/icons/svg/people.svg index 3985ab51..2bd54aeb 100644 --- a/src/icons/svg/people.svg +++ b/src/icons/svg/people.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/icons/svg/peoples.svg b/src/icons/svg/peoples.svg index 2dccfcc0..2c911615 100644 --- a/src/icons/svg/peoples.svg +++ b/src/icons/svg/peoples.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/icons/svg/qq.svg b/src/icons/svg/qq.svg index 97aee717..ee13d4ec 100644 --- a/src/icons/svg/qq.svg +++ b/src/icons/svg/qq.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/icons/svg/shopping.svg b/src/icons/svg/shopping.svg new file mode 100644 index 00000000..87513e7c --- /dev/null +++ b/src/icons/svg/shopping.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/shoppingCard.svg b/src/icons/svg/shoppingCard.svg deleted file mode 100644 index cdebbdb4..00000000 --- a/src/icons/svg/shoppingCard.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/size.svg b/src/icons/svg/size.svg index def290f7..ddb25b8d 100644 --- a/src/icons/svg/size.svg +++ b/src/icons/svg/size.svg @@ -1,2 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/icons/svg/star.svg b/src/icons/svg/star.svg index 685a301d..6cf86e66 100644 --- a/src/icons/svg/star.svg +++ b/src/icons/svg/star.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/icons/svg/tab.svg b/src/icons/svg/tab.svg index 17aa088b..b4b48e48 100644 --- a/src/icons/svg/tab.svg +++ b/src/icons/svg/tab.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/icons/svg/table.svg b/src/icons/svg/table.svg index 083bc8cc..dbfe5d64 100644 --- a/src/icons/svg/table.svg +++ b/src/icons/svg/table.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/icons/svg/theme.svg b/src/icons/svg/theme.svg index d5c2e5ad..5982a2f7 100644 --- a/src/icons/svg/theme.svg +++ b/src/icons/svg/theme.svg @@ -1 +1 @@ - + \ No newline at end of file diff --git a/src/icons/svg/tree.svg b/src/icons/svg/tree.svg new file mode 100644 index 00000000..dd4b7dd2 --- /dev/null +++ b/src/icons/svg/tree.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/user.svg b/src/icons/svg/user.svg index 5971deeb..0ba0716a 100644 --- a/src/icons/svg/user.svg +++ b/src/icons/svg/user.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/icons/svg/wechat.svg b/src/icons/svg/wechat.svg index d88a64bc..9e18b717 100644 --- a/src/icons/svg/wechat.svg +++ b/src/icons/svg/wechat.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/icons/svg/zip.svg b/src/icons/svg/zip.svg index e9a9d012..f806fc48 100644 --- a/src/icons/svg/zip.svg +++ b/src/icons/svg/zip.svg @@ -1 +1 @@ - + \ No newline at end of file diff --git a/src/icons/svgo.yml b/src/icons/svgo.yml new file mode 100644 index 00000000..d11906ae --- /dev/null +++ b/src/icons/svgo.yml @@ -0,0 +1,22 @@ +# replace default config + +# multipass: true +# full: true + +plugins: + + # - name + # + # or: + # - name: false + # - name: true + # + # or: + # - name: + # param1: 1 + # param2: 2 + +- removeAttrs: + attrs: + - 'fill' + - 'fill-rule' diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index ce1aafa6..97de701e 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -7,7 +7,7 @@ import { asyncRouterMap, constantRouterMap } from '@/router' */ function hasPermission(roles, route) { if (route.meta && route.meta.roles) { - return roles.some(role => route.meta.roles.indexOf(role) >= 0) + return roles.some(role => route.meta.roles.includes(role)) } else { return true } @@ -15,20 +15,23 @@ function hasPermission(roles, route) { /** * 递归过滤异步路由表,返回符合用户角色权限的路由表 - * @param asyncRouterMap + * @param routes asyncRouterMap * @param roles */ -function filterAsyncRouter(asyncRouterMap, roles) { - const accessedRouters = asyncRouterMap.filter(route => { - if (hasPermission(roles, route)) { - if (route.children && route.children.length) { - route.children = filterAsyncRouter(route.children, roles) +function filterAsyncRouter(routes, roles) { + const res = [] + + routes.forEach(route => { + const tmp = { ...route } + if (hasPermission(roles, tmp)) { + if (tmp.children) { + tmp.children = filterAsyncRouter(tmp.children, roles) } - return true + res.push(tmp) } - return false }) - return accessedRouters + + return res } const permission = { @@ -47,7 +50,7 @@ const permission = { return new Promise(resolve => { const { roles } = data let accessedRouters - if (roles.indexOf('admin') >= 0) { + if (roles.includes('admin')) { accessedRouters = asyncRouterMap } else { accessedRouters = filterAsyncRouter(asyncRouterMap, roles) diff --git a/src/store/modules/tagsView.js b/src/store/modules/tagsView.js index f2faeb12..cbf9eeb7 100644 --- a/src/store/modules/tagsView.js +++ b/src/store/modules/tagsView.js @@ -60,6 +60,15 @@ const tagsView = { }, DEL_ALL_CACHED_VIEWS: state => { state.cachedViews = [] + }, + + UPDATE_VISITED_VIEW: (state, view) => { + for (let v of state.visitedViews) { + if (v.path === view.path) { + v = Object.assign(v, view) + break + } + } } }, @@ -142,6 +151,10 @@ const tagsView = { commit('DEL_ALL_CACHED_VIEWS') resolve([...state.cachedViews]) }) + }, + + updateVisitedView({ commit }, view) { + commit('UPDATE_VISITED_VIEW', view) } } } diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 13e76399..0f7e2296 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -122,7 +122,7 @@ const user = { }, // 动态修改权限 - ChangeRoles({ commit }, role) { + ChangeRoles({ commit, dispatch }, role) { return new Promise(resolve => { commit('SET_TOKEN', role) setToken(role) @@ -132,6 +132,7 @@ const user = { commit('SET_NAME', data.name) commit('SET_AVATAR', data.avatar) commit('SET_INTRODUCTION', data.introduction) + dispatch('GenerateRoutes', data) // 动态修改权限后 重绘侧边菜单 resolve() }) }) diff --git a/src/styles/sidebar.scss b/src/styles/sidebar.scss index fd922526..faa7366e 100644 --- a/src/styles/sidebar.scss +++ b/src/styles/sidebar.scss @@ -47,6 +47,9 @@ height: 100%; width: 100% !important; } + .is-active > .el-submenu__title{ + color: #f4f4f5!important; + } } .hideSidebar { .sidebar-container { @@ -120,3 +123,11 @@ } } } + +.el-menu--vertical{ + & >.el-menu{ + .svg-icon{ + margin-right: 16px; + } + } +} diff --git a/src/utils/i18n.js b/src/utils/i18n.js index 0cb5e253..76be5a4e 100644 --- a/src/utils/i18n.js +++ b/src/utils/i18n.js @@ -1,9 +1,11 @@ // translate router.meta.title, be used in breadcrumb sidebar tagsview export function generateTitle(title) { const hasKey = this.$te('route.' + title) - const translatedTitle = this.$t('route.' + title) // $t :this method from vue-i18n, inject in @/lang/index.js if (hasKey) { + // $t :this method from vue-i18n, inject in @/lang/index.js + const translatedTitle = this.$t('route.' + title) + return translatedTitle } return title diff --git a/src/vendor/Blob.js b/src/vendor/Blob.js deleted file mode 100644 index 5e426dc2..00000000 --- a/src/vendor/Blob.js +++ /dev/null @@ -1,176 +0,0 @@ -/* eslint-disable */ -/* Blob.js - * A Blob implementation. - * 2014-05-27 - * - * By Eli Grey, http://eligrey.com - * By Devin Samarin, https://github.com/eboyjr - * License: X11/MIT - * See LICENSE.md - */ - -/*global self, unescape */ -/*jslint bitwise: true, regexp: true, confusion: true, es5: true, vars: true, white: true, - plusplus: true */ - -/*! @source http://purl.eligrey.com/github/Blob.js/blob/master/Blob.js */ - -(function (view) { - "use strict"; - - view.URL = view.URL || view.webkitURL; - - if (view.Blob && view.URL) { - try { - new Blob; - return; - } catch (e) {} - } - - // Internally we use a BlobBuilder implementation to base Blob off of - // in order to support older browsers that only have BlobBuilder - var BlobBuilder = view.BlobBuilder || view.WebKitBlobBuilder || view.MozBlobBuilder || (function (view) { - var - get_class = function (object) { - return Object.prototype.toString.call(object).match(/^\[object\s(.*)\]$/)[1]; - }, - FakeBlobBuilder = function BlobBuilder() { - this.data = []; - }, - FakeBlob = function Blob(data, type, encoding) { - this.data = data; - this.size = data.length; - this.type = type; - this.encoding = encoding; - }, - FBB_proto = FakeBlobBuilder.prototype, - FB_proto = FakeBlob.prototype, - FileReaderSync = view.FileReaderSync, - FileException = function (type) { - this.code = this[this.name = type]; - }, - file_ex_codes = ( - "NOT_FOUND_ERR SECURITY_ERR ABORT_ERR NOT_READABLE_ERR ENCODING_ERR " + - "NO_MODIFICATION_ALLOWED_ERR INVALID_STATE_ERR SYNTAX_ERR" - ).split(" "), - file_ex_code = file_ex_codes.length, - real_URL = view.URL || view.webkitURL || view, - real_create_object_URL = real_URL.createObjectURL, - real_revoke_object_URL = real_URL.revokeObjectURL, - URL = real_URL, - btoa = view.btoa, - atob = view.atob - - , - ArrayBuffer = view.ArrayBuffer, - Uint8Array = view.Uint8Array; - FakeBlob.fake = FB_proto.fake = true; - while (file_ex_code--) { - FileException.prototype[file_ex_codes[file_ex_code]] = file_ex_code + 1; - } - if (!real_URL.createObjectURL) { - URL = view.URL = {}; - } - URL.createObjectURL = function (blob) { - var - type = blob.type, - data_URI_header; - if (type === null) { - type = "application/octet-stream"; - } - if (blob instanceof FakeBlob) { - data_URI_header = "data:" + type; - if (blob.encoding === "base64") { - return data_URI_header + ";base64," + blob.data; - } else if (blob.encoding === "URI") { - return data_URI_header + "," + decodeURIComponent(blob.data); - } - if (btoa) { - return data_URI_header + ";base64," + btoa(blob.data); - } else { - return data_URI_header + "," + encodeURIComponent(blob.data); - } - } else if (real_create_object_URL) { - return real_create_object_URL.call(real_URL, blob); - } - }; - URL.revokeObjectURL = function (object_URL) { - if (object_URL.substring(0, 5) !== "data:" && real_revoke_object_URL) { - real_revoke_object_URL.call(real_URL, object_URL); - } - }; - FBB_proto.append = function (data /*, endings*/ ) { - var bb = this.data; - // decode data to a binary string - if (Uint8Array && (data instanceof ArrayBuffer || data instanceof Uint8Array)) { - var - str = "", - buf = new Uint8Array(data), - i = 0, - buf_len = buf.length; - for (; i < buf_len; i++) { - str += String.fromCharCode(buf[i]); - } - bb.push(str); - } else if (get_class(data) === "Blob" || get_class(data) === "File") { - if (FileReaderSync) { - var fr = new FileReaderSync; - bb.push(fr.readAsBinaryString(data)); - } else { - // async FileReader won't work as BlobBuilder is sync - throw new FileException("NOT_READABLE_ERR"); - } - } else if (data instanceof FakeBlob) { - if (data.encoding === "base64" && atob) { - bb.push(atob(data.data)); - } else if (data.encoding === "URI") { - bb.push(decodeURIComponent(data.data)); - } else if (data.encoding === "raw") { - bb.push(data.data); - } - } else { - if (typeof data !== "string") { - data += ""; // convert unsupported types to strings - } - // decode UTF-16 to binary string - bb.push(unescape(encodeURIComponent(data))); - } - }; - FBB_proto.getBlob = function (type) { - if (!arguments.length) { - type = null; - } - return new FakeBlob(this.data.join(""), type, "raw"); - }; - FBB_proto.toString = function () { - return "[object BlobBuilder]"; - }; - FB_proto.slice = function (start, end, type) { - var args = arguments.length; - if (args < 3) { - type = null; - } - return new FakeBlob( - this.data.slice(start, args > 1 ? end : this.data.length), type, this.encoding - ); - }; - FB_proto.toString = function () { - return "[object Blob]"; - }; - FB_proto.close = function () { - this.size = this.data.length = 0; - }; - return FakeBlobBuilder; - }(view)); - - view.Blob = function Blob(blobParts, options) { - var type = options ? (options.type || "") : ""; - var builder = new BlobBuilder(); - if (blobParts) { - for (var i = 0, len = blobParts.length; i < len; i++) { - builder.append(blobParts[i]); - } - } - return builder.getBlob(type); - }; -}(typeof self !== "undefined" && self || typeof window !== "undefined" && window || this.content || this)); diff --git a/src/vendor/Export2Excel.js b/src/vendor/Export2Excel.js index 75f33ae1..ba956dc1 100644 --- a/src/vendor/Export2Excel.js +++ b/src/vendor/Export2Excel.js @@ -1,6 +1,5 @@ /* eslint-disable */ require('script-loader!file-saver'); -require('script-loader!@/vendor/Blob'); import XLSX from 'xlsx' function generateArray(table) { @@ -149,7 +148,8 @@ export function export_json_to_excel({ header, data, filename, - autoWidth = true + autoWidth = true, + bookType= 'xlsx' } = {}) { /* original data */ filename = filename || 'excel-list' @@ -196,11 +196,11 @@ export function export_json_to_excel({ wb.Sheets[ws_name] = ws; var wbout = XLSX.write(wb, { - bookType: 'xlsx', + bookType: bookType, bookSST: false, type: 'binary' }); saveAs(new Blob([s2ab(wbout)], { type: "application/octet-stream" - }), filename + ".xlsx"); + }), `${filename}.${bookType}`); } diff --git a/src/views/dashboard/admin/components/PanelGroup.vue b/src/views/dashboard/admin/components/PanelGroup.vue index 2d1d58c9..8125b846 100644 --- a/src/views/dashboard/admin/components/PanelGroup.vue +++ b/src/views/dashboard/admin/components/PanelGroup.vue @@ -35,8 +35,8 @@
-
- +
+
Shoppings
@@ -91,7 +91,7 @@ export default { .icon-money { background: #f4516c; } - .icon-shoppingCard { + .icon-shopping { background: #34bfa3 } } @@ -104,7 +104,7 @@ export default { .icon-money { color: #f4516c; } - .icon-shoppingCard { + .icon-shopping { color: #34bfa3 } .card-panel-icon-wrapper { diff --git a/src/views/example/components/ArticleDetail.vue b/src/views/example/components/ArticleDetail.vue index c7ec1eb0..4e3dca2c 100644 --- a/src/views/example/components/ArticleDetail.vue +++ b/src/views/example/components/ArticleDetail.vue @@ -149,6 +149,9 @@ export default { computed: { contentShortLength() { return this.postForm.content_short.length + }, + lang() { + return this.$store.getters.language } }, created() { @@ -166,10 +169,18 @@ export default { // Just for test this.postForm.title += ` Article Id:${this.postForm.id}` this.postForm.content_short += ` Article Id:${this.postForm.id}` + + // Set tagsview title + this.setTagsViewTitle() }).catch(err => { console.log(err) }) }, + setTagsViewTitle() { + const title = this.lang === 'zh' ? '编辑文章' : 'Edit Article' + const route = Object.assign({}, this.$route, { title: `${title}-${this.postForm.id}` }) + this.$store.dispatch('updateVisitedView', route) + }, submitForm() { this.postForm.display_time = parseInt(this.display_time / 1000) console.log(this.postForm) diff --git a/src/views/example/list.vue b/src/views/example/list.vue index f44d7078..4ab61d38 100644 --- a/src/views/example/list.vue +++ b/src/views/example/list.vue @@ -1,7 +1,7 @@