1272 lines
39 KiB
Vue
1272 lines
39 KiB
Vue
<template>
|
||
<div class="top-nav">
|
||
<!-- 顶部容器 -->
|
||
<div id="topContainer" class="container">
|
||
<!-- 统一显示logo和导航 -->
|
||
<div class="logo">
|
||
<!-- Logo图片,点击跳转首页 -->
|
||
<img v-if="JSON.stringify(logoInfoNew) !== '{}'" @click="$router.push(homePath)" style="cursor:pointer;"
|
||
class="logoImg" :src="logoInfoNew.home.logoImg || ''" alt="">
|
||
|
||
<!-- 主导航菜单 -->
|
||
<nav class="main-nav">
|
||
<div class="nav-list">
|
||
<!-- 首页 -->
|
||
<p :class="{ active: $route.path.includes('/index') }">
|
||
<!-- 动态判断域名跳转首页 -->
|
||
<a @click="goHome">{{ translations[language].home }}</a>
|
||
</p>
|
||
<!-- 产品与服务:鼠标移入显示子菜单 -->
|
||
<p @mouseleave="sildeOut" @mouseenter="sildeIn(product_service)">
|
||
<a>{{ translations[language].ecosystem }}</a>
|
||
</p>
|
||
<!-- 供需广场 -->
|
||
<p :class="{ active: $route.path.includes('/supply') }">
|
||
<a @click="$router.push('/ncmatchHome/supplyAndDemandSquare')">{{ translations[language].supply }}</a>
|
||
</p>
|
||
<!-- 关于我们 -->
|
||
<p :class="{ active: $route.path.includes('/about') }" @mouseleave="sildeOut"
|
||
@click="$router.push('/homePage/about')">
|
||
<a>{{ translations[language].aboutUs }}</a>
|
||
</p>
|
||
</div>
|
||
</nav>
|
||
</div>
|
||
|
||
<!-- 用户区域:登录/注册按钮和用户下拉菜单 -->
|
||
<div class="user-area">
|
||
<!-- AI -->
|
||
<i class="iconfont icon-AIzhushou functions" @click="handleAIClick"></i>
|
||
<!-- 客服 -->
|
||
<i class="iconfont icon-kefu functions" @click="handleServiceClick"></i>
|
||
<!-- 控制台按钮(已登录) -->
|
||
<a @click="goB" v-if="loginState" class="login-btn">{{ translations[language].console }}</a>
|
||
<!-- 消息 -->
|
||
<i class="iconfont icon-xiaoxi functions" @click="handleMessageClick"></i>
|
||
<!-- 登录按钮(未登录) -->
|
||
<a @click="$router.push({
|
||
path: '/login',
|
||
query: {
|
||
fromPath: 'homePage'
|
||
}
|
||
})" v-if="!loginState" class="login-btn">{{ translations[language].login }}</a>
|
||
<!-- 注册按钮(未登录) -->
|
||
<a @click="$router.push('/registrationPage')" v-if="!loginState" class="register-btn">{{
|
||
translations[language].register }}</a>
|
||
|
||
<!-- 用户下拉菜单(已登录) -->
|
||
<el-dropdown v-if="loginState" @visible-change="handleShow"
|
||
class="avatar-container right-menu-item hover-effect nick-name-style" style="margin-right: 0" trigger="click">
|
||
<!-- 头像区域:添加点击事件 -->
|
||
<div class="avatar-wrapper" @click="goHome">
|
||
<i
|
||
style="font-size: 18px; color: #262626;font-weight: 400;cursor: pointer;display: flex;justify-content: flex-end;align-items: center">
|
||
<div class="imgUser"><img src="../../../../assets/image/user.png" alt=""></div>
|
||
{{ nick_name }}
|
||
<i id="resverIcon" class="el-icon-arrow-up el-icon--right resverIcon"></i>
|
||
</i>
|
||
</div>
|
||
<!-- 用户信息下拉菜单内容 -->
|
||
<el-dropdown-menu slot="dropdown" style="width: 230px;font-size: 16px;" divided>
|
||
<div style="display: flex;flex-direction: column;padding:15px 15px;background-color: #f0f2f5">
|
||
<span style="font-weight: bold;font-size: 20px;margin-bottom: 5px;color: #333333">{{ nick_name }}</span>
|
||
<span style="font-size: 12px;color:#666;display: flex;justify-content:flex-start;align-items: center"> ID:
|
||
<span ref="contentToCopy">
|
||
{{
|
||
userId
|
||
}}
|
||
</span>
|
||
<svg @click="copyBtn" class="copy-btn" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"
|
||
width="12" height="12" style="fill: #1019ab;">
|
||
<path
|
||
d="M394.666667 106.666667h448a74.666667 74.666667 0 0 1 74.666666 74.666666v448a74.666667 74.666667 0 0 1-74.666666 74.666667H394.666667a74.666667 74.666667 0 0 1-74.666667-74.666667V181.333333a74.666667 74.666667 0 0 1 74.666667-74.666666z m0 64a10.666667 10.666667 0 0 0-10.666667 10.666666v448a10.666667 10.666667 0 0 0 10.666667 10.666667h448a10.666667 10.666667 0 0 0 10.666666-10.666667V181.333333a10.666667 10.666667 0 0 0-10.666666-10.666666H394.666667z m245.333333 597.333333a32 32 0 0 1 64 0v74.666667a74.666667 74.666667 0 0 1-74.666667 74.666666H181.333333a74.666667 74.666667 0 0 1-74.666666-74.666666V394.666667a74.666667 74.666667 0 0 1 74.666666-74.666667h74.666667a32 32 0 0 1 0 64h-74.666667a10.666667 10.666667 0 0 0-10.666666 10.666667v448a10.666667 10.666667 0 0 0 10.666666 10.666666h448a10.666667 10.666667 0 0 0 10.666667-10.666666v-74.666667z"
|
||
p-id="1521"></path>
|
||
</svg>
|
||
</span>
|
||
</div>
|
||
<el-divider style="margin: 0!important;"></el-divider>
|
||
<div v-if="role.includes('客户')"
|
||
style="padding: 0 18px; width: 100%;height: 60px;display: flex;justify-content: space-between;align-items: center">
|
||
<span style="color:#666;display: block;font-size: 14px;" class="moneyNow"><span
|
||
style="display: block;margin-bottom: 5px">{{ translations[language].balance }}</span>{{
|
||
mybalance ? mybalance : initMybalance()
|
||
}} ¥</span>
|
||
<el-button v-if="!isShowKbossCharge" type="primary" @click="$router.push('/kbossCharge')" plain
|
||
style="padding: 8px; ">
|
||
{{ translations[language].recharge }}
|
||
</el-button>
|
||
</div>
|
||
<el-dropdown-item v-if="role.includes('客户')" @click.native="$router.push('/customer/customerInformation')">
|
||
<span style="display: block">{{ translations[language].personalCenter }}</span>
|
||
</el-dropdown-item>
|
||
<el-dropdown-item @click.native="logout">
|
||
<span style="display: block">{{ translations[language].logout }}</span>
|
||
</el-dropdown-item>
|
||
</el-dropdown-menu>
|
||
</el-dropdown>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- 悬浮面板 -->
|
||
<div @mouseleave="sildeOut" @mouseenter="keepPanel" v-show="isShowPanel" class="panel">
|
||
<div class="inPanel">
|
||
<div class="panelLeft">
|
||
<ul class="outUl">
|
||
<li style="cursor: default" class="outLi" v-for="item in showPanelData" :key="item.firTitle">
|
||
<span style="cursor: default!important;" :class="['tilte', 'activeFir']">
|
||
{{
|
||
getTranslation(item.firTitle)
|
||
}}
|
||
</span>
|
||
<ul class="inUl">
|
||
<li class="inLi" v-for="i in item.secMenu" :key="i.id">
|
||
<span style="position: relative" @mouseenter="sildeSecMenu(i)"
|
||
:class="['twoMenuStyle', secId === i.id ? 'activeSec' : '']">{{ getTranslation(i.secTitle) }}</span>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
<span class="ge"></span>
|
||
<div
|
||
v-if="secMenuData.length > 0 && secMenuData[0].thrMenu && secMenuData[0].thrMenu.length > 0 && secMenuData[0].thrMenu[0].thrTitle != null && secMenuData[0].secTitle !== secMenuData[0].thrMenu[0].thrTitle"
|
||
class="panelLeft">
|
||
<ul>
|
||
<li style="font-size: 14px!important;" @mouseenter="sildeThrMenu(thr)" v-for="(thr, index) in threeData"
|
||
:key="index">
|
||
{{ getTranslation(thr.thrTitle) }}
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
<span
|
||
v-if="secMenuData.length > 0 && secMenuData[0].thrMenu && secMenuData[0].thrMenu.length > 0 && secMenuData[0].thrMenu[0].thrTitle != null && secMenuData[0].secTitle !== secMenuData[0].thrMenu[0].thrTitle"
|
||
class="ge"></span>
|
||
<div class="panelRight"
|
||
v-if="showPanelRightData.length > 0 && showPanelRightData[0] && showPanelRightData[0].value">
|
||
<ul class="leastMenu inBox">
|
||
<li class="clickItem" style="font-size: 14px!important;margin: 8px 0;cursor: pointer"
|
||
v-for="itemR in showPanelRightData[0].value" :key="itemR.id" @click="clickGo(itemR)">
|
||
{{ getTranslation(itemR.name) }} <span v-if="itemR.discount" class="zhe">{{
|
||
itemR.discount }}折</span>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
<div class="panelRight" v-else>
|
||
<div style="text-align: center; color: #999; padding: 20px;">
|
||
{{ translations[language].noData }}
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- 消息中心组件 -->
|
||
<message-center
|
||
ref="messageCenter"
|
||
:visible.sync="messageCenterVisible"
|
||
:userId="userId"
|
||
@unread-count-update="handleUnreadCountUpdate"
|
||
/>
|
||
</div>
|
||
</template>
|
||
|
||
<script>
|
||
import Vue from 'vue'
|
||
import { computingData, networkData, storageData, testData } from "@/views/homePage/components/topBox/testData";
|
||
import { reqNavList, reqNewHomeFestival, reqNewHomeSync } from "@/api/newHome";
|
||
import { mapGetters, mapState } from "vuex";
|
||
import { getLogoAPI, getUserInfoAPI } from "@/api/login";
|
||
import { reqApplyChannel } from "@/api/customer/channel";
|
||
import store from "@/store";
|
||
import { getHomePath } from '@/views/setting/tools'
|
||
import { languageStore, languageBus } from '@/utils/language'
|
||
import MessageCenter from '@/components/MessageCenter/MessageCenter.vue'
|
||
|
||
export default Vue.extend({
|
||
name: "TopBox",
|
||
components: {
|
||
MessageCenter
|
||
},
|
||
data() {
|
||
return {
|
||
messageCenterVisible: false,
|
||
homePath: getHomePath(),
|
||
isShowKbossCharge: false,
|
||
role: sessionStorage.getItem("jueseNew") == "admin" ? [] : sessionStorage.getItem("jueseNew"),
|
||
userId: sessionStorage.getItem("userId"),
|
||
firId: "",
|
||
secId: "",
|
||
nick_name: "",
|
||
showTimer: null,
|
||
hideTimer: null,
|
||
showPanelData: [],
|
||
secMenuData: [],
|
||
showPanelRightData: [],
|
||
threeData: [],
|
||
fourData: [],
|
||
product_service: [],
|
||
language: 'zh',
|
||
languageChangedHandler: null,
|
||
messageCount: 0,
|
||
translations: {
|
||
zh: {
|
||
home: '首页',
|
||
ecosystem: '产品与服务',
|
||
supply: '供需广场',
|
||
aboutUs: '关于我们',
|
||
balance: '余额',
|
||
recharge: '充值',
|
||
personalCenter: '个人中心',
|
||
logout: '退出登录',
|
||
searchPlaceholder: '搜索',
|
||
console: '控制台',
|
||
login: '登录',
|
||
register: '立即注册',
|
||
noData: '暂无数据',
|
||
aiAssistant: 'AI助手',
|
||
customerService: '在线客服',
|
||
featureComingSoon: '功能即将上线,敬请期待!',
|
||
'云': '云',
|
||
'算': '算',
|
||
'网': '网',
|
||
'用': '用',
|
||
'百度云': '百度云',
|
||
'智算': '智算',
|
||
'算力网络': '算力网络',
|
||
'AI应用': 'AI应用',
|
||
'计算': '计算',
|
||
'网络': '网络',
|
||
'存储': '存储',
|
||
'数据库': '数据库',
|
||
'泛CDN': '泛CDN',
|
||
'AI能力引擎': 'AI能力引擎',
|
||
'云与业务安全': '云与业务安全',
|
||
'大数据平台': '大数据平台',
|
||
'云原生平台': '云原生平台',
|
||
'智能内容科技': '智能内容科技',
|
||
'SME企业服务': 'SME企业服务',
|
||
'视频云平台': '视频云平台',
|
||
'智能短信': '智能短信',
|
||
'智慧医疗': '智慧医疗',
|
||
'智慧客服': '智慧客服',
|
||
'云服务器_GPU': '云服务器_GPU',
|
||
'云服务器_BCC': '云服务器_BCC',
|
||
'专属服务器': '专属服务器',
|
||
'轻量应用服务器': '轻量应用服务器',
|
||
'专线接入': '专线接入',
|
||
'对等连接': '对等连接',
|
||
'智能云解析': '智能云解析',
|
||
'弹性公网IP': '弹性公网IP',
|
||
'IPv6公网网关': 'IPv6公网网关',
|
||
'共享带宽': '共享带宽',
|
||
'NAT网关': 'NAT网关',
|
||
'智能流量管理': '智能流量管理',
|
||
'EIP带宽包': 'EIP带宽包',
|
||
'VPN网关': 'VPN网关',
|
||
'服务网卡': '服务网卡',
|
||
'云智能网': '云智能网',
|
||
'负载均衡': '负载均衡',
|
||
'文件存储': '文件存储',
|
||
'对象存储': '对象存储',
|
||
'云磁盘': '云磁盘',
|
||
'内容分发网络': '内容分发网络',
|
||
'数据可视化私有化': '数据可视化私有化',
|
||
'消息服务 for Kafka': '消息服务 for Kafka',
|
||
'云数据库RDS': '云数据库RDS',
|
||
'MapReduce': 'MapReduce',
|
||
'云数据库SCS for Redis': '云数据库SCS for Redis',
|
||
'云数据库HBase': '云数据库HBase',
|
||
'云数据库DocDB for MongoDB': '云数据库DocDB for MongoDB',
|
||
'数据传输服务': '数据传输服务',
|
||
'音视频直播': '音视频直播',
|
||
'动态加速': '动态加速',
|
||
'文字识别': '文字识别',
|
||
'语音能力引擎': '语音能力引擎',
|
||
'自然语言处理': '自然语言处理',
|
||
'图像识别': '图像识别',
|
||
'图像搜索': '图像搜索',
|
||
'卡证识别': '卡证识别',
|
||
'图像增强与特效': '图像增强与特效',
|
||
'人脸识别': '人脸识别',
|
||
'机器翻译': '机器翻译',
|
||
'密钥管理服务': '密钥管理服务',
|
||
'主机安全': '主机安全',
|
||
'云防火墙': '云防火墙',
|
||
'应用防火墙': '应用防火墙',
|
||
'入侵检测系统': '入侵检测系统',
|
||
'云堡垒机': '云堡垒机',
|
||
'DDoS防护服务': 'DDoS防护服务',
|
||
'实时音视频': '实时音视频',
|
||
'音视频处理': '音视频处理',
|
||
'Elasticsearch': 'Elasticsearch',
|
||
'数据仓库DORIS': '数据仓库DORIS',
|
||
'商标知产服务': '商标知产服务',
|
||
'容器引擎': '容器引擎',
|
||
'工商财税服务': '工商财税服务',
|
||
'媒体内容分析': '媒体内容分析',
|
||
'备案服务': '备案服务',
|
||
'智能门户': '智能门户',
|
||
'容器镜像服务': '容器镜像服务',
|
||
'域名服务': '域名服务',
|
||
'简单消息服务': '简单消息服务',
|
||
'容器云': '容器云',
|
||
'裸金属': '裸金属',
|
||
'一体机-昆仑芯': '一体机-昆仑芯',
|
||
'一体机-天数智芯': '一体机-天数智芯',
|
||
'互联网专线': '互联网专线',
|
||
'SDWAN': 'SDWAN',
|
||
'DCI': 'DCI',
|
||
'AI专线': 'AI专线',
|
||
'灵医智能体': '灵医智能体',
|
||
'客悦·智能客服': '客悦·智能客服'
|
||
},
|
||
en: {
|
||
home: 'Home',
|
||
ecosystem: 'Products & Services',
|
||
supply: 'Supply',
|
||
aboutUs: 'About Us',
|
||
balance: 'Balance',
|
||
recharge: 'Recharge',
|
||
personalCenter: 'Personal Center',
|
||
logout: 'Logout',
|
||
searchPlaceholder: 'Search',
|
||
console: 'Console',
|
||
login: 'Login',
|
||
register: 'Register Now',
|
||
noData: 'No Data',
|
||
aiAssistant: 'AI Assistant',
|
||
customerService: 'Customer Service',
|
||
featureComingSoon: 'Feature coming soon, stay tuned!',
|
||
'云': 'Cloud',
|
||
'算': 'Computing',
|
||
'网': 'Network',
|
||
'用': 'Application',
|
||
'百度云': 'Baidu Cloud',
|
||
'智算': 'Intelligent Computing',
|
||
'算力网络': 'Computing Power Network',
|
||
'AI应用': 'AI Application',
|
||
'计算': 'Compute',
|
||
'网络': 'Network',
|
||
'存储': 'Storage',
|
||
'数据库': 'Database',
|
||
'泛CDN': 'CDN',
|
||
'AI能力引擎': 'AI Engine',
|
||
'云与业务安全': 'Cloud & Business Security',
|
||
'大数据平台': 'Big Data Platform',
|
||
'云原生平台': 'Cloud Native Platform',
|
||
'智能内容科技': 'Intelligent Content Tech',
|
||
'SME企业服务': 'SME Enterprise Service',
|
||
'视频云平台': 'Video Cloud Platform',
|
||
'智能短信': 'Smart SMS',
|
||
'智慧医疗': 'Smart Healthcare',
|
||
'智慧客服': 'Smart Customer Service',
|
||
'云服务器_GPU': 'Cloud Server GPU',
|
||
'云服务器_BCC': 'Cloud Server BCC',
|
||
'专属服务器': 'Dedicated Server',
|
||
'轻量应用服务器': 'Lightweight App Server',
|
||
'专线接入': 'Direct Connect',
|
||
'对等连接': 'Peer Connection',
|
||
'智能云解析': 'Smart Cloud DNS',
|
||
'弹性公网IP': 'Elastic Public IP',
|
||
'IPv6公网网关': 'IPv6 Public Gateway',
|
||
'共享带宽': 'Shared Bandwidth',
|
||
'NAT网关': 'NAT Gateway',
|
||
'智能流量管理': 'Smart Traffic Management',
|
||
'EIP带宽包': 'EIP Bandwidth Package',
|
||
'VPN网关': 'VPN Gateway',
|
||
'服务网卡': 'Service Network Card',
|
||
'云智能网': 'Cloud Smart Network',
|
||
'负载均衡': 'Load Balancer',
|
||
'文件存储': 'File Storage',
|
||
'对象存储': 'Object Storage',
|
||
'云磁盘': 'Cloud Disk',
|
||
'内容分发网络': 'Content Delivery Network',
|
||
'数据可视化私有化': 'Data Visualization Private',
|
||
'消息服务 for Kafka': 'Message Service for Kafka',
|
||
'云数据库RDS': 'Cloud Database RDS',
|
||
'MapReduce': 'MapReduce',
|
||
'云数据库SCS for Redis': 'Cloud Database SCS for Redis',
|
||
'云数据库HBase': 'Cloud Database HBase',
|
||
'云数据库DocDB for MongoDB': 'Cloud Database DocDB for MongoDB',
|
||
'数据传输服务': 'Data Transfer Service',
|
||
'音视频直播': 'Audio/Video Live',
|
||
'动态加速': 'Dynamic Acceleration',
|
||
'文字识别': 'Text Recognition',
|
||
'语音能力引擎': 'Speech Engine',
|
||
'自然语言处理': 'Natural Language Processing',
|
||
'图像识别': 'Image Recognition',
|
||
'图像搜索': 'Image Search',
|
||
'卡证识别': 'Card/Certificate Recognition',
|
||
'图像增强与特效': 'Image Enhancement & Effects',
|
||
'人脸识别': 'Face Recognition',
|
||
'机器翻译': 'Machine Translation',
|
||
'密钥管理服务': 'Key Management Service',
|
||
'主机安全': 'Host Security',
|
||
'云防火墙': 'Cloud Firewall',
|
||
'应用防火墙': 'Application Firewall',
|
||
'入侵检测系统': 'Intrusion Detection System',
|
||
'云堡垒机': 'Cloud Bastion Host',
|
||
'DDoS防护服务': 'DDoS Protection Service',
|
||
'实时音视频': 'Real-time Audio/Video',
|
||
'音视频处理': 'Audio/Video Processing',
|
||
'Elasticsearch': 'Elasticsearch',
|
||
'数据仓库DORIS': 'Data Warehouse DORIS',
|
||
'商标知产服务': 'Trademark & IP Service',
|
||
'容器引擎': 'Container Engine',
|
||
'工商财税服务': 'Business & Tax Service',
|
||
'媒体内容分析': 'Media Content Analysis',
|
||
'备案服务': 'Filing Service',
|
||
'智能门户': 'Smart Portal',
|
||
'容器镜像服务': 'Container Image Service',
|
||
'域名服务': 'Domain Name Service',
|
||
'简单消息服务': 'Simple Message Service',
|
||
'容器云': 'Container Cloud',
|
||
'裸金属': 'Bare Metal',
|
||
'一体机-昆仑芯': 'All-in-One Kunlun Chip',
|
||
'一体机-天数智芯': 'All-in-One Days Chip',
|
||
'互联网专线': 'Internet Leased Line',
|
||
'SDWAN': 'SDWAN',
|
||
'DCI': 'DCI',
|
||
'AI专线': 'AI Leased Line',
|
||
'灵医智能体': 'LingYi Medical AI',
|
||
'客悦·智能客服': 'KeYue Smart Customer Service'
|
||
}
|
||
}
|
||
}
|
||
},
|
||
created() {
|
||
this.homePath = getHomePath()
|
||
if (sessionStorage.getItem('userId')) {
|
||
this.$store.commit('setLoginState', true);
|
||
}
|
||
!this.showRegisterButton && this.getUserInfo();
|
||
this.init()
|
||
this.initLanguage()
|
||
this.initData()
|
||
},
|
||
mounted() {
|
||
if (sessionStorage.getItem("username")) {
|
||
this.nick_name = sessionStorage.getItem("username");
|
||
}
|
||
this.$nextTick(() => {
|
||
const topContainer = document.getElementById('topContainer');
|
||
if (topContainer) {
|
||
topContainer.scrollIntoView({
|
||
behavior: 'smooth',
|
||
block: 'start'
|
||
});
|
||
}
|
||
});
|
||
},
|
||
beforeDestroy() {
|
||
if (this.languageChangedHandler) {
|
||
languageBus.$off('language-changed', this.languageChangedHandler)
|
||
}
|
||
},
|
||
computed: {
|
||
...mapGetters(["sidebar", "avatar", "device"]),
|
||
...mapState({
|
||
isShowPanel: (state) => state.product.showHomeNav,
|
||
navIndex: (state) => state.product.navIndex,
|
||
gridObj: state => state.operationAnalysis.gridObj,
|
||
mybalance: state => state.user.mybalance,
|
||
logoutUrl: state => state.login.logoutUrl,
|
||
loginStateVuex: state => state.login.loginState,
|
||
logoInfoNew: state => state.product.logoInfoNew,
|
||
}),
|
||
loginState() {
|
||
const userId = sessionStorage.getItem('userId');
|
||
return this.loginStateVuex || (userId !== null && userId !== 'null' && userId !== '');
|
||
},
|
||
showRegisterButton() {
|
||
const orgType = window.sessionStorage.getItem('org_type');
|
||
const userId = window.sessionStorage.getItem('userId');
|
||
return orgType !== '2' && orgType !== '3' && userId === null;
|
||
},
|
||
username() {
|
||
return sessionStorage.getItem('username') || '';
|
||
},
|
||
// 判断当前是否为ncmatch.cn域名
|
||
isNcmatchDomain() {
|
||
return window.location.hostname.includes('ncmatch.cn');
|
||
}
|
||
},
|
||
methods: {
|
||
// 处理AI助手点击
|
||
handleAIClick() {
|
||
this.$message.info({
|
||
message: this.translations[this.language].featureComingSoon,
|
||
duration: 3000,
|
||
showClose: true
|
||
});
|
||
},
|
||
|
||
// 处理客服点击
|
||
handleServiceClick() {
|
||
this.$message.info({
|
||
message: this.translations[this.language].featureComingSoon,
|
||
duration: 3000,
|
||
showClose: true
|
||
});
|
||
},
|
||
|
||
// 处理消息图标点击
|
||
handleMessageClick() {
|
||
if (this.loginState) {
|
||
this.messageCenterVisible = true;
|
||
if (this.$refs.messageCenter) {
|
||
this.$refs.messageCenter.open();
|
||
}
|
||
} else {
|
||
this.handleGoLogin()
|
||
}
|
||
},
|
||
|
||
// 处理未读消息数量更新
|
||
handleUnreadCountUpdate(count) {
|
||
this.messageCount = count;
|
||
},
|
||
|
||
// 初始化语言状态
|
||
initLanguage() {
|
||
this.language = languageStore.getLanguage()
|
||
this.languageChangedHandler = (lang) => {
|
||
this.language = lang
|
||
}
|
||
languageBus.$on('language-changed', this.languageChangedHandler)
|
||
},
|
||
|
||
// 切换语言
|
||
toggleLanguage() {
|
||
const newLanguage = this.language === 'zh' ? 'en' : 'zh';
|
||
languageStore.setLanguage(newLanguage);
|
||
},
|
||
|
||
// 获取翻译文本
|
||
getTranslation(key) {
|
||
if (!key) return ''
|
||
return this.translations[this.language]?.[key] || key
|
||
},
|
||
|
||
// 控制台按钮点击事件
|
||
goB() {
|
||
if (sessionStorage.getItem('jueseNew').includes('客户')) {
|
||
this.$router.push('/product/productHome')
|
||
} else if (sessionStorage.getItem('jueseNew').includes('运营')) {
|
||
this.$router.push('/operation/supplierManagement')
|
||
}
|
||
},
|
||
|
||
// 初始化Logo信息
|
||
init() {
|
||
let remoteUrl = ''
|
||
if (window.location.href.includes("dev")) {
|
||
remoteUrl = 'https://www.kaiyuancloud.cn/dev/reseller/get_ipc_logo.dspy'
|
||
} else if (window.location.href.includes("localhost")) {
|
||
remoteUrl = 'http://localhost:9527/'
|
||
} else {
|
||
remoteUrl = 'https://www.kaiyuancloud.cn/reseller/get_ipc_logo.dspy'
|
||
}
|
||
|
||
let params = {
|
||
url_link: window.location.href.split("#")[0]
|
||
}
|
||
getLogoAPI(params).then((res) => {
|
||
if (res.status == true && res.data && res.data.length) {
|
||
this.$store.commit('setLogoInfoNew', res.data[0].additional_msg);
|
||
this.isShow = true
|
||
if (res.data[0].orgname == '中关村数智人工智能产业联盟') {
|
||
this.logoUrlOut = 'https://www.ncmatch.cn'
|
||
}
|
||
|
||
this.photosUrl = res.data[0];
|
||
if (this.photosUrl.orgname != '业主机构') {
|
||
this.isLogo = true
|
||
this.logoImg = this.photosUrl.logo;
|
||
this.$store.commit('setLogo', this.photosUrl.logo)
|
||
this.logoText = this.photosUrl.orgname;
|
||
} else {
|
||
this.$store.commit('setLogo', "")
|
||
}
|
||
} else {
|
||
this.$message({
|
||
message: "获取ipc失败~",
|
||
type: "error",
|
||
});
|
||
}
|
||
});
|
||
},
|
||
|
||
// 退出登录
|
||
async logout() {
|
||
this.$store.commit('setLoginState', false)
|
||
store.commit('tagsView/resetBreadcrumbState');
|
||
sessionStorage.removeItem("auths");
|
||
sessionStorage.removeItem("routes");
|
||
sessionStorage.removeItem("user");
|
||
sessionStorage.removeItem("userId");
|
||
sessionStorage.removeItem("org_type")
|
||
localStorage.removeItem("auths");
|
||
localStorage.removeItem("routes");
|
||
localStorage.removeItem("user");
|
||
localStorage.removeItem("userId");
|
||
localStorage.removeItem("org_type")
|
||
localStorage.removeItem('userId')
|
||
if (!window.location.href.includes('homePage/index')) {
|
||
await this.$router.push(getHomePath());
|
||
}
|
||
},
|
||
|
||
// 修改密码
|
||
edituserPassword() {
|
||
this.passwordDialog = true;
|
||
},
|
||
|
||
// 申请渠道管理
|
||
channelFirstBtn() {
|
||
reqApplyChannel({ user_id: this.userId }).then(res => {
|
||
if (res.code == "100" || res.code == "210") {
|
||
this.$message.success(res.msg)
|
||
} else if (res.code == "300") {
|
||
this.channelManagementShow = true
|
||
} else if (res.code == "200") {
|
||
this.$router.push('/customer/channelMangement')
|
||
}
|
||
})
|
||
},
|
||
|
||
// 初始化余额
|
||
initMybalance() {
|
||
return sessionStorage.getItem('mybalance')
|
||
},
|
||
|
||
// 复制用户ID
|
||
copyBtn() {
|
||
const textToCopy = this.$refs.contentToCopy.innerText;
|
||
navigator.clipboard.writeText(textToCopy).then(() => {
|
||
this.$message.success('复制成功!')
|
||
}).catch((error) => {
|
||
console.error('复制失败', error);
|
||
});
|
||
},
|
||
|
||
// 获取用户信息
|
||
async getUserInfo() {
|
||
if (!this.userId) return;
|
||
getUserInfoAPI({ id: this.userId }).then((res) => {
|
||
if (res.status) {
|
||
this.userInfoList = res.data;
|
||
sessionStorage.setItem("orgid", res.data[0].orgid);
|
||
} else {
|
||
this.$message({
|
||
message: res.msg,
|
||
type: "error",
|
||
});
|
||
}
|
||
});
|
||
},
|
||
|
||
// 处理下拉菜单显示/隐藏时的图标旋转
|
||
handleShow(isShow) {
|
||
let resverNode = document.getElementById('resverIcon')
|
||
if (isShow) {
|
||
if (this.role.includes('客户')) {
|
||
this.$store.dispatch('user/getCustmoersMoney')
|
||
}
|
||
resverNode.style.transform = 'rotate(180deg)'
|
||
} else {
|
||
resverNode.style.transform = 'rotate(0)'
|
||
}
|
||
},
|
||
|
||
// 鼠标进入三级菜单项
|
||
sildeThrMenu(item) {
|
||
let res = []
|
||
res.push(item)
|
||
this.showPanelRightData = res
|
||
},
|
||
|
||
// 点击菜单项进行跳转或打开新窗口
|
||
clickGo(item) {
|
||
this.$store.commit('setShowHomeNav', false)
|
||
let userId = sessionStorage.getItem('userId')
|
||
const orgType = window.sessionStorage.getItem('org_type');
|
||
let isKehu = orgType === '2' || orgType === '3';
|
||
if (item.type === '百度云') {
|
||
if (this.loginState) {
|
||
this.$store.commit('setRedirectUrl', item.url)
|
||
localStorage.setItem('redirectUrl', item.url)
|
||
localStorage.setItem('userRescourseUrl', item.listUrl)
|
||
this.$router.push({
|
||
name: 'baiduProductShow',
|
||
params: {
|
||
listUrl: item.listUrl,
|
||
url: item.url
|
||
}
|
||
})
|
||
} else {
|
||
this.$router.push({
|
||
path: "/login",
|
||
query: {
|
||
fromPath: 'homePage',
|
||
type: 'bd',
|
||
listUrl: item.listUrl,
|
||
url: item.url
|
||
}
|
||
})
|
||
}
|
||
} else if (item.type === '阿里云') {
|
||
if (this.loginState) {
|
||
reqNewHomeSync().then(response => {
|
||
if (response.status) {
|
||
reqNewHomeFestival().then(res => {
|
||
if (res.status) {
|
||
window.open(res.data)
|
||
} else {
|
||
this.$message.warning(res.msg)
|
||
}
|
||
})
|
||
} else {
|
||
this.$message.warning(response.msg)
|
||
}
|
||
})
|
||
} else {
|
||
this.$router.push({
|
||
path: "/login",
|
||
query: {
|
||
fromPath: 'homePage',
|
||
type: 'ali',
|
||
}
|
||
})
|
||
}
|
||
} else if (item.type === '智算' || item.type === '算力网络') {
|
||
if (item.name === '容器云') {
|
||
if (this.loginState) {
|
||
this.$router.push('/product/productHome/k8s/createK8s')
|
||
} else {
|
||
this.$router.push({
|
||
path: "/login",
|
||
query: {
|
||
fromPath: 'homePage',
|
||
type: 'rqy',
|
||
}
|
||
})
|
||
}
|
||
} else {
|
||
this.$router.push({
|
||
path: '/homePage/detail',
|
||
query: {
|
||
id: item.id,
|
||
}
|
||
})
|
||
}
|
||
} else if (item.name === '灵医智能体') {
|
||
this.$router.push('/homePage/hospital')
|
||
} else if (item.name === '客悦·智能客服') {
|
||
this.$router.push('/homePage/customerService')
|
||
}
|
||
},
|
||
|
||
// 改变面板数据
|
||
changeData(data) {
|
||
this.showPanelData = data || []
|
||
this.secMenuData = data?.[0]?.secMenu || []
|
||
if (this.secMenuData.length > 0) {
|
||
const firstSecMenu = this.secMenuData[0]
|
||
this.threeData = firstSecMenu.thrMenu || []
|
||
if (this.threeData.length > 0) {
|
||
this.showPanelRightData = this.threeData.map(item => ({
|
||
...item,
|
||
thrTitle: item.thrTitle || firstSecMenu.secTitle
|
||
}))
|
||
} else {
|
||
this.showPanelRightData = [{
|
||
thrTitle: firstSecMenu.secTitle,
|
||
value: []
|
||
}]
|
||
}
|
||
} else {
|
||
this.threeData = []
|
||
this.showPanelRightData = []
|
||
}
|
||
},
|
||
|
||
// 初始化导航数据
|
||
initData() {
|
||
reqNavList({ url_link: window.location.href }).then(res => {
|
||
if (res.status) {
|
||
this.product_service = this.buildData(res.data.product_service)
|
||
this.changeData(this.product_service)
|
||
}
|
||
}).catch(error => {
|
||
console.error("获取导航数据失败:", error)
|
||
this.product_service = []
|
||
this.changeData([])
|
||
})
|
||
},
|
||
|
||
// 构建导航数据结构
|
||
buildData(data) {
|
||
let res = [];
|
||
data.forEach(item => {
|
||
if (item.secMenu && Array.isArray(item.secMenu)) {
|
||
item.secMenu.forEach(secItem => {
|
||
if (secItem.thrMenu && Array.isArray(secItem.thrMenu)) {
|
||
secItem.thrMenu.forEach(thrItem => {
|
||
if (thrItem.value && Array.isArray(thrItem.value)) {
|
||
thrItem.value.forEach(valueItem => {
|
||
valueItem.type = secItem.secTitle;
|
||
});
|
||
}
|
||
});
|
||
}
|
||
});
|
||
}
|
||
});
|
||
return data;
|
||
},
|
||
|
||
// 鼠标进入二级菜单项
|
||
sildeSecMenu(item) {
|
||
this.secId = item.id
|
||
if (!item.thrMenu || item.thrMenu.length === 0) {
|
||
this.threeData = []
|
||
this.showPanelRightData = [{
|
||
thrTitle: item.secTitle,
|
||
value: []
|
||
}]
|
||
return
|
||
}
|
||
this.threeData = item.thrMenu.map(menu => ({
|
||
...menu,
|
||
thrTitle: menu.thrTitle || item.secTitle
|
||
}))
|
||
this.showPanelRightData = this.threeData
|
||
},
|
||
|
||
// 返回测试数据
|
||
networkData() {
|
||
return networkData
|
||
},
|
||
storageData() {
|
||
return storageData
|
||
},
|
||
testData() {
|
||
return testData
|
||
},
|
||
|
||
// 鼠标进入一级菜单项
|
||
sildeItemIn(item) {
|
||
this.firId = item.id
|
||
this.secId = item.secMenu[0].id
|
||
this.secMenuData = item.secMenu || []
|
||
this.showPanelRightData = this.secMenuData[0].thrMenu || []
|
||
},
|
||
computingData() {
|
||
return computingData
|
||
},
|
||
|
||
// 鼠标进入生态与合作菜单
|
||
sildeIn(item) {
|
||
this.changeData(item)
|
||
if (this.hideTimer) {
|
||
clearTimeout(this.hideTimer)
|
||
}
|
||
this.showTimer = setTimeout(() => {
|
||
this.$store.commit('setShowHomeNav', true)
|
||
}, 100)
|
||
},
|
||
|
||
// 鼠标离开导航区域
|
||
sildeOut() {
|
||
if (this.showTimer) {
|
||
clearTimeout(this.showTimer)
|
||
}
|
||
this.hideTimer = setTimeout(() => {
|
||
this.$store.commit('setShowHomeNav', false)
|
||
}, 200)
|
||
},
|
||
|
||
// 鼠标进入面板区域,取消隐藏
|
||
keepPanel() {
|
||
if (this.hideTimer) {
|
||
clearTimeout(this.hideTimer)
|
||
}
|
||
},
|
||
|
||
// 处理登录跳转逻辑
|
||
handleGoLogin() {
|
||
let token = this.$store.getters.token;
|
||
if (!token) {
|
||
this.$message.warning('请先登录哦~');
|
||
this.$router.push({
|
||
path: '/login'
|
||
});
|
||
}
|
||
},
|
||
|
||
// 首页跳转方法
|
||
goHome() {
|
||
if (this.isNcmatchDomain) {
|
||
this.$router.push('/ncmatchHome/index');
|
||
} else {
|
||
this.$router.push('/homePage/index');
|
||
}
|
||
}
|
||
},
|
||
})
|
||
</script>
|
||
|
||
<style scoped lang="less">
|
||
.top-nav {
|
||
font-size: 18px !important;
|
||
|
||
* {
|
||
font-size: 18px !important;
|
||
}
|
||
|
||
font-weight: 500;
|
||
color: #222F60 !important;
|
||
position: relative;
|
||
background-color: #fff;
|
||
box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.08);
|
||
width: 100%;
|
||
z-index: 1000;
|
||
|
||
.container {
|
||
font-size: 18px;
|
||
width: 100%;
|
||
height: 100%;
|
||
margin: 0 auto;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
padding: 14px 20px;
|
||
}
|
||
|
||
.logo {
|
||
display: flex;
|
||
align-items: center;
|
||
|
||
.logoImg {
|
||
width: 148px;
|
||
}
|
||
}
|
||
|
||
.main-nav {
|
||
margin-left: 44px;
|
||
z-index: 10000;
|
||
|
||
.nav-list {
|
||
display: flex;
|
||
list-style: none;
|
||
margin: 0;
|
||
padding: 0;
|
||
|
||
p {
|
||
height: 100%;
|
||
padding-right: 40px;
|
||
position: relative;
|
||
|
||
a {
|
||
text-decoration: none;
|
||
font-size: 18px !important;
|
||
padding: 5px 0;
|
||
transition: all 0.3s;
|
||
|
||
&:hover {
|
||
color: #1E6FFF;
|
||
}
|
||
}
|
||
|
||
&.active a {
|
||
color: #1E6FFF;
|
||
font-weight: bold;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
.user-area {
|
||
display: flex;
|
||
align-items: center;
|
||
|
||
.search-box {
|
||
display: flex;
|
||
align-items: center;
|
||
border: 2px solid #d2d7e6;
|
||
border-radius: 8px;
|
||
padding: 8px;
|
||
|
||
input {
|
||
margin-left: 10px;
|
||
border: 0;
|
||
outline: none;
|
||
}
|
||
}
|
||
|
||
.language-toggle {
|
||
cursor: pointer;
|
||
margin-right: 20px;
|
||
text-align: center;
|
||
border-radius: 4px;
|
||
font-size: 14px;
|
||
text-decoration: none;
|
||
transition: all 0.3s;
|
||
color: #333;
|
||
z-index: 1001;
|
||
display: flex;
|
||
align-items: center;
|
||
|
||
.icon-ditu_diqiu_o {
|
||
margin-right: 5px;
|
||
font-size: 24px !important;
|
||
}
|
||
|
||
&:hover {
|
||
color: #1E6FFF;
|
||
}
|
||
}
|
||
|
||
a {
|
||
border-radius: 4px;
|
||
font-size: 14px;
|
||
text-decoration: none;
|
||
transition: all 0.3s;
|
||
}
|
||
|
||
.login-btn {
|
||
margin-right: 20px;
|
||
color: #333;
|
||
|
||
&:hover {
|
||
color: #1E6FFF;
|
||
}
|
||
}
|
||
|
||
.register-btn {
|
||
display: flex;
|
||
justify-content: center;
|
||
align-items: center;
|
||
background: linear-gradient(90deg, #275AFF 0%, #2EBDFA 100%);
|
||
border-radius: 10px;
|
||
padding: 6px 10px;
|
||
color: white;
|
||
|
||
&:hover {
|
||
opacity: 0.9;
|
||
}
|
||
}
|
||
|
||
.icon-xiaoxi {
|
||
font-size: 24px !important;
|
||
}
|
||
|
||
.functions {
|
||
padding-right: 20px;
|
||
font-size: 20px;
|
||
color: #000;
|
||
cursor: pointer;
|
||
|
||
&:hover {
|
||
color: #1E6FFF;
|
||
}
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
.panel {
|
||
.inPanel {
|
||
padding: 20px;
|
||
border-radius: 8px;
|
||
|
||
width: 100%;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: flex-start;
|
||
height: calc(100vh - 100px);
|
||
background: #fff;
|
||
margin: 10px 20px 20px;
|
||
margin-left: 0;
|
||
margin-right: 0;
|
||
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
|
||
transition: opacity 0.3s ease;
|
||
}
|
||
|
||
display: flex;
|
||
flex-direction: column;
|
||
|
||
justify-content: flex-start;
|
||
align-items: center;
|
||
color: #091221;
|
||
position: absolute;
|
||
top: 84px;
|
||
left: 0;
|
||
width: calc(100% - 450px);
|
||
margin-left: 250px;
|
||
z-index: 999;
|
||
overflow-y: auto;
|
||
|
||
.panelLeft {
|
||
height: 100% !important;
|
||
justify-content: stretch;
|
||
font-size: 14px !important;
|
||
width: 200px;
|
||
overflow-y: auto;
|
||
|
||
li {
|
||
padding: 10px;
|
||
transition: background-color 0.3s;
|
||
|
||
&:hover {
|
||
cursor: pointer;
|
||
color: #1E6FFF;
|
||
}
|
||
}
|
||
}
|
||
|
||
.panelRight {
|
||
flex: 1;
|
||
padding-left: 20px;
|
||
overflow-y: auto;
|
||
}
|
||
}
|
||
|
||
.activeFir {
|
||
background-image: linear-gradient(90deg, rgba(210, 228, 253, .6), hsla(0, 0%, 100%, .6));
|
||
border-radius: 4px;
|
||
cursor: pointer;
|
||
}
|
||
|
||
.twoMenuStyle {
|
||
cursor: pointer;
|
||
position: relative;
|
||
color: #091221;
|
||
font-size: 14px !important;
|
||
|
||
&::after {
|
||
transition: all .3s ease-in-out;
|
||
content: '';
|
||
width: 0;
|
||
position: absolute;
|
||
bottom: -5px;
|
||
left: 0;
|
||
height: 2px;
|
||
background: #091221;
|
||
border-radius: 1px;
|
||
}
|
||
}
|
||
|
||
.activeSec {
|
||
font-weight: 600;
|
||
|
||
&::after {
|
||
width: 100% !important;
|
||
}
|
||
}
|
||
|
||
.subTitle {
|
||
font-size: 16px;
|
||
color: #2468f2;
|
||
font-weight: 600;
|
||
margin: 5px 0;
|
||
display: inline-block;
|
||
}
|
||
|
||
.leastMenu {
|
||
overflow-y: auto;
|
||
|
||
.inBox {
|
||
li {
|
||
font-size: 14px !important;
|
||
margin: 6px 0;
|
||
display: flex;
|
||
justify-content: flex-start;
|
||
align-items: flex-end;
|
||
|
||
&:hover {
|
||
cursor: pointer;
|
||
color: #1E6FFF !important;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
.ge {
|
||
background-image: url('https://bce.bdstatic.com/portal-cloud-server/images/nav/dropdown_bar_middle.png');
|
||
box-sizing: border-box;
|
||
display: block;
|
||
height: 100%;
|
||
width: 20px;
|
||
margin: 0 10px;
|
||
}
|
||
|
||
.zhe {
|
||
font-size: 12px !important;
|
||
border-radius: 4px;
|
||
padding: 1px 2px;
|
||
color: red;
|
||
display: inline-block;
|
||
margin-left: 3px;
|
||
}
|
||
|
||
.outUl {
|
||
.outLi {
|
||
padding: 10px;
|
||
|
||
.tilte {
|
||
width: 100%;
|
||
display: inline-block;
|
||
padding: 5px;
|
||
}
|
||
|
||
.inUl {
|
||
.inLi {
|
||
padding: 10px 10px 10px 5px;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
.logoImg {
|
||
width: 148px;
|
||
height: 48px;
|
||
}
|
||
|
||
.clickItem {
|
||
margin-bottom: 15px !important;
|
||
|
||
&:hover {
|
||
color: #1E6FFF !important;
|
||
}
|
||
}
|
||
|
||
.imgUser {
|
||
display: flex;
|
||
justify-content: center;
|
||
align-items: center;
|
||
width: 30px;
|
||
height: 30px;
|
||
border-radius: 50%;
|
||
color: white;
|
||
margin-right: 8px;
|
||
|
||
img {
|
||
width: 40px;
|
||
height: 40px;
|
||
}
|
||
}
|
||
|
||
.company-name {
|
||
font-size: 24px;
|
||
font-weight: bold;
|
||
color: #222F60;
|
||
cursor: pointer;
|
||
transition: color 0.3s ease;
|
||
|
||
&:hover {
|
||
color: #1E6FFF;
|
||
}
|
||
}
|
||
</style>
|