Browse Source

Merge pull request 'dev' (#63) from dev into test

Reviewed-on: common/base_daoshi_vue_ts#63
test
姜鑫 3 years ago
parent
commit
78cbaae5eb
  1. 86
      public/static/qm/MainMap_QM.js
  2. 8
      public/static/qm/three.js
  3. 172
      src/base/Logout/Logout.vue
  4. 1
      src/base/Logout/chahao.svg
  5. 9
      src/components/PublicComponent/PublicComponent.vue
  6. 13
      src/composables/useHandleScreen.ts
  7. 50
      src/composables/useLogout.ts

86
public/static/qm/MainMap_QM.js

@ -33,7 +33,7 @@ QMUtil = function () {
this.beforPath = "./"; this.beforPath = "./";
this.options = { this.options = {
playSpeed: 6, //动画播放速度 playSpeed: 6, //动画播放速度
collision: false, //是否支持名称的碰撞检测
collision: true, //是否支持名称的碰撞检测
showStyle: false, //是否4K showStyle: false, //是否4K
modelIcon: true, //是否使用模型 true 模型 false 图标 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}]; 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 参数 相机坐标/ 镜头方向 //debug 参数 相机坐标/ 镜头方向
this.guiOptions = { cameraX: 0, cameraY: 220, cameraZ: 220, targatX: 0, targatY: 0, targatZ: 0 }; //this.button = function() {}; 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.selectBuild = 0;
this.selectFloor = 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.pathColor = pathColor != 0xb47834 ? pathColor : this.util.options.pathColor;
this.util.options.pathStyle = pathStyle != "3D" ? pathStyle : this.util.options.pathStyle; this.util.options.pathStyle = pathStyle != "3D" ? pathStyle : this.util.options.pathStyle;
this.util.iconUrl = iconUrl; this.util.iconUrl = iconUrl;
if (!isNaN(Number(options.floor))) { if (!isNaN(Number(options.floor))) {
this.util.startObj.floor = this.util.deviceObj.floor = parseInt(options.floor) || 0; this.util.startObj.floor = this.util.deviceObj.floor = parseInt(options.floor) || 0;
} else { } else {
@ -1457,11 +1456,13 @@ MainMap_QM.prototype = {
for(let k=0; k<this.util.allMap.length; k++){ for(let k=0; k<this.util.allMap.length; k++){
for (let kk = 0; kk < this.util.allMap[k].buildArr.length; kk++) { for (let kk = 0; kk < this.util.allMap[k].buildArr.length; kk++) {
let floor = this.util.allMap[k].buildArr[kk].mapData; let floor = this.util.allMap[k].buildArr[kk].mapData;
for (let t = 0; t < floor.models.length; t++) {
for (let i = 0; i < this.util.modelStr.length; i++) {
if (floor.models[t].type == this.util.modelStr[i].key) {
this.util.modelStr[i].load = true;
break;
if(floor.models){
for (let t = 0; t < floor.models.length; t++) {
for (let i = 0; i < this.util.modelStr.length; i++) {
if (floor.models[t].type == this.util.modelStr[i].key) {
this.util.modelStr[i].load = true;
break;
}
} }
} }
} }
@ -1649,11 +1650,7 @@ MainMap_QM.prototype = {
} }
}, },
loaderOver: function (e) { loaderOver: function (e) {
this.cancelRender();
this.util.pathStateObj.basePath = null;
this.renderer.dispose();
this.remove_child(this.sceneGap);
this.scene.remove(this.sceneGap);
this.sceneGap = new THREE.Group(); this.sceneGap = new THREE.Group();
this.sceneGap.position.set(this.util.sceneGap.x, this.util.sceneGap.y, this.util.sceneGap.z); this.sceneGap.position.set(this.util.sceneGap.x, this.util.sceneGap.y, this.util.sceneGap.z);
this.sceneGap.scale.set(this.util.sceneGap.scale, this.util.sceneGap.scale, this.util.sceneGap.scale); this.sceneGap.scale.set(this.util.sceneGap.scale, this.util.sceneGap.scale, this.util.sceneGap.scale);
@ -1785,7 +1782,26 @@ MainMap_QM.prototype = {
} }
}, 50); }, 50);
}, },
beforeDestroy:function(options) {
if (this.scene) {
this.renderer.dispose()
this.util.pathStateObj.basePath = null;
this.remove_child(this.sceneGap);
this.scene.remove(this.sceneGap);
let parent = document.getElementById(options.containerId || "mapContainer");
while ((elem = parent.firstChild)) {
elem.remove();
}
this.renderer.domElement = null
this.renderer = null
this.scene.clear()
this.scene = null
this.camera = null
this.controls = null
}
},
initTreeModel: function () { initTreeModel: function () {
if(this.index < this.util.modelStr.length - 1 ){ if(this.index < this.util.modelStr.length - 1 ){
if(this.util.modelStr[this.index].load){ if(this.util.modelStr[this.index].load){
this.gltfLoad(this.util.beforPath + this.util.modelStr[this.index].url); this.gltfLoad(this.util.beforPath + this.util.modelStr[this.index].url);
@ -1867,15 +1883,15 @@ MainMap_QM.prototype = {
//初始化方向为第一人称方向 //初始化方向为第一人称方向
let angle = this.util.options.deviceAng ? this.util.deviceObj.angle : 0; let angle = this.util.options.deviceAng ? this.util.deviceObj.angle : 0;
this.rotationAngle(angle); this.rotationAngle(angle);
if(this.util.guiOptions.cameraY == 220 && this.util.guiOptions.cameraZ == 220){
let boundBox = new THREE.Box3();
boundBox.setFromObject(this.sceneGap);
let wd = Math.max(boundBox.max.x-boundBox.min.x, boundBox.max.y-boundBox.min.y);
let cameraDis = Math.sqrt(this.util.guiOptions.cameraY*this.util.guiOptions.cameraY+this.util.guiOptions.cameraZ*this.util.guiOptions.cameraZ);
this.camera.fov = this.calcFov(cameraDis, wd, this.w / this.h);
this.camera.aspect = this.w / this.h;
this.camera.updateProjectionMatrix();
}
// if(this.util.guiOptions.cameraY == 220 && this.util.guiOptions.cameraZ == 220){
// let boundBox = new THREE.Box3();
// boundBox.setFromObject(this.sceneGap);
// let wd = Math.max(boundBox.max.x-boundBox.min.x, boundBox.max.y-boundBox.min.y);
// let cameraDis = Math.sqrt(this.util.guiOptions.cameraY*this.util.guiOptions.cameraY+this.util.guiOptions.cameraZ*this.util.guiOptions.cameraZ);
// this.camera.fov = this.calcFov(cameraDis, wd, this.w / this.h);
// this.camera.aspect = this.w / this.h;
// this.camera.updateProjectionMatrix();
// }
this.startRender(); this.startRender();
setTimeout(() => { setTimeout(() => {
Map_QM.controls.saveState(); Map_QM.controls.saveState();
@ -2088,7 +2104,7 @@ MainMap_QM.prototype = {
Map_QM.controls.enabled = true; Map_QM.controls.enabled = true;
Map_QM.controls.enableRotate = true; Map_QM.controls.enableRotate = true;
Map_QM.util.pathStateObj.forShopArr = { direction: "", wayList: [] }; Map_QM.util.pathStateObj.forShopArr = { direction: "", wayList: [] };
Map_QM.resetMeDir();
this.controls.reset();
if (Map_QM.guide && Map_QM.guide.visible) { if (Map_QM.guide && Map_QM.guide.visible) {
Map_QM.guide.visible = false Map_QM.guide.visible = false
} }
@ -2217,7 +2233,7 @@ MainMap_QM.prototype = {
Map_QM.util.selectBuild = build; Map_QM.util.selectBuild = build;
Map_QM.util.selectFloor = fIndex; Map_QM.util.selectFloor = fIndex;
if (Map_QM.util.options.shadow) { 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 () { z: 0, ease: Cubic.easeIn, onComplete: function () {
Map_QM.timeOutInit(); Map_QM.timeOutInit();
if (callBack) callBack(); if (callBack) callBack();
@ -2839,8 +2855,10 @@ MainMap_QM.prototype = {
Map_QM.controls.update(); Map_QM.controls.update();
Map_QM.renderer.render(Map_QM.scene, Map_QM.camera); Map_QM.renderer.render(Map_QM.scene, Map_QM.camera);
Map_QM.labelRenderer.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) { for (let item of Map_QM.mixers) {
item.update(T); item.update(T);
} }
@ -3066,7 +3084,7 @@ MainMap_QM.prototype = {
} }
}, },
onCallTouchORMouse: function (mouse) { 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; return;
} }
let raycaster = new THREE.Raycaster(); let raycaster = new THREE.Raycaster();
@ -3405,14 +3423,12 @@ MainMap_QM.prototype = {
if (!Map_QM) { if (!Map_QM) {
return; return;
} }
if (!Map_QM.util.options.collision) {
return;
}
clearTimeout(Map_QM.util.timeObj.collTime); clearTimeout(Map_QM.util.timeObj.collTime);
Map_QM.util.timeObj.collTime = setTimeout(() => { Map_QM.util.timeObj.collTime = setTimeout(() => {
clearTimeout(Map_QM.util.timeObj.collTime); 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 = []; let checkList = [];
if (Map_QM.util.options.overlap) { if (Map_QM.util.options.overlap) {
for (let i = 0; i < Map_QM.mapArr[Map_QM.util.selectBuild].length; i++) { 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(callBackLoadOver,{build : 0, floor : 3, navPoint : 7, angle : 0, perc_H : "-50%",containerId : "mapContainer"});
*/ */
MainMap_QM.init = function (callBack, options) { MainMap_QM.init = function (callBack, options) {
if(Map_QM){
Map_QM.cancelRender();
Map_QM.beforeDestroy(options);
}
Map_QM = new MainMap_QM(callBack, options); Map_QM = new MainMap_QM(callBack, options);
return Map_QM; return Map_QM;
} }

8
public/static/qm/three.js

@ -39018,7 +39018,7 @@ var uniforms = {
u_time: { value: 0.0 } u_time: { value: 0.0 }
}; };
// 着色器设置 // 着色器设置
const vertexShader = `
var vertexShader1 = `
varying vec2 vUv; varying vec2 vUv;
attribute float percent; attribute float percent;
uniform float u_time; uniform float u_time;
@ -39037,7 +39037,7 @@ const vertexShader = `
gl_Position = projectionMatrix * mvPosition; gl_Position = projectionMatrix * mvPosition;
} }
` `
const fragmentShader = `
var fragmentShader1 = `
#ifdef GL_ES #ifdef GL_ES
precision mediump float; precision mediump float;
#endif #endif
@ -39093,8 +39093,8 @@ function initFlyLine( curve, matSetting, pointsNumber ) {
}; };
const lineMaterial = new THREE.ShaderMaterial( { const lineMaterial = new THREE.ShaderMaterial( {
uniforms: singleUniforms, uniforms: singleUniforms,
vertexShader: vertexShader,
fragmentShader: fragmentShader,
vertexShader: vertexShader1,
fragmentShader: fragmentShader1,
transparent: true transparent: true
} ); } );
return lineMaterial; return lineMaterial;

172
src/base/Logout/Logout.vue

@ -1,172 +0,0 @@
<template>
<div v-if="modelValue" class="logout-container">
<div class="dialog-wrapper">
<p class="out-icon" @click="close">
<img src="./chahao.svg" class="close-icon" />
</p>
<input id="pwd" v-model="state.pwd" class="commons" placeholder="请输入密码" type="password" />
<p v-if="state.error" class="err-tips">密码错误</p>
<ul class="num-items">
<li v-for="item of state.num" :key="item" class="num-item" @click="handleClick(item)">
{{ item }}
</li>
<li class="num-item deletes" @click="deletes">
<img alt="" src="./chahao.svg" />
</li>
</ul>
<button class="close-browser commons" @click="closeBrowser">退出程序</button>
</div>
</div>
</template>
<script setup lang="ts">
import { watch, reactive, computed } from 'vue'
defineProps({
modelValue: Boolean
})
const emits = defineEmits(['bingo', 'close', 'update:modelValue'])
const state = reactive({
pwd: '',
error: false,
num: [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
})
const MAX_LEN = 6
//
const generatePwd = computed(() => {
const date = new Date()
return `${date.getDate().toString().padStart(2, '0')}${date.getDay().toString().padStart(2, '0')}${(date.getMonth() + 1)
.toString()
.padStart(2, '0')}`
})
function closeBrowser() {
if (state.pwd === generatePwd.value) {
emits('bingo')
}
}
function close() {
emits('update:modelValue', false)
}
function deletes() {
state.pwd = state.pwd.substring(0, state.pwd.length - 1)
}
function handleClick(item: number) {
if (state.pwd.length >= MAX_LEN) {
return
}
state.pwd += item
}
watch(
() => state.pwd,
newVal => {
state.error = newVal.length === MAX_LEN && newVal !== generatePwd.value
}
)
</script>
<style lang="scss" scoped>
.logout-container {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 9999;
background-color: rgb(0 0 0 / 30%);
backdrop-filter: blur(20px);
animation-duration: 0.3s;
.dialog-wrapper {
position: fixed;
top: 50%;
left: 50%;
display: flex;
align-items: center;
width: 780px;
padding: 90px 0;
background-color: #fff;
border-radius: 20px;
transform: translate3d(-50%, -50%, 0);
flex-direction: column;
align-content: flex-start;
.out-icon {
position: absolute;
top: 20px;
right: 25px;
.close-icon {
width: 50px;
}
}
.err-tips {
position: absolute;
top: 166px;
left: 172px;
font-size: 14px;
color: #c03127;
font-weight: bolder;
}
.commons {
width: 500px;
height: 60px;
border: none;
border-radius: 60px;
outline: none;
}
#pwd {
padding-left: 30px;
margin-bottom: 45px;
font-size: 16px;
box-shadow: 0 5px 9px 0 rgb(90 90 90 / 20%);
}
.num-items {
display: grid;
grid-template-columns: repeat(3, 62px);
grid-template-rows: repeat(3, 62px);
gap: 45px 80px;
width: 350px;
margin: 0 auto;
margin-bottom: 45px;
.num-item {
font-size: 30px;
text-align: center;
color: black;
border-radius: 50%;
line-height: 62px;
&.deletes {
display: flex;
justify-content: center;
align-items: center;
}
&:hover {
color: #fff;
background-color: #aca8b3;
}
&:nth-child(10) {
grid-column-start: 2;
}
img {
width: 40px;
height: 40px;
}
}
}
.close-browser {
font-size: 22px;
color: #fff;
background-color: #aca8b3;
}
}
}
</style>

1
src/base/Logout/chahao.svg

@ -1 +0,0 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1558935211967" class="icon" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1972" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16"><defs><style type="text/css"></style></defs><path d="M883.7 825L570.8 511.9 883.7 199c8.1-8.1 12.2-18.7 12.2-29.4 0-10.6-4.1-21.3-12.2-29.4a41.465 41.465 0 0 0-58.8 0L512 453.3 199.1 140.2a41.465 41.465 0 0 0-58.8 0 41.465 41.465 0 0 0 0 58.8l313.1 312.9L140.3 825a41.465 41.465 0 0 0 0 58.8c16.3 16.3 42.5 16.3 58.8 0L512 570.7l313.1 312.9c8.1 8.1 18.7 12.2 29.4 12.2 10.6 0 21.3-4.1 29.4-12.2 16.1-16.1 16.1-42.5-0.2-58.6z" p-id="1973" fill="#b8bfc3"></path></svg>

Before

Width:  |  Height:  |  Size: 797 B

9
src/components/PublicComponent/PublicComponent.vue

@ -3,9 +3,6 @@
<!-- 地图容器 --> <!-- 地图容器 -->
<Map @handle-go="handleGO" @handle-detail="handleDetail" /> <Map @handle-go="handleGO" @handle-detail="handleDetail" />
<!-- 退出弹框 -->
<Logout v-model="logout" />
<!-- 倒计时返回首页提示 --> <!-- 倒计时返回首页提示 -->
<Transition enter-active-class="animate__animated animate__zoomIn" leave-active-class="animate__animated animate__zoomOut"> <Transition enter-active-class="animate__animated animate__zoomIn" leave-active-class="animate__animated animate__zoomOut">
<AutoBackNotification v-if="showCountDownDialog" :title="title" :delay="isWallpaper ? toWallpaperTime : toIndexTime" /> <AutoBackNotification v-if="showCountDownDialog" :title="title" :delay="isWallpaper ? toWallpaperTime : toIndexTime" />
@ -21,20 +18,16 @@ import { useHandleScreen } from '@/composables/useHandleScreen'
import { useInitMap } from '@/composables/useInitMap' import { useInitMap } from '@/composables/useInitMap'
import Map from '@/components/Map/Map.vue' import Map from '@/components/Map/Map.vue'
const Logout = defineAsyncComponent(() => import('@/base/Logout/Logout.vue'))
const AutoBackNotification = defineAsyncComponent(() => import('@/base/AutoBackNotification/AutoBackNotification.vue')) const AutoBackNotification = defineAsyncComponent(() => import('@/base/AutoBackNotification/AutoBackNotification.vue'))
const router = useRouter() const router = useRouter()
const route = useRoute() const route = useRoute()
const store = useRootStore() const store = useRootStore()
const { language, showSearch, showDetail } = storeToRefs(store) 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() { function handleScreen() {
setLogout(false)
resetClickNumber()
showSearch.value && store.SET_SHOW_SEARCH(false) showSearch.value && store.SET_SHOW_SEARCH(false)
showDetail.value && store.SET_SHOW_DETAIL(false) showDetail.value && store.SET_SHOW_DETAIL(false)
language.value !== 'zh' && store.SET_LANGUAGE('zh') language.value !== 'zh' && store.SET_LANGUAGE('zh')

13
src/composables/useHandleScreen.ts

@ -2,7 +2,6 @@ import { ref, computed, onMounted, watch, toRefs } from 'vue'
import { useRootStore } from '@/store/root' import { useRootStore } from '@/store/root'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { getBackTime } from '@/http/api/base' import { getBackTime } from '@/http/api/base'
import { useLogout } from '@/composables/useLogout'
export const useHandleScreen = (callback: () => void) => { export const useHandleScreen = (callback: () => void) => {
const MIN_TIME = 0 const MIN_TIME = 0
@ -12,9 +11,7 @@ export const useHandleScreen = (callback: () => void) => {
const router = useRouter() const router = useRouter()
const store = useRootStore() 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 totalTime = ref<[number, number]>([60, 60]) //总时间
const toIndexTime = ref(60) //回首页的时间 const toIndexTime = ref(60) //回首页的时间
@ -58,8 +55,7 @@ export const useHandleScreen = (callback: () => void) => {
//跳转屏保挂载到全局 供app使用 //跳转屏保挂载到全局 供app使用
window.sleepToWallpaper = sleepToWallpaper window.sleepToWallpaper = sleepToWallpaper
async function checkHandleScreen(e: TouchEvent) {
device.value.label === 'windows' && addTotalClick(e)
async function checkHandleScreen() {
toIndexTime.value = totalTime.value[0] toIndexTime.value = totalTime.value[0]
toWallpaperTime.value = totalTime.value[1] toWallpaperTime.value = totalTime.value[1]
@ -115,9 +111,6 @@ export const useHandleScreen = (callback: () => void) => {
totalTime, totalTime,
toIndexTime, toIndexTime,
toWallpaperTime, toWallpaperTime,
logout,
checkHandleScreen,
resetClickNumber,
setLogout
checkHandleScreen
} }
} }

50
src/composables/useLogout.ts

@ -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 }
}
Loading…
Cancel
Save