Browse Source

试试翰林院

dev^2
dai 2 years ago
parent
commit
9832ec93e1
  1. 3
      .env.development
  2. 2
      src/js/store/index.js
  3. 486
      src/views/main-shuju/main-navbar.vue
  4. 286
      src/views/main-shuju/main.vue

3
.env.development

@ -1,12 +1,13 @@
NODE_ENV=development
VUE_APP_API_SERVER = http://192.168.1.140/api
# VUE_APP_API_SERVER = http://192.168.1.140/api
# VUE_APP_API_SERVER = https://epmet-yantai.elinkservice.cn/api
# VUE_APP_API_SERVER = https://epmet-test.elinkservice.cn/api
# VUE_APP_API_SERVER = https://epmet-cloud.elinkservice.cn/api
# VUE_APP_API_SERVER = https://epdc-shibei.elinkservice.cn/api
# VUE_APP_API_SERVER = https://epmet-dev.elinkservice.cn:41080/api
# VUE_APP_API_SERVER = https://epmet-dev.elinkservice.cn/api
VUE_APP_API_SERVER = https://epmet-panshi.elinkservice.cn/api
# VUE_APP_NODE_ENV=dev_sdtdt
VUE_APP_NODE_ENV=dev

2
src/js/store/index.js

@ -45,6 +45,8 @@ export default new Vuex.Store({
fixed1920: {
height: document.documentElement.clientHeight,
},
fullscreen: false, //是否全屏状态
},
modules: {
user,

486
src/views/main-shuju/main-navbar.vue

@ -1,86 +1,100 @@
<template>
<div>
<nav v-if="showHeader" class="m-navbar">
<div class="navbar__header">
<h1 class="navbar__brand">
<a class="navbar__brand-lg" href="javascript:;">{{ customerName }}</a>
<a class="navbar__brand-mini" href="javascript:;">{{
customerName.slice(0, 2)
}}</a>
</h1>
</div>
<div class="navbar__body">
<el-menu class="navbar__menu mr-auto" mode="horizontal">
<el-menu-item
index="1"
@click="$store.state.sidebarFold = !$store.state.sidebarFold"
>
<svg
class="icon-svg navbar__icon-menu navbar__icon-menu--switch"
aria-hidden="true"
>
<use xlink:href="#icon-outdent"></use>
</svg>
</el-menu-item>
<div>
<nav v-if="showHeader" class="m-navbar">
<div class="navbar__header">
<h1 class="navbar__brand">
<a class="navbar__brand-lg" href="javascript:;">{{
customerName
}}</a>
<a class="navbar__brand-mini" href="javascript:;">{{
customerName.slice(0, 2)
}}</a>
</h1>
</div>
<div class="navbar__body">
<el-menu class="navbar__menu mr-auto" mode="horizontal">
<el-menu-item
index="1"
@click="
$store.state.sidebarFold = !$store.state.sidebarFold
"
>
<svg
class="icon-svg navbar__icon-menu navbar__icon-menu--switch"
aria-hidden="true"
>
<use xlink:href="#icon-outdent"></use>
</svg>
</el-menu-item>
<el-menu-item index="2" @click="refresh()">
<svg class="icon-svg navbar__icon-menu" aria-hidden="true">
<use xlink:href="#icon-sync"></use>
</svg>
</el-menu-item>
</el-menu>
<el-menu-item index="2" @click="refresh()">
<svg
class="icon-svg navbar__icon-menu"
aria-hidden="true"
>
<use xlink:href="#icon-sync"></use>
</svg>
</el-menu-item>
</el-menu>
<el-menu
:default-active="$store.state.mainShuju.activeName"
:unique-opened="true"
:collapseTransition="false"
mode="horizontal"
class="navbar__menu mr-auto z-div"
>
<el-menu-item index="index" @click="toIndexPage">
<span>首页</span>
</el-menu-item>
<el-menu
:default-active="$store.state.mainShuju.activeName"
:unique-opened="true"
:collapseTransition="false"
mode="horizontal"
class="navbar__menu mr-auto z-div"
>
<el-menu-item index="index" @click="toIndexPage">
<span>首页</span>
</el-menu-item>
<template v-for="(menu, idx) in $store.state.mainShuju.menuList">
<li
class="sub-menu"
:class="
$store.state.mainShuju.activeName == menu.id ? 'z-on' : ''
"
v-if="menu.children"
:key="menu.id"
@click="gotoRouteHandle(menu.id, idx)"
>
<span>{{ menu.name }}</span>
<div class="sub-menu-list">
<div
:class="
$store.state.mainShuju.activeName == subMenu.id
? 'z-on'
: ''
"
:key="subMenu.id"
@click="gotoRouteHandle(subMenu.id, subIndex)"
v-for="(subMenu, subIndex) in menu.children"
>
{{ subMenu.name }}
</div>
</div>
</li>
<el-menu-item
v-else
:key="menu.id"
:menu="menu"
:index="menu.id"
@click="gotoRouteHandle(menu.id, idx)"
>
<span>{{ menu.name }}</span>
</el-menu-item>
</template>
</el-menu>
<template
v-for="(menu, idx) in $store.state.mainShuju.menuList"
>
<li
class="sub-menu"
:class="
$store.state.mainShuju.activeName == menu.id
? 'z-on'
: ''
"
v-if="menu.children"
:key="menu.id"
@click="gotoRouteHandle(menu.id, idx)"
>
<span>{{ menu.name }}</span>
<div class="sub-menu-list">
<div
:class="
$store.state.mainShuju.activeName ==
subMenu.id
? 'z-on'
: ''
"
:key="subMenu.id"
@click="
gotoRouteHandle(subMenu.id, subIndex)
"
v-for="(subMenu, subIndex) in menu.children"
>
{{ subMenu.name }}
</div>
</div>
</li>
<el-menu-item
v-else
:key="menu.id"
:menu="menu"
:index="menu.id"
@click="gotoRouteHandle(menu.id, idx)"
>
<span>{{ menu.name }}</span>
</el-menu-item>
</template>
</el-menu>
<el-menu class="navbar__menu" mode="horizontal">
<!-- <el-menu-item index="1">
<el-menu class="navbar__menu" mode="horizontal">
<!-- <el-menu-item index="1">
<el-dropdown placement="bottom"
:show-timeout="0">
<el-button size="mini">{{ $t('_lang') }}</el-button>
@ -91,7 +105,7 @@
</el-dropdown-menu>
</el-dropdown>
</el-menu-item> -->
<!-- <el-menu-item index="2">
<!-- <el-menu-item index="2">
<a href="//www.renren.io/"
target="_blank">
<svg class="icon-svg navbar__icon-menu"
@ -100,39 +114,48 @@
</svg>
</a>
</el-menu-item> -->
<el-menu-item index="3" @click="fullscreenHandle()">
<svg class="icon-svg navbar__icon-menu" aria-hidden="true">
<use xlink:href="#icon-fullscreen"></use>
</svg>
</el-menu-item>
<el-menu-item index="3" @click="fullscreenHandle()">
<svg
class="icon-svg navbar__icon-menu"
aria-hidden="true"
>
<use xlink:href="#icon-fullscreen"></use>
</svg>
</el-menu-item>
<el-menu-item index="4" class="navbar__avatar">
<el-dropdown placement="bottom" :show-timeout="0">
<span class="el-dropdown-link">
<img src="~@/assets/img/staff-default-avatar.png" />
<span>{{ $store.state.user.realName }}</span>
<i class="el-icon-arrow-down"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="updatePasswordHandle()">{{
$t("updatePassword.title")
}}</el-dropdown-item>
<el-dropdown-item @click.native="logoutHandle()">{{
$t("logout")
}}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-menu-item>
</el-menu>
</div>
<!-- 弹窗, 修改密码 -->
<update-password-work
v-if="updatePassowrdVisible"
ref="updatePassowrd"
></update-password-work>
</nav>
<nav v-else class="navbar main-line"></nav>
</div>
<el-menu-item index="4" class="navbar__avatar">
<el-dropdown placement="bottom" :show-timeout="0">
<span class="el-dropdown-link">
<img
src="~@/assets/img/staff-default-avatar.png"
/>
<span>{{ $store.state.user.realName }}</span>
<i class="el-icon-arrow-down"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item
@click.native="updatePasswordHandle()"
>{{
$t("updatePassword.title")
}}</el-dropdown-item
>
<el-dropdown-item
@click.native="logoutHandle()"
>{{ $t("logout") }}</el-dropdown-item
>
</el-dropdown-menu>
</el-dropdown>
</el-menu-item>
</el-menu>
</div>
<!-- 弹窗, 修改密码 -->
<update-password-work
v-if="updatePassowrdVisible"
ref="updatePassowrd"
></update-password-work>
</nav>
<nav v-else class="navbar main-line"></nav>
</div>
</template>
<script>
@ -142,122 +165,147 @@ import screenfull from "screenfull";
import UpdatePasswordWork from "@/views/main-navbar-update-password-work";
import { clearLoginInfo } from "@/utils";
export default {
inject: ["refresh"],
data() {
return {
showHeader: true,
i18nMessages: messages,
updatePassowrdVisible: false,
customerName: "",
};
},
components: {
UpdatePasswordWork,
},
created() {
// let platformToken = localStorage.getItem("showHeader") || "";
// if (
// typeof platformToken !== "undefined" &&
// platformToken !== "undefined" &&
// platformToken !== ""
// ) {
// this.showHeader = false;
// }
this.changeCustomerName();
const customerId = localStorage.getItem("customerId");
let siteconfigElement = window.SITE_CONFIG["menuShujuList"];
// 亿 -
if ("04c0d396e298f13e57aa5904a657eaa6" != customerId && "3fdd0380deff5b30f45376cdf995d1c1" != customerId){
for (let index in siteconfigElement){
if (siteconfigElement[index].id == '6'){
let newMenuArr = siteconfigElement[index].children.filter(item =>item.id !== 'duoyuanfuwufenxi');
siteconfigElement[index].children = newMenuArr;
}
}
}
this.$store.state.mainShuju.menuList = siteconfigElement;
},
computed: {},
methods: {
toIndexPage() {
this.$router.replace("/indexWork");
},
// menuId()
gotoRouteHandle(menuId, idx) {
var route = window.SITE_CONFIG["dynamicMenuRoutesShuju"].filter(
(item) => item.meta.menuId === menuId
)[0];
if (route) {
this.$router.push({ name: route.name });
this.$store.state.mainShuju.activeName = menuId;
}
},
changeCustomerName() {
this.customerName =
localStorage.getItem("customerName") || "数据分析可视化平台";
},
//
fullscreenHandle() {
if (!screenfull.enabled) {
return this.$message({
message: this.$t("fullscreen.prompt"),
type: "warning",
duration: 500,
});
}
screenfull.toggle();
},
//
updatePasswordHandle() {
this.updatePassowrdVisible = true;
this.$nextTick(() => {
this.$refs.updatePassowrd.init();
});
},
// 退
logoutHandle() {
this.$confirm(
this.$t("prompt.info", { handle: this.$t("logout") }),
this.$t("prompt.title"),
{
confirmButtonText: this.$t("confirm"),
cancelButtonText: this.$t("cancel"),
type: "warning",
}
)
.then(() => {
//
// tabs,
this.$store.state.contentTabs = this.$store.state.contentTabs.filter(
(item) => item.name === "home2"
);
inject: ["refresh"],
data() {
return {
showHeader: true,
i18nMessages: messages,
updatePassowrdVisible: false,
customerName: "",
};
},
components: {
UpdatePasswordWork,
},
created() {
// let platformToken = localStorage.getItem("showHeader") || "";
// if (
// typeof platformToken !== "undefined" &&
// platformToken !== "undefined" &&
// platformToken !== ""
// ) {
// this.showHeader = false;
// }
this.changeCustomerName();
const customerId = localStorage.getItem("customerId");
let siteconfigElement = window.SITE_CONFIG["menuShujuList"];
// 亿 -
if (
"04c0d396e298f13e57aa5904a657eaa6" != customerId &&
"3fdd0380deff5b30f45376cdf995d1c1" != customerId
) {
for (let index in siteconfigElement) {
if (siteconfigElement[index].id == "6") {
let newMenuArr = siteconfigElement[index].children.filter(
(item) => item.id !== "duoyuanfuwufenxi"
);
siteconfigElement[index].children = newMenuArr;
}
}
}
this.$store.state.mainShuju.menuList = siteconfigElement;
//
this.checkFullscreen();
},
computed: {},
methods: {
//
checkFullscreen() {
const fn = () => {
if (document.fullscreenElement === null) {
console.log("Exited fullscreen");
this.$store.state.fullscreen = false;
} else {
console.log("Entered fullscreen");
this.$store.state.fullscreen = true;
}
};
//
document.addEventListener("fullscreenchange", fn);
fn();
},
toIndexPage() {
this.$router.replace("/indexWork");
},
// menuId()
gotoRouteHandle(menuId, idx) {
var route = window.SITE_CONFIG["dynamicMenuRoutesShuju"].filter(
(item) => item.meta.menuId === menuId
)[0];
if (route) {
this.$router.push({ name: route.name });
this.$store.state.mainShuju.activeName = menuId;
}
},
changeCustomerName() {
this.customerName =
localStorage.getItem("customerName") || "数据分析可视化平台";
},
//
fullscreenHandle() {
if (!screenfull.enabled) {
return this.$message({
message: this.$t("fullscreen.prompt"),
type: "warning",
duration: 500,
});
}
screenfull.toggle();
},
//
updatePasswordHandle() {
this.updatePassowrdVisible = true;
this.$nextTick(() => {
this.$refs.updatePassowrd.init();
});
},
// 退
logoutHandle() {
this.$confirm(
this.$t("prompt.info", { handle: this.$t("logout") }),
this.$t("prompt.title"),
{
confirmButtonText: this.$t("confirm"),
cancelButtonText: this.$t("cancel"),
type: "warning",
}
)
.then(() => {
//
// tabs,
this.$store.state.contentTabs =
this.$store.state.contentTabs.filter(
(item) => item.name === "home2"
);
this.$http
.post("/auth/login/logout")
.then(({ data: res }) => {
if (res.code !== 0) {
// 退
if (res.code !== 10007) {
this.$message.error(res.msg);
}
}
this.$http
.post("/auth/login/logout")
.then(({ data: res }) => {
if (res.code !== 0) {
// 退
if (res.code !== 10007) {
this.$message.error(res.msg);
}
}
clearLoginInfo();
clearLoginInfo();
this.$router.push({ name: "login" });
})
.catch(() => {});
})
.catch(() => {});
},
},
this.$router.push({ name: "login" });
})
.catch(() => {});
})
.catch(() => {});
},
},
};
</script>
<style lang="scss" scoped>
.main-line {
height: 50px;
background: #eeeeee;
height: 50px;
background: #eeeeee;
}
</style>

286
src/views/main-shuju/main.vue

@ -1,30 +1,33 @@
<template>
<fixed1920>
<div
v-loading.fullscreen.lock="loading"
:element-loading-text="$t('loading')"
:class="[
'g-bd',
{ 'z-sidebar--fold': $store.state.sidebarFold },
{
'z-sidebar--noside': true,
},
{ 'z-iframe': $store.state.inIframe },
]"
>
<template v-if="!loading">
<main-navbar ref="ref_navbar" v-if="!$store.state.inIframe" />
<fixed1920>
<div
v-loading.fullscreen.lock="loading"
:element-loading-text="$t('loading')"
:class="[
'g-bd',
{ 'z-sidebar--fold': $store.state.sidebarFold },
{
'z-sidebar--noside': true,
},
{ 'z-iframe': $store.state.inIframe || ($store.state.fullscreen && $route.name=='i-1642710158240174082') },
]"
>
<template v-if="!loading">
<main-navbar
ref="ref_navbar"
v-if="!$store.state.inIframe && !($store.state.fullscreen && $route.name=='i-1642710158240174082')"
/>
<div class="g-cnt">
<main-content
v-if="!$store.state.contentIsNeedRefresh"
@changeCustomerName="changeCustomerName"
/>
</div>
<main-theme-tools />
</template>
</div>
</fixed1920>
<div class="g-cnt">
<main-content
v-if="!$store.state.contentIsNeedRefresh"
@changeCustomerName="changeCustomerName"
/>
</div>
<main-theme-tools />
</template>
</div>
</fixed1920>
</template>
<script>
@ -38,138 +41,141 @@ import fixed1920 from "@/views/components/fixed1920.vue";
import MainThemeTools from "./main-theme-tools";
export default {
provide() {
return {
//
refresh() {
this.$store.state.contentIsNeedRefresh = true;
this.$nextTick(() => {
this.$store.state.contentIsNeedRefresh = false;
});
},
};
},
data() {
return {
loading: true,
userType: localStorage.getItem("userType"),
};
},
components: {
MainNavbar,
MainContent,
fixed1920,
MainThemeTools,
},
provide() {
return {
//
refresh() {
this.$store.state.contentIsNeedRefresh = true;
this.$nextTick(() => {
this.$store.state.contentIsNeedRefresh = false;
});
},
};
},
data() {
return {
loading: true,
userType: localStorage.getItem("userType"),
};
},
components: {
MainNavbar,
MainContent,
fixed1920,
MainThemeTools,
},
watch: {
$route: "routeHandle",
},
async created() {
this.windowResizeHandle();
this.routeHandle(this.$route);
Promise.all([this.getWorkUserInfo()]).then(() => {
this.loading = false;
});
},
computed: {},
methods: {
changeCustomerName(customerName) {
this.$refs["ref_navbar"].changeCustomerName(customerName);
},
//
windowResizeHandle() {
this.$store.state.sidebarFold =
document.documentElement["clientWidth"] <= 992 || false;
window.addEventListener(
"resize",
debounce(() => {
this.$store.state.sidebarFold =
document.documentElement["clientWidth"] <= 992 || false;
}, 150)
);
},
// ,
routeHandle(route) {
if (!route.meta.isTab) {
this.$store.state.mainShuju.activeName = "";
this.$store.state.mainShuju.contentTabsActiveName = "";
return false;
}
var tab = this.$store.state.contentTabs.filter(
(item) => item.name === route.name
)[0];
if (!tab) {
tab = {
...window.SITE_CONFIG["contentTabDefault"],
...route.meta,
name: route.name,
params: { ...route.params },
query: { ...route.query },
};
this.$store.state.contentTabs =
this.$store.state.contentTabs.concat(tab);
}
watch: {
$route: "routeHandle",
},
async created() {
this.windowResizeHandle();
this.routeHandle(this.$route);
Promise.all([this.getWorkUserInfo()]).then(() => {
this.loading = false;
});
},
computed: {},
methods: {
changeCustomerName(customerName) {
this.$refs["ref_navbar"].changeCustomerName(customerName);
},
//
windowResizeHandle() {
this.$store.state.sidebarFold =
document.documentElement["clientWidth"] <= 992 || false;
window.addEventListener(
"resize",
debounce(() => {
this.$store.state.sidebarFold =
document.documentElement["clientWidth"] <= 992 || false;
}, 150)
);
},
// ,
routeHandle(route) {
if (!route.meta.isTab) {
this.$store.state.mainShuju.activeName = "";
this.$store.state.mainShuju.contentTabsActiveName = "";
return false;
}
var tab = this.$store.state.contentTabs.filter(
(item) => item.name === route.name
)[0];
if (!tab) {
tab = {
...window.SITE_CONFIG["contentTabDefault"],
...route.meta,
name: route.name,
params: { ...route.params },
query: { ...route.query },
};
this.$store.state.contentTabs =
this.$store.state.contentTabs.concat(tab);
}
this.$store.state.mainShuju.activeName = tab.menuId;
this.$store.state.mainShuju.contentTabsActiveName = tab.name;
},
this.$store.state.mainShuju.activeName = tab.menuId;
this.$store.state.mainShuju.contentTabsActiveName = tab.name;
},
//
async getWorkUserInfo() {
const url = "/epmetuser/customerstaff/staffbasicinfo";
let params = {};
const { data, code, msg } = await requestPost(url, params);
if (code === 0) {
this.$store.state.user = { ...data };
console.log("user---hahha", this.$store.state.user);
localStorage.setItem("roleList", data.roleList);
localStorage.setItem("customerId", data.customerId);
localStorage.setItem("staffId", data.id);
localStorage.setItem("agencyId", data.agencyId);
localStorage.setItem("level", data.level);
if (!localStorage.getItem("customerName")) {
localStorage.setItem("customerName", data.customerName || "");
}
} else {
this.$message.error(msg);
}
},
},
//
async getWorkUserInfo() {
const url = "/epmetuser/customerstaff/staffbasicinfo";
let params = {};
const { data, code, msg } = await requestPost(url, params);
if (code === 0) {
this.$store.state.user = { ...data };
console.log("user---hahha", this.$store.state.user);
localStorage.setItem("roleList", data.roleList);
localStorage.setItem("customerId", data.customerId);
localStorage.setItem("staffId", data.id);
localStorage.setItem("agencyId", data.agencyId);
localStorage.setItem("level", data.level);
if (!localStorage.getItem("customerName")) {
localStorage.setItem(
"customerName",
data.customerName || ""
);
}
} else {
this.$message.error(msg);
}
},
},
};
</script>
<style lang="scss" src="@/assets/scss/main-shuju.scss" scoped></style>
<style lang="scss">
.info-h {
height: calc(100% - 320px);
// overflow: auto;
height: calc(100% - 320px);
// overflow: auto;
}
.info-scroll {
&::-webkit-scrollbar {
width: 8px;
// background: linear-gradient(270deg, #0063FE, #0095FF);
}
&::-webkit-scrollbar {
width: 8px;
// background: linear-gradient(270deg, #0063FE, #0095FF);
}
&::-webkit-scrollbar-corner,
&::-webkit-scrollbar-corner,
/* 滚动条角落 */
&::-webkit-scrollbar-thumb,
&::-webkit-scrollbar-track {
/*滚动条的轨道*/
border-radius: 4px;
}
/*滚动条的轨道*/
border-radius: 4px;
}
&::-webkit-scrollbar-corner,
&::-webkit-scrollbar-track {
/* 滚动条轨道 */
&::-webkit-scrollbar-corner,
&::-webkit-scrollbar-track {
/* 滚动条轨道 */
background: rgba(12, 129, 254, 0.24);
// box-shadow: inset 0 0 1px rgba(180, 160, 120, 0.5);
}
background: rgba(12, 129, 254, 0.24);
// box-shadow: inset 0 0 1px rgba(180, 160, 120, 0.5);
}
&::-webkit-scrollbar-thumb {
/* 滚动条手柄 */
background: linear-gradient(270deg, #1257c9, #0095ff);
}
&::-webkit-scrollbar-thumb {
/* 滚动条手柄 */
background: linear-gradient(270deg, #1257c9, #0095ff);
}
}
</style>

Loading…
Cancel
Save