feat: add function of async router and async menu; 🌟

新增:异步路由和菜单功能;
This commit is contained in:
iczer 2020-07-29 11:08:01 +08:00
parent a4764d880d
commit bfb0358217
36 changed files with 614 additions and 450 deletions

5
.env Normal file
View File

@ -0,0 +1,5 @@
VUE_APP_NAME=admin
VUE_APP_ROUTES_KEY=admin.routes
VUE_APP_PERMISSIONS_KEY=admin.permissions
VUE_APP_ROLES_KEY=admin.roles
VUE_APP_USER_KEY=admin.user

5
.env.development Normal file
View File

@ -0,0 +1,5 @@
VUE_APP_NAME=admin
VUE_APP_ROUTES_KEY=admin.routes
VUE_APP_PERMISSIONS_KEY=admin.permissions
VUE_APP_ROLES_KEY=admin.roles
VUE_APP_USER_KEY=admin.user

View File

@ -24,7 +24,6 @@
"enquire.js": "^2.1.6",
"js-cookie": "^2.2.1",
"mockjs": "^1.1.0",
"pouchdb": "^7.2.1",
"viser-vue": "^2.4.8",
"vue": "^2.6.11",
"vue-i18n": "^8.18.2",

18
src/bootstrap.js vendored Normal file
View File

@ -0,0 +1,18 @@
import {loadRoutes, loginGuard, authorityGuard} from '@/utils/routerUtil'
/**
* 启动引导方法
* 应用启动时需要执行的操作放在这里
* @param router 应用的路由实例
* @param store 应用的 vuex.store 实例
* @param i18n 应用的 vue-i18n 实例
*/
function bootstrap({router, store, i18n}) {
// 加载路由
loadRoutes({router, store, i18n})
// 添加路由守卫
loginGuard(router)
authorityGuard(router, store)
}
export default bootstrap

View File

@ -7,7 +7,7 @@
<h1>{{config[type].title}}</h1>
<div class="desc">{{config[type].desc}}</div>
<div class="action">
<a-button type="primary" >返回首页</a-button>
<a-button type="primary" @click="backHome">返回首页</a-button>
</div>
</div>
</div>
@ -18,11 +18,19 @@ import Config from './typeConfig'
export default {
name: 'ExceptionPage',
props: ['type'],
props: ['type', 'homeRoute'],
data () {
return {
config: Config
}
},
methods: {
backHome() {
if (this.homeRoute) {
this.$router.push(this.homeRoute)
}
this.$emit('backHome', this.type)
}
}
}
</script>

View File

