1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- import { config } from '@/api/request/config.js'
- /* 操作权限验证
- * str 为权限字符 用于匹配操作角色的字符
- * str === performEvacuation 应急疏散操作权限
- * str === checkGentle 安全检查
- */
- export function controlsRestrictVerify(str) {
- if(str){
- let controlsRestrict = uni.getStorageSync('controlsRestrict');
- return controlsRestrict.indexOf(str) != -1;
- }else{
- return false
- }
- }
- /* 页面权限验证
- * str 为权限字符 用于匹配操作角色的字符
- */
- export function pageRestrictVerify(str) {
- if(str){
- let permissions = uni.getStorageSync('permissions')+'';
- return permissions.indexOf(str) != -1;
- }else{
- return false
- }
- }
- /* 硬件控制与视频监控权限验证(校级管理员/院级管理员/实验室管理员)
- subAdminId 传入的实验室管理员ID
- schoolId 校级管理员身份ID
- collegeId 院级管理员身份ID
- userInfo.position 当前用户身份ID (系统用户为NULL)
- userInfo.userId 当前用户userID
- */
- export function itoOrVideoLimits(subAdminId) {
- let userInfo = uni.getStorageSync('user');
- let schoolId = config.schoolId;
- let collegeId = config.collegeId;
- if(userInfo.position == null){
- //如果是管理员(系统用户)
- return true
- }else if(userInfo.position == schoolId || userInfo.position == collegeId){
- //如果是校级管理员/院级管理员
- return true
- }else if(userInfo.userId == subAdminId){
- //如果当前用户userId 与 管理员ID相等
- return true
- }else{
- return false
- }
- }
|