From a306f8e209d62bff25d084daaf5112f072abe967 Mon Sep 17 00:00:00 2001 From: jiannibang <271381693@qq.com> Date: Fri, 9 Jun 2023 18:10:47 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E5=A4=8D=E4=B8=8Ewindows?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E5=B1=8F=E4=BF=9D=E4=BA=A4=E4=BA=92=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/composables/useHandleScreen.js | 12 ++++++++++-- src/store/root/getters.js | 6 ------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/composables/useHandleScreen.js b/src/composables/useHandleScreen.js index b1ca195..a3835c2 100644 --- a/src/composables/useHandleScreen.js +++ b/src/composables/useHandleScreen.js @@ -3,11 +3,19 @@ import { getBackTime } from '@/http/api' import { useRouter } from 'vue-router' import { useStatistics } from '@/composables/useStatistics' import { useStore } from '@/store/root' - +const DEVICE = { + WINDOWS: 'windows', + ANDROID: 'android' +} export const useHandleScreen = (callback, screenSaveCallback) => { const router = useRouter() const store = useStore() - const { nativeMethods, mapStatus } = toRefs(store) + const { currentFloor: device, mapStatus } = toRefs(store) + + const nativeMethods = computed(() => { + return !device.value ? {} : device.value.label === DEVICE.ANDROID ? window.android : window.chrome.webview.hostObjects.sync.csobj + }) + const state = reactive({ isWall: false, //当前是回到首页还是回到屏保 messageWS: null, diff --git a/src/store/root/getters.js b/src/store/root/getters.js index b8efdd6..63bf56d 100644 --- a/src/store/root/getters.js +++ b/src/store/root/getters.js @@ -53,9 +53,3 @@ export const currentFloorShopMap = ({ currentFloor: device, shopList, mapData }) return { ...acc, [shop.shopCode]: result } }, {}) } -export const nativeMethods = state => { - if (state.currentFloor.label === DEVICE.ANDROID) { - return window.android - } - return window.chrome?.webview?.hostObjects?.sync?.csobj -}