Browse Source

refactor: ♻️ 代码重构

pull/1/head
jiangx 3 years ago
parent
commit
fe008e6636
  1. 6
      src/composables/useHandleScreen.ts
  2. 7
      src/store/root/getters.ts

6
src/composables/useHandleScreen.ts

@ -54,8 +54,7 @@ export const useHandleScreen = (callback: () => void) => {
//跳转屏保挂载到全局 供app使用
window.sleepToWallpaper = async () => {
await sleepToWallpaper()
nativeMethods.value?.goScreenSave()
await checkHandleScreen()
}
async function checkHandleScreen() {
@ -93,8 +92,7 @@ export const useHandleScreen = (callback: () => void) => {
if (!nativeMethods.value?.hasProgram()) {
return
}
await sleepToWallpaper()
nativeMethods.value?.goScreenSave()
await checkHandleScreen()
}
})

7
src/store/root/getters.ts

@ -1,3 +1,4 @@
import { DEVICE } from '@/enums'
import type { State } from './state'
import type { CreateGetters } from '../types'
import type { PickRecommendShop } from '@/http/api/brand/types'
@ -14,22 +15,26 @@ export type GenGetters = CreateGetters<State, GettersMap>
export const getters: GenGetters = {
nativeMethods() {
if (this.device.label === 'android') {
if (this.device.label === DEVICE.ANDROID) {
return window.android
}
return window.chrome?.webview?.hostObjects?.sync?.csobj
},
//当前设备所处楼栋的楼层列表
currentBuildingFloorsList() {
const currentBuilding = this.buildingList.find(building => building.buildingCode === this.device.buildingCode)
return currentBuilding?.floorList ?? []
},
//推荐店铺列表
recommendList() {
return this.BrandInfo.recommendList ?? []
},
//品牌模块的楼层列表
brandFloorList() {
const currentBuilding = this.BrandInfo.buildingList?.find(item => item.buildingCode === this.device.buildingCode)
return currentBuilding?.floorList ?? []
},
//业态列表
industryList() {
return this.BrandInfo.industryFatherList ?? []
}

Loading…
Cancel
Save