更新 #145

Closed
charles wants to merge 4 commits from main into prod1
5 changed files with 120 additions and 43 deletions

View File

@ -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
}
},
]
},
// 令牌管理 - 一级菜单(所有登录用户都能看到)
@ -1250,30 +1274,30 @@ export const asyncRoutes = [
// 容器实例 - 客户角色可见
{
path: "/containerInstance",
component: Layout,
redirect: "/containerInstance/index",
meta: {
title: "容器实例",
icon: "el-icon-box",
noCache: true,
fullPath: "/containerInstance",
roles: ["客户"]
},
children: [
{
path: "index",
component: () => import("@/views/customer/containerInstance"),
name: "ContainerInstance",
meta: {
title: "容器实例",
fullPath: "/containerInstance/index",
roles: ["客户"]
}
}
]
},
// {
// path: "/containerInstance",
// component: Layout,
// redirect: "/containerInstance/index",
// meta: {
// title: "容器实例",
// icon: "el-icon-box",
// noCache: true,
// fullPath: "/containerInstance",
// roles: ["客户"]
// },
// children: [
// {
// path: "index",
// component: () => import("@/views/customer/containerInstance"),
// name: "ContainerInstance",
// meta: {
// title: "容器实例",
// fullPath: "/containerInstance/index",
// roles: ["客户"]
// }
// }
// ]
// },
// 退订管理 - 变为一级菜单(包含子菜单)

View File

@ -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);

View File

@ -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) {

View File

@ -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,
@ -313,7 +314,7 @@ export default Vue.extend({
return orgType !== '2' && orgType !== '3' && userId === null
},
isNcmatchDomain() {
return window.location.hostname.includes('ncmatch.cn')
return window.location.hostname.includes('ncmatch.cn') || window.location.hostname.includes('zgcopc.opencomputing.cn')
},
isActiveHome() {
return this.isNcmatchDomain
@ -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')

View File

@ -1,6 +1,6 @@
<template>
<div class="product-service-page" :class="{ 'single-product-page': isSinglePageMode }">
x
<!-- 产品分类导航 -->
<div v-if="!isSinglePageMode" class="category-nav">
<div v-for="category in panelData"
@ -118,12 +118,11 @@
<div class="token-card-top">
<span class="token-provider-avatar">
<img
v-if="product.model_logo && !product.logoLoadFailed"
:src="getModelLogoUrl(product.model_logo)"
alt=""
:src="product.model_logo"
alt="模型logo"
@error="handleModelLogoError(product)"
>
<span v-else>{{ getProviderInitial(product.provider || product.display_name || product.model_name) }}</span>
</span>
<div class="token-title-group">