Browse Source

fds

shibei_master
dai 4 years ago
parent
commit
13601a9093
  1. 113
      src/views/main-navbar.vue
  2. 37
      src/views/main-shuju/main-navbar.vue
  3. 26
      src/views/main-shuju/main.vue

113
src/views/main-navbar.vue

@ -46,9 +46,7 @@
mode="horizontal"
class="aui-navbar__menu mr-auto z-div"
>
<el-menu-item
@click="toIndexPage"
>
<el-menu-item @click="toIndexPage">
<span>首页</span>
</el-menu-item>
@ -104,12 +102,11 @@
<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="updatePasswordHandle()">{{
$t("updatePassword.title")
}}</el-dropdown-item>
<el-dropdown-item @click.native="logoutHandle()">{{
$t('logout')
$t("logout")
}}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
@ -127,119 +124,121 @@
</template>
<script>
import { messages } from '@/i18n'
import { mapGetters } from 'vuex'
import screenfull from 'screenfull'
import UpdatePasswordWork from './main-navbar-update-password-work'
import { clearLoginInfo } from '@/utils'
import { messages } from "@/i18n";
import { mapGetters } from "vuex";
import screenfull from "screenfull";
import UpdatePasswordWork from "./main-navbar-update-password-work";
import { clearLoginInfo } from "@/utils";
export default {
inject: ['refresh'],
inject: ["refresh"],
data() {
return {
showHeader: true,
i18nMessages: messages,
updatePassowrdVisible: false,
customerName: localStorage.getItem('customerName')
}
customerName: "",
};
},
components: {
UpdatePasswordWork
UpdatePasswordWork,
},
created() {
let platformToken = localStorage.getItem('showHeader') || ''
let platformToken = localStorage.getItem("showHeader") || "";
if (
typeof platformToken !== 'undefined' &&
platformToken !== 'undefined' &&
platformToken !== ''
typeof platformToken !== "undefined" &&
platformToken !== "undefined" &&
platformToken !== ""
) {
this.showHeader = false
this.showHeader = false;
}
console.log('=============================', this.userType)
this.changeCustomerName();
console.log("=============================", this.userType);
},
computed: {
userType() {
return localStorage.getItem('userType')
}
return localStorage.getItem("userType");
},
},
methods: {
toIndexPage(){
this.$router.replace('/indexWork')
toIndexPage() {
this.$router.replace("/indexWork");
},
// menuId()
gotoRouteHandle(menuId, idx) {
var route = window.SITE_CONFIG['dynamicMenuRoutes'].filter(
var route = window.SITE_CONFIG["dynamicMenuRoutes"].filter(
(item) => item.meta.menuId === menuId
)[0]
)[0];
if (route) {
this.$router.push({ name: route.name })
this.$router.push({ name: route.name });
}
this.$store.state.LevelOneMenuActiveName = menuId
this.$store.state.LevelOneMenuActiveName = menuId;
this.$store.state.sidebarActiveSubMenuList =
this.$store.state.sidebarMenuList[idx].children || []
this.$store.state.sidebarMenuList[idx].children || [];
},
changeCustomerName(customerName) {
this.customerName = localStorage.getItem('customerName')
this.customerName =
localStorage.getItem("customerName") || "党建引领基层治理互联管理平台";
},
//
fullscreenHandle() {
if (!screenfull.enabled) {
return this.$message({
message: this.$t('fullscreen.prompt'),
type: 'warning',
duration: 500
})
message: this.$t("fullscreen.prompt"),
type: "warning",
duration: 500,
});
}
screenfull.toggle()
screenfull.toggle();
},
//
updatePasswordHandle() {
this.updatePassowrdVisible = true
this.updatePassowrdVisible = true;
this.$nextTick(() => {
this.$refs.updatePassowrd.init()
})
this.$refs.updatePassowrd.init();
});
},
// 退
logoutHandle() {
this.$confirm(
this.$t('prompt.info', { handle: this.$t('logout') }),
this.$t('prompt.title'),
this.$t("prompt.info", { handle: this.$t("logout") }),
this.$t("prompt.title"),
{
confirmButtonText: this.$t('confirm'),
cancelButtonText: this.$t('cancel'),
type: 'warning'
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'
)
(item) => item.name === "home"
);
this.$http
.post('/auth/login/logout')
.post("/auth/login/logout")
.then(({ data: res }) => {
if (res.code !== 0) {
// 退
if (res.code !== 10007) {
this.$message.error(res.msg)
this.$message.error(res.msg);
}
}
clearLoginInfo()
this.$router.push({ name: 'login' })
clearLoginInfo();
this.$router.push({ name: "login" });
// if (localStorage.getItem('userType') === 'work') {
// this.$router.push({ name: 'loginWork' })
// } else {
// this.$router.push({ name: 'login' })
// }
})
.catch(() => {})
.catch(() => {});
})
.catch(() => {})
}
}
}
.catch(() => {});
},
},
};
</script>
<style lang="scss" scoped>
.main-line {

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

@ -3,9 +3,7 @@
<nav v-if="showHeader" class="m-navbar">
<div class="navbar__header">
<h1 class="navbar__brand" @click="$router.push({ name: 'home' })">
<a class="navbar__brand-lg" href="javascript:;">{{
userType === "work" ? customerName : $t("brand.lg")
}}</a>
<a class="navbar__brand-lg" href="javascript:;">{{ customerName }}</a>
<a class="navbar__brand-mini" href="javascript:;">{{
customerName.slice(0, 2)
}}</a>
@ -47,7 +45,7 @@
<li
class="sub-menu"
:class="
$store.state.mainShuju.activeName == menu.id ? 'z-on' : ''
$store.state.mainShuju.activeName == menu.name ? 'z-on' : ''
"
v-if="menu.children"
:key="menu.id"
@ -150,29 +148,25 @@ export default {
showHeader: true,
i18nMessages: messages,
updatePassowrdVisible: false,
customerName: localStorage.getItem("customerName"),
customerName: "",
};
},
components: {
UpdatePasswordWork,
},
created() {
let platformToken = localStorage.getItem("showHeader") || "";
if (
typeof platformToken !== "undefined" &&
platformToken !== "undefined" &&
platformToken !== ""
) {
this.showHeader = false;
}
console.log("=============================", this.userType);
// let platformToken = localStorage.getItem("showHeader") || "";
// if (
// typeof platformToken !== "undefined" &&
// platformToken !== "undefined" &&
// platformToken !== ""
// ) {
// this.showHeader = false;
// }
this.changeCustomerName();
this.$store.state.mainShuju.menuList = window.SITE_CONFIG["menuShujuList"];
},
computed: {
userType() {
return localStorage.getItem("userType");
},
},
computed: {},
methods: {
toIndexPage() {
this.$router.replace("/indexWork");
@ -187,8 +181,9 @@ export default {
this.$store.state.mainShuju.activeName = menuId;
}
},
changeCustomerName(customerName) {
this.customerName = localStorage.getItem("customerName");
changeCustomerName() {
this.customerName =
localStorage.getItem("customerName") || "数据分析可视化平台";
},
//
fullscreenHandle() {

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

@ -28,7 +28,6 @@ import MainContent from "./main-content";
import debounce from "lodash/debounce";
import { mapGetters } from "vuex";
import nextTick from "dai-js/tools/nextTick";
import { requestPost } from "@/js/dai/request";
export default {
provide() {
@ -103,18 +102,25 @@ export default {
this.$store.state.mainShuju.activeName = tab.menuId;
this.$store.state.mainShuju.contentTabsActiveName = tab.name;
},
//
async getWorkUserInfo() {
getWorkUserInfo() {
const url = "/epmetuser/customerstaff/staffbasicinfo";
let params = {};
const { data, code, msg } = await requestPost(url, params);
if (code === 0) {
this.$store.state.user = { ...data };
localStorage.setItem("roleList", data.roleList);
localStorage.setItem("customerId", data.customerId);
}
window.app.ajax.post(
url,
params,
(data, rspMsg) => {
this.$store.state.user = { ...data };
localStorage.setItem("roleList", data.roleList);
localStorage.setItem("customerId", data.customerId);
if (!localStorage.getItem("customerName")) {
localStorage.setItem("customerName", data.customerName || "");
}
},
(rspMsg, data) => {
this.$message.error(rspMsg);
}
);
},
},
};

Loading…
Cancel
Save