功能变化: frame_out 在新创建中打开

pull/102/MERGE
李强 2023-07-10 07:55:32 +08:00
parent 8394f92178
commit 3543ea86d4
2 changed files with 15 additions and 20 deletions

View File

@ -1,11 +1,3 @@
/*
* @创建文件时间: 2021-06-01 22:41:21
* @Auther: 猿小天
* @最后修改人: 猿小天
* @最后修改时间: 2021-11-19 21:35:56
* 联系Qq:1638245306
* @文件介绍: 菜单获取
*/
import { uniqueId } from 'lodash' import { uniqueId } from 'lodash'
import { request } from '@/api/service' import { request } from '@/api/service'
import XEUtils from 'xe-utils' import XEUtils from 'xe-utils'
@ -76,7 +68,8 @@ export const handleRouter = function (menuData) {
meta: { meta: {
title: item.name, title: item.name,
auth: true, auth: true,
cache: item.cache cache: item.cache,
openInNewWindow: item.frame_out
} }
} }
if (item.frame_out) { if (item.frame_out) {

View File

@ -1,11 +1,3 @@
/*
* @创建文件时间: 2021-06-01 22:41:21
* @Auther: 猿小天
* @最后修改人: 猿小天
* @最后修改时间: 2021-11-19 21:49:43
* 联系Qq:1638245306
* @文件介绍:
*/
import Vue from 'vue' import Vue from 'vue'
import VueRouter from 'vue-router' import VueRouter from 'vue-router'
// 进度条 // 进度条
@ -42,7 +34,7 @@ const router = new VueRouter({
*/ */
router.beforeEach(async (to, from, next) => { router.beforeEach(async (to, from, next) => {
// 白名单 // 白名单
const whiteList = ['/login', '/auth-redirect', '/bind', '/register', '/oauth2'] const whiteList = ['/login', '/auth-redirect', '/bind', '/register', '/clientRenew', '/oauth2']
// 确认已经加载多标签页数据 https://github.com/d2-projects/d2-admin/issues/201 // 确认已经加载多标签页数据 https://github.com/d2-projects/d2-admin/issues/201
await store.dispatch('d2admin/page/isLoaded') await store.dispatch('d2admin/page/isLoaded')
// 确认已经加载组件尺寸设置 https://github.com/d2-projects/d2-admin/issues/198 // 确认已经加载组件尺寸设置 https://github.com/d2-projects/d2-admin/issues/198
@ -92,11 +84,21 @@ router.beforeEach(async (to, from, next) => {
next({ path: to.fullPath, replace: true, params: to.params }) next({ path: to.fullPath, replace: true, params: to.params })
}) })
} else { } else {
next()
const childrenPath = window.qiankunActiveRule || [] const childrenPath = window.qiankunActiveRule || []
if (to.name) { if (to.name) {
// name 属性说明是主应用的路由 // name 属性说明是主应用的路由
next() if (to.meta.openInNewWindow && !to.query.newWindow) {
// 在新窗口中打开路由
const { href } = router.resolve({
path: to.path + '?newWindow=1'
})
window.open(href, '_blank')
// 取消当前导航
NProgress.done()
next(false)
} else {
next()
}
} else if (childrenPath.some((item) => to.path.includes(item))) { } else if (childrenPath.some((item) => to.path.includes(item))) {
next() next()
} else { } else {