Browse Source

iframe

yantai_master
tianqian 2 years ago
parent
commit
a7c11c403c
  1. 425
      src/views/main-navbar.vue

425
src/views/main-navbar.vue

@ -1,66 +1,39 @@
<template> <template>
<div> <div>
<nav <nav v-if="showHeader" class="aui-navbar" :class="`aui-navbar--${$store.state.navbarLayoutType}`">
v-if="showHeader" <div class="aui-navbar__header">
class="aui-navbar" <h1 class="aui-navbar__brand">
:class="`aui-navbar--${$store.state.navbarLayoutType}`" <a class="aui-navbar__brand-lg" href="javascript:;">{{ $store.state.user.agencyName
>
<div class="aui-navbar__header">
<h1 class="aui-navbar__brand">
<a class="aui-navbar__brand-lg" href="javascript:;">{{
$store.state.user.agencyName
}}</a> }}</a>
<a class="aui-navbar__brand-mini" href="javascript:;">{{ <a class="aui-navbar__brand-mini" href="javascript:;">{{ $store.state.user.agencyName .slice(0, 2)
$store.state.user.agencyName .slice(0, 2)
}}</a> }}</a>
</h1> </h1>
</div> </div>
<div class="aui-navbar__body"> <div class="aui-navbar__body">
<el-menu class="aui-navbar__menu mr-auto" mode="horizontal"> <el-menu class="aui-navbar__menu mr-auto" mode="horizontal">
<el-menu-item <el-menu-item index="1" @click="$store.state.sidebarFold = !$store.state.sidebarFold">
index="1" <svg class="icon-svg aui-navbar__icon-menu aui-navbar__icon-menu--switch" aria-hidden="true">
@click="$store.state.sidebarFold = !$store.state.sidebarFold" <use xlink:href="#icon-outdent"></use>
> </svg>
<svg </el-menu-item>
class="icon-svg aui-navbar__icon-menu aui-navbar__icon-menu--switch" <el-menu-item index="2" @click="refresh()">
aria-hidden="true" <svg class="icon-svg aui-navbar__icon-menu" aria-hidden="true">
> <use xlink:href="#icon-sync"></use>
<use xlink:href="#icon-outdent"></use> </svg>
</svg> </el-menu-item>
</el-menu-item> </el-menu>
<el-menu :default-active="$store.state.LevelOneMenuActiveName" :unique-opened="true"
<el-menu-item index="2" @click="refresh()"> :collapseTransition="false" mode="horizontal" class="aui-navbar__menu mr-auto z-div">
<svg class="icon-svg aui-navbar__icon-menu" aria-hidden="true"> <el-menu-item @click="toIndexPage">
<use xlink:href="#icon-sync"></use> <span>首页</span>
</svg> </el-menu-item>
</el-menu-item> <el-menu-item v-show="menu.showFlag==1" v-for="(menu, idx) in $store.state.sidebarMenuList"
</el-menu> :key="menu.id" :menu="menu" :index="menu.id" @click="gotoRouteHandle(menu.id, idx,menu.name)">
<span>{{ menu.name }}</span>
<el-menu </el-menu-item>
:default-active="$store.state.LevelOneMenuActiveName" </el-menu>
:unique-opened="true" <el-menu class="aui-navbar__menu" mode="horizontal">
:collapseTransition="false" <!-- <el-menu-item index="1">
mode="horizontal"
class="aui-navbar__menu mr-auto z-div"
>
<el-menu-item @click="toIndexPage">
<span>首页</span>
</el-menu-item>
<el-menu-item
v-show="menu.showFlag==1"
v-for="(menu, idx) in $store.state.sidebarMenuList"
:key="menu.id"
:menu="menu"
:index="menu.id"
@click="gotoRouteHandle(menu.id, idx)"
>
<span>{{ menu.name }}</span>
</el-menu-item>
</el-menu>
<el-menu class="aui-navbar__menu" mode="horizontal">
<!-- <el-menu-item index="1">
<el-dropdown placement="bottom" <el-dropdown placement="bottom"
:show-timeout="0"> :show-timeout="0">
<el-button size="mini">{{ $t('_lang') }}</el-button> <el-button size="mini">{{ $t('_lang') }}</el-button>
@ -71,7 +44,7 @@
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</el-menu-item> --> </el-menu-item> -->
<!-- <el-menu-item index="2"> <!-- <el-menu-item index="2">
<a href="//www.renren.io/" <a href="//www.renren.io/"
target="_blank"> target="_blank">
<svg class="icon-svg aui-navbar__icon-menu" <svg class="icon-svg aui-navbar__icon-menu"
@ -80,171 +53,189 @@
</svg> </svg>
</a> </a>
</el-menu-item> --> </el-menu-item> -->
<!-- <el-menu-item index="3" <!-- <el-menu-item index="3"
@click="fullscreenHandle()"> @click="fullscreenHandle()">
<svg class="icon-svg aui-navbar__icon-menu" <svg class="icon-svg aui-navbar__icon-menu"
aria-hidden="true"> aria-hidden="true">
<use xlink:href="#icon-fullscreen"></use> <use xlink:href="#icon-fullscreen"></use>
</svg> </svg>
</el-menu-item> --> </el-menu-item> -->
<el-menu-item index="4" class="aui-navbar__avatar">
<el-menu-item index="4" class="aui-navbar__avatar"> <el-dropdown placement="bottom" :show-timeout="0">
<el-dropdown placement="bottom" :show-timeout="0"> <span class="el-dropdown-link">
<span class="el-dropdown-link"> <img v-if="$store.state.user.gender === '2'"
<img src="~@/assets/img/staff-default-avatar-girl.png" />
v-if="$store.state.user.gender === '2'" <img v-else src="~@/assets/img/staff-default-avatar-boy.png" />
src="~@/assets/img/staff-default-avatar-girl.png" <span>{{ $store.state.user.realName }}</span>
/> <i class="el-icon-arrow-down"></i>
<img v-else src="~@/assets/img/staff-default-avatar-boy.png" /> </span>
<span>{{ $store.state.user.realName }}</span> <el-dropdown-menu slot="dropdown">
<i class="el-icon-arrow-down"></i> <el-dropdown-item @click.native="updatePasswordHandle()">{{ $t("updatePassword.title")
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="updatePasswordHandle()">{{
$t("updatePassword.title")
}}</el-dropdown-item> }}</el-dropdown-item>
<el-dropdown-item @click.native="logoutHandle()">{{ <el-dropdown-item @click.native="logoutHandle()">{{ $t("logout")
$t("logout")
}}</el-dropdown-item> }}</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</el-menu-item> </el-menu-item>
</el-menu> </el-menu>
</div> </div>
<!-- 弹窗, 修改密码 --> <!-- 弹窗, 修改密码 -->
<update-password-work <update-password-work v-if="updatePassowrdVisible" ref="updatePassowrd"></update-password-work>
v-if="updatePassowrdVisible" </nav>
ref="updatePassowrd" <nav v-else class="aui-navbar main-line"></nav>
></update-password-work> </div>
</nav>
<nav v-else class="aui-navbar main-line"></nav>
</div>
</template> </template>
<script> <script>
import { messages } from "@/i18n"; import {
import { mapGetters } from "vuex"; messages
import screenfull from "screenfull"; } from "@/i18n";
import UpdatePasswordWork from "./main-navbar-update-password-work"; import {
import { clearLoginInfo } from "@/utils"; mapGetters
export default { } from "vuex";
inject: ["refresh"], import screenfull from "screenfull";
data() { import UpdatePasswordWork from "./main-navbar-update-password-work";
return { import {
showHeader: true, clearLoginInfo
i18nMessages: messages, } from "@/utils";
updatePassowrdVisible: false, export default {
customerName: "", inject: ["refresh"],
}; data() {
}, return {
components: { showHeader: true,
UpdatePasswordWork, i18nMessages: messages,
}, updatePassowrdVisible: false,
created() { customerName: "",
let platformToken = localStorage.getItem("showHeader") || ""; pmenuName: ""
if ( };
typeof platformToken !== "undefined" && },
platformToken !== "undefined" && components: {
platformToken !== "" UpdatePasswordWork,
) { },
this.showHeader = false; created() {
} let platformToken = localStorage.getItem("showHeader") || "";
this.changeCustomerName(); if (typeof platformToken !== "undefined" && platformToken !== "undefined" && platformToken !== "") {
console.log("=============================", this.userType); this.showHeader = false;
}, }
computed: { this.changeCustomerName();
userType() { console.log("=============================", this.userType);
return localStorage.getItem("userType"); },
}, computed: {
}, userType() {
methods: { return localStorage.getItem("userType");
toIndexPage() { },
this.$router.replace("/indexWork"); },
}, methods: {
// menuId() toIndexPage() {
gotoRouteHandle(menuId, idx) { this.$router.replace("/indexWork");
var route = window.SITE_CONFIG["dynamicMenuRoutes"].filter( },
(item) => item.meta.menuId === menuId cycleClear() {
)[0]; try {
if (route) { var el = document.getElementById("iframes");
if (route.meta.iframeURL.endsWith("【跳转新页面】")) { console.log("存在")
return window.open(route.meta.iframeURL.slice(0, -7)); if (el) {
} else { el.contentWindow.document.write('');
this.$router.push({ name: route.name }); el.contentWindow.document.clear();
} var p = el.parentNode;
} p.removeChild(el);
this.$store.state.LevelOneMenuActiveName = menuId; }
this.$store.state.sidebarActiveSubMenuList = window.close();
this.$store.state.sidebarMenuList[idx].children || []; } catch (e) {
}, setTimeout(cycleClear, 100);
changeCustomerName(customerName) { }
this.customerName = },
localStorage.getItem("customerName") || "党建引领基层治理互联管理平台"; // menuId()
}, gotoRouteHandle(menuId, idx, menuName) {
// let delName = "基层业务"
fullscreenHandle() { if (this.pmenuName == delName) {
if (!screenfull.enabled) { this.pmenuName = menuName
return this.$message({ this.$store.state.contentTabs.forEach((item, index) => {
message: this.$t("fullscreen.prompt"), if (item.title == delName) {
type: "warning", this.$store.state.contentTabs.splice(index, 1)
duration: 500, }
}); })
} var el = document.getElementById("iframes");
screenfull.toggle(); if (el) {
}, el.src = "";
// setTimeout(cycleClear, 100);
updatePasswordHandle() { }
this.updatePassowrdVisible = true; } else {
this.$nextTick(() => { this.pmenuName = menuName;
this.$refs.updatePassowrd.init(); }
}); var route = window.SITE_CONFIG["dynamicMenuRoutes"].filter(
}, (item) => item.meta.menuId === menuId)[0];
// 退 if (route) {
logoutHandle() { if (route.meta.iframeURL.endsWith("【跳转新页面】")) {
this.$confirm( return window.open(route.meta.iframeURL.slice(0, -7));
this.$t("prompt.info", { handle: this.$t("logout") }), } else {
this.$t("prompt.title"), this.$router.push({
{ name: route.name
confirmButtonText: this.$t("confirm"), });
cancelButtonText: this.$t("cancel"), }
type: "warning", }
} this.$store.state.LevelOneMenuActiveName = menuId;
) this.$store.state.sidebarActiveSubMenuList = this.$store.state.sidebarMenuList[idx].children || [];
.then(() => { },
// changeCustomerName(customerName) {
// tabs, this.customerName = localStorage.getItem("customerName") || "党建引领基层治理互联管理平台";
this.$store.state.contentTabs = this.$store.state.contentTabs.filter( },
(item) => item.name === "home" //
); fullscreenHandle() {
if (!screenfull.enabled) {
this.$http return this.$message({
.post("/auth/login/logout") message: this.$t("fullscreen.prompt"),
.then(({ data: res }) => { type: "warning",
if (res.code !== 0) { duration: 500,
// 退 });
if (res.code !== 10007) { }
this.$message.error(res.msg); screenfull.toggle();
} },
} //
updatePasswordHandle() {
clearLoginInfo(); this.updatePassowrdVisible = true;
this.$router.push({ name: "login" }); this.$nextTick(() => {
// if (localStorage.getItem('userType') === 'work') { this.$refs.updatePassowrd.init();
// this.$router.push({ name: 'loginWork' }) });
// } else { },
// this.$router.push({ name: 'login' }) // 退
// } logoutHandle() {
}) this.$confirm(this.$t("prompt.info", {
.catch(() => {}); handle: this.$t("logout")
}) }), this.$t("prompt.title"), {
.catch(() => {}); confirmButtonText: this.$t("confirm"),
}, cancelButtonText: this.$t("cancel"),
}, type: "warning",
}; }).then(() => {
//
// tabs,
this.$store.state.contentTabs = this.$store.state.contentTabs.filter(
(item) => item.name === "home");
this.$http.post("/auth/login/logout").then(({
data: res
}) => {
if (res.code !== 0) {
// 退
if (res.code !== 10007) {
this.$message.error(res.msg);
}
}
clearLoginInfo();
this.$router.push({
name: "login"
});
// if (localStorage.getItem('userType') === 'work') {
// this.$router.push({ name: 'loginWork' })
// } else {
// this.$router.push({ name: 'login' })
// }
}).catch(() => {});
}).catch(() => {});
},
},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.main-line { .main-line {
height: 50px; height: 50px;
background: #eeeeee; background: #eeeeee;
} }
</style> </style>
Loading…
Cancel
Save