diff --git a/src/components/Verifition/src/Verify/VerifyPoints.vue b/src/components/Verifition/src/Verify/VerifyPoints.vue index 9d04f291e..0c2745048 100644 --- a/src/components/Verifition/src/Verify/VerifyPoints.vue +++ b/src/components/Verifition/src/Verify/VerifyPoints.vue @@ -148,6 +148,8 @@ onMounted(() => { } }) const canvas = ref(null) +const timer1 = ref(0) +const timer2 = ref(0) const canvasClick = (e) => { checkPosArr.push(getMousePos(canvas, e)) if (num.value == checkNum.value) { @@ -157,7 +159,7 @@ const canvasClick = (e) => { checkPosArr.length = 0 checkPosArr.push(...arr) //等创建坐标执行完 - setTimeout(() => { + timer1.value = setTimeout(() => { // var flag = this.comparePos(this.fontPos, this.checkPosArr); //发送后端请求 var captchaVerification = secretKey.value @@ -177,9 +179,13 @@ const canvasClick = (e) => { text.value = t('captcha.success') bindingClick.value = false if (mode.value == 'pop') { - setTimeout(() => { + timer2.value = setTimeout(() => { proxy.$parent.clickShow = false refresh() + if(timer2.value){ + clearTimeout(timer2.value) + timer2.value = 0 + } }, 1500) } proxy.$parent.$emit('success', { captchaVerification }) @@ -188,17 +194,33 @@ const canvasClick = (e) => { barAreaColor.value = '#d9534f' barAreaBorderColor.value = '#d9534f' text.value = t('captcha.fail') - setTimeout(() => { + timer2.value = setTimeout(() => { refresh() + if(timer2.value){ + clearTimeout(timer2.value) + timer2.value = 0 + } }, 700) } }) + if(timer1.value){ + clearTimeout(timer1.value) + timer1.value = 0 + } }, 400) } if (num.value < checkNum.value) { num.value = createPoint(getMousePos(canvas, e)) } } +onBeforeUnmount(() => { + if(timer1.value){ + clearTimeout(timer1.value) + } + if(timer2.value){ + clearTimeout(timer2.value) + } +}) //获取坐标 const getMousePos = function (obj, e) { var x = e.offsetX diff --git a/src/components/Verifition/src/Verify/VerifySlide.vue b/src/components/Verifition/src/Verify/VerifySlide.vue index 8b448b0de..aa11ad132 100644 --- a/src/components/Verifition/src/Verify/VerifySlide.vue +++ b/src/components/Verifition/src/Verify/VerifySlide.vue @@ -295,9 +295,14 @@ const end = () => { showRefresh.value = false isEnd.value = true if (mode.value == 'pop') { - setTimeout(() => { + let timer + timer = setTimeout(() => { proxy.$parent.clickShow = false refresh() + if(timer){ + clearTimeout(timer) + timer = null + } }, 1500) } passFlag.value = true @@ -309,10 +314,15 @@ const end = () => { secretKey.value ) : backToken.value + '---' + JSON.stringify({ x: moveLeftDistance, y: 5.0 }) - setTimeout(() => { + let timer + timer = setTimeout(() => { tipWords.value = '' proxy.$parent.closeBox() proxy.$parent.$emit('success', { captchaVerification }) + if(timer){ + clearTimeout(timer) + timer = null + } }, 1000) } else { moveBlockBackgroundColor.value = '#d9534f' @@ -320,13 +330,23 @@ const end = () => { iconColor.value = '#fff' iconClass.value = 'icon-close' passFlag.value = false - setTimeout(function () { + let timer + timer = setTimeout(()=>{ refresh() + if(timer){ + clearTimeout(timer) + timer = null + } }, 1000) proxy.$parent.$emit('error', proxy) tipWords.value = t('captcha.fail') - setTimeout(() => { + let timer1 + timer1 = setTimeout(() => { tipWords.value = '' + if(timer1){ + clearTimeout(timer1) + timer1 = null + } }, 1000) } }) @@ -351,10 +371,15 @@ const refresh = async () => { isEnd.value = false await getPictrue() - setTimeout(() => { + let timer + timer = setTimeout(() => { transitionWidth.value = '' transitionLeft.value = '' text.value = explain.value + if(timer){ + clearTimeout(timer) + timer = null + } }, 300) } diff --git a/src/components/bpmnProcessDesigner/package/penal/base/ElementBaseInfo.vue b/src/components/bpmnProcessDesigner/package/penal/base/ElementBaseInfo.vue index 639c1cb2d..6d64b3b7c 100644 --- a/src/components/bpmnProcessDesigner/package/penal/base/ElementBaseInfo.vue +++ b/src/components/bpmnProcessDesigner/package/penal/base/ElementBaseInfo.vue @@ -76,6 +76,9 @@ const resetBaseInfo = () => { // elementBaseInfo.value = JSON.parse(JSON.stringify(bpmnElement.value.businessObject)) console.log(elementBaseInfo.value, 'elementBaseInfo22222222222') } +const timer1 = ref() +const timer2 = ref() +const timer3 = ref() const handleKeyUpdate = (value) => { // 校验 value 的值,只有 XML NCName 通过的情况下,才进行赋值。否则,会导致流程图报错,无法绘制的问题 if (!value) { @@ -90,8 +93,12 @@ const handleKeyUpdate = (value) => { // 在 BPMN 的 XML 中,流程标识 key,其实对应的是 id 节点 elementBaseInfo.value['id'] = value - setTimeout(() => { + timer1.value = setTimeout(() => { updateBaseInfo('id') + if(timer1.value){ + clearTimeout(timer1.value) + timer1.value = 0 + } }, 100) } const handleNameUpdate = (value) => { @@ -101,8 +108,12 @@ const handleNameUpdate = (value) => { } elementBaseInfo.value['name'] = value - setTimeout(() => { + timer2.value = setTimeout(() => { updateBaseInfo('name') + if(timer2.value){ + clearTimeout(timer2.value) + timer2.value = 0 + } }, 100) } // const handleDescriptionUpdate=(value)=> { @@ -140,10 +151,14 @@ const updateBaseInfo = (key) => { } onMounted(() => { // 针对上传的 bpmn 流程图时,需要延迟 1 秒的时间,保证 key 和 name 的更新 - setTimeout(() => { + timer3.value = setTimeout(() => { console.log(props.model, 'props.model') handleKeyUpdate(props.model.key) handleNameUpdate(props.model.name) + if(timer3.value){ + clearTimeout(timer3.value) + timer3.value = 0 + } console.log(props, 'propsssssssssssssssssssss') }, 1000) }) @@ -180,5 +195,17 @@ watch( // } onBeforeUnmount(() => { bpmnElement.value = null + if(timer1.value){ + clearTimeout(timer1.value) + timer1.value = 0 + } + if(timer2.value){ + clearTimeout(timer2.value) + timer2.value = 0 + } + if(timer3.value){ + clearTimeout(timer3.value) + timer3.value = 0 + } }) diff --git a/src/components/bpmnProcessDesigner/src/utils/directive/clickOutSide.js b/src/components/bpmnProcessDesigner/src/utils/directive/clickOutSide.js index bb71d4420..e0da73e77 100644 --- a/src/components/bpmnProcessDesigner/src/utils/directive/clickOutSide.js +++ b/src/components/bpmnProcessDesigner/src/utils/directive/clickOutSide.js @@ -22,9 +22,13 @@ export default { methodName: binding.expression, bindingFn: binding.value } - - setTimeout(() => { + let timer + timer = setTimeout(() => { document.addEventListener('touchstart', documentHandler) // 为document绑定事件 + if(timer){ + clearTimeout(timer) + timer = null + } }) }, update(el, binding) { diff --git a/src/components/iFrame/src/IFrame.vue b/src/components/iFrame/src/IFrame.vue index 85b3e3c34..5d2626d6d 100644 --- a/src/components/iFrame/src/IFrame.vue +++ b/src/components/iFrame/src/IFrame.vue @@ -14,6 +14,8 @@ const init = () => { height.value = document.documentElement.clientHeight - 94.5 + 'px' loading.value = false } +const timer1 = ref() +const timer2 = ref() console.log(props.src); function populateIframe(iframe, headers) { @@ -37,14 +39,33 @@ function populateIframe(iframe, headers) { onMounted(() => { - setTimeout(() => { + timer1.value = setTimeout(() => { var iframe = document.querySelector("#iframe"); populateIframe(iframe, [["Authorization", 'Bearer ' + getAccessToken()], ["tenant-id", getTenantId()]]); + if(timer1.value){ + clearTimeout(timer1.value) + timer1.value = 0 + } }, 300); - setTimeout(() => { + timer2.value = setTimeout(() => { init() + if(timer2.value){ + clearTimeout(timer2.value) + timer2.value = 0 + } }, 300) }) + +onBeforeUnmount(() => { + if(timer1.value){ + clearTimeout(timer1.value) + timer1.value = 0 + } + if(timer2.value){ + clearTimeout(timer2.value) + timer2.value = 0 + } +})