diff --git a/src/base/Logout/Logout.vue b/src/base/Logout/Logout.vue deleted file mode 100644 index 07cfa29..0000000 --- a/src/base/Logout/Logout.vue +++ /dev/null @@ -1,172 +0,0 @@ - - - - - diff --git a/src/base/Logout/chahao.svg b/src/base/Logout/chahao.svg deleted file mode 100644 index b999bf7..0000000 --- a/src/base/Logout/chahao.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/components/PublicComponent/PublicComponent.vue b/src/components/PublicComponent/PublicComponent.vue index 9abdd3d..a1231e4 100644 --- a/src/components/PublicComponent/PublicComponent.vue +++ b/src/components/PublicComponent/PublicComponent.vue @@ -3,9 +3,6 @@ - - - @@ -21,20 +18,16 @@ import { useHandleScreen } from '@/composables/useHandleScreen' import { useInitMap } from '@/composables/useInitMap' import Map from '@/components/Map/Map.vue' -const Logout = defineAsyncComponent(() => import('@/base/Logout/Logout.vue')) const AutoBackNotification = defineAsyncComponent(() => import('@/base/AutoBackNotification/AutoBackNotification.vue')) const router = useRouter() const route = useRoute() const store = useRootStore() const { language, showSearch, showDetail } = storeToRefs(store) -const { checkHandleScreen, showCountDownDialog, title, toIndexTime, toWallpaperTime, isWallpaper, setLogout, resetClickNumber, logout } = - useHandleScreen(handleScreen) +const { checkHandleScreen, showCountDownDialog, title, toIndexTime, toWallpaperTime, isWallpaper } = useHandleScreen(handleScreen) //指定时间返回首页时做的操作 function handleScreen() { - setLogout(false) - resetClickNumber() showSearch.value && store.SET_SHOW_SEARCH(false) showDetail.value && store.SET_SHOW_DETAIL(false) language.value !== 'zh' && store.SET_LANGUAGE('zh') diff --git a/src/composables/useHandleScreen.ts b/src/composables/useHandleScreen.ts index e3203c8..92a9aec 100644 --- a/src/composables/useHandleScreen.ts +++ b/src/composables/useHandleScreen.ts @@ -2,7 +2,6 @@ import { ref, computed, onMounted, watch, toRefs } from 'vue' import { useRootStore } from '@/store/root' import { useRouter } from 'vue-router' import { getBackTime } from '@/http/api/base' -import { useLogout } from '@/composables/useLogout' export const useHandleScreen = (callback: () => void) => { const MIN_TIME = 0 @@ -12,9 +11,7 @@ export const useHandleScreen = (callback: () => void) => { const router = useRouter() const store = useRootStore() - const { device, nativeMethods, mapStatus } = toRefs(store) - - const { logout, resetClickNumber, setLogout, addTotalClick } = useLogout() + const { nativeMethods, mapStatus } = toRefs(store) const totalTime = ref<[number, number]>([60, 60]) //总时间 const toIndexTime = ref(60) //回首页的时间 @@ -58,8 +55,7 @@ export const useHandleScreen = (callback: () => void) => { //跳转屏保挂载到全局 供app使用 window.sleepToWallpaper = sleepToWallpaper - async function checkHandleScreen(e: TouchEvent) { - device.value.label === 'windows' && addTotalClick(e) + async function checkHandleScreen() { toIndexTime.value = totalTime.value[0] toWallpaperTime.value = totalTime.value[1] @@ -115,9 +111,6 @@ export const useHandleScreen = (callback: () => void) => { totalTime, toIndexTime, toWallpaperTime, - logout, - checkHandleScreen, - resetClickNumber, - setLogout + checkHandleScreen } } diff --git a/src/composables/useLogout.ts b/src/composables/useLogout.ts deleted file mode 100644 index 55f4ce8..0000000 --- a/src/composables/useLogout.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { ref, nextTick, watch } from 'vue' - -export const useLogout = () => { - const logout = ref(false) - const clickedNumberTotal = ref(0) - const timer = ref() - const MAX_NUMBER = 10 - const DELAY_TIME = 10000 - const SAFE_COORDINATES = 200 - - function resetClickNumber() { - clickedNumberTotal.value = 0 - } - - function setLogout(flag: boolean) { - logout.value = flag - } - - //点击商场logo 达到最大次数显示退出框 - function addTotalClick(e: TouchEvent) { - try { - const { clientX, clientY } = e.changedTouches[0] - const _clientX = parseInt(String(clientX), 10) - const _clientY = parseInt(String(clientY), 10) - if (_clientX >= 0 && _clientX <= SAFE_COORDINATES && _clientY >= 0 && _clientY <= SAFE_COORDINATES) { - clickedNumberTotal.value++ - } - nextTick(() => { - if (clickedNumberTotal.value >= MAX_NUMBER) { - logout.value = true - resetClickNumber() - } - }) - } catch (error) { - console.log(error) - } - } - - watch(clickedNumberTotal, newVal => { - clearTimeout(timer.value) - timer.value = setTimeout(() => { - if (newVal !== 0) { - clearTimeout(timer.value) - resetClickNumber() - } - }, DELAY_TIME) - }) - - return { resetClickNumber, addTotalClick, setLogout, logout } -}