Browse Source

Merge branch 'master' into shibei_master

V1.0
dai 4 years ago
parent
commit
53651bf437
  1. 2
      src/views/main-shuju/main-navbar.vue
  2. 29
      src/views/main-shuju/main.vue
  3. 106
      src/views/main.vue

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

@ -45,7 +45,7 @@
<li
class="sub-menu"
:class="
$store.state.mainShuju.activeName == menu.name ? 'z-on' : ''
$store.state.mainShuju.activeName == menu.id ? 'z-on' : ''
"
v-if="menu.children"
:key="menu.id"

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

@ -102,25 +102,24 @@ export default {
this.$store.state.mainShuju.activeName = tab.menuId;
this.$store.state.mainShuju.contentTabsActiveName = tab.name;
},
//
getWorkUserInfo() {
async getWorkUserInfo() {
const url = "/epmetuser/customerstaff/staffbasicinfo";
let params = {};
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);
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);
if (!localStorage.getItem("customerName")) {
localStorage.setItem("customerName", data.customerName || "");
}
);
} else {
this.$message.error(rspMsg);
}
},
},
};

106
src/views/main.vue

@ -1,7 +1,8 @@
<template>
<div v-loading.fullscreen.lock="loading"
:element-loading-text="$t('loading')"
:class="[
<div
v-loading.fullscreen.lock="loading"
:element-loading-text="$t('loading')"
:class="[
'aui-wrapper',
{ 'aui-sidebar--fold': $store.state.sidebarFold },
{
@ -9,14 +10,16 @@
$store.state.sidebarActiveSubMenuList.length == 0,
},
{ 'z-iframe': $store.state.inIframe },
]">
]"
>
<template v-if="!loading">
<main-navbar ref="ref_navbar"
v-if="!$store.state.inIframe" />
<main-navbar ref="ref_navbar" v-if="!$store.state.inIframe" />
<main-sidebar v-if="!$store.state.inIframe" />
<div class="aui-content__wrapper">
<main-content v-if="!$store.state.contentIsNeedRefresh"
@changeCustomerName="changeCustomerName" />
<main-content
v-if="!$store.state.contentIsNeedRefresh"
@changeCustomerName="changeCustomerName"
/>
</div>
<main-theme-tools v-if="!$store.state.inIframe" />
</template>
@ -31,12 +34,13 @@ import MainThemeTools from "./main-theme-tools";
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 () {
provide() {
return {
//
refresh () {
refresh() {
this.$store.state.contentIsNeedRefresh = true;
this.$nextTick(() => {
this.$store.state.contentIsNeedRefresh = false;
@ -44,7 +48,7 @@ export default {
},
};
},
data () {
data() {
return {
loading: true,
userType: localStorage.getItem("userType"),
@ -60,26 +64,20 @@ export default {
watch: {
$route: "routeHandle",
},
async created () {
async created() {
this.windowResizeHandle();
this.routeHandle(this.$route);
if (localStorage.getItem("userType") === "work") {
Promise.all([this.getWorkUserInfo()]).then(() => {
this.loading = false;
});
} else {
Promise.all([this.getUserInfo()]).then(() => {
this.loading = false;
});
}
Promise.all([this.getWorkUserInfo()]).then(() => {
this.loading = false;
});
},
computed: {},
methods: {
changeCustomerName (customerName) {
changeCustomerName(customerName) {
this.$refs["ref_navbar"].changeCustomerName(customerName);
},
//
windowResizeHandle () {
windowResizeHandle() {
this.$store.state.sidebarFold =
document.documentElement["clientWidth"] <= 992 || false;
window.addEventListener(
@ -91,7 +89,7 @@ export default {
);
},
// ,
routeHandle (route) {
routeHandle(route) {
if (!route.meta.isTab) {
return false;
}
@ -114,7 +112,7 @@ export default {
this.$store.state.contentTabsActiveName = tab.name;
this.syncLevelOneMenuActive(tab.menuId);
},
async syncLevelOneMenuActive (menuId) {
async syncLevelOneMenuActive(menuId) {
await nextTick();
console.log(
"*******************************",
@ -137,54 +135,22 @@ export default {
idx !== -1 ? this.$store.state.sidebarMenuList[idx].children : [];
},
//
getUserInfo () {
const url = "/epmetuser/operuser/queryOperUserDto";
return this.$http
.get(url)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
}
this.$store.state.user.id = res.data.id;
this.$store.state.user.realName = res.data.realName;
this.$store.state.user.superAdmin = res.data.superAdmin;
this.$store.state.user.gender = data.gender;
localStorage.setItem("customerId", "");
})
.catch(() => { });
},
//
getWorkUserInfo () {
async getWorkUserInfo() {
const url = "/epmetuser/customerstaff/staffbasicinfo";
let params = {};
window.app.ajax.post(
url,
params,
(data, rspMsg) => {
this.$store.state.user = { ...data };
console.log("user---hahha", this.$store.state.user);
// this.$store.state.user.id = data.id
// this.$store.state.user.realName = data.realName
// this.$store.state.user.superAdmin = data.superAdmin
// this.$store.state.user.gender = data.gender
localStorage.setItem("roleList", data.roleList);
localStorage.setItem("customerId", data.customerId);
localStorage.setItem("staffId", data.id);
// this.$store.state.user.roleList = data.roleList
// this.$store.state.user.customerId = data.customerId
},
(rspMsg, data) => {
this.$message.error(rspMsg);
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);
if (!localStorage.getItem("customerName")) {
localStorage.setItem("customerName", data.customerName || "");
}
);
// return this.$http.get(url).then(({ data: res }) => {
// if (res.code !== 0) {
// return this.$message.error(res.msg)
// }
// }).catch(() => { })
} else {
this.$message.error(rspMsg);
}
},
},
};

Loading…
Cancel
Save