Compare commits

..

1 Commits

Author SHA1 Message Date
82d5642376 优化使用体验,包括触摸事件、数据加载等 2025-06-26 11:20:11 +08:00
58 changed files with 531 additions and 758 deletions

View File

@ -1,7 +1,6 @@
import request from '@/service/index.js'
import qs from 'qs'
import { useTalkStore, useDialogueStore } from '@/store'
import { handleFindWebview } from '@/utils/common'
// 获取聊天列表服务接口
export const ServeGetTalkList = (data) => {
@ -47,7 +46,23 @@ export const ServeClearTalkUnreadNum = (data, unReadNum) => {
useTalkStore().findTalkIndex(useDialogueStore().index_name)
]?.is_disturb
) {
handleFindWebview(`updateUnreadMsgNumReduce('${unReadNum}')`)
if (typeof plus !== 'undefined') {
let OAWebView = plus.webview.all()
OAWebView.forEach((webview) => {
if (webview.id === 'webviewId1') {
webview.evalJS(`updateUnreadMsgNumReduce('${unReadNum}')`)
}
})
} else {
document.addEventListener('plusready', () => {
let OAWebView = plus.webview.all()
OAWebView.forEach((webview) => {
if (webview.id === 'webviewId1') {
webview.evalJS(`updateUnreadMsgNumReduce('${unReadNum}')`)
}
})
})
}
}
return request({
url: '/api/v1/talk/unread/clear',
@ -68,8 +83,7 @@ export const ServeTalkRecords = (data) => {
// 获取转发会话记录详情列表服务接口
export const ServeGetForwardRecords = (data) => {
return request({
// url: '/api/v1/talk/records/forward/v2',
url: '/api/v1/talk/records/forward',
url: '/api/v1/talk/records/forward/v2',
method: 'GET',
data,
})

View File

@ -4,8 +4,7 @@ import qs from 'qs'
// ES搜索聊天记录-主页搜索什么都有
export const ServeSeachQueryAll = (data) => {
return request({
// url: '/api/v1/elasticsearch/query-all/v2',
url: '/api/v1/elasticsearch/query-all',
url: '/api/v1/elasticsearch/query-all/v2',
method: 'POST',
data,
})
@ -14,8 +13,7 @@ export const ServeSeachQueryAll = (data) => {
// ES搜索用户数据
export const ServeQueryUser = (data) => {
return request({
// url: '/api/v1/elasticsearch/query-user/v2',
url: '/api/v1/elasticsearch/query-user',
url: '/api/v1/elasticsearch/query-user/v2',
method: 'POST',
data,
})

View File

@ -3,8 +3,8 @@
<view
:id="popoverBoxId"
class="popover-box"
@touchend="onTouchend"
@touchstart="onTouchstart"
v-passive-end="onTouchend"
v-passive-touch="onTouchstart"
>
<slot></slot>
</view>
@ -75,7 +75,7 @@
</view>
<view
v-show="data.popoverShow"
@touchstart="close"
v-passive-touch="close"
@click="close"
class="popover-bg"
></view>

View File

@ -1,155 +1,109 @@
<script lang="ts" setup>
import { ref, reactive, onMounted, onUnmounted, computed } from 'vue'
import { PlayOne, PauseOne } from '@icon-park/vue-next'
import { ITalkRecordExtraAudio, ITalkRecord } from '@/types/chat'
import { onHide } from '@dcloudio/uni-app'
import aTrumpet from '@/uni_modules/a-trumpet/components/a-trumpet/a-trumpet.vue'
import { useUserStore } from '@/store'
import { ref, reactive, onMounted } from "vue";
import { PlayOne, PauseOne } from "@icon-park/vue-next";
import { ITalkRecordExtraAudio, ITalkRecord } from "@/types/chat";
const props = defineProps<{
extra: ITalkRecordExtraAudio
data: ITalkRecord
maxWidth?: Boolean
}>()
extra: ITalkRecordExtraAudio;
data: ITalkRecord;
maxWidth?: Boolean;
}>();
const userStore = useUserStore()
const talkParams = reactive({
uid: computed(() => userStore.uid),
})
const audioRef = ref();
const audioContext = ref<any>(null);
const durationDesc = ref("-");
const audioContext = ref<any>(null)
const durationDesc = ref('-')
const state = reactive({
isAudioPlay: false,
progress: 0,
duration: 0,
currentTime: 0,
loading: true,
})
//
function onOtherAudioPlay(e) {
if (e.detail !== props.data.msg_id && state.isAudioPlay) {
audioContext.value.pause()
state.isAudioPlay = false
}
}
});
onMounted(() => {
audioContext.value = uni.createInnerAudioContext()
audioContext.value.src = props.extra.url
// 使uni-app
audioContext.value = uni.createInnerAudioContext();
audioContext.value.src = props.extra.url;
audioContext.value.onCanplay(() => {
state.duration = audioContext.value.duration
durationDesc.value = formatTime(parseInt(audioContext.value.duration))
state.loading = false
})
state.duration = audioContext.value.duration;
durationDesc.value = formatTime(parseInt(audioContext.value.duration));
state.loading = false;
});
audioContext.value.onTimeUpdate(() => {
if (audioContext.value.duration == 0) {
state.progress = 0
state.progress = 0;
} else {
state.currentTime = audioContext.value.currentTime
state.currentTime = audioContext.value.currentTime;
state.progress =
(audioContext.value.currentTime / audioContext.value.duration) * 100
(audioContext.value.currentTime / audioContext.value.duration) * 100;
}
})
});
audioContext.value.onEnded(() => {
state.isAudioPlay = false
state.progress = 0
})
state.isAudioPlay = false;
state.progress = 0;
});
audioContext.value.onError((e) => {
console.log('音频播放异常===>', e)
})
window.addEventListener('audio-play', onOtherAudioPlay)
})
onUnmounted(() => {
window.removeEventListener('audio-play', onOtherAudioPlay)
audioContext.value &&
audioContext.value.destroy &&
audioContext.value.destroy()
})
onHide(() => {
if (audioContext.value && audioContext.value.pause) {
audioContext.value.pause()
state.isAudioPlay = false
}
})
console.log("音频播放异常===>", e);
});
});
const onPlay = () => {
if (state.isAudioPlay) {
audioContext.value.pause()
state.isAudioPlay = false
audioContext.value.pause();
} else {
//
window.dispatchEvent(
new CustomEvent('audio-play', { detail: props.data.msg_id }),
)
audioContext.value.play()
state.isAudioPlay = true
audioContext.value.play();
}
}
state.isAudioPlay = !state.isAudioPlay;
};
const onPlayEnd = () => {
state.isAudioPlay = false;
state.progress = 0;
};
const formatTime = (value: number = 0) => {
if (value == 0) {
return '-'
return "-";
}
const minutes = Math.floor(value / 60)
let seconds = value
const minutes = Math.floor(value / 60);
let seconds = value;
if (minutes > 0) {
seconds = Math.floor(value - minutes * 60)
seconds = Math.floor(value - minutes * 60);
}
return `${minutes}'${seconds}"`
}
return `${minutes}'${seconds}"`;
};
</script>
<template>
<div
class="audio-message"
@click.stop="onPlay"
:class="
props?.data?.user_id == talkParams.uid
? 'justify-end py-[22rpx] pl-[30rpx] pr-[16rpx]'
: 'justify-start py-[22rpx] pr-[30rpx] pl-[16rpx]'
"
>
<a-trumpet
v-if="props?.data?.user_id != talkParams.uid"
:isPlay="state.isAudioPlay"
color="#C1C1C1"
:size="30"
></a-trumpet>
<div
:class="
props?.data?.user_id == talkParams.uid ? 'mr-[8rpx]' : 'ml-[8rpx]'
"
>
{{ Math.ceil(props?.extra?.duration / 1000) }}s
<div class="im-message-audio">
<div class="play">
<div class="btn pointer" @click.stop="onPlay">
<n-icon
:size="18"
:component="state.isAudioPlay ? PauseOne : PlayOne"
/>
</div>
<a-trumpet
v-if="props?.data?.user_id == talkParams.uid"
:isPlay="state.isAudioPlay"
color="#C1C1C1"
:size="30"
direction="left"
></a-trumpet>
</div>
<div class="desc">
<span class="line" v-for="i in 23" :key="i"></span>
<span
class="indicator"
:style="{ left: state.progress + '%' }"
v-show="state.progress > 0"
></span>
</div>
<div class="time">{{ durationDesc }}</div>
</div>
</template>
<style lang="less" scoped>
.audio-message {
display: flex;
flex-direction: row;
align-items: center;
width: 100%;
height: 100%;
background-color: #fff;
border-radius: 10px;
}
.im-message-audio {
--audio-bg-color: #f5f5f5;
--audio-btn-bg-color: #ffffff;
@ -291,7 +245,7 @@ const formatTime = (value: number = 0) => {
}
}
html[theme-mode='dark'] {
html[theme-mode="dark"] {
.im-message-audio {
--audio-bg-color: #2c2c32;
--audio-btn-bg-color: rgb(78, 75, 75);

View File

@ -92,8 +92,8 @@ defineExpose({
<tm-button
@click="sendCancel"
:width="319"
@touchstart="cancel = false"
@touchend="cancel = true"
v-passive-touch="cancel = false"
v-passive-end="cancel = true"
:fontSize="32"
:height="112"
:margin="[0]"
@ -107,8 +107,8 @@ defineExpose({
<div class="flex justify-center items-center text-[#CF3050]">
<tm-button
@click="sendConfirm"
@touchstart="confirm = false"
@touchend="confirm = true"
v-passive-touch="confirm = false"
v-passive-end="confirm = true"
:width="319"
:fontSize="32"
:transprent="confirm"

View File

@ -34,7 +34,7 @@ class Connect {
// 更新 WebSocket 连接状态
useUserStore().updateSocketStatus(true)
// online.value = true;
useTalkStore().loadTalkList()
uni.$emit('socket-refresh-talk-list')
},
// Websocket 断开连接回调方法
onClose: () => {

View File

@ -15,7 +15,6 @@ import {
useDialogueListStore,
useGroupStore,
} from '@/store'
import { handleFindWebview } from '@/utils/common'
/**
* 好友状态事件
@ -155,7 +154,23 @@ class Talk extends Base {
//更新未读数量+1
updateUnreadMsgNumAdd() {
handleFindWebview(`updateUnreadMsgNumAdd()`)
if (typeof plus !== 'undefined') {
let OAWebView = plus.webview.all()
OAWebView.forEach((webview) => {
if (webview.id === 'webviewId1') {
webview.evalJS(`updateUnreadMsgNumAdd()`)
}
})
} else {
document.addEventListener('plusready', () => {
let OAWebView = plus.webview.all()
OAWebView.forEach((webview) => {
if (webview.id === 'webviewId1') {
webview.evalJS(`updateUnreadMsgNumAdd()`)
}
})
})
}
}
/**

View File

@ -23,7 +23,6 @@ import {
useDialogueListStore,
} from '@/store'
import { uniStorage } from '@/utils/uniStorage.js'
import { handleFindWebview } from '@/utils/common'
const { showMessage } = messagePopup()
dayjs.locale('zh-cn')
@ -53,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) => {
@ -73,7 +117,12 @@ export function createApp() {
return
}
console.log('===准备创建本地通知栏消息')
handleFindWebview(`doCreatePushMessage('${msg}')`)
let OAWebView = plus.webview.all()
OAWebView.forEach((webview, index) => {
if (webview.id === 'webviewId1') {
webview.evalJS(`doCreatePushMessage('${msg}')`)
}
})
}
//处理聊天推送弹窗点开
@ -94,14 +143,14 @@ export function createApp() {
// 通讯录跳转
window.handleContacts = () => {
// 旧版本-按组织架构树的通讯录
uni.navigateTo({
url: '/pages/chooseByDeps/index?chooseMode=3&type=true'
});
// uni.navigateTo({
// url: '/pages/chooseByDeps/index?chooseMode=3&type=true'
// });
// 新版本-按公司别、好友、群组的通讯录
// uni.navigateTo({
// url: '/pages/addressBook/index?type=true',
// })
uni.navigateTo({
url: '/pages/addressBook/index?type=true',
})
}
//处理OA、墨册强制刷新时聊天同步强制刷新
@ -115,7 +164,12 @@ export function createApp() {
//检查聊天页面是否可用
window.checkChatWebviewAvailable = () => {
handleFindWebview(`doneCheckChatWebviewAvailable()`)
let OAWebView = plus.webview.all()
OAWebView.forEach((webview, index) => {
if (webview.id === 'webviewId1') {
webview.evalJS(`doneCheckChatWebviewAvailable()`)
}
})
}
//获取从base传来的多选视频列表
@ -128,19 +182,6 @@ export function createApp() {
}
}
//检查是否是特殊测试用户,开启控制台
const checkTestUser = () => {
const userStore = useUserStore()
if (
import.meta.env.VITE_SHOW_CONSOLE === 'false' &&
userStore.mobile == '18100591363'
) {
new VConsole()
}
}
checkTestUser()
window.message = ['success', 'error', 'warning'].reduce((acc, type) => {
acc[type] = (message) => {
if (typeof message === 'string') {

View File

@ -331,7 +331,7 @@ import avatarModule from '@/components/avatar-module/index.vue'
import { ref, onMounted, reactive, watch } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { handleSetWebviewStyle, handleFindWebview } from '@/utils/common'
import { handleSetWebviewStyle } from '@/utils/common'
import { ServeUserGroupChatList, ServeCreateTalkList } from '@/api/chat/index'
import { ServeGetSessionId } from '@/api/search/index'
import { formatTalkItem } from '@/utils/talk'
@ -376,7 +376,12 @@ onLoad((options) => {
const goWebHome = () => {
uni.navigateBack()
handleFindWebview(`handleBackHost()`)
let OAWebView = plus.webview.all()
OAWebView.forEach((webview) => {
if (webview.id === 'webviewId1') {
webview.evalJS(`handleBackHost()`)
}
})
}
onMounted(() => {

View File

@ -342,8 +342,7 @@
import checkBox from '@/components/checkBox/index.vue'
import lodash from 'lodash'
import {
handleSetWebviewStyle,
handleFindWebview
handleSetWebviewStyle
} from '@/utils/common'
import {
@ -399,7 +398,12 @@
})
const goWebHome = () => {
uni.navigateBack()
handleFindWebview(`handleBackHost()`)
let OAWebView = plus.webview.all()
OAWebView.forEach((webview) => {
if (webview.id === 'webviewId1') {
webview.evalJS(`handleBackHost()`)
}
})
}
//
const isPreSelectedMember = (member) => {

View File

@ -57,7 +57,6 @@ import videoImg from '@/static/image/chatList/video@2x.png'
import folder from '@/static/image/chatList/folder.png'
import { uploadImg } from '@/api/chat'
import { uniqueId } from '@/utils'
import { handleFindWebview } from '@/utils/common'
const props = defineProps({
sendUserInfo: {
@ -163,7 +162,12 @@ const photoActionsSelect = (index) => {
)
}
} else {
// handleFindWebview(`getPlusVideoPicker()`)
// let OAWebView = plus.webview.all()
// OAWebView.forEach((webview, index) => {
// if (webview.id === 'webviewId1') {
// webview.evalJS(`getPlusVideoPicker()`)
// }
// })
// return
uni.chooseVideo({
sourceType: ['album'],

View File

@ -256,17 +256,16 @@ const checkSendPermission = () => {
//
const checkNeedAddFriend = () => {
state.canSendMsg = true
// let params = {
// receiver_id: state.userInfo.sys_id, //id
// talk_type: 1,
// }
// ServeCheckFriend(params).then((res) => {
// console.log(res)
// if (res?.code === 200) {
// state.canSendMsg = res.data?.is_friend || false
// }
// })
let params = {
receiver_id: state.userInfo.sys_id, //id
talk_type: 1,
}
ServeCheckFriend(params).then((res) => {
console.log(res)
if (res?.code === 200) {
state.canSendMsg = res.data?.is_friend || false
}
})
}
//

View File

@ -61,7 +61,7 @@
</template> -->
<!-- 数据加载状态栏 -->
<div class="dialog-list" @touchstart="handleHidePanel">
<div class="dialog-list" v-passive-touch="handleHidePanel">
<div
class="message-item"
v-for="item in virtualList"
@ -146,8 +146,8 @@
<aside
class="avatar-column"
@click="toUserDetailPage(item)"
@touchstart="() => handleAvatarTouchStart(item)"
@touchend="handleAvatarTouchEnd"
v-passive-touch="() => handleAvatarTouchStart(item)"
v-passive-end="handleAvatarTouchEnd"
>
<!-- <im-avatar
class="pointer"
@ -229,19 +229,10 @@
>
<div
class="talk-tools voice-content"
v-if="
item?.voiceContent ||
(!item?.voiceContent && item?.isVoiceToTexting)
"
v-if="item.voiceContent"
@click="copyVoiceContent(item?.voiceContent || '')"
>
<wd-loading
v-if="item?.isVoiceToTexting && !item?.voiceContent"
color="#46299D"
:size="20"
style="margin: 0 12rpx 0 0;"
/>
<span v-if="item?.voiceContent">{{ item.voiceContent }}</span>
<span>{{ item.voiceContent }}</span>
</div>
</div>
@ -2719,12 +2710,6 @@ const onProgressFn = (progress, id) => {
// console.log((progress.loaded / progress.total) * 100, 'progress')
}
//
const startRecord = () => {
//
window.dispatchEvent(new CustomEvent('audio-play', { detail: null }))
}
//
const endRecord = (file, url, duration) => {
console.log(file, url, duration)
@ -2751,9 +2736,6 @@ const endRecord = (file, url, duration) => {
resp.catch(() => {})
}
//
const cancelRecord = () => {}
//
const sendMediaMessage = (mediaUrl, duration, size) => {
// console.log(mediaUrl, 'mediaUrl')
@ -2782,21 +2764,17 @@ const sendMediaMessage = (mediaUrl, duration, size) => {
//
const convertText = (msgItem) => {
msgItem.isVoiceToTexting = true
const resp = ServeConvertText({
voiceUrl: msgItem.extra.url,
msgId: msgItem.msg_id,
})
// console.log(resp, 'resp')
resp.then(({ code, data }) => {
msgItem.isVoiceToTexting = false
// console.log(code, data, 'data')
if (code === 200) {
console.log(data.convText, 'convText')
msgItem.voiceContent = data.convText
}
}).catch(() => {
msgItem.isVoiceToTexting = false
})
}
//
@ -2807,17 +2785,16 @@ const chatInputHeight = computed(() => {
//
const checkNeedAddFriend = () => {
state.value.isFriendOrSameCompany = true
// let params = {
// receiver_id: talkParams.receiver_id, //id
// talk_type: 1,
// }
// ServeCheckFriend(params).then((res) => {
// console.log(res)
// if (res?.code === 200) {
// state.value.isFriendOrSameCompany = res.data?.is_friend || false
// }
// })
let params = {
receiver_id: talkParams.receiver_id, //id
talk_type: 1,
}
ServeCheckFriend(params).then((res) => {
console.log(res)
if (res?.code === 200) {
state.value.isFriendOrSameCompany = res.data?.is_friend || false
}
})
}
//
@ -2840,16 +2817,9 @@ const copyVoiceContent = (voiceContent) => {
if (!voiceContent) {
return
}
uni.setClipboardData({
data: voiceContent,
showToast: false,
success: () => {
clipboard(voiceContent, () => {
message.success('复制成功')
},
})
// clipboard(voiceContent, () => {
// message.success('')
// })
}
</script>
<style scoped lang="less">

View File

@ -10,7 +10,7 @@
:refresher-fixed-bac-height="80"
refresher-fixed-background="#F9F9FD"
refresher-background="#F9F9FD"
v-model="items"
v-model="talkListItems"
@query="queryList"
:loading-more-enabled="false"
:refresher-end-bounce-enabled="false"
@ -18,6 +18,7 @@
:empty-view-show="isEmptyViewShow"
@refresherRefresh="onRefresh"
:show-scrollbar="false"
:auto-clean-list-when-reload="false"
>
<template #top>
<div>
@ -65,9 +66,7 @@
mode="scaleToFill"
/>
<template v-slot:label>
<div
class="w-full px-[14rpx]"
>
<div class="w-full px-[14rpx]">
<div
@click="creatGroupChat"
class="flex items-center pl-[22rpx] py-[32rpx]"
@ -86,7 +85,7 @@
</div>
</div>
<div class="divider"></div>
<!-- <div
<div
@click="toAddFriendPage"
class="flex items-center pl-[22rpx] py-[32rpx]"
>
@ -103,7 +102,7 @@
添加好友
</div>
</div>
<div class="divider"></div> -->
<div class="divider"></div>
<div
@click="toAddressBookPage"
class="flex items-center pl-[22rpx] py-[32rpx]"
@ -139,7 +138,7 @@
</div>
<div class="contentRoot">
<chatItem
v-for="(item, index) in items"
v-for="(item, index) in talkListItems"
:key="item.index_name"
:index="index"
:data="item"
@ -152,7 +151,7 @@
</template>
<script setup>
import customInput from '@/components/custom-input/custom-input.vue'
import { ref, watch, computed } from 'vue'
import { ref, watch, computed, onMounted, onUnmounted } from 'vue'
import { onShow, onLoad } from '@dcloudio/uni-app'
import { useChatList } from '@/store/chatList/index.js'
import { useAuth } from '@/store/auth'
@ -176,23 +175,34 @@ const dialogueParams = reactive({
const { userInfo } = useAuth()
const topItems = computed(() => talkStore.topItems)
const items = computed(() => {
// if (searchKeyword.value.length === 0) {
console.log(talkStore.talkItems)
const talkListItems = ref(talkStore?.talkItems || [])
watch(
() => talkStore.talkItems,
(newVal) => {
talkListItems.value = newVal
},
{
deep: true,
immediate: true,
},
)
// computed(() => {
// // if (searchKeyword.value.length === 0) {
// // console.log(talkStore.talkItems)
return talkStore.talkItems
// }
// return talkStore.talkItems
// // }
// return talkStore.talkItems.filter((item) => {
// let keyword = item.remark || item.name
// // return talkStore.talkItems.filter((item) => {
// // let keyword = item.remark || item.name
// return keyword.toLowerCase().indexOf(searchKeyword.value.toLowerCase()) != -1
// })
})
// // return keyword.toLowerCase().indexOf(searchKeyword.value.toLowerCase()) != -1
// // })
// })
const queryList = (pageNo, pageSize) => {
// paging.value.complete(res.data.list);
console.log(talkStore)
// console.log(talkStore)
talkStore
.loadTalkList()
.then(() => {
@ -245,14 +255,14 @@ const toAddFriendPage = () => {
//
const toAddressBookPage = () => {
// -
uni.navigateTo({
url: '/pages/chooseByDeps/index?chooseMode=3',
})
// uni.navigateTo({
// url: '/pages/chooseByDeps/index?chooseMode=3',
// })
// -
// uni.navigateTo({
// url: '/pages/addressBook/index',
// })
uni.navigateTo({
url: '/pages/addressBook/index',
})
}
/* watch(
@ -263,28 +273,43 @@ const toAddressBookPage = () => {
{ deep: true, immediate: true }
); */
onMounted(() => {
uni.$on('socket-refresh-talk-list', () => {
if (paging.value) {
paging.value.reload() // ZPaging
}
})
})
onUnmounted(() => {
uni.$off('socket-refresh-talk-list')
})
onShow(() => {
handleSetWebviewStyle(true)
//
talkStore
.loadTalkList()
.then(() => {
// paging
if (paging.value) {
paging.value.reload()
}
})
.catch((error) => {
console.error('页面显示时数据加载失败', error)
})
// talkStore
// .loadTalkList()
// .then(() => {
// // paging
// if (paging.value) {
// paging.value.reload()
// }
// })
// .catch((error) => {
// console.error('', error)
// })
})
onLoad((options) => {
console.log(options)
if (options?.openSessionIndexName) {
if (items?.value?.length > 0) {
items.value.forEach((openSession) => {
if (talkListItems?.value?.length > 0) {
talkListItems.value.forEach((openSession) => {
if (openSession.index_name === options?.openSessionIndexName) {
setTimeout(() => {
dialogueStore.setDialogue(openSession)

View File

@ -5,7 +5,6 @@ import lodash from 'lodash'
import { ref } from 'vue'
import { createGlobalState, useStorage } from '@vueuse/core'
import { uniStorage } from '@/utils/uniStorage.js'
import { handleFindWebview } from '@/utils/common'
export const useDialogueListStore = createGlobalState(() => {
const testDatabase = async () => {
@ -41,33 +40,19 @@ export const useDialogueListStore = createGlobalState(() => {
}
const content = {
content: '我试试传送文件和图片是不是一个接口',
name: '测试excel1.xlsx',
path:
'https://cdn-test.szjixun.cn/fonchain-chat/chat/file/multipart/20250307/727a2371-ffc4-46da-b953-a7d449ff82ff-测试excel1.xlsx',
content: "我试试传送文件和图片是不是一个接口",
name: "测试excel1.xlsx",
path: "https://cdn-test.szjixun.cn/fonchain-chat/chat/file/multipart/20250307/727a2371-ffc4-46da-b953-a7d449ff82ff-测试excel1.xlsx",
size: 9909,
drive: 3,
}
const extra = JSON.stringify(content)
drive: 3
};
const extra = JSON.stringify(content);
let chatDBexecuteSql2 = {
eventType: 'executeSql',
eventParams: {
name: 'chat',
sql:
'INSERT INTO talk_records (msg_id, sequence, talk_type, msg_type, user_id, receiver_id, is_revoke, is_mark, quote_id, extra, created_at, updated_at, biz_date) VALUES ("' +
'77b715fb30f54f739a255a915ef72445' +
'", 166, 2, 1, 1774, 888890, 0, 0, "' +
'' +
'", "' +
extra +
'", "' +
'2025-03-06T15:57:07.000Z' +
'", "' +
'2025-03-06T15:57:07.000Z' +
'", "' +
'20250306' +
'")',
sql: 'INSERT INTO talk_records (msg_id, sequence, talk_type, msg_type, user_id, receiver_id, is_revoke, is_mark, quote_id, extra, created_at, updated_at, biz_date) VALUES ("'+'77b715fb30f54f739a255a915ef72445'+'", 166, 2, 1, 1774, 888890, 0, 0, "'+''+'", "'+extra+'", "'+'2025-03-06T15:57:07.000Z'+'", "'+'2025-03-06T15:57:07.000Z'+'", "'+'20250306'+'")',
},
}
let chatDBSelectSql = {
@ -84,27 +69,38 @@ export const useDialogueListStore = createGlobalState(() => {
path: '_doc/chat.db',
},
}
// handleFindWebview(
// `operateSQLite('${encodeURIComponent(JSON.stringify(chatDatabase))}')`,
// )
// handleFindWebview(
// `operateSQLite('${encodeURIComponent(
// JSON.stringify(chatDBexecuteSql),
// )}')`,
// )
// handleFindWebview(
// `operateSQLite('${encodeURIComponent(
// JSON.stringify(chatDBexecuteSql2),
// )}')`,
// )
// handleFindWebview(
// `operateSQLite('${encodeURIComponent(JSON.stringify(chatDBSelectSql))}')`,
// )
// handleFindWebview(
// `operateSQLite('${encodeURIComponent(
// JSON.stringify(chatDBIsOpenDatabase),
// )}')`,
// )
document.addEventListener('plusready', () => {
let OAWebView = plus.webview.all()
OAWebView.forEach((webview, index) => {
if (webview.id === 'webviewId1') {
webview.evalJS(
`operateSQLite('${encodeURIComponent(
JSON.stringify(chatDatabase),
)}')`,
)
webview.evalJS(
`operateSQLite('${encodeURIComponent(
JSON.stringify(chatDBexecuteSql),
)}')`,
)
webview.evalJS(
`operateSQLite('${encodeURIComponent(
JSON.stringify(chatDBexecuteSql2),
)}')`,
)
webview.evalJS(
`operateSQLite('${encodeURIComponent(
JSON.stringify(chatDBSelectSql),
)}')`,
)
webview.evalJS(
`operateSQLite('${encodeURIComponent(
JSON.stringify(chatDBIsOpenDatabase),
)}')`,
)
}
})
})
}
// testDatabase()

View File

@ -2,7 +2,6 @@ import { defineStore } from 'pinia'
import { ServeGetTalkList, ServeCreateTalkList } from '@/api/chat/index'
import { formatTalkItem, ttime, KEY_INDEX_NAME } from '@/utils/talk'
import { useEditorDraftStore } from './editor-draft'
import { handleFindWebview } from '@/utils/common'
// import { ISession } from '@/types/chat'
export const useTalkStore = defineStore('talk', {
@ -104,7 +103,23 @@ export const useTalkStore = defineStore('talk', {
return resp.then(({ code, data }) => {
if (code == 200) {
//向OA的webview通信改变未读消息数量
handleFindWebview(`doUpdateUnreadNum('${data.unread_num}')`)
if (typeof plus !== 'undefined') {
let OAWebView = plus.webview.all()
OAWebView.forEach((webview) => {
if (webview.id === 'webviewId1') {
webview.evalJS(`doUpdateUnreadNum('${data.unread_num}')`)
}
})
} else {
document.addEventListener('plusready', () => {
let OAWebView = plus.webview.all()
OAWebView.forEach((webview) => {
if (webview.id === 'webviewId1') {
webview.evalJS(`doUpdateUnreadNum('${data.unread_num}')`)
}
})
})
}
this.items = data.items.map((item) => {
const value = formatTalkItem(item)

View File

@ -1,2 +0,0 @@
## 1.0.02023-09-05
实现基础功能

View File

@ -1,130 +0,0 @@
<template>
<view :style="[boxStyel]" class="box">
<view class="audio-style" :style="[audioStyel]" :class="{ 'animation': isPlay }">
<view class="small" :style="{'background-color': color}"></view>
<view class="middle" :style="{'border-right-color': color}"></view>
<view class="large" :style="{'border-right-color': color}"></view>
</view>
</view>
</template>
<script>
export default {
emits: [],
props: {
isPlay: {
type: [Boolean],
default: false
},
direction: {
type: String,
default: 'right'
},
size: {
type: Number,
default: 24
},
color: {
type: String,
default: '#222'
}
},
data() {
return {
};
},
computed: {
audioStyel() {
return {
transform: `scale(${this.size / 24})`
};
},
boxStyel() {
const directDic = { right: '0deg', bottom: '90deg', left: '180deg', top: '270deg' };
const dir = directDic[this.direction || 'left'];
const style = {
transform: `rotate(${dir})`,
width: this.size + 'px',
height: this.size + 'px'
};
return style;
}
},
methods: {}
};
</script>
<style lang="scss" scoped>
view{
box-sizing: border-box;
}
.box {
// border: 1px solid #4c4c4c;
display: inline-flex;
align-items: center;
justify-content: center;
overflow: hidden;
}
.audio-style {
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
& > view {
border: 2px solid transparent;
border-radius: 50%;
}
}
.small {
border: 0px solid;
width: 3px;
height: 3px;
}
.middle {
width: 16px;
height: 16px;
margin-left: -11px;
opacity: 1;
}
.large {
width: 24px;
height: 24px;
margin-left: -19px;
opacity: 1;
}
.animation {
.middle {
animation: middle 1.2s ease-in-out infinite;
}
.large {
animation: large 1.2s ease-in-out infinite;
}
}
//
@keyframes middle {
0% {
opacity: 0;
}
10% {
opacity: 1;
}
100% {
opacity: 0;
}
}
@keyframes large {
0% {
opacity: 0;
}
50% {
opacity: 1;
}
60% {
opacity: 0;
}
100% {
opacity: 0;
}
}
</style>

View File

@ -1,83 +0,0 @@
{
"id": "a-trumpet",
"displayName": "纯css语音播放语音聊天播放小喇叭动画组件",
"version": "1.0.0",
"description": "纯css语音播放语音聊天播放小喇叭动画组件",
"keywords": [
"a-trumpet",
"语音播报",
"播放小喇叭",
"动画"
],
"repository": "",
"engines": {
},
"dcloudext": {
"type": "component-vue",
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "无",
"permissions": "无"
},
"npmurl": ""
},
"uni_modules": {
"dependencies": [],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y"
},
"client": {
"Vue": {
"vue2": "y",
"vue3": "y"
},
"App": {
"app-vue": "y",
"app-nvue": "y"
},
"H5-mobile": {
"Safari": "y",
"Android Browser": "y",
"微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y"
},
"H5-pc": {
"Chrome": "y",
"IE": "y",
"Edge": "y",
"Firefox": "y",
"Safari": "y"
},
"小程序": {
"微信": "y",
"阿里": "y",
"百度": "y",
"字节跳动": "y",
"QQ": "y",
"钉钉": "y",
"快手": "y",
"飞书": "y",
"京东": "y"
},
"快应用": {
"华为": "y",
"联盟": "y"
}
}
}
}
}

View File

@ -1,18 +0,0 @@
# a-trumpet
## 用法
```html
<a-trumpet :isPlay="isplay"></a-trumpet>
<a-trumpet :isPlay="isplay" color="#1100ff"></a-trumpet>
<a-trumpet :isPlay="isplay" :size="50"></a-trumpet>
<a-trumpet :isPlay="isplay" direction="right"></a-trumpet>
```
## 属性说明:
| 属性名 | 类型 | 默认值 | 说明 |
| ---- | ---- | ---- | ---- |
| isplay | Boolean | false | 是否播放动画 |
| size | Number | 24 | 宽高的尺寸 |
| color | String | #222 | 颜色 |
| direction | String | top、bottom、left、ringt| 方向,上下左右 |

View File

@ -7,9 +7,9 @@
<view
class="record-btn"
@longpress="startRecord"
@touchstart="touchStart"
@touchmove="touchMove"
@touchend="endRecord"
v-passive-touch="touchStart"
v-passive-move="touchMove"
v-passive-end="endRecord"
hover-class="record-btn-hover"
hover-start-time="200"
hover-stay-time="150"
@ -160,7 +160,7 @@ import 'recorder-core/src/engine/mp3-engine'
import 'recorder-core/src/extensions/waveview'
import recordCancelBg from '@/static/image/record/chat-voice-animation-bg-red.png'
// #endif
import { multiplication, handleFindWebview } from '@/utils/common'
import { multiplication } from '@/utils/common'
export default {
name: 'nbVoiceRecord',
/**
@ -355,11 +355,7 @@ export default {
// }, 1000)
if (Number(permissionStatus) === 1) {
that.continueAppMicro()
} else if (
Number(permissionStatus) === -1 ||
(Number(permissionStatus) === 0 &&
uni.getSystemInfoSync().osName === 'ios')
) {
} else if (Number(permissionStatus) === -1) {
uni.showModal({
title: '提示',
content: '检测到您还未授权麦克风哦',
@ -368,10 +364,12 @@ export default {
cancelText: '保持拒绝',
success: ({ confirm, cancel }) => {
if (confirm) {
handleFindWebview(`handleRequestAndroidPermission('settings')`)
let OAWebView = plus.webview.all()
OAWebView.forEach((webview, index) => {
if (webview.id === 'webviewId1') {
webview.evalJS(`handleRequestAndroidPermission('settings')`)
}
if (cancel) {
that.isCheckingPermission = false
})
}
},
})
@ -453,7 +451,12 @@ export default {
// #endif
// #ifdef H5
if (typeof plus !== 'undefined') {
handleFindWebview(`handleRequestAndroidPermission('micro')`)
let OAWebView = plus.webview.all()
OAWebView.forEach((webview, index) => {
if (webview.id === 'webviewId1') {
webview.evalJS(`handleRequestAndroidPermission('micro')`)
}
})
} else {
that.continueAppMicro(isFirstRequestPer)
}

View File

@ -1,14 +1,14 @@
<template>
<!-- #ifdef MP -->
<view @touchstart="touch.startDrag" @touchmove.stop="touch.onDrag" @touchend="touch.endDrag" :data-prop="towxsShareData">
<view v-passive-touch="touch.startDrag" v-passive-move.stop="touch.onDrag" v-passive-end="touch.endDrag" :data-prop="towxsShareData">
<!-- #endif -->
<!-- #ifdef H5||APP-VUE -->
<view @touchstart="touch.startDrag" @touchmove="touch.onDrag" @touchend="touch.endDrag" :data-prop="towxsShareData">
<view v-passive-touch="touch.startDrag" v-passive-move="touch.onDrag" v-passive-end="touch.endDrag" :data-prop="towxsShareData">
<!-- #endif -->
<!-- #ifdef APP-NVUE -->
<view >
<!-- #endif -->
<view @touchstart="touchstart" :style="{ left: _offset[0] + 'rpx', top: _offset[1] + 'rpx' }" class="div" id="adsorb" ref="adsorb">
<view v-passive-touch="touchstart" :style="{ left: _offset[0] + 'rpx', top: _offset[1] + 'rpx' }" class="div" id="adsorb" ref="adsorb">
<view
:eventPenetrationEnabled="true"
:style="{

View File

@ -1,11 +1,11 @@
<template>
<button
@click="onclick"
@touchstart="touchstart"
@touchend="touchend"
v-passive-touch="touchstart"
v-passive-end="touchend"
@longpress="emits('longpress', $event)"
@touchcancel="touchcancel"
@touchmove="emits('touchmove', $event)"
v-passive-move="(e: Event) => emits('touchmove', e)"
@getphonenumber="emits('getphonenumber', $event)"
@error="emits('error', $event)"
@opensetting="emits('opensetting', $event)"

View File

@ -5,9 +5,9 @@
<canvas
@click="emits('click', $event)"
v-if="!isPc"
@touchstart="touchStart"
@touchmove="touchMove"
@touchend="touchEnd"
v-passive-touch="touchStart"
v-passive-move="touchMove"
v-passive-end="touchEnd"
:id="canvasId"
:canvas-id="canvasId"
class="canvas"
@ -26,9 +26,9 @@
<!-- #ifdef MP-WEIXIN || MP-QQ -->
<canvas
@click="emits('click', $event)"
@touchstart="touchStart"
@touchmove="touchMove"
@touchend="touchEnd"
v-passive-touch="touchStart"
v-passive-move="touchMove"
v-passive-end="touchEnd"
type="2d"
id="canvasId"
canvas-id="canvasId"
@ -39,9 +39,9 @@
<!-- #ifdef MP-ALIPAY -->
<canvas
@click="emits('click', $event)"
@touchstart="touchStart"
@touchmove="touchMove"
@touchend="touchEnd"
v-passive-touch="touchStart"
v-passive-move="touchMove"
v-passive-end="touchEnd"
type="2d"
:id="canvasId"
:canvas-id="canvasId"

View File

@ -1,7 +1,7 @@
<template>
<view @touchmove.stop="stopMove" class="flex flex-col flex-col-top-center">
<view v-passive-move.stop="stopMove" class="flex flex-col flex-col-top-center">
<view
@touchmove.stop="stopMove"
v-passive-move.stop="stopMove"
v-if="showCanvas"
class="overflow relative"
ref="webviewWk"
@ -17,9 +17,9 @@
<!-- #endif -->
<!-- #ifdef MP-WEIXIN || MP-ALIPAY || MP-QQ -->
<canvas
@touchstart="touchStart"
@touchmove="touchMove"
@touchend="touchEnd"
v-passive-touch="touchStart"
v-passive-move="touchMove"
v-passive-end="touchEnd"
class="canvas"
type="2d"
id="canvasId"
@ -28,9 +28,9 @@
<!-- #endif -->
<!-- #ifndef MP-WEIXIN || MP-ALIPAY || MP-QQ || APP-NVUE -->
<canvas
@touchstart="touchStart"
@touchmove="touchMove"
@touchend="touchEnd"
v-passive-touch="touchStart"
v-passive-move="touchMove"
v-passive-end="touchEnd"
class="canvas"
:id="canvasId"
:canvas-id="canvasId"
@ -41,30 +41,30 @@
<view
id="wrapper"
class="absolute l-0 t-0 wrapper item"
@touchstart="colorTouch.startDrag"
@touchmove="colorTouch.onDrag"
@touchend="colorTouch.endDrag"
v-passive-touch="colorTouch.startDrag"
v-passive-move="colorTouch.onDrag"
v-passive-end="colorTouch.endDrag"
@touchcancel="colorTouch.endDrag"
>
<view class="itemwk" @touchend="touchEndWk(0)" @touchmove="touchEndWk(0)"></view>
<view class="itemwk" v-passive-end="touchEndWk(0)" v-passive-move="touchEndWk(0)"></view>
</view>
<view
id="wrapper2"
class="absolute r-0 t-0 wrapper item"
@touchstart="colorTouch.startDrag2"
@touchmove="colorTouch.onDrag2"
@touchend="colorTouch.endDrag2"
v-passive-touch="colorTouch.startDrag2"
v-passive-move="colorTouch.onDrag2"
v-passive-end="colorTouch.endDrag2"
@touchcancel="colorTouch.endDrag2"
>
<view class="itemwk" @touchend="touchEndWk(1)" @touchmove="touchEndWk(1)"></view>
<view class="itemwk" v-passive-end="touchEndWk(1)" v-passive-move="touchEndWk(1)"></view>
</view>
<!-- #endif -->
<!-- #ifdef APP-NVUE -->
<view id="wrapper" ref="wrapper" class="absolute l-0 t-0 wrapper item" @touchstart="nvueStartH">
<view id="wrapper" ref="wrapper" class="absolute l-0 t-0 wrapper item" v-passive-touch="nvueStartH">
<view class="itemwk"></view>
</view>
<view id="wrapper2" ref="wrapper2" class="absolute r-0 t-0 wrapper item" @touchstart="nvueStartS">
<view id="wrapper2" ref="wrapper2" class="absolute r-0 t-0 wrapper item" v-passive-touch="nvueStartS">
<view class="itemwk"></view>
</view>
<!-- #endif -->

View File

@ -1,9 +1,9 @@
<template>
<view
@longpress=""
@touchstart="touchStart"
@touchmove.stop.prevent="touchMove"
@touchend="touchEnd"
v-passive-touch="touchStart"
v-passive-move.stop.prevent="touchMove"
v-passive-end="touchEnd"
@touchcancel="touchEnd"
@mousedown="touchStart"
@mousemove.stop.prevent="touchMove"

View File

@ -39,12 +39,12 @@
</view>
<view
:style="{ height: h - 1 + 'px', width: '100rpx' }"
@touchstart.stop.prevent="m_start($event, index)"
v-passive-touch.stop.prevent="(e: Event) => m_start(e, index)"
@longpress="m_start_longpress(index)"
@mousedown="m_start($event, index)"
@touchmove.stop.prevent="m_move($event, index)"
v-passive-move.stop.prevent="(e: Event) => m_move(e, index)"
@mousemove.stop.prevent="m_move($event, index)"
@touchend="m_end($event, index)"
v-passive-end="(e: Event) => m_end(e, index)"
@mouseup="m_end($event, index)"
class="flex-shrink flex flex-row flex-row-center-center opacity-3"
>

View File

@ -3,7 +3,7 @@
<view
v-if="show"
@click.stop="closeDromenu"
@touchmove.stop=""
v-passive-move.stop=""
class="l-0 t-0 fixed zIndex-9"
:style="[
{

View File

@ -37,7 +37,7 @@
<!-- 背景遮罩,透明背景 -->
<view
@click="close"
@touchmove.stop="stopEvent"
v-passive-move.stop="stopEvent"
class="bg fixed"
:style="{
left: (isNaN(activeIndex) || isButton ? '-10000' : 0) + 'px',
@ -56,7 +56,7 @@
<!-- 动态菜单及内容的背景 -->
<view
@click="close"
@touchmove.stop="stopEvent"
v-passive-move.stop="stopEvent"
:class="[isNaN(activeIndex) ? 'bgAnioff' : 'bgAni']"
class="bgContent fixed"
:style="{
@ -70,7 +70,7 @@
<!-- 动态菜单及内容 -->
<view
@click="close"
@touchmove.stop="stopEvent"
v-passive-move.stop="stopEvent"
class="content fixed"
:style="{
left: (isNaN(activeIndex) || isButton ? '-10000' : (props.fixed?0:el_left)) + 'px',

View File

@ -27,9 +27,9 @@
>
<view
:style="[{ height: `${navright.length * navHeight}rpx`, width: '60rpx' }]"
@touchstart="touchStart"
@touchmove.stop.prevent="touchMove"
@touchend="touchEnd"
v-passive-touch="touchStart"
v-passive-move.stop.prevent="touchMove"
v-passive-end="touchEnd"
id="navlist"
ref="navlist"
class="flex flex-col flex-center"

View File

@ -7,7 +7,7 @@
<!-- #endif -->
<view
@touchmove.prevent=""
v-passive-move.prevent=""
v-if="showMask"
class="l-0 t-0"
:style="[

View File

@ -2,9 +2,9 @@
<scroll-view
class="scroyy"
:scroll-top="scrollTop"
@touchstart="onTouchStart"
@touchmove="onTouchMove"
@touchend="onTouchEnd"
v-passive-touch="onTouchStart"
v-passive-move="onTouchMove"
v-passive-end="onTouchEnd"
@scroll="onScroll"
@scrolltoupper="onScrollToTop"
@scrolltolower="onScrollToBottom"

View File

@ -3,9 +3,9 @@
<scroll-view
class="scroyy"
:scroll-top="scrollTop"
@touchstart="onTouchStart"
@touchmove="onTouchMove"
@touchend="onTouchEnd"
v-passive-touch="onTouchStart"
v-passive-move="onTouchMove"
v-passive-end="onTouchEnd"
@scroll="onScroll"
@scrolltoupper="onScrollToTop"
@scrolltolower="onScrollToBottom"

View File

@ -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"

View File

@ -3,9 +3,9 @@
<!-- #ifdef APP-NVUE -->
<gcanvas
v-if="show"
@touchstart="touchstart"
@touchmove="touchsmove"
@touchend="touchsend"
v-passive-touch="touchstart"
v-passive-move="touchsmove"
v-passive-end="touchsend"
:id="canvasId"
:ref="canvasId"
class="canvas"
@ -15,9 +15,9 @@
<!-- #endif -->
<!-- #ifdef MP-WEIXIN || MP-ALIPAY || MP-QQ -->
<canvas
@touchstart="touchstart"
@touchmove="touchsmove"
@touchend="touchsend"
v-passive-touch="touchstart"
v-passive-move="touchsmove"
v-passive-end="touchsend"
@mousedown="touchstart"
@mousemove.stop="touchsmove"
@mouseup.stop="touchsend"
@ -30,9 +30,9 @@
<!-- #endif -->
<!-- #ifndef MP-WEIXIN || MP-ALIPAY || MP-QQ || APP-NVUE -->
<canvas
@touchstart.stop="touchstart"
@touchmove.stop="touchsmove"
@touchend.stop="touchsend"
v-passive-touch.stop="touchstart"
v-passive-move.stop="touchsmove"
v-passive-end.stop="touchsend"
@mousedown.stop="touchstart"
@mousemove.stop="touchsmove"
@mouseup.stop="touchsend"

View File

@ -4,9 +4,9 @@
<view >
<view
v-if="!_disabled"
@touchstart="startDrag"
@touchmove="onDrag"
@touchend="endDrag"
v-passive-touch="startDrag"
v-passive-move="onDrag"
v-passive-end="endDrag"
@touchcancel="endDrag"
:style="`width:${attr.width}px;height:${attr.height}px `"
class="overflow relative"
@ -97,7 +97,7 @@
</view>
<view
@click="emits('click')"
@touchstart.stop="touchstart"
v-passive-touch.stop="touchstart"
id="wrapper"
ref="tabsDom"
class="absolute l-0 t-0"

View File

@ -2,7 +2,7 @@
<!-- #ifdef MP-WEIXIN -->
<!-- <view
data-text="hehe"
@touchstart.stop="test.touchstart" @mousedown.stop="movestart" @touchmove.stop="test.touchmove" @mousemove.stop="moveing" @touchend.stop="moveend" @mouseup.stop="moveend" @mouseleave.stop="moveend"
v-passive-touch.stop="test.touchstart" @mousedown.stop="movestart" v-passive-move.stop="test.touchmove" @mousemove.stop="moveing" v-passive-end.stop="moveend" @mouseup.stop="moveend" @mouseleave.stop="moveend"
class="absolute movable" :style="[
props.direction == 'horizontal'?{width:props.size+'rpx',height:props.size+'rpx',transform:`translateX(${_x}px)`,top:'0px'}:'',
props.direction == 'vertical'?{width:props.size+'rpx',height:props.size+'rpx',transform:`translateY(${_x}px)`,left:0+'rpx',top:'0px'}:'',
@ -13,11 +13,11 @@
<!-- #endif -->
<view
@touchstart.stop="movestart"
v-passive-touch.stop="movestart"
@mousedown.stop="movestart"
@touchmove.stop="moveing"
v-passive-move.stop="moveing"
@mousemove.stop="moveing"
@touchend.stop="moveend"
v-passive-end.stop="moveend"
@mouseup.stop="moveend"
@mouseleave.stop="moveend"
class="absolute"

View File

@ -12,10 +12,10 @@
<movable-view
:class="[moveIndex === item._index ? 'opacity-6 zIndex-1' : 'zIndex-0']"
:animation="false"
@touchstart="drageStart"
@touchmove="onTouchMove($event, index)"
v-passive-touch="drageStart"
v-passive-move="(e: Event) => onTouchMove(e, index)"
@touchcancel="dragEnd($event, index)"
@touchend="dragEnd($event, index)"
v-passive-end="(e: Event) => dragEnd(e, index)"
@change="eleChange($event, index)"
:x="item._x"
:y="item._y"

View File

@ -2,7 +2,7 @@
<view class="flex flex-row" :style="[{ height: `${props.height}rpx`,width: `${props.width}rpx`,}]">
<tmSheet text class="flex-1" :transprent="props.circular" :followTheme="false" _class="flex flex-row flex-1"
:color="props.bgColor" :margin="[0, 0]" :padding="[0, 0]">
<view @click="setStep('-')" @longpress="longpressEvent('-')" @touchend="endlongpressEvent('-')"
<view @click="setStep('-')" @longpress="longpressEvent('-')" v-passive-end="endlongpressEvent('-')"
:class="[!props.circular ? `` : `round-${10}`, 'overflow', _disabled || isJianDisabled ? 'opacity-5' : '']">
<tmSheet :followTheme="props.followTheme" :round="props.circular ? 10 : props.round"
:linear="props.linear" :linear-deep="props.linearDeep" _class="flex-center" :color="props.color"
@ -23,7 +23,7 @@
}
]" type="digit" />
<view @click="setStep('+')" @longpress="longpressEvent('+')" @touchend="endlongpressEvent('+')"
<view @click="setStep('+')" @longpress="longpressEvent('+')" v-passive-end="endlongpressEvent('+')"
:class="[!props.circular ? `` : `round-${10}`, 'overflow', _disabled || isAddDisabled ? 'opacity-5' : '']">
<tmSheet :followTheme="props.followTheme" :round="props.circular ? 10 : props.round"
:linear="props.linear" :linear-deep="props.linearDeep" :_class="'flex-center'" :color="props.color"

View File

@ -49,7 +49,7 @@
</view>
<scroll-view
@scroll="tableScroll"
@touchstart="scrollDong = 't'"
v-passive-touch="scrollDong = 't'"
@mouseup="scrollDong = 't'"
class="flex-1"
:class="['tableHeader']"
@ -160,7 +160,7 @@
class="flex-1"
:scroll-with-animation="false"
@scroll="headerScroll($event, 0)"
@touchstart="touchStartScroll(0)"
v-passive-touch="touchStartScroll(0)"
@mouseup="touchStartScroll(0)"
:scroll-x="true"
:scroll-y="true"

View File

@ -51,8 +51,8 @@
:style="[{ width: _width + 'rpx' }, _height ? { height: _height + 'rpx' } : '']"
>
<view
@touchStart="onScrollStart"
@touchend="onScrollEnd"
v-passive-touch="onScrollStart"
v-passive-end="onScrollEnd"
v-if="isShowRender"
:style="{ transform: `translateY(${reFresh == 2 ? -refreshJuli : 0}px)` }"
class="flex contentx"

View File

@ -8,9 +8,9 @@
<!-- https://ask.dcloud.net.cn/question/143230 -->
<!-- #ifndef APP-NVUE -->
<view
@touchmove="onMove"
@touchend="onEnd"
@touchstart="onStart"
v-passive-move="onMove"
v-passive-end="onEnd"
v-passive-touch="onStart"
@mousemove="onMove"
@mouseup="onEnd"
@mouseleave="onEnd"
@ -28,11 +28,11 @@
</view>
<!-- #endif -->
<!-- #ifdef APP-NVUE -->
<!-- @touchmove="onMove"
@touchend="onEnd"
@touchstart="onStart" -->
<!-- v-passive-move="onMove"
v-passive-end="onEnd"
v-passive-touch="onStart" -->
<view
@touchstart="spinNvueAni"
v-passive-touch="spinNvueAni"
ref="tabsDom"
:style="{
width: props.swiper ? `${totalWidth}px` : `${props.width}rpx`,
@ -351,9 +351,9 @@
<!-- #ifndef APP-NVUE -->
<view
id="webIdTabs"
@touchmove="onMove"
@touchend="onEnd"
@touchstart="onStart"
v-passive-move="onMove"
v-passive-end="onEnd"
v-passive-touch="onStart"
@touchcancel="onEnd"
@mousemove="onMove"
@mouseup="onEnd"
@ -372,13 +372,13 @@
</view>
<!-- #endif -->
<!-- #ifdef APP-NVUE -->
<!-- @touchmove="onMove"
@touchend="onEnd"
@touchstart="onStart" -->
<!-- @touchmove="onMove" @touchend="onEnd" @touchcancel="onEnd" -->
<!-- v-passive-move="onMove"
v-passive-end="onEnd"
v-passive-touch="onStart" -->
<!-- v-passive-move="onMove" v-passive-end="onEnd" @touchcancel="onEnd" -->
<view
@touchstart="spinNvueAni"
@touchmove="onMove"
v-passive-touch="spinNvueAni"
v-passive-move="onMove"
ref="tabsDom"
:style="{
width: props.swiper ? `${totalWidth}px` : `${props.width}rpx`,

View File

@ -11,9 +11,9 @@ interface positionType {
import { useTouchFinger } from '@/tmui/tool/useFun/useTouchFinger'
const {touchstart,touchmove,touchend,touchcancel,addEventListener,direction,deltaXY,preTapPosition,angle,scale } = useTouchFinger();
<image
@touchstart="touchstart"
@touchmove="touchmove"
@touchend="touchend"
v-passive-touch="touchstart"
v-passive-move="touchmove"
v-passive-end="touchend"
@touchcancel="touchcancel"
src="https://pic.rmb.bdstatic.com/bjh/beautify/aee57799c6885386bb748e07fe43f78f.jpeg"
:style="{transform:`scale(${scale}) rotate(${angle}deg)`,width:'100px',height:'100px'}"></image>

View File

@ -1,6 +1,6 @@
<template>
<view v-if="showPopup" class="uni-popup" :class="[popupstyle, isDesktop ? 'fixforpc-z-index' : '']">
<view @touchstart="touchstart">
<view v-passive-touch="touchstart">
<uni-transition key="1" v-if="maskShow" name="mask" mode-class="fade" :styles="maskClass"
:duration="duration" :show="showTrans" @click="onTap" />
<uni-transition key="2" :mode-class="ani" name="content" :styles="transClass" :duration="duration"

View File

@ -57,7 +57,7 @@
>
<view class="wd-picker__wraper">
<!--toolBar-->
<view class="wd-picker__toolbar" @touchmove="noop">
<view class="wd-picker__toolbar" v-passive-move="noop">
<!--取消按钮-->
<view class="wd-picker__action wd-picker__action--cancel" @click="onCancel">
{{ cancelButtonText || translate('cancel') }}

View File

@ -1,8 +1,8 @@
<template>
<view
@touchmove.stop.prevent="handleTouchMove"
@touchstart="handleTouchStart"
@touchend="handleTouchEnd"
v-passive-move.stop.prevent="handleTouchMove"
v-passive-touch="handleTouchStart"
v-passive-end="handleTouchEnd"
:class="`wd-fab ${customClass}`"
:style="rootStyle"
@click.stop=""

View File

@ -1,6 +1,6 @@
<template>
<!-- 绘制的图片canvas -->
<view v-if="modelValue" :class="`wd-img-cropper ${customClass}`" :style="customStyle" @touchmove="preventTouchMove">
<view v-if="modelValue" :class="`wd-img-cropper ${customClass}`" :style="customStyle" v-passive-move="preventTouchMove">
<!-- 展示在用户面前的裁剪框 -->
<view class="wd-img-cropper__wrapper">
<!-- 画出裁剪框 -->
@ -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"
/>

View File

@ -8,8 +8,8 @@
</scroll-view>
<view
class="wd-index-bar__sidebar"
@touchmove.stop.prevent="handleTouchMove"
@touchend.stop.prevent="handleTouchEnd"
v-passive-move.stop.prevent="handleTouchMove"
v-passive-end.stop.prevent="handleTouchEnd"
@touchcancel.stop.prevent="handleTouchEnd"
>
<view

View File

@ -1,5 +1,5 @@
<template>
<view :class="`wd-key-wrapper ${wider ? 'wd-key-wrapper--wider' : ''}`" @touchstart="onTouchStart" @touchmove="onTouchMove" @touchend="onTouchEnd">
<view :class="`wd-key-wrapper ${wider ? 'wd-key-wrapper--wider' : ''}`" v-passive-touch="onTouchStart" v-passive-move="onTouchMove" v-passive-end="onTouchEnd">
<view :class="keyClass">
<wd-loading custom-class="wd-key--loading-icon" v-if="props.loading" />
<template v-if="type === 'delete'">

View File

@ -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 : ''"
>
<slot></slot>
</wd-transition>

View File

@ -1,6 +1,6 @@
<template>
<view :class="`wd-password-input ${customClass}`" :style="customStyle">
<view @touchstart="onTouchStart" class="wd-password-input__security">
<view v-passive-touch="onTouchStart" class="wd-password-input__security">
<view
v-for="(_, index) in length"
:key="index"

View File

@ -38,7 +38,7 @@
custom-class="wd-picker__popup"
>
<view class="wd-picker__wraper">
<view class="wd-picker__toolbar" @touchmove="noop">
<view class="wd-picker__toolbar" v-passive-move="noop">
<view class="wd-picker__action wd-picker__action--cancel" @click="onCancel">
{{ cancelButtonText || translate('cancel') }}
</view>

View File

@ -7,7 +7,7 @@
:duration="duration"
:custom-style="modalStyle"
@click="handleClickModal"
@touchmove="noop"
v-passive-move="noop"
/>
<view v-if="!lazyRender || inited" :class="rootClass" :style="style" @transitionend="onTransitionEnd">
<slot />

View File

@ -92,7 +92,7 @@
</view>
</wd-radio-group>
</view>
<view v-if="loading" class="wd-select-picker__loading" @touchmove="noop">
<view v-if="loading" class="wd-select-picker__loading" v-passive-move="noop">
<wd-loading :color="loadingColor" />
</view>
</scroll-view>

View File

@ -12,9 +12,9 @@
<view
class="wd-slider__button-wrapper"
:style="buttonLeftStyle"
@touchstart="onTouchStart"
@touchmove="onTouchMove"
@touchend="onTouchEnd"
v-passive-touch="onTouchStart"
v-passive-move="onTouchMove"
v-passive-end="onTouchEnd"
@touchcancel="onTouchEnd"
>
<view class="wd-slider__label" v-if="!hideLabel">{{ leftNewValue }}</view>
@ -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"
>
<view class="wd-slider__label" v-if="!hideLabel">{{ rightNewValue }}</view>

View File

@ -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()
}

View File

@ -59,7 +59,7 @@
</wd-sticky>
<!--标签页-->
<view class="wd-tabs__container" @touchstart="onTouchStart" @touchmove="onTouchMove" @touchend="onTouchEnd" @touchcancel="onTouchEnd">
<view class="wd-tabs__container" v-passive-touch="onTouchStart" v-passive-move="onTouchMove" v-passive-end="onTouchEnd" @touchcancel="onTouchEnd">
<view :class="['wd-tabs__body', animated ? 'is-animated' : '']" :style="bodyStyle">
<slot />
</view>
@ -114,7 +114,7 @@
</view>
<!--标签页-->
<view class="wd-tabs__container" @touchstart="onTouchStart" @touchmove="onTouchMove" @touchend="onTouchEnd" @touchcancel="onTouchEnd">
<view class="wd-tabs__container" v-passive-touch="onTouchStart" v-passive-move="onTouchMove" v-passive-end="onTouchEnd" @touchcancel="onTouchEnd">
<view :class="['wd-tabs__body', animated ? 'is-animated' : '']" :style="bodyStyle">
<slot />
</view>

View File

@ -214,27 +214,6 @@ export function handleSetWebviewStyle(hasTabBar) {
}
}
//遍历所有的webview并通信
export function handleFindWebview(evalJS_) {
const findWebview = () => {
let allWebView = plus.webview.all()
allWebView.forEach((webview) => {
//由于webviewId后面的数字是动态分配的在很小情况下OAWebview的Id并不是webviewId1
//因此不做限制,全局广播,由接收页面自行接收处理
// if (webview.id === 'webviewId1') {//找到OAWebview
webview.evalJS(evalJS_)
// }
})
}
if (typeof plus !== 'undefined') {
findWebview()
} else {
document.addEventListener('plusready', () => {
findWebview()
})
}
}
// 通用运算函数
/*
函数加法函数用来得到精确的加法结果
@ -244,16 +223,16 @@ export function handleFindWebview(evalJS_) {
返回值两数相加的结果
*/
export function addition(arg1, arg2) {
;(arg1 = arg1.toString()), (arg2 = arg2.toString())
var arg1Arr = arg1.split('.'),
arg2Arr = arg2.split('.'),
d1 = arg1Arr.length == 2 ? arg1Arr[1] : '',
d2 = arg2Arr.length == 2 ? arg2Arr[1] : ''
var maxLen = Math.max(d1.length, d2.length)
var m = Math.pow(10, maxLen)
var result = Number(((arg1 * m + arg2 * m) / m).toFixed(maxLen))
var d = arguments[2]
return typeof d === 'number' ? Number(result.toFixed(d)) : result
arg1 = arg1.toString(), arg2 = arg2.toString();
var arg1Arr = arg1.split("."),
arg2Arr = arg2.split("."),
d1 = arg1Arr.length == 2 ? arg1Arr[1] : "",
d2 = arg2Arr.length == 2 ? arg2Arr[1] : "";
var maxLen = Math.max(d1.length, d2.length);
var m = Math.pow(10, maxLen);
var result = Number(((arg1 * m + arg2 * m) / m).toFixed(maxLen));
var d = arguments[2];
return typeof d === "number" ? Number((result).toFixed(d)) : result;
}
/*
@ -274,18 +253,10 @@ export function addition(arg1, arg2) {
export function multiplication(arg1, arg2) {
var r1 = arg1.toString(),
r2 = arg2.toString(),
m,
resultVal,
d = arguments[2]
m =
(r1.split('.')[1] ? r1.split('.')[1].length : 0) +
(r2.split('.')[1] ? r2.split('.')[1].length : 0)
resultVal =
(Number(r1.replace('.', '')) * Number(r2.replace('.', ''))) /
Math.pow(10, m)
return typeof d !== 'number'
? Number(resultVal)
: Number(resultVal.toFixed(parseInt(d)))
m, resultVal, d = arguments[2];
m = (r1.split(".")[1] ? r1.split(".")[1].length : 0) + (r2.split(".")[1] ? r2.split(".")[1].length : 0);
resultVal = Number(r1.replace(".", "")) * Number(r2.replace(".", "")) / Math.pow(10, m);
return typeof d !== "number" ? Number(resultVal) : Number(resultVal.toFixed(parseInt(d)));
}
/*
@ -298,16 +269,8 @@ export function multiplication(arg1, arg2) {
export function division(arg1, arg2) {
var r1 = arg1.toString(),
r2 = arg2.toString(),
m,
resultVal,
d = arguments[2]
m =
(r2.split('.')[1] ? r2.split('.')[1].length : 0) -
(r1.split('.')[1] ? r1.split('.')[1].length : 0)
resultVal =
(Number(r1.replace('.', '')) / Number(r2.replace('.', ''))) *
Math.pow(10, m)
return typeof d !== 'number'
? Number(resultVal)
: Number(resultVal.toFixed(parseInt(d)))
m, resultVal, d = arguments[2];
m = (r2.split(".")[1] ? r2.split(".")[1].length : 0) - (r1.split(".")[1] ? r1.split(".")[1].length : 0);
resultVal = Number(r1.replace(".", "")) / Number(r2.replace(".", "")) * Math.pow(10, m);
return typeof d !== "number" ? Number(resultVal) : Number(resultVal.toFixed(parseInt(d)));
}