userCheck.ts 966 B

123456789101112131415161718192021222324252627282930
  1. import { ElMessageBox } from 'element-plus';
  2. import configInfo from '@/stores/modules/config';
  3. const configInfoStore = configInfo();
  4. export function useCheckInfo() {
  5. if(localStorage.getItem('check') === 'false'){
  6. ShowError()
  7. }
  8. window.addEventListener('storage',(e)=>{
  9. if(e.key === 'check' && e.newValue === 'false' && e.oldValue === 'true'){
  10. ShowError()
  11. }
  12. })
  13. function ShowError(){
  14. if(configInfoStore.appModel === 2) return;
  15. ElMessageBox({
  16. title:"连接出错!",
  17. message:'设备连接出错,请在主窗口中重新连接设备后,在重新打开此窗口后进行操作',
  18. showCancelButton:false,
  19. showConfirmButton:false,
  20. closeOnClickModal:false,
  21. closeOnPressEscape:false,
  22. closeOnHashChange:false
  23. })
  24. }
  25. }