index.js 673 B

123456789101112131415161718192021222324
  1. /* 操作权限验证
  2. * str 为权限字符 用于匹配操作角色的字符
  3. * str === performEvacuation 应急疏散操作权限
  4. * str === checkGentle 安全检查
  5. */
  6. export function controlsRestrictVerify(str) {
  7. if(str){
  8. let controlsRestrict = uni.getStorageSync('controlsRestrict');
  9. return controlsRestrict.indexOf(str) != -1;
  10. }else{
  11. return false
  12. }
  13. }
  14. /* 页面权限验证
  15. * str 为权限字符 用于匹配操作角色的字符
  16. */
  17. export function pageRestrictVerify(str) {
  18. if(str){
  19. let permissions = uni.getStorageSync('permissions')+'';
  20. return permissions.indexOf(str) != -1;
  21. }else{
  22. return false
  23. }
  24. }