Browse Source

feat: 修复与windows设备屏保交互逻辑

ShangHai_LongXiang
jiannibang 3 years ago
parent
commit
a306f8e209
  1. 12
      src/composables/useHandleScreen.js
  2. 6
      src/store/root/getters.js

12
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,

6
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
}

Loading…
Cancel
Save