|
@@ -69,19 +69,16 @@
|
|
|
created() {
|
|
|
if (localStorage.userInfo != null) {
|
|
|
var user = JSON.parse(localStorage.userInfo);
|
|
|
- // if (user.role == 3 ) {
|
|
|
- // //公司高层
|
|
|
- // this.$router.push({ path: '/cost' });
|
|
|
- // } else if (user.role == 4) {
|
|
|
- // //财务管理员
|
|
|
- // this.$router.push({ path: '/team' });
|
|
|
- // } else {
|
|
|
- // this.$router.push({ path: '/daily' });
|
|
|
- // }
|
|
|
if(user.moduleList.length > 0) {
|
|
|
this.$router.push({ path: user.moduleList[0].path })
|
|
|
}
|
|
|
}
|
|
|
+ let windowHerf = window.location.href
|
|
|
+ if(windowHerf.indexOf('?jobNumber') != '-1') {
|
|
|
+ let jobNumber = windowHerf.split('jobNumber=')[1].split('&token=')[0]
|
|
|
+ let token = windowHerf.split('&token=')[1]
|
|
|
+ this.automaticLogin(jobNumber, token)
|
|
|
+ }
|
|
|
},
|
|
|
mounted() {
|
|
|
var ua = navigator.userAgent.toLowerCase();
|
|
@@ -210,15 +207,6 @@
|
|
|
localStorage.user = JSON.stringify(res.data);
|
|
|
sessionStorage.setItem('user', JSON.stringify(res.data));
|
|
|
this.permissionsList(res.data)
|
|
|
- // if (user.role == 3) {
|
|
|
- // //公司高层
|
|
|
- // this.$router.push({ path: '/cost' });
|
|
|
- // } else if (user.role == 4) {
|
|
|
- // //财务管理员
|
|
|
- // this.$router.push({ path: '/team' });
|
|
|
- // } else {
|
|
|
- // this.$router.push({ path: '/daily' });
|
|
|
- // }
|
|
|
if(user.moduleList.length > 0) {
|
|
|
this.$router.push({ path: user.moduleList[0].path })
|
|
|
}
|
|
@@ -243,15 +231,6 @@
|
|
|
localStorage.user = JSON.stringify(res.data);
|
|
|
sessionStorage.setItem('user', JSON.stringify(res.data));
|
|
|
this.permissionsList(res.data)
|
|
|
- // if (user.role == 3) {
|
|
|
- // //公司高层
|
|
|
- // this.$router.push({ path: '/cost' });
|
|
|
- // } else if (user.role == 4) {
|
|
|
- // //财务管理员
|
|
|
- // this.$router.push({ path: '/team' });
|
|
|
- // } else {
|
|
|
- // this.$router.push({ path: '/daily' });
|
|
|
- // }
|
|
|
if(jumpurl){
|
|
|
this.$router.push({ path: jumpurl })
|
|
|
}else if(user.moduleList.length > 0) {
|
|
@@ -330,6 +309,46 @@
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ // 米莱得用工号登录
|
|
|
+ automaticLogin(jobNumber, token) {
|
|
|
+ this.http.post('/user/loginAdminByThirdParty', {
|
|
|
+ jobNumber: jobNumber,
|
|
|
+ token: token
|
|
|
+ } , res => {
|
|
|
+ if (res.code == "ok") {
|
|
|
+ if(res.data.moduleList.length == 0){
|
|
|
+ this.$message({
|
|
|
+ message: '请联系管理员为\u3000' + res.data.roleName + '\u3000分配权限',
|
|
|
+ type: 'error'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var user = res.data;
|
|
|
+ sessionStorage.setItem('user', JSON.stringify(res.data));
|
|
|
+ this.permissionsList(res.data)
|
|
|
+ if (user.company.packageSimple == 1) {
|
|
|
+ //简易模式,直接进入工时统计表
|
|
|
+ this.$router.push({ path: '/simple' });
|
|
|
+ sessionStorage.setItem('autoRoute','/simple')
|
|
|
+ } else {
|
|
|
+ if(user.moduleList.length > 0) {
|
|
|
+ this.$router.push({ path: user.moduleList[0].path })
|
|
|
+ sessionStorage.setItem('autoRoute',user.moduleList[0].path)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: res.msg,
|
|
|
+ type: 'error'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }, error => {
|
|
|
+ this.$message({
|
|
|
+ message: error,
|
|
|
+ type: 'error'
|
|
|
+ });
|
|
|
+ })
|
|
|
+ },
|
|
|
// 权限控制
|
|
|
permissionsList(item) {
|
|
|
var arr = []
|