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

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

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

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

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