From 57349ceeeb9c9ea0995c6de637d3626f8e66a961 Mon Sep 17 00:00:00 2001 From: hrx <18603305412@163.com> Date: Thu, 23 Jul 2026 10:38:21 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- f/web-kboss/src/router/index.js | 24 +++++++++++ f/web-kboss/src/store/modules/permission.js | 5 ++- .../src/views/LoginDialog/LoginDialog.vue | 41 +++++++++++++++---- .../homePage/components/topBox/index.vue | 34 +++++++++++++-- 4 files changed, 91 insertions(+), 13 deletions(-) diff --git a/f/web-kboss/src/router/index.js b/f/web-kboss/src/router/index.js index 1dca6fa..dc1a73f 100644 --- a/f/web-kboss/src/router/index.js +++ b/f/web-kboss/src/router/index.js @@ -256,6 +256,19 @@ export const constantRoutes = [ component: () => import('@/views/product/charge/index.vue'), hidden: true }, + { + path: '/product/productHome', + component: Layout, + hidden: true, + children: [ + { + path: '', + name: 'ProductConsoleHomeStatic', + component: () => import('@/views/product/productHome/productIndex/index.vue'), + meta: { title: '产品', fullPath: '/product/productHome', noCache: true } + } + ] + }, { path: '/kyyForm', name: 'kyyForm', @@ -653,6 +666,17 @@ export const asyncRoutes = [ noCache: true } }, + { + path: "productHome", + component: () => import('@/views/product/productHome/productIndex/index.vue'), + name: 'ProductConsoleHome', + hidden: true, + meta: { + title: "产品", + fullPath: "/product/productHome", + noCache: true + } + }, ] }, // 令牌管理 - 一级菜单(所有登录用户都能看到) diff --git a/f/web-kboss/src/store/modules/permission.js b/f/web-kboss/src/store/modules/permission.js index 08d5880..9b8272d 100644 --- a/f/web-kboss/src/store/modules/permission.js +++ b/f/web-kboss/src/store/modules/permission.js @@ -370,7 +370,8 @@ function getAdministratorRoutes(routes, deviceType = 'pc') { } function addAdministratorRoutes(accessedRoutes, routes, userRoles = [], deviceType = 'pc') { - if (!userRoles.includes(ADMINISTRATOR_ROLE)) { + const orgType = parseInt(sessionStorage.getItem('org_type') || sessionStorage.getItem('orgType') || '0') + if (!userRoles.includes(ADMINISTRATOR_ROLE) || isCustomer(userRoles) || orgType === 2 || orgType === 3) { return accessedRoutes; } @@ -522,7 +523,7 @@ const actions = { console.log("用户类型:", userType, "orgType:", orgType, "设备类型:", deviceType); console.log("ACTION generateRoutes - auths:", auths); - if (!isSuperAdmin && userRoles.includes(ADMINISTRATOR_ROLE)) { + if (!isSuperAdmin && userRoles.includes(ADMINISTRATOR_ROLE) && !isCustomer(userRoles) && orgType !== 2 && orgType !== 3) { const administratorRoutes = getAdministratorRoutes(asyncRoutes, deviceType); commit("SET_ROUTES", administratorRoutes); resolve(administratorRoutes); diff --git a/f/web-kboss/src/views/LoginDialog/LoginDialog.vue b/f/web-kboss/src/views/LoginDialog/LoginDialog.vue index 298bfc8..8404426 100644 --- a/f/web-kboss/src/views/LoginDialog/LoginDialog.vue +++ b/f/web-kboss/src/views/LoginDialog/LoginDialog.vue @@ -381,24 +381,49 @@ export default { } }) }, + goAfterLogin(path) { + if (this.$route.path === path) { + this.$router.replace({ + path, + query: { + ...this.$route.query, + _route_refresh: Date.now() + } + }).catch(() => {}) + return + } + this.$router.push(path).catch(() => {}) + }, redirectAfterLogin(res) { + if (res.admin === 1) { + this.goAfterLogin('/') + return + } + if (String(res.org_type) === '2' || String(res.org_type) === '3') { + sessionStorage.removeItem('loginRedirectPath') + this.goAfterLogin(getHomePath()) + return + } + if (res.roles && res.roles.includes('客户')) { + sessionStorage.removeItem('loginRedirectPath') + this.goAfterLogin(getHomePath()) + return + } if (res.roles && res.roles.includes('管理员')) { sessionStorage.removeItem('loginRedirectPath') - this.$router.push('/superAdministrator/roleManagement').catch(() => {}) + this.goAfterLogin('/superAdministrator/roleManagement') return } const redirectPath = sessionStorage.getItem('loginRedirectPath') if (redirectPath && redirectPath.startsWith('/') && !redirectPath.includes('/login')) { sessionStorage.removeItem('loginRedirectPath') - this.$router.push(redirectPath).catch(() => {}) + this.goAfterLogin(redirectPath) return } - if (res.admin === 1) this.$router.push('/').catch(() => {}) - else if (String(res.org_type) === '2' || String(res.org_type) === '3') this.$router.push(getHomePath()).catch(() => {}) - else if (res.roles && res.roles.includes('运营')) this.$router.push('/operation/supplierManagement').catch(() => {}) - else if (res.roles && res.roles.includes('销售')) this.$router.push('/sales/distributorManagement').catch(() => {}) - else if (res.roles && res.roles.includes('运维')) this.$router.push('/operationAndMaintenance/workOrderProcessing').catch(() => {}) - else this.$router.push('/').catch(() => {}) + if (res.roles && res.roles.includes('运营')) this.goAfterLogin('/operation/supplierManagement') + else if (res.roles && res.roles.includes('销售')) this.goAfterLogin('/sales/distributorManagement') + else if (res.roles && res.roles.includes('运维')) this.goAfterLogin('/operationAndMaintenance/workOrderProcessing') + else this.goAfterLogin('/') }, handleRegister() { if (!this.registerForm.agree) { diff --git a/f/web-kboss/src/views/homePage/components/topBox/index.vue b/f/web-kboss/src/views/homePage/components/topBox/index.vue index 24c8b71..18d37ef 100644 --- a/f/web-kboss/src/views/homePage/components/topBox/index.vue +++ b/f/web-kboss/src/views/homePage/components/topBox/index.vue @@ -275,6 +275,7 @@ export default Vue.extend({ activeLocale: 'zh-CN', isProductPanelVisible: false, loginDialogVisible: false, + consoleRoutesEnsured: false, // 登录信息 isShowKbossCharge: false, @@ -296,7 +297,7 @@ export default Vue.extend({ } }, computed: { - ...mapGetters(['sidebar', 'avatar', 'device']), + ...mapGetters(['sidebar', 'avatar', 'device', 'permission_routes']), ...mapState({ mybalance: state => state.user.mybalance, logoutUrl: state => state.login.logoutUrl, @@ -519,6 +520,7 @@ export default Vue.extend({ this.loginDialogVisible = false this.nick_name = sessionStorage.getItem('username') || '' this.userId = sessionStorage.getItem('userId') + this.consoleRoutesEnsured = false }, goLogin() { this.openLoginDialog() @@ -537,9 +539,35 @@ export default Vue.extend({ handleUnreadCountUpdate(count) { this.messageCount = count }, - goB() { + async ensureConsoleRoutes() { + if (this.consoleRoutesEnsured) return + const authsText = sessionStorage.getItem('auths') || '[]' + let auths = [] + try { + auths = JSON.parse(authsText) + } catch (error) { + auths = [] + } + const rolesText = sessionStorage.getItem('roles') || '[]' + let roles = [] + try { + roles = JSON.parse(rolesText) + } catch (error) { + roles = [] + } + const accessRoutes = await this.$store.dispatch('permission/generateRoutes', { + user: sessionStorage.getItem('username') || '', + auths, + orgType: sessionStorage.getItem('org_type'), + roles + }) + this.$router.addRoutes(accessRoutes) + this.consoleRoutesEnsured = true + }, + async goB() { + await this.ensureConsoleRoutes() const role = sessionStorage.getItem('jueseNew') || '' - if (role.includes('客户')) this.$router.push('/product/productHome') + if (role.includes('客户')) this.$router.push('/product/productHome').catch(() => this.$router.replace('/product/productHome')) else if (role.includes('运营')) this.$router.push('/operation/supplierManagement') else if (role.includes('运维')) this.$router.push('/operationAndMaintenance/workOrderProcessing') else if (role.includes('销售')) this.$router.push('/sales/distributorManagement') -- 2.34.1 From 22e411293f79e5b100e59810585de7a0050575db Mon Sep 17 00:00:00 2001 From: hrx <18603305412@163.com> Date: Thu, 23 Jul 2026 11:37:23 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- f/web-kboss/src/views/product/allProduct/index.vue | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/f/web-kboss/src/views/product/allProduct/index.vue b/f/web-kboss/src/views/product/allProduct/index.vue index 375cd6d..8324a9a 100644 --- a/f/web-kboss/src/views/product/allProduct/index.vue +++ b/f/web-kboss/src/views/product/allProduct/index.vue @@ -118,12 +118,11 @@