|
@@ -50,84 +50,88 @@
|
|
|
// document.head.appendChild(consoleScript);
|
|
|
// }
|
|
|
// console.log('userNameNeedTranslate',window.location.href);
|
|
|
- if(this.user.userNameNeedTranslate == '1'){
|
|
|
- this.agentConfig()
|
|
|
- }
|
|
|
- var ua = navigator.userAgent.toLowerCase();
|
|
|
- if (ua.indexOf("wxwork") > 0) {
|
|
|
- this.isCorpWX = true;
|
|
|
- } else if (ua.indexOf("micromessenger") > 0) {
|
|
|
- this.isWX = true;
|
|
|
- }
|
|
|
-
|
|
|
- if (this.user.company.packageEngineering == 1) {
|
|
|
- this.routers.push(
|
|
|
- {
|
|
|
- name: '专业审核',
|
|
|
- url: '/profession_review',
|
|
|
- icon: 'todo-list-o'
|
|
|
- });
|
|
|
+ let that = this
|
|
|
+ if (localStorage.userInfo != null) {
|
|
|
+ that.getAccountInfo();
|
|
|
}
|
|
|
- var list = this.user.moduleList
|
|
|
- for (var i in list) {
|
|
|
- if(list[i].name == '工时报告') {
|
|
|
- this.routers.push({name: '查看日报',url: '/calendar',icon: 'description'})
|
|
|
- this.routers.push({name: '填写日报',url: '/edit',icon: 'edit'})
|
|
|
- // if (this.user.companyId == 817 || this.user.companyId == 7 || this.user.companyId == 10) {
|
|
|
- this.routers.push({name: '按周填报',url: '/weekEdit',icon: 'records'})
|
|
|
- // }
|
|
|
- }
|
|
|
- if(list[i].name == '待办任务') {
|
|
|
- this.routers.push({
|
|
|
- name: '待办任务',
|
|
|
- url: '/task',
|
|
|
- icon: 'coupon-o'
|
|
|
- });
|
|
|
+ that.getModule()
|
|
|
+ that.getMessage();
|
|
|
+ that.bindIfNessary();
|
|
|
+ },
|
|
|
+ components: {
|
|
|
+ Footer
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 模块
|
|
|
+ getModule() {
|
|
|
+ if(this.user.userNameNeedTranslate == '1'){
|
|
|
+ this.agentConfig()
|
|
|
}
|
|
|
- if(list[i].name == '项目报告审核') {
|
|
|
- this.routers.push({name: '项目报告审核',url: '/review',icon: 'todo-list-o'})
|
|
|
+ var ua = navigator.userAgent.toLowerCase();
|
|
|
+ if (ua.indexOf("wxwork") > 0) {
|
|
|
+ this.isCorpWX = true;
|
|
|
+ } else if (ua.indexOf("micromessenger") > 0) {
|
|
|
+ this.isWX = true;
|
|
|
}
|
|
|
- if(list[i].name == '项目管理') {
|
|
|
- this.routers.push({name: '项目管理',url: '/project',icon: 'label-o'})
|
|
|
+
|
|
|
+ if (this.user.company.packageEngineering == 1) {
|
|
|
+ this.routers.push(
|
|
|
+ {
|
|
|
+ name: '专业审核',
|
|
|
+ url: '/profession_review',
|
|
|
+ icon: 'todo-list-o'
|
|
|
+ });
|
|
|
}
|
|
|
- if(list[i].name == '导入日报审核') {
|
|
|
- this.routers.push({name: '导入日报审核',url: '/audit',icon: 'label-o'})
|
|
|
+ var list = this.user.moduleList
|
|
|
+ for (var i in list) {
|
|
|
+ if(list[i].name == '工时报告') {
|
|
|
+ this.routers.push({name: '查看日报',url: '/calendar',icon: 'description'})
|
|
|
+ this.routers.push({name: '填写日报',url: '/edit',icon: 'edit'})
|
|
|
+ // if (this.user.companyId == 817 || this.user.companyId == 7 || this.user.companyId == 10) {
|
|
|
+ this.routers.push({name: '按周填报',url: '/weekEdit',icon: 'records'})
|
|
|
+ // }
|
|
|
+ }
|
|
|
+ if(list[i].name == '待办任务') {
|
|
|
+ this.routers.push({
|
|
|
+ name: '待办任务',
|
|
|
+ url: '/task',
|
|
|
+ icon: 'coupon-o'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if(list[i].name == '项目报告审核') {
|
|
|
+ this.routers.push({name: '项目报告审核',url: '/review',icon: 'todo-list-o'})
|
|
|
+ }
|
|
|
+ if(list[i].name == '项目管理') {
|
|
|
+ this.routers.push({name: '项目管理',url: '/project',icon: 'label-o'})
|
|
|
+ }
|
|
|
+ if(list[i].name == '导入日报审核') {
|
|
|
+ this.routers.push({name: '导入日报审核',url: '/audit',icon: 'label-o'})
|
|
|
+ }
|
|
|
+ if(list[i].name == '费用报销') {
|
|
|
+ this.routers.push({
|
|
|
+ name: '费用报销',
|
|
|
+ url: '/expense',
|
|
|
+ icon: 'balance-list-o'
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
- if(list[i].name == '费用报销') {
|
|
|
- this.routers.push({
|
|
|
- name: '费用报销',
|
|
|
- url: '/expense',
|
|
|
- icon: 'balance-list-o'
|
|
|
+ if (this.user.manageDeptId != 0 && this.user.company.packageEngineering == 1) {
|
|
|
+ this.routers.push(
|
|
|
+ {
|
|
|
+ name: '部门审核',
|
|
|
+ url: '/department_review',
|
|
|
+ icon: 'todo-list-o'
|
|
|
});
|
|
|
}
|
|
|
- }
|
|
|
- if (this.user.manageDeptId != 0 && this.user.company.packageEngineering == 1) {
|
|
|
- this.routers.push(
|
|
|
- {
|
|
|
- name: '部门审核',
|
|
|
- url: '/department_review',
|
|
|
- icon: 'todo-list-o'
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- this.routers.push({
|
|
|
- name: '消息记录',
|
|
|
- url: '/msg',
|
|
|
- icon: 'todo-list-o',
|
|
|
- info: this.unreadNum
|
|
|
- });
|
|
|
+
|
|
|
+ this.routers.push({
|
|
|
+ name: '消息记录',
|
|
|
+ url: '/msg',
|
|
|
+ icon: 'todo-list-o',
|
|
|
+ info: this.unreadNum
|
|
|
+ });
|
|
|
+ },
|
|
|
|
|
|
-
|
|
|
- this.getMessage();
|
|
|
- this.bindIfNessary();
|
|
|
- if (localStorage.userInfo != null) {
|
|
|
- this.getAccountInfo();
|
|
|
- }
|
|
|
- },
|
|
|
- components: {
|
|
|
- Footer
|
|
|
- },
|
|
|
- methods: {
|
|
|
// 获取企业微信参数
|
|
|
agentConfig(){
|
|
|
let curUrl = window.location.href.split('#')[0]
|
|
@@ -188,22 +192,37 @@
|
|
|
|
|
|
//获取账户信息
|
|
|
getAccountInfo() {
|
|
|
- this.$axios.get('/user/loginByUserId', {params:{userId: this.user.id}})
|
|
|
- .then(res => {
|
|
|
- // console.log(res);
|
|
|
- if (res.code == 'error') {
|
|
|
- localStorage.errorMsg = res.msg;
|
|
|
- //账号信息有问题,不能使用。
|
|
|
- this.$router.push("/error");
|
|
|
- } else {
|
|
|
-
|
|
|
- localStorage.userInfo = JSON.stringify(res.data);
|
|
|
- this.user = res.data;
|
|
|
- }
|
|
|
- }).catch(err=> {
|
|
|
- alert('err=' + err);
|
|
|
- });
|
|
|
+ let userId = this.user.id
|
|
|
+ if(window.location.href.indexOf('userId') != '-1') {
|
|
|
+ let href = window.location.href;
|
|
|
+ var loginUserId = href.substring(href.indexOf("userId=")+"userId=".length);
|
|
|
+ if (loginUserId.includes('#/')) {
|
|
|
+ loginUserId = loginUserId.substring(0, loginUserId.indexOf('#/'));
|
|
|
+ }
|
|
|
+ userId = loginUserId
|
|
|
+ }
|
|
|
+ if(window.location.href.indexOf('errorMsg') != '-1') {
|
|
|
+ let err = window.location.href.split('errorMsg=')[1]
|
|
|
+ let str = err.split('#/')[0]
|
|
|
+ this.$router.push("/error");
|
|
|
+ }
|
|
|
+ this.$axios.get('/user/loginByUserId', {params:{userId: userId}})
|
|
|
+ .then(res => {
|
|
|
+ // console.log(res);
|
|
|
+ if (res.code == 'error') {
|
|
|
+ localStorage.errorMsg = res.msg;
|
|
|
+ //账号信息有问题,不能使用。
|
|
|
+ this.$router.push("/error");
|
|
|
+ } else {
|
|
|
+
|
|
|
+ localStorage.userInfo = JSON.stringify(res.data);
|
|
|
+ this.user = res.data;
|
|
|
+ }
|
|
|
+ }).catch(err=> {
|
|
|
+ alert('err=' + err);
|
|
|
+ });
|
|
|
},
|
|
|
+
|
|
|
bindIfNessary() {
|
|
|
let href = window.location.href;
|
|
|
var requestUrl = "";
|
|
@@ -259,6 +278,7 @@
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+
|
|
|
//获取消息
|
|
|
getMessage() {
|
|
|
this.$axios.post("/information/list", {
|
|
@@ -272,6 +292,7 @@
|
|
|
}
|
|
|
}).catch(err=> {this.$toast.clear();});
|
|
|
},
|
|
|
+
|
|
|
},
|
|
|
activated(){
|
|
|
this.getMessage()
|