功能变化: 兼容租户模式

pull/104/head
李强 2023-08-21 14:27:07 +08:00
parent 83c702298a
commit 863be2044a
2 changed files with 24 additions and 3 deletions

View File

@ -86,10 +86,27 @@ router.beforeEach(async (to, from, next) => {
}) })
} else { } else {
const childrenPath = window.qiankunActiveRule || [] const childrenPath = window.qiankunActiveRule || []
// 判断是否是租户模式
if (to.path !== '/clientRenew' && store.state.d2admin.user.info.tenant_id) {
// 如果租户到期跳转到续费页面
if (store.state.d2admin.user.info.tenant_expire) {
next({ path: '/clientRenew' })
// 取消当前导航
NProgress.done()
return
// 如果是普通租户如果没有试用套餐且是试用阶段
} else if (store.state.d2admin.user.info.tenant_id !== 100000 && !store.state.d2admin.user.info.package_manage && store.state.d2admin.user.info.tenant_experience) {
next({ path: '/clientRenew' })
// 取消当前导航
NProgress.done()
return
}
}
if (to.name) { if (to.name) {
if (to.meta.openInNewWindow && (from.query.newWindow && to.query.newWindow !== '1' || from.path === '/')) { if (to.meta.openInNewWindow && ((from.query.newWindow && to.query.newWindow !== '1') || from.path === '/')) {
to.query.newWindow = '1' to.query.newWindow = '1'
} }
// name 属性说明是主应用的路由 // name 属性说明是主应用的路由
if (to.meta.openInNewWindow && !to.query.newWindow && !from.query.newWindow && from.path !== '/') { if (to.meta.openInNewWindow && !to.query.newWindow && !from.query.newWindow && from.path !== '/') {
// 在新窗口中打开路由 // 在新窗口中打开路由
@ -101,6 +118,8 @@ router.beforeEach(async (to, from, next) => {
NProgress.done() NProgress.done()
next(false) next(false)
} else { } else {
// 取消当前导航
NProgress.done()
next() next()
} }
} else if (childrenPath.some((item) => to.path.includes(item))) { } else if (childrenPath.some((item) => to.path.includes(item))) {

View File

@ -66,7 +66,7 @@ export default {
* @param {Object} context * @param {Object} context
* @param {Object} payload confirm {Boolean} 是否需要确认 * @param {Object} payload confirm {Boolean} 是否需要确认
*/ */
logout ({ commit, dispatch }, { confirm = false } = {}) { logout ({ commit, dispatch }, { confirm = false, refresh = true } = {}) {
/** /**
* @description 注销 * @description 注销
*/ */
@ -87,7 +87,9 @@ export default {
// 跳转路由 // 跳转路由
router.push({ name: 'login' }) router.push({ name: 'login' })
router.go(0) if (refresh) {
router.go(0)
}
} }
// 判断是否需要确认 // 判断是否需要确认
if (confirm) { if (confirm) {