@ -16,6 +16,7 @@ module.exports = {
hideSetting: false, //隐藏设置抽屉true:隐藏false:不隐藏
systemName: 'Vue Antd Admin', //系统名称
copyright: '2018 ICZER 工作室出品', //copyright
asyncRoutes: false, //异步加载路由true:开启false:不开启
animate: { //动画设置
disabled: false, //禁用动画true:禁用false:启用
name: 'bounce', //动画效果,支持的动画效果可参考 ./animate.config.js

View File

@ -35,8 +35,6 @@ import {mapState, mapMutations} from 'vuex'
const minHeight = window.innerHeight - 64 - 24 - 122
let menuData = []
export default {
name: 'AdminLayout',
components: {Setting, SideMenu, Drawer, PageFooter, AdminHeader},
@ -44,12 +42,12 @@ export default {
return {
minHeight: minHeight,
collapsed: false,
menuData: menuData,
showSetting: false
}
},
computed: {
...mapState('setting', ['isMobile', 'theme', 'layout', 'footerLinks', 'copyright', 'fixedHeader', 'fixedSideBar', 'hideSetting', 'pageMinHeight']),
...mapState('setting', ['isMobile', 'theme', 'layout', 'footerLinks', 'copyright', 'fixedHeader', 'fixedSideBar',
'hideSetting', 'menuData']),
sideMenuWidth() {
return this.collapsed ? '80px' : '256px'
},
@ -74,9 +72,6 @@ export default {
},
beforeDestroy() {
this.correctPageMinHeight(-minHeight + 1)
},
beforeCreate () {
menuData = this.$router.options.routes.find((item) => item.path === '/').children
}
}
</script>

View File

@ -25,13 +25,13 @@
</template>
<script>
import {mapState} from 'vuex'
import {mapGetters} from 'vuex'
import {logout} from '@/services'
export default {
name: 'HeaderAvatar',
computed: {
...mapState('account', ['user']),
...mapGetters('account', ['user']),
},
methods: {
logout() {

View File

@ -0,0 +1,2 @@
import TabsView from './TabsView'
export default TabsView

View File

@ -1,6 +1,6 @@
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import {initRouter} from './router'
import './theme/index.less'
import Antd from 'ant-design-vue'
import Viser from 'viser-vue'
@ -9,14 +9,17 @@ import store from './store'
import 'animate.css/source/animate.css'
import Plugins from '@/plugins'
import {initI18n} from '@/utils/i18n'
import bootstrap from '@/bootstrap'
const router = initRouter(store.state.setting.asyncRoutes)
const i18n = initI18n('CN', 'US')
bootstrap({router, store, i18n})
Vue.config.productionTip = false
Vue.use(Viser)
Vue.use(Antd)
Vue.use(Plugins)
const i18n = initI18n(router, 'CN', 'US')
new Vue({
router,
store,

View File

@ -3,6 +3,7 @@ import '@/mock/user/current'
import '@/mock/project'
import '@/mock/user/login'
import '@/mock/workplace'
import '@/mock/user/routes'
// 设置全局延时
Mock.setup({

View File

@ -22,6 +22,8 @@ Mock.mock('/login', 'post', ({body}) => {
result.data.user = user
result.data.token = 'Authorization:' + Math.random()
result.data.expireAt = new Date(new Date().getTime() + 30 * 60 * 1000)
result.data.permissions = [{id: 'analysis', extra: ['add', 'edit', 'delete']}]
result.data.roles = [{id: 'admin', extra: ['add', 'edit', 'delete']}]
}
return result
})

26
src/mock/user/routes.js Normal file
View File

@ -0,0 +1,26 @@
import Mock from 'mockjs'
Mock.mock('/routes', 'get', () => {
let result = {}
result.code = 0
result.data = [{
router: 'root',
children: [
{
router: 'dashboard',
children: ['workplace', 'analysis'],
},
{
router: 'form',
children: ['basicForm', 'stepForm', 'advanceForm']
},
{
router: 'basicForm',
name: '验权表单',
icon: 'file-excel',
authority: 'form'
}
]
}]
return result
})

View File

@ -0,0 +1,2 @@
import Analysis from './Analysis'
export default Analysis

View File

@ -0,0 +1,2 @@
import WorkPlace from './WorkPlace'
export default WorkPlace

View File

@ -1,5 +1,5 @@
<template>
<exception-page :style="`min-height: ${pageMinHeight}px`" type="403" />
<exception-page home-route="/dashboard/workplace" :style="`min-height: ${minHeight}`" type="403" />
</template>
<script>
@ -9,7 +9,10 @@ export default {
name: 'Exp403',
components: {ExceptionPage},
computed: {
...mapState('setting', ['pageMinHeight'])
...mapState('setting', ['pageMinHeight']),
minHeight() {
return this.pageMinHeight ? this.pageMinHeight + 'px' : '100vh'
}
}
}
</script>

View File

@ -1,5 +1,5 @@
<template>
<exception-page :style="`min-height: ${minHeight}`" type="404" />
<exception-page home-route="/dashboard/workplace" :style="`min-height: ${minHeight}`" type="404" />
</template>
<script>

View File

@ -1,5 +1,5 @@
<template>
<exception-page :style="`min-height: ${pageMinHeight}px`" type="500" />
<exception-page home-route="/dashboard/workplace" :style="`min-height: ${minHeight}`" type="500" />
</template>
<script>
@ -9,7 +9,10 @@ export default {
name: 'Exp500',
components: {ExceptionPage},
computed: {
...mapState('setting', ['pageMinHeight'])
...mapState('setting', ['pageMinHeight']),
minHeight() {
return this.pageMinHeight ? this.pageMinHeight + 'px' : '100vh'
}
}
}
</script>

View File

@ -0,0 +1,2 @@
import AdvancedForm from '@/pages/form/advance/AdvancedForm'
export default AdvancedForm

View File

@ -0,0 +1,2 @@
import BasicForm from './BasicForm'
export default BasicForm

View File

@ -0,0 +1,2 @@
import StepForm from './StepForm'
export default StepForm

View File

@ -75,8 +75,10 @@
<script>
import CommonLayout from '@/layouts/CommonLayout'
import {login} from '@/services'
import {login, getRoutesConfig} from '@/services'
import {setAuthorization} from '@/utils/request'
import {loadRoutes} from '@/utils/routerUtil'
import {mapMutations} from 'vuex'
export default {
name: 'Login',
@ -94,6 +96,7 @@ export default {
}
},
methods: {
...mapMutations('account', ['setUser', 'setPermissions', 'setRoles']),
onSubmit (e) {
e.preventDefault()
this.form.validateFields((err) => {
@ -107,15 +110,24 @@ export default {
},
afterLogin(res) {
this.logging = false
const result = res.data
if (result.code >= 0) {
const user = result.data.user
setAuthorization({token: result.data.token, expireAt: new Date(result.data.expireAt)})
this.$router.push('/dashboard/workplace')
this.$store.commit('account/setUser', user)
this.$message.success(result.message, 3)
const loginRes = res.data
if (loginRes.code >= 0) {
const user = loginRes.data.user
const permissions = loginRes.data.permissions
const roles = loginRes.data.roles
this.setUser(user)
this.setPermissions(permissions)
this.setRoles(roles)
setAuthorization({token: loginRes.data.token, expireAt: new Date(loginRes.data.expireAt)})
//
getRoutesConfig().then(result => {
const routesConfig = result.data.data
loadRoutes({router: this.$router, store: this.$store, i18n: this.$i18n}, routesConfig)
this.$router.push('/dashboard/workplace')
this.$message.success(loginRes.message, 3)
})
} else {
this.error = result.message
this.error = loginRes.message
}
}
}

2
src/pages/login/index.js Normal file
View File

@ -0,0 +1,2 @@
import Login from './Login'
export default Login

View File

@ -0,0 +1,24 @@
import routerMap from './router.map'
import {parseRoutes} from '@/utils/routerUtil'
// 异步路由配置
const routesConfig = [
'login',
'root',
{
router: 'exp404',
path: '*',
name: '404'
},
{
router: 'exp403',
path: '/403',
name: '403'
}
]
const options = {
routes: parseRoutes(routesConfig, routerMap)
}
export default options

View File

@ -1,20 +1,25 @@
import Login from '@/pages/login/Login'
import TabsView from '@/layouts/tabs/TabsView'
import BlankView from '@/layouts/BlankView'
import PageView from '@/layouts/PageView'
// 路由配置
const options = {
routes: [
{
path: '/login',
name: '登录页',
component: Login
component: () => import('@/pages/login')
},
{
path: '*',
name: '404',
component: () => import('@/pages/exception/404'),
},
{
path: '/403',
name: '403',
component: () => import('@/pages/exception/403'),
},
{
path: '/',
name: '首页',
@ -32,12 +37,12 @@ const options = {
{
path: 'workplace',
name: '工作台',
component: () => import('@/pages/dashboard/workplace/WorkPlace'),
component: () => import('@/pages/dashboard/workplace'),
},
{
path: 'analysis',
name: '分析页',
component: () => import('@/pages/dashboard/analysis/Analysis'),
component: () => import('@/pages/dashboard/analysis'),
}
]
},
@ -52,17 +57,17 @@ const options = {
{
path: 'basic',
name: '基础表单',
component: () => import('@/pages/form/basic/BasicForm'),
component: () => import('@/pages/form/basic'),
},
{
path: 'step',
name: '分步表单',
component: () => import('@/pages/form/step/StepForm'),
component: () => import('@/pages/form/step'),
},
{
path: 'advance',
name: '高级表单',
component: () => import('@/pages/form/advance/AdvancedForm'),
component: () => import('@/pages/form/advance'),
}
]
},
@ -197,24 +202,21 @@ const options = {
component: () => import('@/pages/components/Palette')
}
]
},
{
name: '验权表单',
path: 'auth/form',
meta: {
icon: 'file-excel',
authority: {
permission: 'form'
}
},
component: () => import('@/pages/form/basic')
}
]
}
},
]
}
// 不需要登录拦截的路由配置
const loginIgnore = {
names: ['404'], //根据路由名称匹配
paths: ['/login'], //根据路由fullPath匹配
/**
* 判断路由是否包含在该配置中
* @param route vue-router route 对象
* @returns {boolean}
*/
includes(route) {
return this.names.includes(route.name) || this.paths.includes(route.path)
}
}
export {options, loginIgnore}
export default options

View File

@ -1,19 +1,29 @@
import Vue from 'vue'
import Router from 'vue-router'
import {checkAuthorization} from '@/utils/request'
import {options, loginIgnore} from './config'
Vue.use(Router)
const router = new Router(options)
// 登录拦截
router.beforeEach((to, from, next) => {
if (!loginIgnore.includes(to) && !checkAuthorization()) {
next({path: '/login'})
} else {
next()
// 不需要登录拦截的路由配置
const loginIgnore = {
names: ['404'], //根据路由名称匹配
paths: ['/login'], //根据路由fullPath匹配
/**
* 判断路由是否包含在该配置中
* @param route vue-router route 对象
* @returns {boolean}
*/
includes(route) {
return this.names.includes(route.name) || this.paths.includes(route.path)
}
})
}
export default router
/**
* 初始化路由实例
* @param isAsync 是否异步路由模式
* @returns {VueRouter}
*/
function initRouter(isAsync) {
const options = isAsync ? require('./config.async').default : require('./config').default
return new Router(options)
}
export {loginIgnore, initRouter}

154
src/router/router.map.js Normal file
View File

@ -0,0 +1,154 @@
// 视图组件
const view = {
tabs: () => import('@/layouts/tabs'),
blank: () => import('@/layouts/BlankView'),
page: () => import('@/layouts/PageView')
}
// 路由组件注册
const routerMap = {
login: {
authority: '*',
path: '/login',
component: () => import('@/pages/login')
},
root: {
path: '/',
name: '首页',
redirect: '/login',
component: view.tabs
},
dashboard: {
name: 'Dashboard',
component: view.blank
},
workplace: {
name: '工作台',
component: () => import('@/pages/dashboard/workplace')
},
analysis: {
name: '分析页',
component: () => import('@/pages/dashboard/analysis')
},
form: {
name: '表单页',
icon: 'form',
component: view.page
},
basicForm: {
path: 'basic',
name: '基础表单',
component: () => import('@/pages/form/basic')
},
stepForm: {
path: 'step',
name: '分步表单',
component: () => import('@/pages/form/step')
},
advanceForm: {
path: 'advance',
name: '高级表单',
component: () => import('@/pages/form/advance')
},
list: {
name: '列表页',
icon: 'table',
component: view.page
},
queryList: {
path: 'query',
name: '查询表格',
component: () => import('@/pages/list/QueryList')
},
primaryList: {
path: 'primary',
name: '标准列表',
component: () => import('@/pages/list/StandardList')
},
cardList: {
path: 'card',
name: '卡片列表',
component: () => import('@/pages/list/CardList')
},
searchList: {
path: 'search',
name: '搜索列表',
component: () => import('@/pages/list/search/SearchLayout')
},
article: {
name: '文章',
component: () => import('@/pages/list/search/ArticleList')
},
application: {
name: '应用',
component: () => import('@/pages/list/search/ApplicationList')
},
project: {
name: '项目',
component: () => import('@/pages/list/search/ProjectList')
},
details: {
name: '详情页',
icon: 'profile',
component: view.blank
},
basicDetails: {
path: 'basic',
name: '基础详情页',
component: () => import('@/pages/detail/BasicDetail')
},
advanceDetails: {
path: 'advance',
name: '高级详情页',
component: () => import('@/pages/detail/AdvancedDetail')
},
result: {
name: '结果页',
icon: 'check-circle-o',
component: view.page
},
success: {
name: '成功',
component: () => import('@/pages/result/Success')
},
error: {
name: '失败',
component: () => import('@/pages/result/Error')
},
exception: {
name: '异常页',
icon: 'warning',
component: view.blank
},
exp403: {
authority: '*',
name: 'exp403',
path: '403',
component: () => import('@/pages/exception/403')
},
exp404: {
name: 'exp404',
path: '404',
component: () => import('@/pages/exception/404')
},
exp500: {
name: 'exp500',
path: '500',
component: () => import('@/pages/exception/500')
},
components: {
name: '小组件',
icon: 'appstore-o',
component: view.page
},
taskCard: {
name: '任务卡片',
component: () => import('@/pages/components/TaskCard')
},
palette: {
name: '颜色复选框',
component: () => import('@/pages/components/Palette')
}
}
export default routerMap

View File

@ -1,5 +1,6 @@
// const BASE_URL = 'http://localhost:8080' your service base url
const BASE_URL = '' // mock base url
module.exports = {
LOGIN: `${BASE_URL}/login`
LOGIN: `${BASE_URL}/login`,
ROUTES: `${BASE_URL}/routes`
}

View File

@ -1,6 +1,7 @@
import {login, logout} from './user'
import {login, logout, getRoutesConfig} from './user'
export {
login,
logout
logout,
getRoutesConfig
}

View File

@ -1,4 +1,4 @@
import {LOGIN} from '@/services/api'
import {LOGIN, ROUTES} from '@/services/api'
import {request, METHOD, removeAuthorization} from '@/utils/request'
/**
@ -14,11 +14,18 @@ async function login(name, password) {
})
}
async function getRoutesConfig() {
return request(ROUTES, METHOD.GET)
}
/**
* 退出登录
*/
function logout() {
localStorage.removeItem(process.env.VUE_APP_ROUTES_KEY)
localStorage.removeItem(process.env.VUE_APP_PERMISSIONS_KEY)
localStorage.removeItem(process.env.VUE_APP_ROLES_KEY)
removeAuthorization()
}
export {login, logout}
export {login, logout, getRoutesConfig}

View File

@ -1,16 +1,8 @@
import Vue from 'vue'
import Vuex from 'vuex'
import modules from './modules'
import PouchDB from 'pouchdb'
const db = new PouchDB('adminDb')
Vue.use(Vuex)
const store = new Vuex.Store({modules})
// 读取用户信息
db.get('currUser')
.then(doc => store.commit('account/setUser', doc.user))
.catch(() => {})
export default store

View File

@ -1,36 +1,73 @@
import PouchDB from 'pouchdb'
let db = new PouchDB('adminDb')
export default {
namespaced: true,
state: {
user: {
name: '',
avatar: '',
position: '',
address: ''
user: undefined,
permissions: [],
roles: [],
routesConfig: []
},
getters: {
user: state => {
if (!state.user) {
try {
const user = localStorage.getItem(process.env.VUE_APP_USER_KEY)
state.user = JSON.parse(user)
} catch (e) {
console.error(e)
}
}
return state.user
},
permissions: state => {
if (!state.permissions || state.permissions.length === 0) {
try {
const permissions = localStorage.getItem(process.env.VUE_APP_PERMISSIONS_KEY)
state.permissions = JSON.parse(permissions)
} catch (e) {
console.error(e.message)
}
}
return state.permissions
},
roles: state => {
if (!state.roles || state.roles.length === 0) {
try {
const roles = localStorage.getItem(process.env.VUE_APP_ROLES_KEY)
state.roles = JSON.parse(roles)
} catch (e) {
console.error(e.message)
}
}
return state.roles
},
routesConfig: state => {
if (!state.routesConfig || state.routesConfig.length === 0) {
try {
const routesConfig = localStorage.getItem(process.env.VUE_APP_ROUTES_KEY)
state.routesConfig = eval(routesConfig) ? JSON.parse(routesConfig) : state.routesConfig
} catch (e) {
console.error(e.message)
}
}
return state.routesConfig
}
},
mutations: {
setUser (state, user) {
state.user = user
db.get('currUser').then(doc => {
db.put({
_id: 'currUser',
_rev: doc._rev,
user: user
})
}).catch(e => {
if (e.status === 404) {
db.put({
_id: 'currUser',
user: user
})
} else {
throw e
}
})
localStorage.setItem(process.env.VUE_APP_USER_KEY, JSON.stringify(user))
},
setPermissions(state, permissions) {
state.permissions = permissions
localStorage.setItem(process.env.VUE_APP_PERMISSIONS_KEY, JSON.stringify(permissions))
},
setRoles(state, roles) {
state.roles = roles
localStorage.setItem(process.env.VUE_APP_ROLES_KEY, JSON.stringify(roles))
},
setRoutesConfig(state, routesConfig) {
state.routesConfig = routesConfig
localStorage.setItem(process.env.VUE_APP_ROUTES_KEY, JSON.stringify(routesConfig))
}
}
}

View File

@ -8,6 +8,7 @@ export default {
palettes: ADMIN.palettes,
dustbins: [],
pageMinHeight: 0,
menuData: [],
...config,
},
mutations: {
@ -46,6 +47,12 @@ export default {
},
correctPageMinHeight(state, minHeight) {
state.pageMinHeight += minHeight
},
setMenuData(state, menuData) {
state.menuData = menuData
},
setAsyncRoutes(state, asyncRoutes) {
state.asyncRoutes = asyncRoutes
}
}
}

View File

@ -5,28 +5,19 @@ import './Objects'
/**
* 创建 i18n 配置
* @param router 路由
* @param locale 本地化语言
* @param fallback 回退语言
* @returns {VueI18n}
*/
function initI18n(router, locale, fallback) {
function initI18n(locale, fallback) {
Vue.use(VueI18n)
const options = router.options.routes.find(item => item.path === '/').children
formatOptions(options, '')
const CN = generateI18n(new Object(), options, 'name')
const US = generateI18n(new Object(), options, 'path')
const i18n = new VueI18n({
let i18nOptions = {
locale,
fallbackLocale: fallback,
silentFallbackWarn: true,
messages: {CN, US}
})
const messages = routesI18n.messages
Object.keys(messages).forEach(key => {
i18n.mergeLocaleMessage(key, messages[key])
})
return i18n
messages: routesI18n.messages
}
return new VueI18n(i18nOptions)
}
/**
@ -62,6 +53,15 @@ function formatOptions(options, parentPath) {
})
}
function mergeI18nFromRoutes(i18n, routes) {
formatOptions(routes, '')
const CN = generateI18n(new Object(), routes, 'name')
const US = generateI18n(new Object(), routes, 'path')
i18n.mergeLocaleMessage('CN', CN)
i18n.mergeLocaleMessage('US', US)
}
export {
initI18n
}
initI18n,
mergeI18nFromRoutes
}

157
src/utils/routerUtil.js Normal file
View File

@ -0,0 +1,157 @@
import routerMap from '@/router/router.map'
import {mergeI18nFromRoutes} from '@/utils/i18n'
import Router from 'vue-router'
import {loginIgnore} from '@/router'
import {checkAuthorization} from '@/utils/request'
/**
* 根据 路由配置 路由组件注册 解析路由
* @param routesConfig 路由配置
* @param routerMap 本地路由组件注册配置
*/
function parseRoutes(routesConfig, routerMap) {
let routes = []
routesConfig.forEach(item => {
// 获取注册在 routerMap 中的 router初始化 routeCfg
let router = undefined, routeCfg = {}
if (typeof item === 'string') {
router = routerMap[item]
routeCfg = {path: router.path || item, router: item}
} else if (typeof item === 'object') {
router = routerMap[item.router]
routeCfg = item
}
// 从 router 和 routeCfg 解析路由
if (!router) {
console.warn(`can't find register for router ${routeCfg.router}, please register it in advance.`)
} else {
const route = {
path: routeCfg.path || router.path || routeCfg.router,
name: routeCfg.name || router.name,
component: router.component,
redirect: routeCfg.redirect || router.redirect,
meta: {
authority: routeCfg.authority || router.authority || '*',
icon: routeCfg.icon || router.icon,
page: routeCfg.page || router.page
}
}
if (routeCfg.children && routeCfg.children.length > 0) {
route.children = parseRoutes(routeCfg.children, routerMap)
}
routes.push(route)
}
})
return routes
}
/**
* 加载路由
* @param router 应用路由实例
* @param store 应用的 vuex.store 实例
* @param i18n 应用的 vue-i18n 实例
* @param routesConfig 路由配置
*/
function loadRoutes({router, store, i18n}, routesConfig) {
// 如果 routesConfig 有值,则更新到本地,否则从本地获取
if (routesConfig) {
store.commit('account/setRoutesConfig', routesConfig)
} else {
routesConfig = store.getters['account/routesConfig']
}
// 如果开启了异步路由,则加载异步路由配置
const asyncRoutes = store.state.setting.asyncRoutes
if (asyncRoutes) {
if (routesConfig && routesConfig.length > 0) {
const routes = parseRoutes(routesConfig, routerMap)
const finalRoutes = mergeRoutes(router.options.routes, routes)
router.options = {...router.options, routes: finalRoutes}
router.matcher = new Router({...router.options, routes:[]}).matcher
router.addRoutes(finalRoutes)
}
}
// 初始化Admin后台菜单数据
const rootRoute = router.options.routes.find(item => item.path === '/')
const menuRoutes = rootRoute && rootRoute.children
if (menuRoutes) {
mergeI18nFromRoutes(i18n, menuRoutes)
store.commit('setting/setMenuData', menuRoutes)
}
}
/**
* 合并路由
* @param target {Route[]}
* @param source {Route[]}
* @returns {Route[]}
*/
function mergeRoutes(target, source) {
const routesMap = {}
target.forEach(item => routesMap[item.path] = item)
source.forEach(item => routesMap[item.path] = item)
return Object.values(routesMap)
}
/**
* 登录守卫
* @param router 应用路由实例
*/
function loginGuard(router) {
router.beforeEach((to, from, next) => {
if (!loginIgnore.includes(to) && !checkAuthorization()) {
next({path: '/login'})
} else {
next()
}
})
}
/**
* 权限守卫
* @param router 应用路由实例
* @param store 应用的 vuex.store 实例
*/
function authorityGuard(router, store) {
router.beforeEach((to, form, next) => {
const permissions = store.getters['account/permissions']
const roles = store.getters['account/roles']
if (!hasPermission(to, permissions) && !hasRole(to, roles)) {
next({path: '/403'})
} else {
next()
}
})
}
/**
* 判断是否有路由的权限
* @param route 路由
* @param permissions 用户权限集合
* @returns {boolean|*}
*/
function hasPermission(route, permissions) {
const authority = route.meta.authority || '*'
let required = '*'
if (typeof authority === 'string') {
required = authority
} else if (typeof authority === 'object') {
required = authority.permission
}
return required === '*' || (permissions && permissions.findIndex(item => item === required || item.id === required) !== -1)
}
/**
* 判断是否有路由需要的角色
* @param route 路由
* @param roles 用户角色集合
*/
function hasRole(route, roles) {
const authority = route.meta.authority || '*'
let required = undefined
if (typeof authority === 'object') {
required = authority.role
}
return authority === '*' || (required && roles.findIndex(item => item === required || item.id === required) !== -1)
}
export {parseRoutes, loadRoutes, loginGuard, authorityGuard}

341
yarn.lock
View File

@ -1772,48 +1772,11 @@ abbrev@1:
resolved "https://registry.npm.taobao.org/abbrev/download/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8"
integrity sha1-+PLIh60Qv2f2NPAFtph/7TF5qsg=
abort-controller@3.0.0:
version "3.0.0"
resolved "https://registry.npm.taobao.org/abort-controller/download/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392"
integrity sha1-6vVNU7YrrkE46AnKIlyEOabvs5I=
dependencies:
event-target-shim "^5.0.0"
abs-svg-path@~0.1.1:
version "0.1.1"
resolved "https://registry.npm.taobao.org/abs-svg-path/download/abs-svg-path-0.1.1.tgz#df601c8e8d2ba10d4a76d625e236a9a39c2723bf"
integrity sha1-32Acjo0roQ1KdtYl4japo5wnI78=
abstract-leveldown@^6.2.1:
version "6.3.0"
resolved "https://registry.npm.taobao.org/abstract-leveldown/download/abstract-leveldown-6.3.0.tgz#d25221d1e6612f820c35963ba4bd739928f6026a"
integrity sha1-0lIh0eZhL4IMNZY7pL1zmSj2Amo=
dependencies:
buffer "^5.5.0"
immediate "^3.2.3"
level-concat-iterator "~2.0.0"
level-supports "~1.0.0"
xtend "~4.0.0"
abstract-leveldown@~6.0.0:
version "6.0.3"
resolved "https://registry.npm.taobao.org/abstract-leveldown/download/abstract-leveldown-6.0.3.tgz#b4b6159343c74b0c5197b2817854782d8f748c4a"
integrity sha1-tLYVk0PHSwxRl7KBeFR4LY90jEo=
dependencies:
level-concat-iterator "~2.0.0"
xtend "~4.0.0"
abstract-leveldown@~6.2.1, abstract-leveldown@~6.2.3:
version "6.2.3"
resolved "https://registry.npm.taobao.org/abstract-leveldown/download/abstract-leveldown-6.2.3.tgz#036543d87e3710f2528e47040bc3261b77a9a8eb"
integrity sha1-A2VD2H43EPJSjkcEC8MmG3epqOs=
dependencies:
buffer "^5.5.0"
immediate "^3.2.3"
level-concat-iterator "~2.0.0"
level-supports "~1.0.0"
xtend "~4.0.0"
accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.7:
version "1.3.7"
resolved "https://registry.npm.taobao.org/accepts/download/accepts-1.3.7.tgz#531bc726517a3b2b41f850021c6cc15eaab507cd"
@ -2069,11 +2032,6 @@ argparse@^1.0.7:
dependencies:
sprintf-js "~1.0.2"
argsarray@0.0.1:
version "0.0.1"
resolved "https://registry.npm.taobao.org/argsarray/download/argsarray-0.0.1.tgz#6e7207b4ecdb39b0af88303fa5ae22bda8df61cb"
integrity sha1-bnIHtOzbObCviDA/pa4ivajfYcs=
arr-diff@^4.0.0:
version "4.0.0"
resolved "https://registry.npm.taobao.org/arr-diff/download/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520"
@ -2540,11 +2498,6 @@ browserslist@^4.0.0, browserslist@^4.12.0, browserslist@^4.8.5:
node-releases "^1.1.53"
pkg-up "^2.0.0"
buffer-from@1.1.0:
version "1.1.0"
resolved "https://registry.npm.taobao.org/buffer-from/download/buffer-from-1.1.0.tgz#87fcaa3a298358e0ade6e442cfce840740d1ad04"
integrity sha1-h/yqOimDWOCt5uRCz86EB0DRrQQ=
buffer-from@^1.0.0:
version "1.1.1"
resolved "https://registry.npm.taobao.org/buffer-from/download/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef"
@ -2574,14 +2527,6 @@ buffer@^4.3.0:
ieee754 "^1.1.4"
isarray "^1.0.0"
buffer@^5.5.0:
version "5.6.0"
resolved "https://registry.npm.taobao.org/buffer/download/buffer-5.6.0.tgz?cache=0&sync_timestamp=1588706716358&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fbuffer%2Fdownload%2Fbuffer-5.6.0.tgz#a31749dc7d81d84db08abf937b6b8c4033f62786"
integrity sha1-oxdJ3H2B2E2wir+Te2uMQDP2J4Y=
dependencies:
base64-js "^1.0.2"
ieee754 "^1.1.4"
builtin-status-codes@^3.0.0:
version "3.0.0"
resolved "https://registry.npm.taobao.org/builtin-status-codes/download/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8"
@ -2999,11 +2944,6 @@ cliui@^6.0.0:
strip-ansi "^6.0.0"
wrap-ansi "^6.2.0"
clone-buffer@1.0.0:
version "1.0.0"
resolved "https://registry.npm.taobao.org/clone-buffer/download/clone-buffer-1.0.0.tgz#e3e25b207ac4e701af721e2cb5a16792cac3dc58"
integrity sha1-4+JbIHrE5wGvch4staFnksrD3Fg=
clone-response@^1.0.2:
version "1.0.2"
resolved "https://registry.npm.taobao.org/clone-response/download/clone-response-1.0.2.tgz#d1dc973920314df67fbeb94223b4ee350239e96b"
@ -3865,22 +3805,6 @@ defer-to-connect@^1.0.1:
resolved "https://registry.npm.taobao.org/defer-to-connect/download/defer-to-connect-1.1.3.tgz?cache=0&sync_timestamp=1580234470231&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fdefer-to-connect%2Fdownload%2Fdefer-to-connect-1.1.3.tgz#331ae050c08dcf789f8c83a7b81f0ed94f4ac591"
integrity sha1-MxrgUMCNz3ifjIOnuB8O2U9KxZE=
deferred-leveldown@~5.1.0:
version "5.1.0"
resolved "https://registry.npm.taobao.org/deferred-leveldown/download/deferred-leveldown-5.1.0.tgz#c21e40641a8e48530255a4ad31371cc7fe76b332"
integrity sha1-wh5AZBqOSFMCVaStMTccx/52szI=
dependencies:
abstract-leveldown "~6.0.0"
inherits "^2.0.3"
deferred-leveldown@~5.3.0:
version "5.3.0"
resolved "https://registry.npm.taobao.org/deferred-leveldown/download/deferred-leveldown-5.3.0.tgz#27a997ad95408b61161aa69bd489b86c71b78058"
integrity sha1-J6mXrZVAi2EWGqab1Im4bHG3gFg=
dependencies:
abstract-leveldown "~6.2.1"
inherits "^2.0.3"
define-properties@^1.1.2, define-properties@^1.1.3:
version "1.1.3"
resolved "https://registry.npm.taobao.org/define-properties/download/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1"
@ -4131,11 +4055,6 @@ dotignore@~0.1.2:
dependencies:
minimatch "^3.0.4"
double-ended-queue@2.1.0-0:
version "2.1.0-0"
resolved "https://registry.npm.taobao.org/double-ended-queue/download/double-ended-queue-2.1.0-0.tgz#103d3527fd31528f40188130c841efdd78264e5c"
integrity sha1-ED01J/0xUo9AGIEwyEHv3XgmTlw=
duplexer3@^0.1.4:
version "0.1.4"
resolved "https://registry.npm.taobao.org/duplexer3/download/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2"
@ -4227,16 +4146,6 @@ encodeurl@~1.0.2:
resolved "https://registry.npm.taobao.org/encodeurl/download/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59"
integrity sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=
encoding-down@^6.3.0:
version "6.3.0"
resolved "https://registry.npm.taobao.org/encoding-down/download/encoding-down-6.3.0.tgz#b1c4eb0e1728c146ecaef8e32963c549e76d082b"
integrity sha1-scTrDhcowUbsrvjjKWPFSedtCCs=
dependencies:
abstract-leveldown "^6.2.1"
inherits "^2.0.3"
level-codec "^9.0.0"
level-errors "^2.0.0"
end-of-stream@^1.0.0, end-of-stream@^1.1.0:
version "1.4.4"
resolved "https://registry.npm.taobao.org/end-of-stream/download/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0"
@ -4244,13 +4153,6 @@ end-of-stream@^1.0.0, end-of-stream@^1.1.0:
dependencies:
once "^1.4.0"
end-stream@~0.1.0:
version "0.1.0"
resolved "https://registry.npm.taobao.org/end-stream/download/end-stream-0.1.0.tgz#32003f3f438a2b0143168137f8fa6e9866c81ed5"
integrity sha1-MgA/P0OKKwFDFoE3+PpumGbIHtU=
dependencies:
write-stream "~0.4.3"
enhanced-resolve@^4.1.0:
version "4.1.1"
resolved "https://registry.npm.taobao.org/enhanced-resolve/download/enhanced-resolve-4.1.1.tgz?cache=0&sync_timestamp=1591173466113&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fenhanced-resolve%2Fdownload%2Fenhanced-resolve-4.1.1.tgz#2937e2b8066cd0fe7ce0990a98f0d71a35189f66"
@ -4288,7 +4190,7 @@ envinfo@^7.2.0:
resolved "https://registry.npm.taobao.org/envinfo/download/envinfo-7.5.1.tgz#93c26897225a00457c75e734d354ea9106a72236"
integrity sha1-k8JolyJaAEV8dec001TqkQanIjY=
errno@^0.1.1, errno@^0.1.3, errno@~0.1.1, errno@~0.1.7:
errno@^0.1.1, errno@^0.1.3, errno@~0.1.7:
version "0.1.7"
resolved "https://registry.npm.taobao.org/errno/download/errno-0.1.7.tgz#4684d71779ad39af177e3f007996f7c67c852618"
integrity sha1-RoTXF3mtOa8Xfj8AeZb3xnyFJhg=
@ -4335,11 +4237,6 @@ es-to-primitive@^1.2.1:
is-date-object "^1.0.1"
is-symbol "^1.0.2"
es6-denodeify@^0.1.1:
version "0.1.5"
resolved "https://registry.npm.taobao.org/es6-denodeify/download/es6-denodeify-0.1.5.tgz#31d4d5fe9c5503e125460439310e16a2a3f39c1f"
integrity sha1-MdTV/pxVA+ElRgQ5MQ4WoqPznB8=
es6-promise@^4.1.0:
version "4.2.8"
resolved "https://registry.npm.taobao.org/es6-promise/download/es6-promise-4.2.8.tgz#4eb21594c972bc40553d276e510539143db53e0a"
@ -4504,11 +4401,6 @@ event-pubsub@4.3.0:
resolved "https://registry.npm.taobao.org/event-pubsub/download/event-pubsub-4.3.0.tgz#f68d816bc29f1ec02c539dc58c8dd40ce72cb36e"
integrity sha1-9o2Ba8KfHsAsU53FjI3UDOcss24=
event-target-shim@^5.0.0:
version "5.0.1"
resolved "https://registry.npm.taobao.org/event-target-shim/download/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789"
integrity sha1-XU0+vflYPWOlMzzi3rdICrKwV4k=
eventemitter3@^4.0.0:
version "4.0.4"
resolved "https://registry.npm.taobao.org/eventemitter3/download/eventemitter3-4.0.4.tgz?cache=0&sync_timestamp=1589283150629&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Feventemitter3%2Fdownload%2Feventemitter3-4.0.4.tgz#b5463ace635a083d018bdc7c917b4c5f10a85384"
@ -4729,14 +4621,6 @@ fecha@~2.3.3:
resolved "https://registry.npm.taobao.org/fecha/download/fecha-2.3.3.tgz#948e74157df1a32fd1b12c3a3c3cdcb6ec9d96cd"
integrity sha1-lI50FX3xoy/RsSw6PDzctuydls0=
fetch-cookie@0.7.3:
version "0.7.3"
resolved "https://registry.npm.taobao.org/fetch-cookie/download/fetch-cookie-0.7.3.tgz#b8d023f421dd2b2f4a0eca9cd7318a967ed4eed8"
integrity sha1-uNAj9CHdKy9KDsqc1zGKln7U7tg=
dependencies:
es6-denodeify "^0.1.1"
tough-cookie "^2.3.3"
figgy-pudding@^3.5.1:
version "3.5.2"
resolved "https://registry.npm.taobao.org/figgy-pudding/download/figgy-pudding-3.5.2.tgz#b4eee8148abb01dcf1d1ac34367d59e12fa61d6e"
@ -5623,11 +5507,6 @@ image-size@~0.5.0:
resolved "https://registry.npm.taobao.org/image-size/download/image-size-0.5.5.tgz#09dfd4ab9d20e29eb1c3e80b8990378df9e3cb9c"
integrity sha1-Cd/Uq50g4p6xw+gLiZA3jfnjy5w=
immediate@3.0.6:
version "3.0.6"
resolved "https://registry.npm.taobao.org/immediate/download/immediate-3.0.6.tgz?cache=0&sync_timestamp=1591712633681&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fimmediate%2Fdownload%2Fimmediate-3.0.6.tgz#9db1dbd0faf8de6fbe0f5dd5e56bb606280de69b"
integrity sha1-nbHb0Pr43m++D13V5Wu2BigN5ps=
immediate@^3.2.3:
version "3.3.0"
resolved "https://registry.npm.taobao.org/immediate/download/immediate-3.3.0.tgz?cache=0&sync_timestamp=1591712633681&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fimmediate%2Fdownload%2Fimmediate-3.3.0.tgz#1aef225517836bcdf7f2a2de2600c79ff0269266"
@ -6106,11 +5985,6 @@ is-yarn-global@^0.3.0:
resolved "https://registry.npm.taobao.org/is-yarn-global/download/is-yarn-global-0.3.0.tgz#d502d3382590ea3004893746754c89139973e232"
integrity sha1-1QLTOCWQ6jAEiTdGdUyJE5lz4jI=
isarray@0.0.1, isarray@~0.0.1:
version "0.0.1"
resolved "https://registry.npm.taobao.org/isarray/download/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf"
integrity sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=
isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0:
version "1.0.0"
resolved "https://registry.npm.taobao.org/isarray/download/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"
@ -6121,6 +5995,11 @@ isarray@^2.0.1:
resolved "https://registry.npm.taobao.org/isarray/download/isarray-2.0.5.tgz#8af1e4c1221244cc62459faf38940d4e644a5723"
integrity sha1-ivHkwSISRMxiRZ+vOJQNTmRKVyM=
isarray@~0.0.1:
version "0.0.1"
resolved "https://registry.npm.taobao.org/isarray/download/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf"
integrity sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=
isexe@^2.0.0:
version "2.0.0"
resolved "https://registry.npm.taobao.org/isexe/download/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
@ -6394,113 +6273,6 @@ less@^3.11.3:
request "^2.83.0"
source-map "~0.6.0"
level-codec@9.0.1, level-codec@^9.0.0:
version "9.0.1"
resolved "https://registry.npm.taobao.org/level-codec/download/level-codec-9.0.1.tgz#042f4aa85e56d4328ace368c950811ba802b7247"
integrity sha1-BC9KqF5W1DKKzjaMlQgRuoArckc=
level-concat-iterator@~2.0.0:
version "2.0.1"
resolved "https://registry.npm.taobao.org/level-concat-iterator/download/level-concat-iterator-2.0.1.tgz?cache=0&sync_timestamp=1571695338983&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flevel-concat-iterator%2Fdownload%2Flevel-concat-iterator-2.0.1.tgz#1d1009cf108340252cb38c51f9727311193e6263"
integrity sha1-HRAJzxCDQCUss4xR+XJzERk+YmM=
level-errors@^2.0.0, level-errors@~2.0.0:
version "2.0.1"
resolved "https://registry.npm.taobao.org/level-errors/download/level-errors-2.0.1.tgz#2132a677bf4e679ce029f517c2f17432800c05c8"
integrity sha1-ITKmd79OZ5zgKfUXwvF0MoAMBcg=
dependencies:
errno "~0.1.1"
level-iterator-stream@~4.0.0:
version "4.0.2"
resolved "https://registry.npm.taobao.org/level-iterator-stream/download/level-iterator-stream-4.0.2.tgz#7ceba69b713b0d7e22fcc0d1f128ccdc8a24f79c"
integrity sha1-fOumm3E7DX4i/MDR8SjM3Iok95w=
dependencies:
inherits "^2.0.4"
readable-stream "^3.4.0"
xtend "^4.0.2"
level-js@^5.0.0:
version "5.0.2"
resolved "https://registry.npm.taobao.org/level-js/download/level-js-5.0.2.tgz#5e280b8f93abd9ef3a305b13faf0b5397c969b55"
integrity sha1-XigLj5Or2e86MFsT+vC1OXyWm1U=
dependencies:
abstract-leveldown "~6.2.3"
buffer "^5.5.0"
inherits "^2.0.3"
ltgt "^2.1.2"
level-packager@^5.1.0:
version "5.1.1"
resolved "https://registry.npm.taobao.org/level-packager/download/level-packager-5.1.1.tgz#323ec842d6babe7336f70299c14df2e329c18939"
integrity sha1-Mj7IQta6vnM29wKZwU3y4ynBiTk=
dependencies:
encoding-down "^6.3.0"
levelup "^4.3.2"
level-supports@~1.0.0:
version "1.0.1"
resolved "https://registry.npm.taobao.org/level-supports/download/level-supports-1.0.1.tgz?cache=0&sync_timestamp=1571695339491&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flevel-supports%2Fdownload%2Flevel-supports-1.0.1.tgz#2f530a596834c7301622521988e2c36bb77d122d"
integrity sha1-L1MKWWg0xzAWIlIZiOLDa7d9Ei0=
dependencies:
xtend "^4.0.2"
level-write-stream@1.0.0:
version "1.0.0"
resolved "https://registry.npm.taobao.org/level-write-stream/download/level-write-stream-1.0.0.tgz#3f7fbb679a55137c0feb303dee766e12ee13c1dc"
integrity sha1-P3+7Z5pVE3wP6zA97nZuEu4Twdw=
dependencies:
end-stream "~0.1.0"
level@6.0.0:
version "6.0.0"
resolved "https://registry.npm.taobao.org/level/download/level-6.0.0.tgz#d216fb9b9c3940bcec15c5880d8da775ca086c5c"
integrity sha1-0hb7m5w5QLzsFcWIDY2ndcoIbFw=
dependencies:
level-js "^5.0.0"
level-packager "^5.1.0"
leveldown "^5.4.0"
opencollective-postinstall "^2.0.0"
leveldown@5.4.1:
version "5.4.1"
resolved "https://registry.npm.taobao.org/leveldown/download/leveldown-5.4.1.tgz#83a8fdd9bb52b1ed69be2ef59822b6cdfcdb51ec"
integrity sha1-g6j92btSse1pvi71mCK2zfzbUew=
dependencies:
abstract-leveldown "~6.2.1"
napi-macros "~2.0.0"
node-gyp-build "~4.1.0"
leveldown@^5.4.0:
version "5.6.0"
resolved "https://registry.npm.taobao.org/leveldown/download/leveldown-5.6.0.tgz#16ba937bb2991c6094e13ac5a6898ee66d3eee98"
integrity sha1-FrqTe7KZHGCU4TrFpomO5m0+7pg=
dependencies:
abstract-leveldown "~6.2.1"
napi-macros "~2.0.0"
node-gyp-build "~4.1.0"
levelup@4.1.0:
version "4.1.0"
resolved "https://registry.npm.taobao.org/levelup/download/levelup-4.1.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flevelup%2Fdownload%2Flevelup-4.1.0.tgz#49ab5d3a341731cd102f91c6bc17a1acb1969a17"
integrity sha1-SatdOjQXMc0QL5HGvBehrLGWmhc=
dependencies:
deferred-leveldown "~5.1.0"
level-errors "~2.0.0"
level-iterator-stream "~4.0.0"
xtend "~4.0.0"
levelup@^4.3.2:
version "4.4.0"
resolved "https://registry.npm.taobao.org/levelup/download/levelup-4.4.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flevelup%2Fdownload%2Flevelup-4.4.0.tgz#f89da3a228c38deb49c48f88a70fb71f01cafed6"
integrity sha1-+J2joijDjetJxI+Ipw+3HwHK/tY=
dependencies:
deferred-leveldown "~5.3.0"
level-errors "~2.0.0"
level-iterator-stream "~4.0.0"
level-supports "~1.0.0"
xtend "~4.0.0"
leven@^3.1.0:
version "3.1.0"
resolved "https://registry.npm.taobao.org/leven/download/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2"
@ -6726,11 +6498,6 @@ lru-cache@^5.1.1:
dependencies:
yallist "^3.0.2"
ltgt@2.2.1, ltgt@^2.1.2:
version "2.2.1"
resolved "https://registry.npm.taobao.org/ltgt/download/ltgt-2.2.1.tgz#f35ca91c493f7b73da0e07495304f17b31f87ee5"
integrity sha1-81ypHEk/e3PaDgdJUwTxezH4fuU=
make-dir@^2.0.0, make-dir@^2.1.0:
version "2.1.0"
resolved "https://registry.npm.taobao.org/make-dir/download/make-dir-2.1.0.tgz?cache=0&sync_timestamp=1587567572251&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fmake-dir%2Fdownload%2Fmake-dir-2.1.0.tgz#5f0310e18b8be898cc07009295a30ae41e91e6f5"
@ -7138,11 +6905,6 @@ nanomatch@^1.2.9:
snapdragon "^0.8.1"
to-regex "^3.0.1"
napi-macros@~2.0.0:
version "2.0.0"
resolved "https://registry.npm.taobao.org/napi-macros/download/napi-macros-2.0.0.tgz#2b6bae421e7b96eb687aa6c77a7858640670001b"
integrity sha1-K2uuQh57lutoeqbHenhYZAZwABs=
natural-compare@^1.4.0:
version "1.4.0"
resolved "https://registry.npm.taobao.org/natural-compare/download/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7"
@ -7177,21 +6939,11 @@ node-emoji@^1.10.0:
dependencies:
lodash.toarray "^4.4.0"
node-fetch@2.4.1:
version "2.4.1"
resolved "https://registry.npm.taobao.org/node-fetch/download/node-fetch-2.4.1.tgz?cache=0&sync_timestamp=1591866503442&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnode-fetch%2Fdownload%2Fnode-fetch-2.4.1.tgz#b2e38f1117b8acbedbe0524f041fb3177188255d"
integrity sha1-suOPERe4rL7b4FJPBB+zF3GIJV0=
node-forge@0.9.0:
version "0.9.0"
resolved "https://registry.npm.taobao.org/node-forge/download/node-forge-0.9.0.tgz#d624050edbb44874adca12bb9a52ec63cb782579"
integrity sha1-1iQFDtu0SHStyhK7mlLsY8t4JXk=
node-gyp-build@~4.1.0:
version "4.1.1"
resolved "https://registry.npm.taobao.org/node-gyp-build/download/node-gyp-build-4.1.1.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnode-gyp-build%2Fdownload%2Fnode-gyp-build-4.1.1.tgz#d7270b5d86717068d114cc57fff352f96d745feb"
integrity sha1-1ycLXYZxcGjRFMxX//NS+W10X+s=
node-ipc@^9.1.1:
version "9.1.1"
resolved "https://registry.npm.taobao.org/node-ipc/download/node-ipc-9.1.1.tgz#4e245ed6938e65100e595ebc5dc34b16e8dd5d69"
@ -7470,7 +7222,7 @@ open@^6.3.0:
dependencies:
is-wsl "^1.1.0"
opencollective-postinstall@^2.0.0, opencollective-postinstall@^2.0.2:
opencollective-postinstall@^2.0.2:
version "2.0.3"
resolved "https://registry.npm.taobao.org/opencollective-postinstall/download/opencollective-postinstall-2.0.3.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fopencollective-postinstall%2Fdownload%2Fopencollective-postinstall-2.0.3.tgz#7a0fff978f6dbfa4d006238fbac98ed4198c3259"
integrity sha1-eg//l49tv6TQBiOPusmO1BmMMlk=
@ -8239,32 +7991,6 @@ postcss@^7.0.0, postcss@^7.0.1, postcss@^7.0.14, postcss@^7.0.16, postcss@^7.0.2
source-map "^0.6.1"
supports-color "^6.1.0"
pouchdb@^7.2.1:
version "7.2.1"
resolved "https://registry.npm.taobao.org/pouchdb/download/pouchdb-7.2.1.tgz#619e3d5c2463ddd94a4b1bf40d44408c46e9de79"
integrity sha1-YZ49XCRj3dlKSxv0DURAjEbp3nk=
dependencies:
abort-controller "3.0.0"
argsarray "0.0.1"
buffer-from "1.1.0"
clone-buffer "1.0.0"
double-ended-queue "2.1.0-0"
fetch-cookie "0.7.3"
immediate "3.0.6"
inherits "2.0.4"
level "6.0.0"
level-codec "9.0.1"
level-write-stream "1.0.0"
leveldown "5.4.1"
levelup "4.1.0"
ltgt "2.2.1"
node-fetch "2.4.1"
readable-stream "1.0.33"
spark-md5 "3.0.0"
through2 "3.0.1"
uuid "3.3.3"
vuvuzela "1.0.3"
prelude-ls@~1.1.2:
version "1.1.2"
resolved "https://registry.npm.taobao.org/prelude-ls/download/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54"
@ -8536,17 +8262,7 @@ read-pkg@^5.1.1:
string_decoder "~1.1.1"
util-deprecate "~1.0.1"
readable-stream@1.0.33:
version "1.0.33"
resolved "https://registry.npm.taobao.org/readable-stream/download/readable-stream-1.0.33.tgz?cache=0&sync_timestamp=1581624324274&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Freadable-stream%2Fdownload%2Freadable-stream-1.0.33.tgz#3a360dd66c1b1d7fd4705389860eda1d0f61126c"
integrity sha1-OjYN1mwbHX/UcFOJhg7aHQ9hEmw=
dependencies:
core-util-is "~1.0.0"
inherits "~2.0.1"
isarray "0.0.1"
string_decoder "~0.10.x"
"readable-stream@2 || 3", readable-stream@^3.0.6, readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.6.0:
readable-stream@^3.0.6, readable-stream@^3.1.1, readable-stream@^3.6.0:
version "3.6.0"
resolved "https://registry.npm.taobao.org/readable-stream/download/readable-stream-3.6.0.tgz?cache=0&sync_timestamp=1581624324274&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Freadable-stream%2Fdownload%2Freadable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198"
integrity sha1-M3u9o63AcGvT4CRCaihtS0sskZg=
@ -8555,11 +8271,6 @@ readable-stream@1.0.33:
string_decoder "^1.1.1"
util-deprecate "^1.0.1"
readable-stream@~0.0.2:
version "0.0.4"
resolved "https://registry.npm.taobao.org/readable-stream/download/readable-stream-0.0.4.tgz?cache=0&sync_timestamp=1581624324274&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Freadable-stream%2Fdownload%2Freadable-stream-0.0.4.tgz#f32d76e3fb863344a548d79923007173665b3b8d"
integrity sha1-8y124/uGM0SlSNeZIwBxc2ZbO40=
readdirp@^2.2.1:
version "2.2.1"
resolved "https://registry.npm.taobao.org/readdirp/download/readdirp-2.2.1.tgz#0e87622a3325aa33e892285caf8b4e846529a525"
@ -9313,11 +9024,6 @@ source-map@^0.7.3:
resolved "https://registry.npm.taobao.org/source-map/download/source-map-0.7.3.tgz?cache=0&sync_timestamp=1571657176668&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsource-map%2Fdownload%2Fsource-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383"
integrity sha1-UwL4FpAxc1ImVECS5kmB91F1A4M=
spark-md5@3.0.0:
version "3.0.0"
resolved "https://registry.npm.taobao.org/spark-md5/download/spark-md5-3.0.0.tgz?cache=0&sync_timestamp=1583763547803&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fspark-md5%2Fdownload%2Fspark-md5-3.0.0.tgz#3722227c54e2faf24b1dc6d933cc144e6f71bfef"
integrity sha1-NyIifFTi+vJLHcbZM8wUTm9xv+8=
spdx-correct@^3.0.0:
version "3.1.1"
resolved "https://registry.npm.taobao.org/spdx-correct/download/spdx-correct-3.1.1.tgz?cache=0&sync_timestamp=1590161967473&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fspdx-correct%2Fdownload%2Fspdx-correct-3.1.1.tgz#dece81ac9c1e6713e5f7d1b6f17d468fa53d89a9"
@ -9549,11 +9255,6 @@ string_decoder@^1.0.0, string_decoder@^1.1.1:
dependencies:
safe-buffer "~5.2.0"
string_decoder@~0.10.x:
version "0.10.31"
resolved "https://registry.npm.taobao.org/string_decoder/download/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94"
integrity sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=
string_decoder@~1.1.1:
version "1.1.1"
resolved "https://registry.npm.taobao.org/string_decoder/download/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8"
@ -9831,13 +9532,6 @@ thread-loader@^2.1.3:
loader-utils "^1.1.0"
neo-async "^2.6.0"
through2@3.0.1:
version "3.0.1"
resolved "https://registry.npm.taobao.org/through2/download/through2-3.0.1.tgz#39276e713c3302edf9e388dd9c812dd3b825bd5a"
integrity sha1-OSducTwzAu3544jdnIEt07glvVo=
dependencies:
readable-stream "2 || 3"
through2@^2.0.0:
version "2.0.5"
resolved "https://registry.npm.taobao.org/through2/download/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd"
@ -10297,11 +9991,6 @@ utils-merge@1.0.1:
resolved "https://registry.npm.taobao.org/utils-merge/download/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713"
integrity sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=
uuid@3.3.3:
version "3.3.3"
resolved "https://registry.npm.taobao.org/uuid/download/uuid-3.3.3.tgz#4568f0216e78760ee1dbf3a4d2cf53e224112866"
integrity sha1-RWjwIW54dg7h2/Ok0s9T4iQRKGY=
uuid@^3.3.2, uuid@^3.4.0:
version "3.4.0"
resolved "https://registry.npm.taobao.org/uuid/download/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
@ -10526,11 +10215,6 @@ vuex@^3.4.0:
resolved "https://registry.npm.taobao.org/vuex/download/vuex-3.4.0.tgz#20cc086062d750769fce1febb34e7fceeaebde45"
integrity sha1-IMwIYGLXUHafzh/rs05/zurr3kU=
vuvuzela@1.0.3:
version "1.0.3"
resolved "https://registry.npm.taobao.org/vuvuzela/download/vuvuzela-1.0.3.tgz#3be145e58271c73ca55279dd851f12a682114b0b"
integrity sha1-O+FF5YJxxzylUnndhR8SpoIRSws=
warning@^4.0.0:
version "4.0.3"
resolved "https://registry.npm.taobao.org/warning/download/warning-4.0.3.tgz#16e9e077eb8a86d6af7d64aa1e05fd85b4678ca3"
@ -10850,13 +10534,6 @@ write-file-atomic@^3.0.0:
signal-exit "^3.0.2"
typedarray-to-buffer "^3.1.5"
write-stream@~0.4.3:
version "0.4.3"
resolved "https://registry.npm.taobao.org/write-stream/download/write-stream-0.4.3.tgz#83cc8c0347d0af6057a93862b4e3ae01de5c81c1"
integrity sha1-g8yMA0fQr2BXqThitOOuAd5cgcE=
dependencies:
readable-stream "~0.0.2"
write@1.0.3:
version "1.0.3"
resolved "https://registry.npm.taobao.org/write/download/write-1.0.3.tgz#0800e14523b923a387e415123c865616aae0f5c3"
@ -10876,7 +10553,7 @@ xdg-basedir@^4.0.0:
resolved "https://registry.npm.taobao.org/xdg-basedir/download/xdg-basedir-4.0.0.tgz#4bc8d9984403696225ef83a1573cbbcb4e79db13"
integrity sha1-S8jZmEQDaWIl74OhVzy7y0552xM=
xtend@^4.0.0, xtend@^4.0.2, xtend@~4.0.0, xtend@~4.0.1:
xtend@^4.0.0, xtend@~4.0.1:
version "4.0.2"
resolved "https://registry.npm.taobao.org/xtend/download/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54"
integrity sha1-u3J3n1+kZRhrH0OPZ0+jR/2121Q=