Browse Source

修复报无comsterId问题

V1.0
dai 4 years ago
parent
commit
3de6ed2c77
  1. 2
      src/views/main-shuju/main-navbar.vue
  2. 15
      src/views/main-shuju/main.vue
  3. 68
      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"

15
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) => {
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 || "");
}
},
(rspMsg, data) => {
} else {
this.$message.error(rspMsg);
}
);
},
},
};

68
src/views/main.vue

@ -1,5 +1,6 @@
<template>
<div v-loading.fullscreen.lock="loading"
<div
v-loading.fullscreen.lock="loading"
:element-loading-text="$t('loading')"
:class="[
'aui-wrapper',
@ -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,6 +34,7 @@ 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() {
@ -63,15 +67,9 @@ export default {
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;
});
}
},
computed: {},
methods: {
@ -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) => {
const { data, code, msg } = await requestPost(url, params);
if (code === 0) {
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) => {
if (!localStorage.getItem("customerName")) {
localStorage.setItem("customerName", data.customerName || "");
}
} else {
this.$message.error(rspMsg);
}
);
// return this.$http.get(url).then(({ data: res }) => {
// if (res.code !== 0) {
// return this.$message.error(res.msg)
// }
// }).catch(() => { })
},
},
};

Loading…
Cancel
Save