From 82d5642376524123bdc9a8be2629ebc6d0fe51d3 Mon Sep 17 00:00:00 2001 From: wangyifeng <812766448@qq.com> Date: Thu, 26 Jun 2025 11:20:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BD=BF=E7=94=A8=E4=BD=93?= =?UTF-8?q?=E9=AA=8C=EF=BC=8C=E5=8C=85=E6=8B=AC=E8=A7=A6=E6=91=B8=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E3=80=81=E6=95=B0=E6=8D=AE=E5=8A=A0=E8=BD=BD=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/deep-bubble/deep-bubble.vue | 6 +- src/components/x-confirm/index.vue | 8 +- src/connect.js | 2 +- src/main.js | 61 +++++++++++-- src/pages/dialog/index.vue | 6 +- src/pages/index/index.vue | 85 ++++++++++++------- .../components/all-speech/all-speech.vue | 6 +- .../tmui/components/tm-adsorb/tm-adsorb.vue | 6 +- .../tmui/components/tm-button/tm-button.vue | 6 +- .../tmui/components/tm-chart/tm-chart.vue | 18 ++-- .../tm-color-view/tm-color-view.vue | 36 ++++---- .../tmui/components/tm-cropimg/tm-cropimg.vue | 8 +- .../components/tm-drag-list/tm-drag-list.vue | 8 +- .../components/tm-dropdown/tm-dropdown.vue | 2 +- .../tm-filterMenu/tm-filterMenu.vue | 6 +- .../tmui/components/tm-indexes/tm-indexes.vue | 6 +- .../tmui/components/tm-overlay/tm-overlay.vue | 14 +-- .../components/tm-scrolly/scrolly-vue.vue | 6 +- .../tmui/components/tm-scrolly/tm-scrolly.vue | 16 ++-- .../tmui/components/tm-sheet/tm-sheet.vue | 4 +- .../tm-sign-board/tm-sign-board.vue | 18 ++-- .../tm-slide-switch/tm-slide-switch.vue | 26 +++--- .../components/tm-slider/slider-button.vue | 8 +- .../tmui/components/tm-sort/tm-sort.vue | 8 +- .../tmui/components/tm-stepper/tm-stepper.vue | 4 +- .../tmui/components/tm-table/tm-table-old.vue | 4 +- .../components/tm-tabs-pane/tm-tabs-pane.vue | 4 +- .../tmui/components/tm-tabs/tm-tabs.vue | 34 ++++---- .../tmui/tool/useFun/useTouchFinger.ts | 6 +- .../components/uni-popup/uni-popup.vue | 2 +- .../wd-datetime-picker/wd-datetime-picker.vue | 2 +- .../components/wd-fab/wd-fab.vue | 6 +- .../wd-img-cropper/wd-img-cropper.vue | 8 +- .../components/wd-index-bar/wd-index-bar.vue | 4 +- .../wd-number-keyboard/key/index.vue | 2 +- .../components/wd-overlay/wd-overlay.vue | 2 +- .../wd-password-input/wd-password-input.vue | 2 +- .../components/wd-picker/wd-picker.vue | 2 +- .../components/wd-popup/wd-popup.vue | 2 +- .../wd-select-picker/wd-select-picker.vue | 2 +- .../components/wd-slider/wd-slider.vue | 12 +-- .../wd-swipe-action/wd-swipe-action.vue | 8 +- .../components/wd-tabs/wd-tabs.vue | 4 +- 43 files changed, 277 insertions(+), 203 deletions(-) diff --git a/src/components/deep-bubble/deep-bubble.vue b/src/components/deep-bubble/deep-bubble.vue index fc9572c..55ab9c5 100644 --- a/src/components/deep-bubble/deep-bubble.vue +++ b/src/components/deep-bubble/deep-bubble.vue @@ -3,8 +3,8 @@ @@ -75,7 +75,7 @@ diff --git a/src/components/x-confirm/index.vue b/src/components/x-confirm/index.vue index 6ec4db6..8a60928 100644 --- a/src/components/x-confirm/index.vue +++ b/src/components/x-confirm/index.vue @@ -92,8 +92,8 @@ defineExpose({ { diff --git a/src/main.js b/src/main.js index 8835855..5fbdafc 100644 --- a/src/main.js +++ b/src/main.js @@ -16,8 +16,13 @@ import { vLoading } from '@/components/x-loading/index.js' import messagePopup from '@/components/x-message/useMessagePopup' import pageAnimation from '@/components/page-animation/index.vue' import * as plugins from './plugins' -import { useDialogueStore, useTalkStore, useUserStore, useDialogueListStore } from '@/store' -import {uniStorage} from "@/utils/uniStorage.js" +import { + useDialogueStore, + useTalkStore, + useUserStore, + useDialogueListStore, +} from '@/store' +import { uniStorage } from '@/utils/uniStorage.js' const { showMessage } = messagePopup() dayjs.locale('zh-cn') @@ -47,6 +52,51 @@ export function createApp() { }) }, }) + //给touchstart事件添加passive属性 + app.directive('passive-touch', { + mounted(el, binding) { + el._passiveTouchHandler = function (e) { + binding.value(e) + } + el.addEventListener('touchstart', el._passiveTouchHandler, { + passive: true, + }) + }, + unmounted(el) { + el.removeEventListener('touchstart', el._passiveTouchHandler) + delete el._passiveTouchHandler + }, + }) + // 给touchmove事件添加passive属性 + app.directive('passive-move', { + mounted(el, binding) { + el._passiveTouchMoveHandler = function (e) { + binding.value(e) + } + el.addEventListener('touchmove', el._passiveTouchMoveHandler, { + passive: true, + }) + }, + unmounted(el) { + el.removeEventListener('touchmove', el._passiveTouchMoveHandler) + delete el._passiveTouchMoveHandler + }, + }) + // 给touchend事件添加passive属性 + app.directive('passive-end', { + mounted(el, binding) { + el._passiveTouchEndHandler = function (e) { + binding.value(e) + } + el.addEventListener('touchend', el._passiveTouchEndHandler, { + passive: true, + }) + }, + unmounted(el) { + el.removeEventListener('touchend', el._passiveTouchEndHandler) + delete el._passiveTouchEndHandler + }, + }) //获取当前聊天页面所在页面,并通过当前的receiver_id判断是否要创建本地通知栏消息 window.getCurrentChatRoute = (msg) => { @@ -100,8 +150,8 @@ export function createApp() { // 新版本-按公司别、好友、群组的通讯录 uni.navigateTo({ url: '/pages/addressBook/index?type=true', - }); - }; + }) + } //处理OA、墨册强制刷新时,聊天同步强制刷新 window.doLocationRefresh = () => { @@ -126,10 +176,9 @@ export function createApp() { window.getBaseMulVideo = (videoList) => { const videos = JSON.parse(decodeURIComponent(videoList)) console.error('=====videos', videos) - if(videos.length > 0){ + if (videos.length > 0) { const videoUri = videos[0] console.error('=====videoUri', videoUri) - } } diff --git a/src/pages/dialog/index.vue b/src/pages/dialog/index.vue index 5561fe2..3e069ef 100644 --- a/src/pages/dialog/index.vue +++ b/src/pages/dialog/index.vue @@ -61,7 +61,7 @@ --> - + handleAvatarTouchStart(item)" - @touchend="handleAvatarTouchEnd" + v-passive-touch="() => handleAvatarTouchStart(item)" + v-passive-end="handleAvatarTouchEnd" > - + - + - + - + - + - + - + - + diff --git a/src/uni_modules/tmui/components/tm-cropimg/tm-cropimg.vue b/src/uni_modules/tmui/components/tm-cropimg/tm-cropimg.vue index 87aba9b..720864a 100644 --- a/src/uni_modules/tmui/components/tm-cropimg/tm-cropimg.vue +++ b/src/uni_modules/tmui/components/tm-cropimg/tm-cropimg.vue @@ -1,9 +1,9 @@ @@ -118,7 +118,7 @@ watch( () => props.list, () => { jishunTopData() - + }, { deep: true, diff --git a/src/uni_modules/tmui/components/tm-dropdown/tm-dropdown.vue b/src/uni_modules/tmui/components/tm-dropdown/tm-dropdown.vue index c6fccf7..f291a98 100644 --- a/src/uni_modules/tmui/components/tm-dropdown/tm-dropdown.vue +++ b/src/uni_modules/tmui/components/tm-dropdown/tm-dropdown.vue @@ -3,7 +3,7 @@ - diff --git a/src/uni_modules/tmui/components/tm-sheet/tm-sheet.vue b/src/uni_modules/tmui/components/tm-sheet/tm-sheet.vue index 0f1e873..5df8bed 100644 --- a/src/uni_modules/tmui/components/tm-sheet/tm-sheet.vue +++ b/src/uni_modules/tmui/components/tm-sheet/tm-sheet.vue @@ -11,8 +11,8 @@ :blurEffect="blurEffect" @click="onClick" @longpress="longpress" - @touchend="touchend" - @touchstart="touchstart" + v-passive-end="touchend" + v-passive-touch="touchstart" @touchcancel="touchcancel" @mousedown="mousedown" @mouseup="mouseup" diff --git a/src/uni_modules/tmui/components/tm-sign-board/tm-sign-board.vue b/src/uni_modules/tmui/components/tm-sign-board/tm-sign-board.vue index 19997d7..854f852 100644 --- a/src/uni_modules/tmui/components/tm-sign-board/tm-sign-board.vue +++ b/src/uni_modules/tmui/components/tm-sign-board/tm-sign-board.vue @@ -3,9 +3,9 @@ 0) { swipeMove(state.leftWidth) } - + } var range = function (num: number, min: number, max: number) { return Math.min(Math.max(num, min), max) @@ -347,21 +347,21 @@ var swipeMove = function (_offset: number) { transition: transition } funMethod('style', style) - + } var close = function () { opened.value = false swipeMove(0) - + // #ifdef APP-NVUE - + nvue_now_left = -attr.value.rightWidth spinNvueAniEnd(-attr.value.rightWidth,attr.value.rightWidth,true) funMethod('close', false) // #endif // #ifndef APP-NVUE - + funMethod('close', false) // #endif } @@ -395,7 +395,7 @@ const startDrag = (event: TouchEvent | MouseEvent) => { event?.preventDefault(); event?.stopImmediatePropagation(); } catch (error) { - + } resetTouchStatus() state.startOffset = state.offset @@ -410,9 +410,9 @@ const onDrag = (event: TouchEvent | MouseEvent) => { event?.preventDefault(); event?.stopImmediatePropagation(); } catch (error) { - + } - + var touchPoint = event.touches[0] state.deltaX = touchPoint.clientX - state.startX state.deltaY = touchPoint.clientY - state.startY @@ -430,7 +430,7 @@ const endDrag = (event: TouchEvent | MouseEvent) => { state.dragging = false if (+state.rightWidth > 0 && -state.startOffset < +state.rightWidth && -state.offset > +state.rightWidth * THRESHOLD) { open('right') - + } else if (+state.leftWidth > 0 && state.startOffset < +state.leftWidth && state.offset > +state.leftWidth * THRESHOLD) { open('left') } else { diff --git a/src/uni_modules/tmui/components/tm-slider/slider-button.vue b/src/uni_modules/tmui/components/tm-slider/slider-button.vue index d45c623..b5c8bf0 100644 --- a/src/uni_modules/tmui/components/tm-slider/slider-button.vue +++ b/src/uni_modules/tmui/components/tm-slider/slider-button.vue @@ -2,7 +2,7 @@ - - + 0 && props.showTabsLine" class="anilineBar absolute l-0" @@ -351,9 +351,9 @@ - - + + diff --git a/src/uni_modules/uni-popup/components/uni-popup/uni-popup.vue b/src/uni_modules/uni-popup/components/uni-popup/uni-popup.vue index 8349e99..bce639e 100644 --- a/src/uni_modules/uni-popup/components/uni-popup/uni-popup.vue +++ b/src/uni_modules/uni-popup/components/uni-popup/uni-popup.vue @@ -1,6 +1,6 @@ - + - + {{ cancelButtonText || translate('cancel') }} diff --git a/src/uni_modules/wot-design-uni/components/wd-fab/wd-fab.vue b/src/uni_modules/wot-design-uni/components/wd-fab/wd-fab.vue index 27a0876..0f8eae0 100644 --- a/src/uni_modules/wot-design-uni/components/wd-fab/wd-fab.vue +++ b/src/uni_modules/wot-design-uni/components/wd-fab/wd-fab.vue @@ -1,8 +1,8 @@ - + @@ -39,9 +39,9 @@ :src="imgSrc" :style="imageStyle" :lazy-load="false" - @touchstart="handleImgTouchStart" - @touchmove="handleImgTouchMove" - @touchend="handleImgTouchEnd" + v-passive-touch="handleImgTouchStart" + v-passive-move="handleImgTouchMove" + v-passive-end="handleImgTouchEnd" @error="handleImgLoadError" @load="handleImgLoaded" /> diff --git a/src/uni_modules/wot-design-uni/components/wd-index-bar/wd-index-bar.vue b/src/uni_modules/wot-design-uni/components/wd-index-bar/wd-index-bar.vue index 75de549..b7ac112 100644 --- a/src/uni_modules/wot-design-uni/components/wd-index-bar/wd-index-bar.vue +++ b/src/uni_modules/wot-design-uni/components/wd-index-bar/wd-index-bar.vue @@ -8,8 +8,8 @@ - + diff --git a/src/uni_modules/wot-design-uni/components/wd-overlay/wd-overlay.vue b/src/uni_modules/wot-design-uni/components/wd-overlay/wd-overlay.vue index 16c5cae..ab39e45 100644 --- a/src/uni_modules/wot-design-uni/components/wd-overlay/wd-overlay.vue +++ b/src/uni_modules/wot-design-uni/components/wd-overlay/wd-overlay.vue @@ -6,7 +6,7 @@ :duration="duration" :custom-style="`z-index: ${zIndex}; ${customStyle}`" @click="handleClick" - @touchmove.stop.prevent="lockScroll ? noop : ''" + v-passive-move.stop.prevent="lockScroll ? noop : ''" > diff --git a/src/uni_modules/wot-design-uni/components/wd-password-input/wd-password-input.vue b/src/uni_modules/wot-design-uni/components/wd-password-input/wd-password-input.vue index 1bad247..62279d0 100644 --- a/src/uni_modules/wot-design-uni/components/wd-password-input/wd-password-input.vue +++ b/src/uni_modules/wot-design-uni/components/wd-password-input/wd-password-input.vue @@ -1,6 +1,6 @@ - + - + {{ cancelButtonText || translate('cancel') }} diff --git a/src/uni_modules/wot-design-uni/components/wd-popup/wd-popup.vue b/src/uni_modules/wot-design-uni/components/wd-popup/wd-popup.vue index 67ef1fc..b2d3f4b 100644 --- a/src/uni_modules/wot-design-uni/components/wd-popup/wd-popup.vue +++ b/src/uni_modules/wot-design-uni/components/wd-popup/wd-popup.vue @@ -7,7 +7,7 @@ :duration="duration" :custom-style="modalStyle" @click="handleClickModal" - @touchmove="noop" + v-passive-move="noop" /> diff --git a/src/uni_modules/wot-design-uni/components/wd-select-picker/wd-select-picker.vue b/src/uni_modules/wot-design-uni/components/wd-select-picker/wd-select-picker.vue index 6daaea4..014dbff 100644 --- a/src/uni_modules/wot-design-uni/components/wd-select-picker/wd-select-picker.vue +++ b/src/uni_modules/wot-design-uni/components/wd-select-picker/wd-select-picker.vue @@ -92,7 +92,7 @@ - + diff --git a/src/uni_modules/wot-design-uni/components/wd-slider/wd-slider.vue b/src/uni_modules/wot-design-uni/components/wd-slider/wd-slider.vue index 003c7c6..8d1a62c 100644 --- a/src/uni_modules/wot-design-uni/components/wd-slider/wd-slider.vue +++ b/src/uni_modules/wot-design-uni/components/wd-slider/wd-slider.vue @@ -12,9 +12,9 @@ {{ leftNewValue }} @@ -25,9 +25,9 @@ v-if="showRight" class="wd-slider__button-wrapper" :style="buttonRightStyle" - @touchstart="onTouchStartRight" - @touchmove="onTouchMoveRight" - @touchend="onTouchEndRight" + v-passive-touch="onTouchStartRight" + v-passive-move="onTouchMoveRight" + v-passive-end="onTouchEndRight" @touchcancel="onTouchEndRight" > {{ rightNewValue }} diff --git a/src/uni_modules/wot-design-uni/components/wd-swipe-action/wd-swipe-action.vue b/src/uni_modules/wot-design-uni/components/wd-swipe-action/wd-swipe-action.vue index dcffd6a..d483828 100644 --- a/src/uni_modules/wot-design-uni/components/wd-swipe-action/wd-swipe-action.vue +++ b/src/uni_modules/wot-design-uni/components/wd-swipe-action/wd-swipe-action.vue @@ -4,9 +4,9 @@ :class="`wd-swipe-action ${customClass}`" :style="customStyle" @click.stop="onClick()" - @touchstart="startDrag" - @touchmove="onDrag" - @touchend="endDrag" + v-passive-touch="startDrag" + v-passive-move="onDrag" + v-passive-end="endDrag" @touchcancel="endDrag" > @@ -191,7 +191,7 @@ function onDrag(event: TouchEvent) { if (touch.direction.value === 'vertical') { return } else { - event.preventDefault() + // event.preventDefault() event.stopPropagation() } diff --git a/src/uni_modules/wot-design-uni/components/wd-tabs/wd-tabs.vue b/src/uni_modules/wot-design-uni/components/wd-tabs/wd-tabs.vue index 904a6c5..1c85ad5 100644 --- a/src/uni_modules/wot-design-uni/components/wd-tabs/wd-tabs.vue +++ b/src/uni_modules/wot-design-uni/components/wd-tabs/wd-tabs.vue @@ -59,7 +59,7 @@ - + @@ -114,7 +114,7 @@ - +