gaoshp
2024-11-10 5d0a077b235fa694bd356b94edbba7c2f483d36a
src/layout/index.vue
@@ -96,14 +96,15 @@
   <template v-else-if="layout=='dock'">
      <header class="adminui-header">
         <div class="adminui-header-left">
            <div class="logo-bar">
               <img class="logo" src="img/logo.png">
               <span>{{ $CONFIG.APP_NAME }}</span>
            <div class="logo-bar personalized-logo">
               <!-- <img class="logo" src="img/logo.png">
               <span>{{ $CONFIG.APP_NAME }}</span> -->
               <img src="/img/initiallong.b9495273.png" class="img" style="width: 100%; height: 70%;padding-left: 8px;">
            </div>
         </div>
         <div class="adminui-header-right">
            <div v-if="!ismobile" class="adminui-header-menu">
               <el-menu mode="horizontal" :default-active="active" router background-color="#222b45" text-color="#fff" active-text-color="var(--el-color-primary)">
               <el-menu mode="horizontal" @select="handleSelect" :default-active="active" background-color="#222b45" text-color="#fff" active-text-color="var(--el-color-primary)">
                  <NavMenu :navMenus="menu"></NavMenu>
               </el-menu>
            </div>
@@ -193,7 +194,7 @@
   <div class="main-maximize-exit" @click="exitMaximize"><el-icon><el-icon-close /></el-icon></div>
   <div class="layout-setting" @click="openSetting"><el-icon><el-icon-brush-filled /></el-icon></div>
   <!-- <div class="layout-setting" @click="openSetting"><el-icon><el-icon-brush-filled /></el-icon></div> -->
   <el-drawer title="布局实时演示" v-model="settingDialog" :size="400" append-to-body destroy-on-close>
      <setting></setting>
@@ -266,6 +267,38 @@
         }
      },
      methods: {
         findRouteByPath(routes, targetPath) {
            for (let i = 0; i < routes.length; i++) {
               if (routes[i].path === targetPath) {
                  // 如果找到匹配的path,直接返回当前对象
                  return routes[i];
               }
               if (routes[i].children) {
                  // 如果当前对象有children,递归查找
                  const found = this.findRouteByPath(routes[i].children, targetPath);
                  if (found) {
                     return found;
                  }
               }
            }
            // 如果没有找到匹配的path,返回null
            return null;
         },
         handleSelect(key, keyPath,index,routeResult) {
            var MENU = this.$TOOL.data.get("MENU");
            var foundRoute = this.findRouteByPath(MENU, key);
            //http://116.63.148.72:8080/xxl-job-admin
            var TOKEN = this.$TOOL.cookie.get("TOKEN");
            if(key == "/myiframe/urlPath") {  //任务调度
               this.$router.push({path: '/myiframe/urlPath',query:{name: foundRoute.name,src:foundRoute.origin}});
               return;
            }
            if(foundRoute.isOpen != "2") {
               this.$router.push({path: key});
            }else {
               window.open(key + `?token=${TOKEN}`,'_blank');
            }
         },
         openSetting(){
            this.settingDialog = true;
         },