Commit c96c2530 by caoyanzhi

Merge branch 'feature/4月-菜单和权限' into dev

parents bd232ce8 33637a3a
......@@ -40,7 +40,11 @@ export default {
pageRight: []
};
},
beforeDestroy() {
document.removeEventListener('visibilitychange', this.checkUser);
},
created() {
document.addEventListener('visibilitychange', this.checkUser);
this.getUserInfo().then(() => {
// 如果是登录页登页面,就不获取权限数据
if (whiteRoute.includes(toPath) || whiteRoute.includes(fromPath)) {
......@@ -53,6 +57,17 @@ export default {
});
},
methods: {
checkUser() {
if (!document.hidden) {
const oldUser = JSON.parse(sessionStorage.getItem('userInfos'));
this.getUserInfo().then(() => {
const newUser = JSON.parse(sessionStorage.getItem('userInfos'));
if (newUser.clerkId != oldUser.clerkId) {
this.$router.push('/refresh');
}
});
}
},
getUserInfo() {
return postRequest('/haoban-manage3-web/get-login-info', {}).then(resp => {
const { errorCode, result } = resp.data || {};
......
......@@ -34,6 +34,11 @@ export const constantRouterMap = [
component: _import('login', 'login-more')
},
{
path: '/refresh',
name: '刷新',
component: _import('errorPage', 'refresh')
},
{
path: '/',
// 取到菜单数据后,会将/index的路径加到routes中
redirect: '/index',
......
......@@ -69,10 +69,7 @@
</div>
<div class="m-t-20">
<el-input placeholder="请输入导购手机号或code" maxlength="50" prefix-icon="el-icon-search" v-model="searchInput" class="w-293" @keyup.native="value => toInput(value, searchInput)" clearable @clear="clearInput"> </el-input>
<el-select v-model="enterpriseId" placeholder="全部品牌" @change="getBindist" class="w-168 m-l-10">
<el-option label="全部品牌" value=""></el-option>
<el-option v-for="item in brandOptions" :key="item.enterpriseId" :label="item.enterpriseName" :value="item.enterpriseId"> </el-option> </el-select
><el-select v-model="optType" placeholder="请选择" @change="getBindist" class="w-168 m-l-10">
<el-select v-model="optType" placeholder="请选择" @change="getBindist" class="w-168 m-l-10">
<el-option label="全部状态" value=""></el-option>
<el-option label="绑定" value="0"></el-option>
<el-option label="解绑" value="1"></el-option>
......@@ -140,7 +137,7 @@
<script>
import failLog from '@/components/company/fail-log.vue';
import setDepartment from '@/components/company/set-department.vue';
import { getRequest, postRequest } from '@/api/api';
import { getRequest } from '@/api/api';
import errMsg from '@/common/js/error';
import { _debounce } from '@/common/js/public';
export default {
......@@ -158,9 +155,7 @@ export default {
logShow: false,
taskId: '',
// 解绑日志
optType: '',
enterpriseId: '',
brandOptions: []
optType: ''
};
},
computed: {},
......@@ -193,7 +188,6 @@ export default {
if (tab.name == 'first') {
that.getTableList();
} else {
that.getBrandData();
that.getBindist();
}
},
......@@ -247,36 +241,12 @@ export default {
}
},
/**
* 获取品牌
*/
getBrandData() {
const that = this;
postRequest('/haoban-manage3-web/wx-enterprise-list', {})
.then(res => {
let resData = res.data;
if (resData.errorCode == 1) {
if (!!resData.result && !!resData.result.length) {
that.brandOptions = resData.result;
}
return;
}
errMsg.errorMsg(resData);
})
.catch(function(error) {
that.$message.error({
duration: 1000,
message: error.message
});
});
},
/**
* 获取解绑数据
*/
getBindist() {
const that = this;
let para = {
search: that.searchInput || '', // 搜索字段
enterpriseId: that.enterpriseId,
optType: that.optType,
pageNum: that.currentPage, // 当前页
pageSize: that.pageSize // 一页显示个数
......
<script>
export default {
name: 'Refresh',
created() {
this.$router.go(-1);
}
};
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment