From d8b272746ec55c65f6dee2e9fd5f4699220599e1 Mon Sep 17 00:00:00 2001 From: gaozl Date: Thu, 25 May 2023 19:24:11 +0800 Subject: [PATCH 1/4] fix: ci --- public/static/qm/MainMap_QM.js | 43 +++++++++++++++++----------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/public/static/qm/MainMap_QM.js b/public/static/qm/MainMap_QM.js index 66a0729..66f93ee 100644 --- a/public/static/qm/MainMap_QM.js +++ b/public/static/qm/MainMap_QM.js @@ -1,4 +1,4 @@ -var Map_QM, renderFrame = -1, pathCameraState, stats, stateTime, isJUZ = false, hasLine = false, dir = false, iot = true, shopTime, debug = false; //dir--自定义地图大小适应不同版本的地图大小 +var Map_QM, renderFrame = -1, pathCameraState, stats, stateTime, isJUZ = false, hasLine = false, dir = false, iot = false, shopTime, debug = true; //dir--自定义地图大小适应不同版本的地图大小 //basePath 基础路径 graphPath最佳路径 ftPath 扶梯路径 dtPath 电梯路径 var typeObj = [{ ft: 0, type: 0, code: 'ft', name: '扶梯' }, { upft: 1, type: 1, code: 'upft', name: '上扶梯' }, { downft: 2, type: 2, code: 'downft', name: '下扶梯' }, { mys: 3, type: 3, code: 'mys', name: '母婴室' }, { xsj: 4, type: 4, code: 'xsj', name: '洗手间' }, @@ -1389,14 +1389,14 @@ MainMap_QM.prototype = { initOptions: function (options) { //初始化参数 if (this.util.allMap[this.util.selectBuild].playSpeed) { - this.util.options.mapScale = this.util.allMap[this.util.selectBuild].hasOwnProperty("scale") ? parseInt(this.util.allMap[this.util.selectBuild].scale) : 18; - this.util.options.playSpeed = this.util.allMap[this.util.selectBuild].hasOwnProperty("playSpeed") ? parseInt(this.util.allMap[this.util.selectBuild].playSpeed) : 6; - this.util.options.collision = this.util.allMap[this.util.selectBuild].hasOwnProperty("collision") ? this.util.allMap[this.util.selectBuild].collision : true; - this.util.options.navColor = this.util.allMap[this.util.selectBuild].hasOwnProperty("navColor") ? this.util.allMap[this.util.selectBuild].navColor : 0xEE6A50; - this.util.options.aRadius = this.util.allMap[this.util.selectBuild].hasOwnProperty("aRadius") ? parseInt(this.util.allMap[this.util.selectBuild].aRadius) : 2; - this.util.options.boxShop = this.util.allMap[this.util.selectBuild].hasOwnProperty("boxShop") ? this.util.allMap[this.util.selectBuild].boxShop.split(",") : []; - this.util.options.shopStyle = this.util.allMap[this.util.selectBuild].hasOwnProperty("shopStyle") ? this.util.allMap[this.util.selectBuild].shopStyle : "shopName"; - this.util.options.modelIcon = this.util.allMap[this.util.selectBuild].hasOwnProperty("modelIcon") ? this.util.allMap[this.util.selectBuild].modelIcon : true; + this.util.allMap[this.util.selectBuild].hasOwnProperty("scale") && (this.util.options.mapScale = parseInt(this.util.allMap[this.util.selectBuild].scale)); + this.util.allMap[this.util.selectBuild].hasOwnProperty("playSpeed") && (this.util.options.playSpeed = parseInt(this.util.allMap[this.util.selectBuild].playSpeed)); + this.util.allMap[this.util.selectBuild].hasOwnProperty("collision") && (this.util.options.collision = this.util.allMap[this.util.selectBuild].collision); + this.util.allMap[this.util.selectBuild].hasOwnProperty("navColor") && (this.util.options.navColor = this.util.allMap[this.util.selectBuild].navColor); + this.util.allMap[this.util.selectBuild].hasOwnProperty("aRadius") && (this.util.options.aRadius = parseInt(this.util.allMap[this.util.selectBuild].aRadius)); + this.util.allMap[this.util.selectBuild].hasOwnProperty("boxShop") && (this.util.options.boxShop = this.util.allMap[this.util.selectBuild].boxShop.split(",")); + this.util.allMap[this.util.selectBuild].hasOwnProperty("shopStyle") && (this.util.options.shopStyle = this.util.allMap[this.util.selectBuild].shopStyle); + this.util.allMap[this.util.selectBuild].hasOwnProperty("modelIcon") && (this.util.options.modelIcon = this.util.allMap[this.util.selectBuild].modelIcon); this.hemiLight.color = new THREE.Color(this.util.allMap[this.util.selectBuild].s_col || "#fffff0"); this.hemiLight.groundColor = new THREE.Color(this.util.allMap[this.util.selectBuild].g_col || "#ffffff"); @@ -2164,13 +2164,13 @@ MainMap_QM.prototype = { for (let i = 0; i < Map_QM.mapArr[t].length; i++) { Map_QM.mapArr[t][i].allObj.visible = t == build ? true : false; Map_QM.mapArr[t][i].labelObj.traverse((obj) => { - obj.visible = false; + obj.element && (obj.element.style.visibility = "hidden"); }); Map_QM.mapArr[t][i].tagObj.traverse((obj) => { - obj.visible = false; + obj.element && (obj.element.style.visibility = "hidden"); }); Map_QM.mapArr[t][i].showTagObj.traverse((obj) => { - obj.visible = false; + obj.element && (obj.element.style.visibility = "hidden"); }); } } @@ -2179,15 +2179,14 @@ MainMap_QM.prototype = { } else { return; } - for (let i = 0; i < Map_QM.mapArr[build].length; i++) { if (i == fIndex || (i == midIndex && Map_QM.util.options.overlap) || (i == endIndex && Map_QM.util.options.overlap)) { Map_QM.mapArr[build][i].allObj.visible = true; Map_QM.mapArr[build][i].labelObj.traverse((obj) => { - obj.visible = true; + obj.element && (obj.element.style.visibility = "visible") }); Map_QM.mapArr[build][i].showTagObj.traverse((obj) => { - obj.visible = true; + obj.element && (obj.element.style.visibility = "visible"); }); } else { Map_QM.mapArr[build][i].allObj.visible = false; @@ -2519,7 +2518,7 @@ MainMap_QM.prototype = { */ changeStateShopPro: function (isShow = false) { Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].tagObj.traverse((obj) => { - obj.visible = isShow; + obj.element && (obj.element.style.visibility = isShow?"visible":"hidden"); }); }, /** @@ -2818,7 +2817,7 @@ MainMap_QM.prototype = { */ startRender: function () { Map_QM.cancelRender(); - renderFrame = requestAnimationFrame(Map_QM.startRender); + let T = Map_QM.util._clock.getDelta(); Map_QM.util.timeObj.timeS = Map_QM.util.timeObj.timeS + T; // requestAnimationFrame默认调用render函数60次,通过时间判断,降低renderer.render执行频率 @@ -2844,7 +2843,7 @@ MainMap_QM.prototype = { Map_QM.labelRenderer.render(Map_QM.scene, Map_QM.camera); if(Map_QM.mapArr[Map_QM.util.selectBuild] && Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor]){ 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 ); + Map_QM.labelRenderer.renderObject( Map_QM.CSSObject, Map_QM.camera); } for (let item of Map_QM.mixers) { item.update(T); @@ -2859,6 +2858,7 @@ MainMap_QM.prototype = { //timeS置0 Map_QM.util.timeObj.timeS = 0; } + renderFrame = requestAnimationFrame(Map_QM.startRender); }, /** * @api {方法} cancelRender() 取消地图渲染 @@ -3207,6 +3207,7 @@ MainMap_QM.prototype = { 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.zOrder( Map_QM.mapArr[Map_QM.util.selectBuild][Map_QM.util.selectFloor].labelObj ); + Map_QM.collLabel(); if (Map_QM.callBackLoadOver) { let floorData = []; for (let i = 0; i < Map_QM.util.allMap.length; i++) { @@ -3230,7 +3231,7 @@ MainMap_QM.prototype = { type: "changeFloorOver", data: Map_QM.selectFloor }); - Map_QM.collLabel(); + }, autoChangeEleAngle: function () { @@ -3293,6 +3294,7 @@ MainMap_QM.prototype = { controlsChock: function () { Map_QM.autoChangeEleAngle(); Map_QM.collLabel(); + /** * @api {事件} MapAngleChange 地图的方向改变 * @apiGroup 地图事件 @@ -3411,7 +3413,6 @@ MainMap_QM.prototype = { if (!Map_QM || !Map_QM.util.options.collision) { return; } - clearTimeout(Map_QM.util.timeObj.collTime); Map_QM.util.timeObj.collTime = setTimeout(() => { clearTimeout(Map_QM.util.timeObj.collTime); @@ -5198,7 +5199,7 @@ FloorMap_QM.prototype = { obj.rotateY(Map_QM.util.modelArr[i].list[t].rot.y); obj.rotateZ(Map_QM.util.modelArr[i].list[t].rot.z); sopce.allObj.add(obj); - } showTagObj + } }); } } From 32ce94bba88934d1922b35d6a4985a14bcb7df0a Mon Sep 17 00:00:00 2001 From: gaozl Date: Fri, 26 May 2023 17:34:21 +0800 Subject: [PATCH 2/4] fix: ci --- public/static/qm/MainMap_QM.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/public/static/qm/MainMap_QM.js b/public/static/qm/MainMap_QM.js index 66f93ee..e54d6c1 100644 --- a/public/static/qm/MainMap_QM.js +++ b/public/static/qm/MainMap_QM.js @@ -1,4 +1,4 @@ -var Map_QM, renderFrame = -1, pathCameraState, stats, stateTime, isJUZ = false, hasLine = false, dir = false, iot = false, shopTime, debug = true; //dir--自定义地图大小适应不同版本的地图大小 +var Map_QM, renderFrame = -1, pathCameraState, stats, stateTime, isJUZ = false, hasLine = false, dir = false, iot = true, shopTime, debug = false; //dir--自定义地图大小适应不同版本的地图大小 //basePath 基础路径 graphPath最佳路径 ftPath 扶梯路径 dtPath 电梯路径 var typeObj = [{ ft: 0, type: 0, code: 'ft', name: '扶梯' }, { upft: 1, type: 1, code: 'upft', name: '上扶梯' }, { downft: 2, type: 2, code: 'downft', name: '下扶梯' }, { mys: 3, type: 3, code: 'mys', name: '母婴室' }, { xsj: 4, type: 4, code: 'xsj', name: '洗手间' }, @@ -1226,7 +1226,6 @@ MainMap_QM = function (callBack, options) { if (document.getElementById('moveFloorBG')) { this.moveFloorbg = new THREE.CSS2DObject(document.getElementById('moveFloorBG')); - this.scene.add(this.moveFloorbg); } this.man_3d; this.man_2d; @@ -1659,6 +1658,9 @@ MainMap_QM.prototype = { this.buildObj = new THREE.Group(); this.sceneGap.add(this.buildObj); this.CSSObject = new THREE.Object3D(); + if(this.moveFloorbg){ + this.CSSObject.add(this.moveFloorbg); + } this.buildObj.add(this.CSSObject); this.buildObj.add(this.dtLineGroup); this.initGuide(); @@ -4709,7 +4711,6 @@ MainMap_QM.prototype = { Map_QM.moveFloorbg.element.style.height = (floorArr.length * add) + "px"; Map_QM.moveFloorbg.position.set(x0, y0, 80); Map_QM.moveFloorbg.applyMatrix4(Map_QM.mapArr[parseInt(Map_QM.forShopArr[Map_QM.util._indexPathFloor].build)][pathFloor].allObj.matrix); - Map_QM.moveFloorbg.applyMatrix4(Map_QM.sceneGap.matrix); let floorBox = document.getElementById('floorBox'); while (floorBox.hasChildNodes()) { floorBox.removeChild(floorBox.firstChild); From 6d66915670e668cecb73b3c7249e0ff2c98ec5c6 Mon Sep 17 00:00:00 2001 From: gaozl Date: Mon, 29 May 2023 11:30:35 +0800 Subject: [PATCH 3/4] fix: ci --- public/static/qm/MainMap_QM.js | 14 +++++++++----- public/static/qm/three.js | 12 ++++++------ 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/public/static/qm/MainMap_QM.js b/public/static/qm/MainMap_QM.js index e54d6c1..776e109 100644 --- a/public/static/qm/MainMap_QM.js +++ b/public/static/qm/MainMap_QM.js @@ -1,4 +1,4 @@ -var Map_QM, renderFrame = -1, pathCameraState, stats, stateTime, isJUZ = false, hasLine = false, dir = false, iot = true, shopTime, debug = false; //dir--自定义地图大小适应不同版本的地图大小 +var Map_QM, renderFrame = -1, pathCameraState, stats, stateTime, isJUZ = false, hasLine = false, dir = false, iot = false, shopTime, debug = false; //dir--自定义地图大小适应不同版本的地图大小 //basePath 基础路径 graphPath最佳路径 ftPath 扶梯路径 dtPath 电梯路径 var typeObj = [{ ft: 0, type: 0, code: 'ft', name: '扶梯' }, { upft: 1, type: 1, code: 'upft', name: '上扶梯' }, { downft: 2, type: 2, code: 'downft', name: '下扶梯' }, { mys: 3, type: 3, code: 'mys', name: '母婴室' }, { xsj: 4, type: 4, code: 'xsj', name: '洗手间' }, @@ -843,7 +843,7 @@ QMUtil = function () { } else { //不是横线时 根据斜率计算点位 x = point.x + 5; - y = parseInt(gradient * (x - point.x) + point.y); + y = gradient * (x - point.x) + point.y; } return Map_QM.util.pointXY(point, new Map_QM.util.Point(x, y), wallWidth / 2); @@ -866,8 +866,8 @@ QMUtil = function () { let x1 = (-B + Math.sqrt(Math.pow(B, 2) - 4 * A * C)) / (2 * A); let x2 = (-B - Math.sqrt(Math.pow(B, 2) - 4 * A * C)) / (2 * A); - result.push(new Map_QM.util.Point(parseInt(x1), parseInt(k * x1 + b))); - result.push(new Map_QM.util.Point(parseInt(x2), parseInt(k * x2 + b))); + result.push(new Map_QM.util.Point(x1, k * x1 + b)); + result.push(new Map_QM.util.Point(x2, k * x2 + b)); return result; } //计算两条直线的相交点 @@ -2624,7 +2624,11 @@ MainMap_QM.prototype = { drawToLine: function (startPoint, endPoint, dash = 50, color = 0x2269dd, ctrlPoint1 = null, ctrlPoint2 = null) { let curve = new THREE.CubicBezierCurve3(startPoint, ctrlPoint1, ctrlPoint2, endPoint); let points = curve.getPoints(dash); - let flyLine = createFlyCurve(points, false); + let colorChange=[]; + for(let i=1; i<7; i+=2){ + colorChange.push(parseInt("0x"+color.slice(i,i+2))/255); + } + let flyLine = createFlyCurve(points,new THREE.Vector3( colorChange[0], colorChange[1], colorChange[2] ), false); flyLine.userData.type = "toLine"; return flyLine; }, diff --git a/public/static/qm/three.js b/public/static/qm/three.js index 5e36b93..c0362d5 100644 --- a/public/static/qm/three.js +++ b/public/static/qm/three.js @@ -39018,7 +39018,7 @@ var uniforms = { u_time: { value: 0.0 } }; // 着色器设置 -var vertexShader1 = ` +const vertexShader = ` varying vec2 vUv; attribute float percent; uniform float u_time; @@ -39037,7 +39037,7 @@ var vertexShader1 = ` gl_Position = projectionMatrix * mvPosition; } ` -var fragmentShader1 = ` +const fragmentShader = ` #ifdef GL_ES precision mediump float; #endif @@ -39050,10 +39050,10 @@ var fragmentShader1 = ` gl_FragColor = vec4(color,1); } ` -function createFlyCurve(points, closed) { +function createFlyCurve(points, color, closed) { var curve = new THREE.CatmullRomCurve3(points, closed); // 流光的颜色,三个数字分别代表rgb的值,不过注意,需要除以255 - var color = new THREE.Vector3( 0.2235, 0.412, 1 ); + var color = color || new THREE.Vector3( 0.2235, 0.412, 1 ); var flyLine = initFlyLine( curve, { speed: 0.5, color: color, @@ -39093,8 +39093,8 @@ function initFlyLine( curve, matSetting, pointsNumber ) { }; const lineMaterial = new THREE.ShaderMaterial( { uniforms: singleUniforms, - vertexShader: vertexShader1, - fragmentShader: fragmentShader1, + vertexShader: vertexShader, + fragmentShader: fragmentShader, transparent: true } ); return lineMaterial; From bcddac6d72209054546801cc40510b767c11e8b0 Mon Sep 17 00:00:00 2001 From: jiangx <1457960500@qq.com> Date: Mon, 29 May 2023 15:26:20 +0800 Subject: [PATCH 4/4] =?UTF-8?q?refactor:=20=E2=99=BB=EF=B8=8F=20=E9=83=A8?= =?UTF-8?q?=E5=88=86=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/composables/useHandleScreen.ts | 6 +++--- src/composables/useInitMap.ts | 2 +- src/composables/useStatistics.ts | 9 +++++++-- src/http/http.ts | 1 + src/store/root/actions.ts | 8 ++++---- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/composables/useHandleScreen.ts b/src/composables/useHandleScreen.ts index d19bdef..5b6a6b8 100644 --- a/src/composables/useHandleScreen.ts +++ b/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] diff --git a/src/composables/useInitMap.ts b/src/composables/useInitMap.ts index a803538..5d7fac1 100644 --- a/src/composables/useInitMap.ts +++ b/src/composables/useInitMap.ts @@ -59,5 +59,5 @@ function showMapDialog() { //监听地图上下文丢失 刷新页面 function onContextLost() { - location.reload() + window.location.href = '/' } diff --git a/src/composables/useStatistics.ts b/src/composables/useStatistics.ts index 3e440d5..05e04a2 100644 --- a/src/composables/useStatistics.ts +++ b/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) diff --git a/src/http/http.ts b/src/http/http.ts index bd49818..13fc093 100644 --- a/src/http/http.ts +++ b/src/http/http.ts @@ -85,6 +85,7 @@ class Request { const _request = new Request({ timeout: 10000, + timeoutErrorMessage: '网络超时', interceptors: { requestInterceptors(_config) { const store = useRootStore() diff --git a/src/store/root/actions.ts b/src/store/root/actions.ts index bc7994d..3f2c71b 100644 --- a/src/store/root/actions.ts +++ b/src/store/root/actions.ts @@ -24,15 +24,15 @@ export interface Actions { export type GenActions = CreateActions 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) {