diff --git a/src/composables/useDay.ts b/src/composables/useDay.ts index 1201d38..26144ba 100644 --- a/src/composables/useDay.ts +++ b/src/composables/useDay.ts @@ -6,7 +6,7 @@ export const useDay = () => { zh: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'], en: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], tw: ['星期日', '星期壹', '星期二', '星期三', '星期四', '星期五', '星期六'] - } + } as const const date = ref(new Date()) const store = useStore() diff --git a/src/composables/useGuideFilterShop.ts b/src/composables/useGuideFilterShop.ts new file mode 100644 index 0000000..a007332 --- /dev/null +++ b/src/composables/useGuideFilterShop.ts @@ -0,0 +1,22 @@ +import { ref, shallowRef, toRefs } from 'vue' +import { useStore } from '@/store/root' + +export const useGuideFilterShop = () => { + const store = useStore() + const { shopList, currentBuildingFloorsList, currentFloor } = toRefs(store) + + const floorIdx = ref(-1) //楼层选中索引 + const selectedShopList = shallowRef([]) //选中楼层的店铺列表 + + function filterShopByFloorName(floorName: string) { + selectedShopList.value = shopList.value.filter(item => item.floor === floorName) + } + + // //筛选当前楼层所需数据 + function filterAboutCurrentInfo() { + floorIdx.value = currentBuildingFloorsList.value.findIndex(item => item.floor === currentFloor.value.floor) + selectedShopList.value = shopList.value.filter(item => item.floor === currentFloor.value.floor) + } + + return { floorIdx, selectedShopList, filterShopByFloorName, filterAboutCurrentInfo } +} diff --git a/src/composables/useInitConfigAndMallInfo.ts b/src/composables/useInitConfigAndMallInfo.ts index 6589b50..31acd8a 100644 --- a/src/composables/useInitConfigAndMallInfo.ts +++ b/src/composables/useInitConfigAndMallInfo.ts @@ -21,6 +21,6 @@ export const useInitConfigAndMallInfo = async () => { store.SET_BUILDING_LIST(buildingList) store.SET_FACILITY_LIST(_facilityList.data) } catch (error) { - Message({ text: '初始化数据失败', type: 'success' }) + Message({ text: '获取数据失败', type: 'success' }) } } diff --git a/src/composables/useParkingKeyboard.ts b/src/composables/useParkingKeyboard.ts new file mode 100644 index 0000000..d65efc3 --- /dev/null +++ b/src/composables/useParkingKeyboard.ts @@ -0,0 +1,47 @@ +import { ref, computed } from 'vue' +import { isZhWord, isUppercaseWord } from '@/utils/utils' + +export const useParkingKeyboard = () => { + const NOT_ENERGY_PLATE = 7 //非能源车牌长度 + const ENERGY_PLATE = 8 //能源车牌长度 + const SPACE_MAX_LENGTH = 6 //车位最大允许长度 + const LICENSE = ['苏', 'A'] //默认车牌前缀 + + const plate = ref(LICENSE.slice()) + const plateToString = computed(() => plate.value.join('')) + const searchMethod = ref<'车牌' | '车位'>('车牌') + const inputLength = computed(() => (searchMethod.value === '车牌' ? ENERGY_PLATE : SPACE_MAX_LENGTH)) + const isEnergy = ref(false) + function handleEnergy(energy: boolean) { + isEnergy.value = energy + if (!energy && plate.value.length === ENERGY_PLATE) { + plate.value.pop() + } + } + function handleKeyboard(value: string) { + if (searchMethod.value === '车牌') { + if (plate.value.length === 1 && isZhWord(value)) { + plate.value[0] = value + return + } + if ( + (!isEnergy.value && plate.value.length >= NOT_ENERGY_PLATE) || + (isEnergy.value && plate.value.length >= ENERGY_PLATE) || + (plate.value.length === 0 && !isZhWord(value)) || + (plate.value.length === 1 && !isUppercaseWord(value)) || + (plate.value.length >= 2 && plate.value.length < 6 && isZhWord(value)) + ) { + return + } + } else if (plate.value.length >= SPACE_MAX_LENGTH) { + return + } + + plate.value.push(value) + } + function del() { + plate.value.pop() + } + + return { del, handleKeyboard, handleEnergy, inputLength, plate, plateToString, LICENSE, searchMethod } +} diff --git a/src/enums/index.ts b/src/enums/index.ts index c27a790..d31218f 100644 --- a/src/enums/index.ts +++ b/src/enums/index.ts @@ -6,8 +6,8 @@ export enum ACTIVITY_TYPE { } export enum DEVICE { - window = 'windows', - android = 'android' + WINDOWS = 'windows', + ANDROID = 'android' } //卡片推荐类型 diff --git a/src/http/http.ts b/src/http/http.ts index bb0d650..3293ec3 100644 --- a/src/http/http.ts +++ b/src/http/http.ts @@ -13,7 +13,7 @@ class Request { constructor(config: CreateRequestConfig) { this.instance = axios.create(config) - // * 初始化存放取消请求控制器Map + //取消请求控制器Map this.abortControllerMap = new Map() this.interceptorsObj = config.interceptors // 拦截器执行顺序 接口请求 -> 实例请求 -> 全局请求 -> 实例响应 -> 全局响应 -> 接口响应 @@ -31,7 +31,7 @@ class Request { // 使用实例拦截器 this.instance.interceptors.request.use(this.interceptorsObj?.requestInterceptors, this.interceptorsObj?.requestInterceptorsCatch) this.instance.interceptors.response.use(this.interceptorsObj?.responseInterceptors, this.interceptorsObj?.responseInterceptorsCatch) - // 全局响应拦截器保证最后执行 + this.instance.interceptors.response.use( (res: AxiosResponse) => { const url = res.config.url || '' @@ -43,14 +43,13 @@ class Request { } request(config: RequestConfig): Promise { return new Promise((resolve, reject) => { - // 如果为单个请求设置拦截器,这里使用单个请求的拦截器 if (config.interceptors?.requestInterceptors) { config = config.interceptors.requestInterceptors(config as any) } this.instance .request(config) .then(res => { - // 如果为单个响应设置拦截器,这里使用单个响应的拦截器 + // 如果为单个响应设置拦截器,使用单个响应的拦截器 if (config.interceptors?.responseInterceptors) { res = config.interceptors.responseInterceptors(res) } diff --git a/src/i18n/lang/en.json b/src/i18n/lang/en.json index 550d7d5..f29476b 100644 --- a/src/i18n/lang/en.json +++ b/src/i18n/lang/en.json @@ -1,5 +1,10 @@ { "detail": "Detail", "nav": "Navigate", - "energy": "Energy" + "energy": "Energy", + "replay": "Replay", + "pause": "Pause", + "play": "Play", + "speedUp": "Speed up", + "stopSpeedUp": "Stop acceleration" } diff --git a/src/i18n/lang/tw.json b/src/i18n/lang/tw.json index b8d1a78..9d64211 100644 --- a/src/i18n/lang/tw.json +++ b/src/i18n/lang/tw.json @@ -1,5 +1,10 @@ { "detail": "詳情", "nav": "導航", - "energy": "新能源" + "energy": "新能源", + "replay": "重播", + "pause": "暫停", + "play": "播放", + "speedUp": "加速", + "stopSpeedUp": "停止加速" } diff --git a/src/i18n/lang/zh.json b/src/i18n/lang/zh.json index aec7e66..e2ae349 100644 --- a/src/i18n/lang/zh.json +++ b/src/i18n/lang/zh.json @@ -1,5 +1,10 @@ { "detail": "详情", "nav": "导航", - "energy": "新能源" + "energy": "新能源", + "replay": "重播", + "pause": "暂停", + "play": "播放", + "speedUp": "加速", + "stopSpeedUp": "停止加速" } diff --git a/src/plugins/index.ts b/src/plugins/index.ts index d093f8c..723beae 100644 --- a/src/plugins/index.ts +++ b/src/plugins/index.ts @@ -1,6 +1,6 @@ import { switchLanguage } from './switchLanguage' import VueLazyLoad from 'vue3-lazyload' -import { App } from 'vue' +import type { App } from 'vue' export function setupPlugins(app: App) { app.use(switchLanguage).use(VueLazyLoad, { diff --git a/src/store/root/actions.ts b/src/store/root/actions.ts index 8aaae97..7d1bf13 100644 --- a/src/store/root/actions.ts +++ b/src/store/root/actions.ts @@ -2,6 +2,7 @@ import { i18n } from '@/i18n' import type { Language, State } from './state' import type { Root } from '../key' import type { CreateActions } from '../types' + export interface Actions { SET_SHOP_LIST(list: Shop[]): void SET_BUILDING_LIST(list: Building[]): void diff --git a/src/utils/utils.ts b/src/utils/utils.ts index bf0964d..b4b768d 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -120,7 +120,7 @@ export const formatDay = (date: Date, format: 'y.m.d' | 'y/m/d' | 'y-m-d' = 'y-m //判断当前系统 export const isAndroid = () => { const userAgent = navigator.userAgent - const agents = ['Android', 'iPhone', 'iPad'] + const agents = ['Android', 'iPhone', 'iPad'] as const return agents.some(item => userAgent.includes(item)) } diff --git a/src/views/Guide/Guide.vue b/src/views/Guide/Guide.vue index 6fb8770..35eb18c 100644 --- a/src/views/Guide/Guide.vue +++ b/src/views/Guide/Guide.vue @@ -2,24 +2,15 @@
Guide Page
- diff --git a/src/views/Guide/list.ts b/src/views/Guide/list.ts index ac1b695..947e321 100644 --- a/src/views/Guide/list.ts +++ b/src/views/Guide/list.ts @@ -23,11 +23,11 @@ export const list: Item[] = [ nameEn: 'direction', icon: require('@/assets/images/guide/direction.png'), iconActive: require('@/assets/images/guide/direction_active.png') + }, + { + name: MapControl.ACTIVITY_BRAND, + nameEn: 'activity', + icon: require('@/assets/images/guide/brand.svg'), + iconActive: require('@/assets/images/guide/brand_active.svg') } - // { - // name: ACTIVITY_BRAND, - // nameEn: 'activity', - // icon: require('@/assets/images/guide/brand.svg'), - // iconActive: require('@/assets/images/guide/brand_active.svg') - // } ] diff --git a/src/views/Nav/Nav.vue b/src/views/Nav/Nav.vue index 5d4a8b8..6a673f0 100644 --- a/src/views/Nav/Nav.vue +++ b/src/views/Nav/Nav.vue @@ -2,7 +2,7 @@
- - -