消毒机设备
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.0 KiB

  1. import { ElMessageBox } from 'element-plus'
  2. import { delToken } from 'libs/token'
  3. import { useSystemStore } from 'stores/systemStore'
  4. import { ref } from 'vue'
  5. export const useActivateDebug = () => {
  6. const systemStore = useSystemStore()
  7. const logoClickCount = ref(0)
  8. let clickTimeout: NodeJS.Timeout | null = null
  9. const handleLogoClick = () => {
  10. if (clickTimeout) {
  11. clearTimeout(clickTimeout)
  12. }
  13. logoClickCount.value++
  14. if (logoClickCount.value === 10) {
  15. console.log('isDebug', systemStore.isDebug)
  16. ElMessageBox.confirm('确认重新加载?', '提示', {
  17. confirmButtonText: '确认',
  18. cancelButtonText: '取消',
  19. closeOnClickModal: false,
  20. type: 'warning',
  21. })
  22. .finally(() => {
  23. logoClickCount.value = 0 // 重置计数器
  24. })
  25. .then(() => {
  26. delToken()
  27. location.reload()
  28. })
  29. }
  30. clickTimeout = setTimeout(() => {
  31. logoClickCount.value = 0 // 重置计数器
  32. }, 1000)
  33. }
  34. return {
  35. handleLogoClick,
  36. }
  37. }