更新 #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'), component: () => import('@/views/product/charge/index.vue'),
hidden: true 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', path: '/kyyForm',
name: 'kyyForm', name: 'kyyForm',
@ -653,6 +666,17 @@ export const asyncRoutes = [
noCache: true 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", // path: "/containerInstance",
component: Layout, // component: Layout,
redirect: "/containerInstance/index", // redirect: "/containerInstance/index",
meta: { // meta: {
title: "容器实例", // title: "容器实例",
icon: "el-icon-box", // icon: "el-icon-box",
noCache: true, // noCache: true,
fullPath: "/containerInstance", // fullPath: "/containerInstance",
roles: ["客户"] // roles: ["客户"]
}, // },
children: [ // children: [
{ // {
path: "index", // path: "index",
component: () => import("@/views/customer/containerInstance"), // component: () => import("@/views/customer/containerInstance"),
name: "ContainerInstance", // name: "ContainerInstance",
meta: { // meta: {
title: "容器实例", // title: "容器实例",
fullPath: "/containerInstance/index", // fullPath: "/containerInstance/index",
roles: ["客户"] // roles: ["客户"]
} // }
} // }
] // ]
}, // },
// 退订管理 - 变为一级菜单(包含子菜单) // 退订管理 - 变为一级菜单(包含子菜单)

View File

@ -370,7 +370,8 @@ function getAdministratorRoutes(routes, deviceType = 'pc') {
} }
function addAdministratorRoutes(accessedRoutes, routes, userRoles = [], 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; return accessedRoutes;
} }
@ -522,7 +523,7 @@ const actions = {
console.log("用户类型:", userType, "orgType:", orgType, "设备类型:", deviceType); console.log("用户类型:", userType, "orgType:", orgType, "设备类型:", deviceType);
console.log("ACTION generateRoutes - auths:", auths); 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); const administratorRoutes = getAdministratorRoutes(asyncRoutes, deviceType);
commit("SET_ROUTES", administratorRoutes); commit("SET_ROUTES", administratorRoutes);
resolve(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) { 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('管理员')) { if (res.roles && res.roles.includes('管理员')) {
sessionStorage.removeItem('loginRedirectPath') sessionStorage.removeItem('loginRedirectPath')
this.$router.push('/superAdministrator/roleManagement').catch(() => {}) this.goAfterLogin('/superAdministrator/roleManagement')
return return
} }
const redirectPath = sessionStorage.getItem('loginRedirectPath') const redirectPath = sessionStorage.getItem('loginRedirectPath')
if (redirectPath && redirectPath.startsWith('/') && !redirectPath.includes('/login')) { if (redirectPath && redirectPath.startsWith('/') && !redirectPath.includes('/login')) {
sessionStorage.removeItem('loginRedirectPath') sessionStorage.removeItem('loginRedirectPath')
this.$router.push(redirectPath).catch(() => {}) this.goAfterLogin(redirectPath)
return return
} }
if (res.admin === 1) this.$router.push('/').catch(() => {}) if (res.roles && res.roles.includes('运营')) this.goAfterLogin('/operation/supplierManagement')
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.goAfterLogin('/sales/distributorManagement')
else if (res.roles && res.roles.includes('运营')) this.$router.push('/operation/supplierManagement').catch(() => {}) else if (res.roles && res.roles.includes('运维')) this.goAfterLogin('/operationAndMaintenance/workOrderProcessing')
else if (res.roles && res.roles.includes('销售')) this.$router.push('/sales/distributorManagement').catch(() => {}) else this.goAfterLogin('/')
else if (res.roles && res.roles.includes('运维')) this.$router.push('/operationAndMaintenance/workOrderProcessing').catch(() => {})
else this.$router.push('/').catch(() => {})
}, },
handleRegister() { handleRegister() {
if (!this.registerForm.agree) { if (!this.registerForm.agree) {

View File

@ -275,6 +275,7 @@ export default Vue.extend({
activeLocale: 'zh-CN', activeLocale: 'zh-CN',
isProductPanelVisible: false, isProductPanelVisible: false,
loginDialogVisible: false, loginDialogVisible: false,
consoleRoutesEnsured: false,
// //
isShowKbossCharge: false, isShowKbossCharge: false,
@ -296,7 +297,7 @@ export default Vue.extend({
} }
}, },
computed: { computed: {
...mapGetters(['sidebar', 'avatar', 'device']), ...mapGetters(['sidebar', 'avatar', 'device', 'permission_routes']),
...mapState({ ...mapState({
mybalance: state => state.user.mybalance, mybalance: state => state.user.mybalance,
logoutUrl: state => state.login.logoutUrl, logoutUrl: state => state.login.logoutUrl,
@ -313,7 +314,7 @@ export default Vue.extend({
return orgType !== '2' && orgType !== '3' && userId === null return orgType !== '2' && orgType !== '3' && userId === null
}, },
isNcmatchDomain() { isNcmatchDomain() {
return window.location.hostname.includes('ncmatch.cn') return window.location.hostname.includes('ncmatch.cn') || window.location.hostname.includes('zgcopc.opencomputing.cn')
}, },
isActiveHome() { isActiveHome() {
return this.isNcmatchDomain return this.isNcmatchDomain
@ -519,6 +520,7 @@ export default Vue.extend({
this.loginDialogVisible = false this.loginDialogVisible = false
this.nick_name = sessionStorage.getItem('username') || '' this.nick_name = sessionStorage.getItem('username') || ''
this.userId = sessionStorage.getItem('userId') this.userId = sessionStorage.getItem('userId')
this.consoleRoutesEnsured = false
}, },
goLogin() { goLogin() {
this.openLoginDialog() this.openLoginDialog()
@ -537,9 +539,35 @@ export default Vue.extend({
handleUnreadCountUpdate(count) { handleUnreadCountUpdate(count) {
this.messageCount = 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') || '' 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('/operation/supplierManagement')
else if (role.includes('运维')) this.$router.push('/operationAndMaintenance/workOrderProcessing') else if (role.includes('运维')) this.$router.push('/operationAndMaintenance/workOrderProcessing')
else if (role.includes('销售')) this.$router.push('/sales/distributorManagement') else if (role.includes('销售')) this.$router.push('/sales/distributorManagement')

View File

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