From 65b112892c142e8f8d76d3f061254bb8476d2720 Mon Sep 17 00:00:00 2001 From: gaozl Date: Tue, 23 May 2023 10:28:38 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E5=9C=B0=E5=9B=BE=E5=8F=AF=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/static/qm/MainMap_QM.js | 86 +++++++++++++++++++++------------- public/static/qm/three.js | 8 ++-- 2 files changed, 57 insertions(+), 37 deletions(-) diff --git a/public/static/qm/MainMap_QM.js b/public/static/qm/MainMap_QM.js index 7fd9455..0130780 100644 --- a/public/static/qm/MainMap_QM.js +++ b/public/static/qm/MainMap_QM.js @@ -33,7 +33,7 @@ QMUtil = function () { this.beforPath = "./"; this.options = { playSpeed: 6, //动画播放速度 - collision: false, //是否支持名称的碰撞检测 + collision: true, //是否支持名称的碰撞检测 showStyle: false, //是否4K modelIcon: true, //是否使用模型 true 模型 false 图标 otherPath: [], //人为干预的路线 [{f:"0_5_10",s:"1_5_47",d:500},{f:"1_5_47",s:"0_5_10",d:500}]; @@ -77,7 +77,7 @@ QMUtil = function () { //debug 参数 相机坐标/ 镜头方向 this.guiOptions = { cameraX: 0, cameraY: 220, cameraZ: 220, targatX: 0, targatY: 0, targatZ: 0 }; //this.button = function() {}; - this.sceneGap = { x: 0, y: 0, z: 0, scale: dir ? 0.15 : 0.08 }; //改变地图位置,大小 + this.sceneGap = { x: 0, y: 0, z: 0, scale: dir ? 0.15 : 0.09 }; //改变地图位置,大小 this.selectBuild = 0; this.selectFloor = 0; @@ -1440,7 +1440,6 @@ MainMap_QM.prototype = { this.util.options.pathColor = pathColor != 0xb47834 ? pathColor : this.util.options.pathColor; this.util.options.pathStyle = pathStyle != "3D" ? pathStyle : this.util.options.pathStyle; this.util.iconUrl = iconUrl; - if (!isNaN(Number(options.floor))) { this.util.startObj.floor = this.util.deviceObj.floor = parseInt(options.floor) || 0; } else { @@ -1457,11 +1456,13 @@ MainMap_QM.prototype = { for(let k=0; k { Map_QM.controls.saveState(); @@ -2088,7 +2104,7 @@ MainMap_QM.prototype = { Map_QM.controls.enabled = true; Map_QM.controls.enableRotate = true; Map_QM.util.pathStateObj.forShopArr = { direction: "", wayList: [] }; - Map_QM.resetMeDir(); + this.controls.reset(); if (Map_QM.guide && Map_QM.guide.visible) { Map_QM.guide.visible = false } @@ -2217,7 +2233,7 @@ MainMap_QM.prototype = { Map_QM.util.selectBuild = build; Map_QM.util.selectFloor = fIndex; if (Map_QM.util.options.shadow) { - TweenMax.fromTo(Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].allObj.position, 0.3, { z: Map_QM.util.options.fSpace }, { + TweenMax.fromTo(Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].allObj.position, 0.2, { z: Map_QM.util.options.fSpace }, { z: 0, ease: Cubic.easeIn, onComplete: function () { Map_QM.timeOutInit(); if (callBack) callBack(); @@ -2839,8 +2855,10 @@ MainMap_QM.prototype = { Map_QM.controls.update(); Map_QM.renderer.render(Map_QM.scene, Map_QM.camera); Map_QM.labelRenderer.render(Map_QM.scene, Map_QM.camera); - Map_QM.labelRenderer.renderObject( Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].labelObj, Map_QM.camera ); - Map_QM.labelRenderer.renderObject( Map_QM.CSSObject, Map_QM.camera ); + if(Map_QM.mapArr[Map_QM.util.selectBuild]){ + Map_QM.labelRenderer.renderObject( Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].labelObj, Map_QM.camera ); + Map_QM.labelRenderer.renderObject( Map_QM.CSSObject, Map_QM.camera ); + } for (let item of Map_QM.mixers) { item.update(T); } @@ -3066,7 +3084,7 @@ MainMap_QM.prototype = { } }, onCallTouchORMouse: function (mouse) { - if (!Map_QM.mapArr[Map_QM.util.selectBuild] && !Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor] || Map_QM.util.pathStateObj.isPathState) { + if (!Map_QM.mapArr[Map_QM.util.selectBuild] && !Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor] ) { return; } let raycaster = new THREE.Raycaster(); @@ -3405,14 +3423,12 @@ MainMap_QM.prototype = { if (!Map_QM) { return; } + if (!Map_QM.util.options.collision) { + return; + } clearTimeout(Map_QM.util.timeObj.collTime); Map_QM.util.timeObj.collTime = setTimeout(() => { clearTimeout(Map_QM.util.timeObj.collTime); - Map_QM.labelRenderer.zOrder( Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].labelObj ); - if (!Map_QM.util.options.collision) { - return; - } - let checkList = []; if (Map_QM.util.options.overlap) { for (let i = 0; i < Map_QM.mapArr[Map_QM.util.selectBuild].length; i++) { @@ -3483,7 +3499,7 @@ MainMap_QM.prototype = { } } } - }, 500); + }, 300); }, /** @@ -5091,6 +5107,10 @@ MainMap_QM.prototype = { * MainMap_QM.init(callBackLoadOver,{build : 0, floor : 3, navPoint : 7, angle : 0, perc_H : "-50%",containerId : "mapContainer"}); */ MainMap_QM.init = function (callBack, options) { + if(Map_QM){ + Map_QM.cancelRender(); + Map_QM.beforeDestroy(options); + } Map_QM = new MainMap_QM(callBack, options); return Map_QM; } diff --git a/public/static/qm/three.js b/public/static/qm/three.js index f7cecb2..5e36b93 100644 --- a/public/static/qm/three.js +++ b/public/static/qm/three.js @@ -39018,7 +39018,7 @@ var uniforms = { u_time: { value: 0.0 } }; // 着色器设置 -const vertexShader = ` +var vertexShader1 = ` varying vec2 vUv; attribute float percent; uniform float u_time; @@ -39037,7 +39037,7 @@ const vertexShader = ` gl_Position = projectionMatrix * mvPosition; } ` -const fragmentShader = ` +var fragmentShader1 = ` #ifdef GL_ES precision mediump float; #endif @@ -39093,8 +39093,8 @@ function initFlyLine( curve, matSetting, pointsNumber ) { }; const lineMaterial = new THREE.ShaderMaterial( { uniforms: singleUniforms, - vertexShader: vertexShader, - fragmentShader: fragmentShader, + vertexShader: vertexShader1, + fragmentShader: fragmentShader1, transparent: true } ); return lineMaterial; From 011643802a65cc62434f97ef063d7799bfd4392d Mon Sep 17 00:00:00 2001 From: jiangx <1457960500@qq.com> Date: Tue, 23 May 2023 11:16:25 +0800 Subject: [PATCH 2/2] =?UTF-8?q?refactor:=20=E2=99=BB=EF=B8=8F=20=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E9=80=80=E5=87=BA=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/Logout/Logout.vue | 172 ------------------ src/base/Logout/chahao.svg | 1 - .../PublicComponent/PublicComponent.vue | 9 +- src/composables/useHandleScreen.ts | 13 +- src/composables/useLogout.ts | 50 ----- 5 files changed, 4 insertions(+), 241 deletions(-) delete mode 100644 src/base/Logout/Logout.vue delete mode 100644 src/base/Logout/chahao.svg delete mode 100644 src/composables/useLogout.ts diff --git a/src/base/Logout/Logout.vue b/src/base/Logout/Logout.vue deleted file mode 100644 index 07cfa29..0000000 --- a/src/base/Logout/Logout.vue +++ /dev/null @@ -1,172 +0,0 @@ - - - - - diff --git a/src/base/Logout/chahao.svg b/src/base/Logout/chahao.svg deleted file mode 100644 index b999bf7..0000000 --- a/src/base/Logout/chahao.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/components/PublicComponent/PublicComponent.vue b/src/components/PublicComponent/PublicComponent.vue index 9abdd3d..a1231e4 100644 --- a/src/components/PublicComponent/PublicComponent.vue +++ b/src/components/PublicComponent/PublicComponent.vue @@ -3,9 +3,6 @@ - - - @@ -21,20 +18,16 @@ import { useHandleScreen } from '@/composables/useHandleScreen' import { useInitMap } from '@/composables/useInitMap' import Map from '@/components/Map/Map.vue' -const Logout = defineAsyncComponent(() => import('@/base/Logout/Logout.vue')) const AutoBackNotification = defineAsyncComponent(() => import('@/base/AutoBackNotification/AutoBackNotification.vue')) const router = useRouter() const route = useRoute() const store = useRootStore() const { language, showSearch, showDetail } = storeToRefs(store) -const { checkHandleScreen, showCountDownDialog, title, toIndexTime, toWallpaperTime, isWallpaper, setLogout, resetClickNumber, logout } = - useHandleScreen(handleScreen) +const { checkHandleScreen, showCountDownDialog, title, toIndexTime, toWallpaperTime, isWallpaper } = useHandleScreen(handleScreen) //指定时间返回首页时做的操作 function handleScreen() { - setLogout(false) - resetClickNumber() showSearch.value && store.SET_SHOW_SEARCH(false) showDetail.value && store.SET_SHOW_DETAIL(false) language.value !== 'zh' && store.SET_LANGUAGE('zh') diff --git a/src/composables/useHandleScreen.ts b/src/composables/useHandleScreen.ts index e3203c8..92a9aec 100644 --- a/src/composables/useHandleScreen.ts +++ b/src/composables/useHandleScreen.ts @@ -2,7 +2,6 @@ import { ref, computed, onMounted, watch, toRefs } from 'vue' import { useRootStore } from '@/store/root' import { useRouter } from 'vue-router' import { getBackTime } from '@/http/api/base' -import { useLogout } from '@/composables/useLogout' export const useHandleScreen = (callback: () => void) => { const MIN_TIME = 0 @@ -12,9 +11,7 @@ export const useHandleScreen = (callback: () => void) => { const router = useRouter() const store = useRootStore() - const { device, nativeMethods, mapStatus } = toRefs(store) - - const { logout, resetClickNumber, setLogout, addTotalClick } = useLogout() + const { nativeMethods, mapStatus } = toRefs(store) const totalTime = ref<[number, number]>([60, 60]) //总时间 const toIndexTime = ref(60) //回首页的时间 @@ -58,8 +55,7 @@ export const useHandleScreen = (callback: () => void) => { //跳转屏保挂载到全局 供app使用 window.sleepToWallpaper = sleepToWallpaper - async function checkHandleScreen(e: TouchEvent) { - device.value.label === 'windows' && addTotalClick(e) + async function checkHandleScreen() { toIndexTime.value = totalTime.value[0] toWallpaperTime.value = totalTime.value[1] @@ -115,9 +111,6 @@ export const useHandleScreen = (callback: () => void) => { totalTime, toIndexTime, toWallpaperTime, - logout, - checkHandleScreen, - resetClickNumber, - setLogout + checkHandleScreen } } diff --git a/src/composables/useLogout.ts b/src/composables/useLogout.ts deleted file mode 100644 index 55f4ce8..0000000 --- a/src/composables/useLogout.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { ref, nextTick, watch } from 'vue' - -export const useLogout = () => { - const logout = ref(false) - const clickedNumberTotal = ref(0) - const timer = ref() - const MAX_NUMBER = 10 - const DELAY_TIME = 10000 - const SAFE_COORDINATES = 200 - - function resetClickNumber() { - clickedNumberTotal.value = 0 - } - - function setLogout(flag: boolean) { - logout.value = flag - } - - //点击商场logo 达到最大次数显示退出框 - function addTotalClick(e: TouchEvent) { - try { - const { clientX, clientY } = e.changedTouches[0] - const _clientX = parseInt(String(clientX), 10) - const _clientY = parseInt(String(clientY), 10) - if (_clientX >= 0 && _clientX <= SAFE_COORDINATES && _clientY >= 0 && _clientY <= SAFE_COORDINATES) { - clickedNumberTotal.value++ - } - nextTick(() => { - if (clickedNumberTotal.value >= MAX_NUMBER) { - logout.value = true - resetClickNumber() - } - }) - } catch (error) { - console.log(error) - } - } - - watch(clickedNumberTotal, newVal => { - clearTimeout(timer.value) - timer.value = setTimeout(() => { - if (newVal !== 0) { - clearTimeout(timer.value) - resetClickNumber() - } - }, DELAY_TIME) - }) - - return { resetClickNumber, addTotalClick, setLogout, logout } -}