暂存
This commit is contained in:
@@ -252,6 +252,7 @@
|
||||
style: "color:#fff;font-size:28rpx"
|
||||
},
|
||||
],
|
||||
roleObj:{},
|
||||
infoShow: false, // 显示电子书相关
|
||||
showEbook: false, // 显示电子书相关
|
||||
userMes: {},
|
||||
@@ -323,6 +324,7 @@
|
||||
onShow() {
|
||||
// console.log(this.userInfo, "11111111111111");
|
||||
this.getData();
|
||||
this.getUserRole()
|
||||
// 隐藏原生的tabbar
|
||||
// uni.hideTabBar();
|
||||
},
|
||||
@@ -424,80 +426,91 @@
|
||||
url: url,
|
||||
});
|
||||
},
|
||||
// 获取用户的角色信息
|
||||
getUserRole(){
|
||||
this.$http.post("common/class/getRoleType").then((res) => {
|
||||
console.log('用户角色信息',res);
|
||||
this.roleObj = res.result
|
||||
var zhurenIndex = this.pageList.findIndex(item => {
|
||||
return item.name == '主任教学'
|
||||
})
|
||||
if (zhurenIndex > -1) {
|
||||
this.pageList.splice(zhurenIndex, 1)
|
||||
}
|
||||
var banzhangIndex = this.pageList.findIndex(item => {
|
||||
return item.name == '班级管理'
|
||||
})
|
||||
if (banzhangIndex > -1) {
|
||||
this.pageList.splice(banzhangIndex, 1)
|
||||
}
|
||||
var yonghuIndex = this.pageList.findIndex(item => {
|
||||
return item.name == '我的班级'
|
||||
})
|
||||
if (yonghuIndex > -1) {
|
||||
this.pageList.splice(yonghuIndex, 1)
|
||||
}
|
||||
if (this.roleObj.isDirector) {
|
||||
var n = this.pageList.find(item => {
|
||||
return item.name == '主任教学'
|
||||
})
|
||||
console.log('主任找到了么', n);
|
||||
if (!n) {
|
||||
// this.directorShow = true : this.directorShow = false
|
||||
var item = {
|
||||
// { // 主任之外的人显示班级管理
|
||||
name: "主任教学",
|
||||
url: "/pages/miniClass/DirectorModalList?type=mine",
|
||||
type: "pageJump",
|
||||
// },
|
||||
}
|
||||
this.pageList.splice(3, 0, item);
|
||||
}
|
||||
}
|
||||
// 是班长
|
||||
if (this.roleObj.isMonitor) {
|
||||
var n = this.pageList.find(item => {
|
||||
return item.name == '班级管理'
|
||||
})
|
||||
console.log('班长n找到了么', n);
|
||||
if (!n) {
|
||||
var item = {
|
||||
|
||||
name: "班级管理",
|
||||
url: "/pages/miniClass/MonitorClassList?type=mine",
|
||||
type: "pageJump",
|
||||
|
||||
}
|
||||
this.pageList.splice(3, 0, item);
|
||||
}
|
||||
}
|
||||
// 是学员
|
||||
if(this.roleObj.isStudent){
|
||||
var n = this.pageList.find(item => {
|
||||
return item.name == '我的班级'
|
||||
})
|
||||
console.log('我的班级找到了么', n);
|
||||
if (!n) {
|
||||
var item = {
|
||||
|
||||
name: "我的班级",
|
||||
url: "/pages/miniClass/myClassList?type=mine",
|
||||
type: "pageJump",
|
||||
|
||||
}
|
||||
this.pageList.splice(3, 0, item);
|
||||
}
|
||||
}
|
||||
|
||||
}).catch(e => {
|
||||
console.log('获取角色信息失败');
|
||||
})
|
||||
},
|
||||
getData() {
|
||||
// 获取个人信息
|
||||
if (this.userInfo.id != undefined) {
|
||||
this.$http.post("common/user/getUserInfo").then((res) => {
|
||||
this.userMes = res.result;
|
||||
var zhurenIndex = this.pageList.findIndex(item => {
|
||||
return item.name == '主任教学'
|
||||
})
|
||||
if (zhurenIndex > -1) {
|
||||
this.pageList.splice(zhurenIndex, 1)
|
||||
}
|
||||
var banzhangIndex = this.pageList.findIndex(item => {
|
||||
return item.name == '班级管理'
|
||||
})
|
||||
if (banzhangIndex > -1) {
|
||||
this.pageList.splice(banzhangIndex, 1)
|
||||
}
|
||||
var yonghuIndex = this.pageList.findIndex(item => {
|
||||
return item.name == '我的班级'
|
||||
})
|
||||
if (yonghuIndex > -1) {
|
||||
this.pageList.splice(yonghuIndex, 1)
|
||||
}
|
||||
if (res.isDirector) {
|
||||
var n = this.pageList.find(item => {
|
||||
return item.name == '主任教学'
|
||||
})
|
||||
console.log('主任找到了么', n);
|
||||
if (!n) {
|
||||
// this.directorShow = true : this.directorShow = false
|
||||
var item = {
|
||||
// { // 主任之外的人显示班级管理
|
||||
name: "主任教学",
|
||||
url: "/pages/miniClass/miniClassMan?type=mine",
|
||||
type: "pageJump",
|
||||
// },
|
||||
}
|
||||
this.pageList.splice(3, 0, item);
|
||||
}
|
||||
} else{
|
||||
if (res.isMonitor) {
|
||||
var n = this.pageList.find(item => {
|
||||
return item.name == '班级管理'
|
||||
})
|
||||
console.log('班长n找到了么', n);
|
||||
if (!n) {
|
||||
var item = {
|
||||
// 主任之外的人显示班级管理
|
||||
name: "班级管理",
|
||||
url: "/pages/miniClass/MonitorClassList?type=mine",
|
||||
type: "pageJump",
|
||||
|
||||
}
|
||||
this.pageList.splice(3, 0, item);
|
||||
}
|
||||
} else {
|
||||
if(!res.isMonitor && !res.isDirector){
|
||||
var n = this.pageList.find(item => {
|
||||
return item.name == '我的班级'
|
||||
})
|
||||
console.log('我的班级找到了么', n);
|
||||
if (!n) {
|
||||
var item = {
|
||||
// 主任之外的人显示班级管理
|
||||
name: "我的班级",
|
||||
url: "/pages/miniClass/myClassList?type=mine",
|
||||
type: "pageJump",
|
||||
|
||||
}
|
||||
this.pageList.splice(3, 0, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user