123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302 |
- <template>
- <nav class="site-navbar mynewnav" :class="'site-navbar--' + mybarLayoutSkin">
- <!-- <div class="site-navbar__header">
- <h1 class="site-navbar__brand" @click="$router.push({ name: 'home' })">
- <a class="site-navbar__brand-lg" href="javascript:;">智能算法平台</a>
- <a class="site-navbar__brand-mini" href="javascript:;">人人</a>
- </h1>
- </div> -->
- <el-menu class="my" mode="horizontal"
- background-color="#545c64" text-color="#fff" active-text-color="#fff">
- <el-menu-item class="site-navbar__brand" @click="$router.push({ path: '/visi-dataset'})"> <a
- class="site-navbar__brand-lg" href="javascript:;">智能算法平台</a></el-menu-item>
- <el-menu-item index="home" @click="$router.push({ name: 'home' })">
- <span slot="title">帮助文档</span>
- </el-menu-item>
- <!-- <el-menu-item index="home" @click="$router.push({ name: 'home' })">
- <icon-svg name="shouye" class="site-sidebar__menu-icon"></icon-svg>
- <span slot="title">首页</span>
- </el-menu-item> -->
- <!-- 开始自己的菜单这部分为测试静态路由,不需要 -->
- <!-- <el-menu-item index="dataset" @click="$router.push({ name: 'dataset' })">
- <icon-svg name="shouye" class="site-sidebar__menu-icon"></icon-svg>
- <span slot="title">数据集管理</span>
- </el-menu-item> -->
- <!-- demo菜单 -->
- <!-- <el-submenu index="demo">
- <template slot="title">
- <icon-svg name="shoucang" class="site-sidebar__menu-icon"></icon-svg>
- <span>demo</span>
- </template>
- <el-menu-item index="demo-echarts" @click="$router.push({ name: 'demo-echarts' })">
- <icon-svg name="tubiao" class="site-sidebar__menu-icon"></icon-svg>
- <span slot="title">echarts</span>
- </el-menu-item>
- <el-menu-item index="demo-ueditor" @click="$router.push({ name: 'demo-ueditor' })">
- <icon-svg name="editor" class="site-sidebar__menu-icon"></icon-svg>
- <span slot="title">ueditor</span>
- </el-menu-item>
- </el-submenu> -->
- <!--
- <el-submenu index="demo">
- <template slot="title">
- <icon-svg name="shoucang" class="site-sidebar__menu-icon"></icon-svg>
- <span>demo</span>
- </template>
- <el-menu-item index="demo-echarts" @click="$router.push({ name: 'demo-echarts' })">
- <icon-svg name="tubiao" class="site-sidebar__menu-icon"></icon-svg>
- <span slot="title">echarts</span>
- </el-menu-item>
- <el-menu-item index="demo-ueditor" @click="$router.push({ name: 'demo-ueditor' })">
- <icon-svg name="editor" class="site-sidebar__menu-icon"></icon-svg>
- <span slot="title">ueditor</span>
- </el-menu-item>
- </el-submenu> -->
- <sub-menu v-for="menu in menuList" :key="menu.menuId" :menu="menu" :dynamicMenuRoutes="dynamicMenuRoutes" >
- </sub-menu>
- <!-- 导航右边 从设置按钮开始-->
- <el-menu-item style="float:right" class="site-navbar__avatar " index="6">
- <el-dropdown :show-timeout="0" placement="bottom">
- <span class="el-dropdown-link">
- <img src="~@/assets/img/avatar.png" :alt="userName" />{{
- userName
- }}
- </span>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item @click.native="updatePasswordHandle()">修改密码</el-dropdown-item>
- <!-- <el-dropdown-item @click.native="switchBigData()">大数据平台</el-dropdown-item>
- <el-dropdown-item @click.native="switchMkcloud()">智能云平台</el-dropdown-item>
- <el-dropdown-item @click.native="switchScreen()">大屏展示</el-dropdown-item> -->
- <el-dropdown-item @click.native="logoutHandle()">退出</el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- </el-menu-item>
- <!-- <el-menu-item style="float:right" index="5" @click="$router.push({ name: 'theme' })">
- <template slot="title">
- <icon-svg name="shezhi" class="el-icon-setting"></icon-svg>
- </template>
- </el-menu-item> -->
- <!-- 弹窗, 修改密码 -->
- <update-password v-if="updatePassowrdVisible" ref="updatePassowrd"></update-password>
- </el-menu>
- </nav>
- </template>
- <script>
- import SubMenu from "./main-sidebar-sub-menu";
- import { isURL } from "@/utils/validate";
- import UpdatePassword from "./main-navbar-update-password";
- import { clearLoginInfo } from "@/utils";
- import { MessageBox } from 'element-ui'
- import { Message } from "element-ui"
- export default {
- data() {
- return {
- dynamicMenuRoutes: [],
- updatePassowrdVisible: false,
- };
- },
- components: {
- SubMenu,
- UpdatePassword,
- },
- computed: {
- navbarLayoutType: {
- get() {
- return this.$store.state.common.navbarLayoutType;
- },
- },
- sidebarFold: {
- get() {
- return this.$store.state.common.sidebarFold;
- },
- set(val) {
- this.$store.commit("common/updateSidebarFold", val);
- },
- },
- mainTabs: {
- get() {
- return this.$store.state.common.mainTabs;
- },
- set(val) {
- this.$store.commit("common/updateMainTabs", val);
- },
- },
- userName: {
- get() {
- return this.$store.state.user.name;
- },
- },
- //分隔
- mybarLayoutSkin: {
- get() {
- return this.$store.state.common.mybarLayoutSkin;
- },
- },
- sidebarFold: {
- get() {
- return this.$store.state.common.sidebarFold;
- },
- },
- menuList: {
- get() {
- return this.$store.state.common.menuList;
- },
- set(val) {
- this.$store.commit("common/updateMenuList", val);
- },
- },
- menuActiveName: {
- get() {
- return this.$store.state.common.menuActiveName;
- },
- set(val) {
- this.$store.commit("common/updateMenuActiveName", val);
- },
- },
- mainTabs: {
- get() {
- return this.$store.state.common.mainTabs;
- },
- set(val) {
- this.$store.commit("common/updateMainTabs", val);
- },
- },
- mainTabsActiveName: {
- get() {
- return this.$store.state.common.mainTabsActiveName;
- },
- set(val) {
- this.$store.commit("common/updateMainTabsActiveName", val);
- },
- },
- },
- watch: {
- $route: "routeHandle",
- },
- created() {
- this.menuList = JSON.parse(sessionStorage.getItem("menuList") || "[]");
- this.dynamicMenuRoutes = JSON.parse(
- sessionStorage.getItem("dynamicMenuRoutes") || "[]"
- );
- this.routeHandle(this.$route);
- },
- methods: {
- // 路由操作
- routeHandle(route) {
- if (route.meta.isTab) {
- // tab选中, 不存在先添加
- var tab = this.mainTabs.filter((item) => item.name === route.name)[0];
- if (!tab) {
- if (route.meta.isDynamic) {
- route = this.dynamicMenuRoutes.filter(
- (item) => item.name === route.name
- )[0];
- if (!route) {
- return console.error("未能找到可用标签页!");
- }
- }
- tab = {
- menuId: route.meta.menuId || route.name,
- name: route.name,
- title: route.meta.title,
- type: isURL(route.meta.iframeUrl) ? "iframe" : "module",
- iframeUrl: route.meta.iframeUrl || "",
- params: route.params,
- query: route.query,
- };
- this.mainTabs = this.mainTabs.concat(tab);
- }
- this.menuActiveName = tab.menuId + "";
- this.mainTabsActiveName = tab.name;
- }
- },
- //分隔
- // 修改密码
- updatePasswordHandle() {
- this.updatePassowrdVisible = true;
- this.$nextTick(() => {
- this.$refs.updatePassowrd.init();
- });
- },
- // 切换大数据平台
- switchBigData() {
- // window.location.href = "http://112.126.68.148/#/"
- window.location.href = "http://112.126.68.148/bdm/#/"
- },
- // 切换智能云平台
- switchMkcloud() {
- // window.location.href = "http://112.126.68.148/#/"
- window.location.href = "http://112.126.68.148/mkcloud/#/"
- },
- // 切换大屏展示
- switchScreen() {
- // window.location.href = "http://112.126.68.148/#/"
- window.location.href = "http://112.126.68.148/screen/#/"
- },
- // 退出
- logoutHandle() {
- MessageBox.confirm(`确定进行[退出]操作?`, "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- this.$http({
- url: this.$http.adornUrl("/sys/logout"),
- method: "post",
- data: this.$http.adornData(),
- }).then(({ data }) => {
- if (data && data.code === 0) {
- clearLoginInfo();
- this.$router.push({ name: "login" });
- //window.location.href="http://112.126.68.148/#/";
- }
- });
- })
- .catch(() => {});
- },
- },
- };
- </script>
- <style scoped>
- .mynewnav {
- height: 50px;
- width: 1903px;
- line-height: 50px;
- }
- .site-navbar__brand {
- display: table-cell;
- vertical-align: middle;
- /*width: 230px;*/
- width: 200px;
- height: 60px;
- margin: 0;
- line-height: 60px;
- font-size: 20px;
- text-align: center;
- text-transform: uppercase;
- white-space: nowrap;
- color: #fff;
- }
- </style>
|