Browse Source

feat: 🚀 添加影院模块的ts声明文件

pull/1/head
jiangx 3 years ago
parent
commit
9c8fc1691c
  1. 3
      .vscode/settings.json
  2. 8
      src/composables/useFacilityNav.ts
  3. 2
      src/store/root/actions.ts
  4. 1
      src/store/root/state.ts
  5. 5
      src/types/activity.d.ts
  6. 3
      src/types/building.d.ts
  7. 15
      src/types/cinema.d.ts
  8. 1
      src/types/language.d.ts
  9. 16
      src/types/map.d.ts
  10. 11
      src/types/task-slice.d.ts
  11. 2
      src/utils/utils.ts

3
.vscode/settings.json

@ -3,9 +3,10 @@
"source.fixAll.stylelint": true, "source.fixAll.stylelint": true,
"source.fixAll.eslint": true "source.fixAll.eslint": true
}, },
"editor.fontSize": 18,
"cSpell.words": [ "cSpell.words": [
"chahao", "chahao",
"columer", "columer",
"perc" "perc"
] ]
}
}

8
src/composables/useFacilityNav.ts

@ -7,14 +7,14 @@ export const useFacilityNav = () => {
const router = useRouter() const router = useRouter()
function handleFacility({ abbreviation, customFacilityName, filePath, code }: Facility) { function handleFacility({ abbreviation, customFacilityName, filePath, code }: Facility) {
const facility = window.Map_QM.pathIcon({ type: abbreviation })
const floorName = store.currentBuildingFloorsList.find(floor => floor.floorOrder === facility.floor)?.floor
const { floor, node } = window.Map_QM.pathIcon({ type: abbreviation })
const floorName = store.currentBuildingFloorsList.find(_floor => _floor.floorOrder === floor)?.floor
const shop = new Brand({ const shop = new Brand({
shopName: customFacilityName, shopName: customFacilityName,
floorOrder: facility.floor,
floorOrder: floor,
floor: floorName as string, floor: floorName as string,
logoUrl: filePath, logoUrl: filePath,
yaxis: facility.node,
yaxis: node,
shopCode: code shopCode: code
}) })
store.SET_SHOP(shop) store.SET_SHOP(shop)

2
src/store/root/actions.ts

@ -1,5 +1,5 @@
import { i18n } from '@/i18n' import { i18n } from '@/i18n'
import type { Language, State } from './state'
import type { State } from './state'
import type { Root } from '../key' import type { Root } from '../key'
import type { CreateActions } from '../types' import type { CreateActions } from '../types'

1
src/store/root/state.ts

@ -1,4 +1,3 @@
export type Language = 'zh' | 'en' | 'tw' //语言 zh: 简体中文 en: 英文 tw: 繁体中文
export interface State { export interface State {
shopList: Readonly<Shop[]> //店铺列表 shopList: Readonly<Shop[]> //店铺列表
buildingList: Building[] //楼栋列表 buildingList: Building[] //楼栋列表

5
src/types/activity.d.ts

@ -3,11 +3,12 @@ declare interface Activity {
activityAddressEn: string //活动地址英文 activityAddressEn: string //活动地址英文
activityContent: string //活动内容 activityContent: string //活动内容
activityContentEn: string //活动内容英文 activityContentEn: string //活动内容英文
activityId: number //活动ID
activityId: number | string //活动ID
activityName: string activityName: string
activityNameEn: string //活动名称英文 activityNameEn: string //活动名称英文
activityType: 1 | 2 | 3 //活动类型,1商场活动;2品牌活动;3会员活动 activityType: 1 | 2 | 3 //活动类型,1商场活动;2品牌活动;3会员活动
building: string //楼栋 building: string //楼栋
buildingCode: string
startDate: string //开始日期 startDate: string //开始日期
endDate: string //结束日期 endDate: string //结束日期
fileUrl: string //活动图片地址 fileUrl: string //活动图片地址
@ -16,6 +17,6 @@ declare interface Activity {
offline: string //下线日期 offline: string //下线日期
online: string //上线日期 online: string //上线日期
ord: number //排序 ord: number //排序
point: number // 导航点
point: number | null // 导航点
shopCode: string //关联店铺code shopCode: string //关联店铺code
} }

3
src/types/building.d.ts

@ -1,8 +1,9 @@
declare interface Floor { declare interface Floor {
floorCode: number
floorCode: number | string
floor: string floor: string
floorOrder: number floorOrder: number
floorMapUrl: string floorMapUrl: string
floorMapCode: string
} }
declare interface Building { declare interface Building {

15
src/types/cinema.d.ts

@ -0,0 +1,15 @@
declare interface Cinema {
alias: string //店铺别名
building: string // 楼栋
cinemaCode: string //影院编码
cinemaIntro: string //影院介绍
cinemaName: string //影院名称
floor: string //楼层
houseNumber: string //门牌号
intro: string //简介(中文)
introEn: string //简介(英文)
logoUrl: string //店铺logo
materialList: string[] //店铺配图集合
shopName: string //店铺名称(中文)
shopNameEn: string //店铺名称(英文)
}

1
src/types/language.d.ts

@ -0,0 +1 @@
declare type Language = 'zh' | 'en' | 'tw' //语言 zh: 简体中文 en: 英文 tw: 繁体中文

16
src/types/map.d.ts

@ -203,13 +203,13 @@ export declare global {
/** /**
* , * ,
* @param startObj shopNum / type 'shop'/'park'
* @param startObj shopNum / type 'shop'/''
* @param toObj shopNum / type 'shop'/'park' * @param toObj shopNum / type 'shop'/'park'
* @param callBackFun * @param callBackFun
*/ */
pathByStartAndOver( pathByStartAndOver(
startObj: { shopNum: string; type: string },
toObj: { shopNum: string; type: string },
startObj: { shopNum: string; type: 'shop' | 'park' },
toObj: { shopNum: string; type: 'shop' | 'park' },
callBackFun: () => void callBackFun: () => void
): void ): void
@ -280,13 +280,19 @@ export declare global {
* Icon * Icon
* @param floorOrder * @param floorOrder
*/ */
getAllIcon(floorOrder?: number): Array<Partial<Shop>>
getAllIcon(floorOrder?: number): Array<any>
/** /**
* *
* @param obj shopNum * @param obj shopNum
*/ */
pathPark(obj: { shopNum: string }): Partial<Shop>
pathPark(obj: { shopNum: string }): {
shopNum: string
node: string | number
floor: number
xaxis: number | string
yaxis: number | string
}
// 地图显示相关API声明 // 地图显示相关API声明

11
src/types/task-slice.d.ts

@ -1,10 +1,9 @@
interface Options {
init({ sliceList, callback }: { sliceList: number; callback: (i: number) => void }): void
next(): void
sliceQueue({ sliceList, callback }: { sliceList: number; callback: (i: number) => void }): void
}
declare module 'task-slice' { declare module 'task-slice' {
interface Options {
init({ sliceList, callback }: { sliceList: number; callback: (i: number) => void }): void
next(): void
sliceQueue({ sliceList, callback }: { sliceList: number; callback: (i: number) => void }): void
}
const TaskSlice: Options const TaskSlice: Options
export default TaskSlice export default TaskSlice
} }

2
src/utils/utils.ts

@ -129,7 +129,7 @@ export const addPrefixByRecursive = (data: any[], prefix = '/static/offline', ex
if (data && typeof data === 'object') { if (data && typeof data === 'object') {
for (const key in data) { for (const key in data) {
if (typeof data[key] === 'string' && exp.test(data[key])) { if (typeof data[key] === 'string' && exp.test(data[key])) {
data[key] = prefix + data[key].replace(/\\/g, '/')
data[key] = prefix + data[key]
} }
if (data[key] && typeof data[key] === 'object') { if (data[key] && typeof data[key] === 'object') {
addPrefixByRecursive(data[key]) addPrefixByRecursive(data[key])

Loading…
Cancel
Save