Reviewed-on: common/base_daoshi_vue_ts#97
@ -9,7 +9,7 @@ export const useInitMap = async function () {
const { device, facilityList, shopList } = storeToRefs(store)
try {
const { data } = await getMapData()
const delPrefixOfFacilityList = facilityList.value.slice().map(item => ({
const delPrefixOfFacilityList = facilityList.value.map(item => ({
...item,
filePath: item.filePath.replace(PREFIX.STATIC_URL, '')
}))
@ -42,7 +42,8 @@ function onClickShop(event: any) {
if (event.data) {
showMapDialog()
window.Map_QM.addElementLabel(document.getElementById('shopInfo'), event.data.xaxis, event.data.yaxis)
!window.shopInfo && document.getElementById('shopInfo')
window.Map_QM.addElementLabel(window.shopInfo, event.data.xaxis, event.data.yaxis)
store.SET_SHOP(event.data.shopData)
} else {
hideMapDialog()
@ -50,12 +51,12 @@ function onClickShop(event: any) {
}
//地图弹框消失
export function hideMapDialog() {
;(document.getElementById('shopInfo') as HTMLElement).style.visibility = 'hidden'
window.shopInfo.style.visibility = 'hidden'
//显示地图弹框
function showMapDialog() {
;(document.getElementById('shopInfo') as HTMLElement).style.visibility = 'visible'
window.shopInfo.style.visibility = 'visible'
//监听地图上下文丢失 刷新页面
@ -25,6 +25,7 @@ export declare global {
interface Window {
shopInfo: HTMLDivElement
MainMap_QM: {
init(callBack: () => void, options: Partial<Options>): void
@ -32,7 +33,7 @@ export declare global {
// 地图工具对象
util: {
options: { playSpeed: number }
changePlaySpeed(speed?: number = 6): void
changePlaySpeed(speed: number = 6): void
// render 对象
renderer: any
@ -13,7 +13,7 @@ export const randomNumber = (min: number, max: number): number => Math.floor(min
* @param {string} phone
* @returns {boolean}
*/
export const checkPhoneNumber = (phone: string): boolean => /^(?:(?:\+|00)86)?1[3-9]\d{9}$/.test(phone)
export const isPhoneNumber = (phone: string): boolean => /^(?:(?:\+|00)86)?1[3-9]\d{9}$/.test(phone)
/**
* 大写字母
@ -119,7 +119,16 @@ export const formatDay = (date: Date, format: 'y.m.d' | 'y/m/d' | 'y-m-d' = 'y-m
return `${year}-${month}-${week}`
//指定key的图片类型加上前缀
//当前时间是否在指定时间段内
export const isInDuringDate = (startDate: string, endDate: string) => {
const currentDate = new Date().toLocaleString()
const start = new Date(startDate).toLocaleString()
const end = new Date(endDate).toLocaleString()
return currentDate >= start && currentDate <= end
//图片地址加上前缀
export const addPrefixByRecursive = (data: any[], prefix = PREFIX.STATIC_URL, exp = /\.(png|jpg|jpeg|JPG|PNG|MP4|mp4)$/) => {
if (data && typeof data === 'object') {
for (const key in data) {