dedsudiyu пре 9 месеци
родитељ
комит
1509b53555
2 измењених фајлова са 54 додато и 42 уклоњено
  1. 37 2
      pages/views/login/login.vue
  2. 17 40
      pages/views/teacherPage/teacherHome.vue

+ 37 - 2
pages/views/login/login.vue

@@ -40,7 +40,8 @@
 		login,
 		configInfo,
 		getConfigByType,
-		systemAppletRolePermission
+		systemAppletRolePermission,
+		securityDataStatisticsGetUserIdentity
 	} from '@/pages/api/index.js'
 	import {
 		Encrypt,
@@ -112,7 +113,9 @@
 							//获取开发配置
 							this.getConfigByType(),
 							//获取权限字段
-							this.systemAppletRolePermission()
+							this.systemAppletRolePermission(),
+							//查询身份
+							this.securityDataStatisticsGetUserIdentity()
 						]).then((result) => {
 							if (uni.getStorageSync('codeData')) {
 								uni.redirectTo({
@@ -214,6 +217,38 @@
 					uni.setStorageSync('fileBrowseEnvironmentExtranet','https://'+Decrypt(obj.fileBrowseEnvironmentExtranet))
 				}
 			},
+			//查询身份
+			async securityDataStatisticsGetUserIdentity(routeUrl) {
+				let self = this;
+				const {
+					data
+				} = await securityDataStatisticsGetUserIdentity();
+				if(data.schoolAdmin){
+					//校级管理员
+					uni.setStorageSync('identityData',{
+						type:'schoolAdmin'
+					});
+				}else if(data.collegeAdmin){
+					//院级管理员
+					uni.setStorageSync('identityData',{
+						type:'collegeAdmin'
+					});
+				}else if(data.schoolGroup){
+					//校级督导组
+					uni.setStorageSync('identityData',{
+						type:'schoolGroup',
+						groupIds:data.groupIds
+					});
+				}else if(data.collegeGroup){
+					//院级督导组
+					uni.setStorageSync('identityData',{
+						type:'collegeGroup',
+						groupIds:data.groupIds
+					});
+				}else{
+					uni.removeStorageSync('identityData');
+				}
+			},
 			checkboxChange() {
 				this.checkedType = !this.checkedType;
 			},

+ 17 - 40
pages/views/teacherPage/teacherHome.vue

@@ -79,9 +79,6 @@
 
 <script>
 	import {
-		securityDataStatisticsGetUserIdentity
-	} from '@/pages/api/index.js'
-	import {
 		pageRestrictVerify
 	} from '@/utils/index'
 	import {
@@ -111,7 +108,8 @@
 				dataPageType: false,
 				title: '实验室安全智慧化管控系统',
 				background: '#0183FA',
-				rectangleLogo: uni.getStorageSync('rectangleLogo')
+				rectangleLogo: uni.getStorageSync('rectangleLogo'),
+				identityData:uni.getStorageSync('identityData'),
 			}
 		},
 		created() {
@@ -124,7 +122,7 @@
 			}
 		},
 		mounted() {
-			this.securityDataStatisticsGetUserIdentity()
+			
 		},
 		methods: {
 			goHome() {
@@ -155,9 +153,19 @@
 
 				} else if (type == 'securityCheck') {
 					//安全检查
-					uni.navigateTo({
-						url: "/pages_safetyCheck/views/safetyCheck",
-					});
+					if(this.identityData){
+						uni.navigateTo({
+							url: "/pages_safetyCheck/views/safetyCheck",
+						});
+					}else{
+						uni.showToast({
+							mask: true,
+							icon: "none",
+							position: "center",
+							title: '您不是校/院级管理员或督导组成员,无法使用该功能.',
+							duration: 2000
+						});
+					}
 				} else if (type == 'securityExamination') {
 					//安全考试
 
@@ -206,38 +214,7 @@
 					//化学品管控
 
 				}
-			}, //获取用户身份标识"adminGentle": false,   管理员身份 "rectifyGentle": false, 院级管理员collegeGentle   整改身份"applyGentle": false    检查者身份
-			async securityDataStatisticsGetUserIdentity(routeUrl) {
-				let self = this;
-				const {
-					data
-				} = await securityDataStatisticsGetUserIdentity();
-				if(data.schoolAdmin){
-					//校级管理员
-					uni.setStorageSync('identityData',{
-						type:'schoolAdmin'
-					});
-				}else if(data.collegeAdmin){
-					//院级管理员
-					uni.setStorageSync('identityData',{
-						type:'collegeAdmin'
-					});
-				}else if(data.schoolGroup){
-					//校级督导组
-					uni.setStorageSync('identityData',{
-						type:'schoolGroup',
-						groupIds:data.groupIds
-					});
-				}else if(data.collegeGroup){
-					//院级督导组
-					uni.setStorageSync('identityData',{
-						type:'collegeGroup',
-						groupIds:data.groupIds
-					});
-				}else{
-					uni.removeStorageSync('identityType');
-				}
-			},
+			}, 
 			/* 扫一扫*/
 			saoCode() {
 				let self = this;