Browse Source

refactor: ♻️ 部分重构

pull/1/head
jiangx 3 years ago
parent
commit
bcddac6d72
  1. 6
      src/composables/useHandleScreen.ts
  2. 2
      src/composables/useInitMap.ts
  3. 9
      src/composables/useStatistics.ts
  4. 1
      src/http/http.ts
  5. 8
      src/store/root/actions.ts

6
src/composables/useHandleScreen.ts

@ -53,11 +53,11 @@ export const useHandleScreen = (callback: () => void) => {
}
//跳转屏保挂载到全局 供app使用
window.sleepToWallpaper = async () => {
await checkHandleScreen()
window.sleepToWallpaper = () => {
checkHandleScreen()
}
async function checkHandleScreen() {
function checkHandleScreen() {
toIndexTime.value = totalTime.value[0]
toWallpaperTime.value = totalTime.value[1]

2
src/composables/useInitMap.ts

@ -59,5 +59,5 @@ function showMapDialog() {
//监听地图上下文丢失 刷新页面
function onContextLost() {
location.reload()
window.location.href = '/'
}

9
src/composables/useStatistics.ts

@ -3,8 +3,13 @@ import { storeToRefs } from 'pinia'
import { getStatistics } from '@/http/api/statistics'
import type { Query, TagType } from '@/http/api/statistics/types'
//店铺编码: tag=navigation或shop或brandSearch或时必传
//industryCode : tag=industry时必传
/**
* @description 店铺编码: tag=navigation或shop或brandSearch或时必传
* @description industryCode: tag=industry时必传
* @param tag : 'navigation' | 'shop' | 'brandSearch' | 'device' | 'program' | 'industry'
* @param shopCode
* @param industryCode
*/
export const useStatistics = ({ tag, shopCode, industryCode = '' }: { tag: TagType; shopCode: string | number; industryCode?: string }) => {
const store = useRootStore()
const { device } = storeToRefs(store)

1
src/http/http.ts

@ -85,6 +85,7 @@ class Request {
const _request = new Request({
timeout: 10000,
timeoutErrorMessage: '网络超时',
interceptors: {
requestInterceptors(_config) {
const store = useRootStore()

8
src/store/root/actions.ts

@ -24,15 +24,15 @@ export interface Actions {
export type GenActions = CreateActions<Root, State, Actions>
export const actions: GenActions = {
SET_SHOP_LIST_BY_FLOOR(list) {
this.shopListGroupByFloor = list
},
SET_SHOW_SEARCH(flag) {
this.showSearch = flag
},
SET_SHOW_DETAIL(flag) {
this.showDetail = flag
},
SET_SHOP_LIST_BY_FLOOR(list) {
this.shopListGroupByFloor = list
},
SET_SHOP_LIST_BY_INDUSTRY(list) {
this.shopListGroupByIndustry = list
},
@ -54,7 +54,7 @@ export const actions: GenActions = {
this.config = config
},
SET_SHOP_LIST(list) {
this.shopList = Object.freeze(list)
this.shopList = list
},
SET_DEVICE(device) {

Loading…
Cancel
Save