Compare commits

..

6 Commits

Author SHA1 Message Date
82e14bb969 无感处理墨册SAAS化加好友需求遗漏代码,等待后续上线通知
Some checks failed
Check / lint (push) Has been cancelled
Check / typecheck (push) Has been cancelled
Check / build (build, 18.x, ubuntu-latest) (push) Has been cancelled
Check / build (build, 18.x, windows-latest) (push) Has been cancelled
Check / build (build:app, 18.x, ubuntu-latest) (push) Has been cancelled
Check / build (build:app, 18.x, windows-latest) (push) Has been cancelled
Check / build (build:mp-weixin, 18.x, ubuntu-latest) (push) Has been cancelled
Check / build (build:mp-weixin, 18.x, windows-latest) (push) Has been cancelled
2025-06-30 14:07:18 +08:00
6ae597c7f4 体制外正式环境为特殊账户开启控制台
Some checks are pending
Check / lint (push) Waiting to run
Check / typecheck (push) Waiting to run
Check / build (build, 18.x, ubuntu-latest) (push) Waiting to run
Check / build (build, 18.x, windows-latest) (push) Waiting to run
Check / build (build:app, 18.x, ubuntu-latest) (push) Waiting to run
Check / build (build:app, 18.x, windows-latest) (push) Waiting to run
Check / build (build:mp-weixin, 18.x, ubuntu-latest) (push) Waiting to run
Check / build (build:mp-weixin, 18.x, windows-latest) (push) Waiting to run
2025-06-30 13:47:09 +08:00
94ef829509 无感处理墨册SAAS化加好友需求部分代码,等待后续上线通知
Some checks are pending
Check / lint (push) Waiting to run
Check / typecheck (push) Waiting to run
Check / build (build, 18.x, ubuntu-latest) (push) Waiting to run
Check / build (build, 18.x, windows-latest) (push) Waiting to run
Check / build (build:app, 18.x, ubuntu-latest) (push) Waiting to run
Check / build (build:app, 18.x, windows-latest) (push) Waiting to run
Check / build (build:mp-weixin, 18.x, ubuntu-latest) (push) Waiting to run
Check / build (build:mp-weixin, 18.x, windows-latest) (push) Waiting to run
2025-06-30 13:26:36 +08:00
16c881acfd 处理语音时长显示格式
Some checks are pending
Check / lint (push) Waiting to run
Check / typecheck (push) Waiting to run
Check / build (build, 18.x, ubuntu-latest) (push) Waiting to run
Check / build (build, 18.x, windows-latest) (push) Waiting to run
Check / build (build:app, 18.x, ubuntu-latest) (push) Waiting to run
Check / build (build:app, 18.x, windows-latest) (push) Waiting to run
Check / build (build:mp-weixin, 18.x, ubuntu-latest) (push) Waiting to run
Check / build (build:mp-weixin, 18.x, windows-latest) (push) Waiting to run
2025-06-30 10:30:43 +08:00
d3164014ee 重构语音播放动画和展示效果;解决复制语音转文字内容错误问题;增加语音转文字loading
Some checks are pending
Check / lint (push) Waiting to run
Check / typecheck (push) Waiting to run
Check / build (build, 18.x, ubuntu-latest) (push) Waiting to run
Check / build (build, 18.x, windows-latest) (push) Waiting to run
Check / build (build:app, 18.x, ubuntu-latest) (push) Waiting to run
Check / build (build:app, 18.x, windows-latest) (push) Waiting to run
Check / build (build:mp-weixin, 18.x, ubuntu-latest) (push) Waiting to run
Check / build (build:mp-weixin, 18.x, windows-latest) (push) Waiting to run
2025-06-30 09:22:24 +08:00
d81bfad19d 抽出所有向OA的Webview通信的方法并封装,统一向所有的webview广播,解决webviewId动态分配导致指定Id时有极小几率不是目标webview导致业务无法继续的问题 2025-06-26 19:06:51 +08:00
58 changed files with 758 additions and 531 deletions

View File

@ -1,6 +1,7 @@
import request from '@/service/index.js'
import qs from 'qs'
import { useTalkStore, useDialogueStore } from '@/store'
import { handleFindWebview } from '@/utils/common'
// 获取聊天列表服务接口
export const ServeGetTalkList = (data) => {
@ -46,23 +47,7 @@ export const ServeClearTalkUnreadNum = (data, unReadNum) => {
useTalkStore().findTalkIndex(useDialogueStore().index_name)
]?.is_disturb
) {
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}')`)
}
})
})
}
handleFindWebview(`updateUnreadMsgNumReduce('${unReadNum}')`)
}
return request({
url: '/api/v1/talk/unread/clear',
@ -83,7 +68,8 @@ export const ServeTalkRecords = (data) => {
// 获取转发会话记录详情列表服务接口
export const ServeGetForwardRecords = (data) => {
return request({
url: '/api/v1/talk/records/forward/v2',
// url: '/api/v1/talk/records/forward/v2',
url: '/api/v1/talk/records/forward',
method: 'GET',
data,
})

View File

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

View File

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

View File

@ -1,109 +1,155 @@
<script lang="ts" setup>
import { ref, reactive, onMounted } from "vue";
import { PlayOne, PauseOne } from "@icon-park/vue-next";
import { ITalkRecordExtraAudio, ITalkRecord } from "@/types/chat";
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'
const props = defineProps<{
extra: ITalkRecordExtraAudio;
data: ITalkRecord;
maxWidth?: Boolean;
}>();
extra: ITalkRecordExtraAudio
data: ITalkRecord
maxWidth?: Boolean
}>()
const audioRef = ref();
const audioContext = ref<any>(null);
const durationDesc = ref("-");
const userStore = useUserStore()
const talkParams = reactive({
uid: computed(() => userStore.uid),
})
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(() => {
// 使uni-app
audioContext.value = uni.createInnerAudioContext();
audioContext.value.src = props.extra.url;
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);
});
});
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
}
})
const onPlay = () => {
if (state.isAudioPlay) {
audioContext.value.pause();
audioContext.value.pause()
state.isAudioPlay = false
} else {
audioContext.value.play();
//
window.dispatchEvent(
new CustomEvent('audio-play', { detail: props.data.msg_id }),
)
audioContext.value.play()
state.isAudioPlay = true
}
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="im-message-audio">
<div class="play">
<div class="btn pointer" @click.stop="onPlay">
<n-icon
:size="18"
:component="state.isAudioPlay ? PauseOne : PlayOne"
/>
</div>
<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>
<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>
<a-trumpet
v-if="props?.data?.user_id == talkParams.uid"
:isPlay="state.isAudioPlay"
color="#C1C1C1"
:size="30"
direction="left"
></a-trumpet>
</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;
@ -245,7 +291,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"
v-passive-touch="cancel = false"
v-passive-end="cancel = true"
@touchstart="cancel = false"
@touchend="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"
v-passive-touch="confirm = false"
v-passive-end="confirm = true"
@touchstart="confirm = false"
@touchend="confirm = true"
:width="319"
:fontSize="32"
:transprent="confirm"

View File

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

View File

@ -15,6 +15,7 @@ import {
useDialogueListStore,
useGroupStore,
} from '@/store'
import { handleFindWebview } from '@/utils/common'
/**
* 好友状态事件
@ -154,23 +155,7 @@ class Talk extends Base {
//更新未读数量+1
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()`)
}
})
})
}
handleFindWebview(`updateUnreadMsgNumAdd()`)
}
/**

View File

@ -23,6 +23,7 @@ import {
useDialogueListStore,
} from '@/store'
import { uniStorage } from '@/utils/uniStorage.js'
import { handleFindWebview } from '@/utils/common'
const { showMessage } = messagePopup()
dayjs.locale('zh-cn')
@ -52,51 +53,6 @@ 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) => {
@ -117,12 +73,7 @@ export function createApp() {
return
}
console.log('===准备创建本地通知栏消息')
let OAWebView = plus.webview.all()
OAWebView.forEach((webview, index) => {
if (webview.id === 'webviewId1') {
webview.evalJS(`doCreatePushMessage('${msg}')`)
}
})
handleFindWebview(`doCreatePushMessage('${msg}')`)
}
//处理聊天推送弹窗点开
@ -143,14 +94,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、墨册强制刷新时聊天同步强制刷新
@ -164,12 +115,7 @@ export function createApp() {
//检查聊天页面是否可用
window.checkChatWebviewAvailable = () => {
let OAWebView = plus.webview.all()
OAWebView.forEach((webview, index) => {
if (webview.id === 'webviewId1') {
webview.evalJS(`doneCheckChatWebviewAvailable()`)
}
})
handleFindWebview(`doneCheckChatWebviewAvailable()`)
}
//获取从base传来的多选视频列表
@ -182,6 +128,19 @@ 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 } from '@/utils/common'
import { handleSetWebviewStyle, handleFindWebview } from '@/utils/common'
import { ServeUserGroupChatList, ServeCreateTalkList } from '@/api/chat/index'
import { ServeGetSessionId } from '@/api/search/index'
import { formatTalkItem } from '@/utils/talk'
@ -376,12 +376,7 @@ onLoad((options) => {
const goWebHome = () => {
uni.navigateBack()
let OAWebView = plus.webview.all()
OAWebView.forEach((webview) => {
if (webview.id === 'webviewId1') {
webview.evalJS(`handleBackHost()`)
}
})
handleFindWebview(`handleBackHost()`)
}
onMounted(() => {

View File

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

View File

@ -57,6 +57,7 @@ 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: {
@ -162,12 +163,7 @@ const photoActionsSelect = (index) => {
)
}
} else {
// let OAWebView = plus.webview.all()
// OAWebView.forEach((webview, index) => {
// if (webview.id === 'webviewId1') {
// webview.evalJS(`getPlusVideoPicker()`)
// }
// })
// handleFindWebview(`getPlusVideoPicker()`)
// return
uni.chooseVideo({
sourceType: ['album'],

View File

@ -256,16 +256,17 @@ const checkSendPermission = () => {
//
const checkNeedAddFriend = () => {
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
}
})
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
// }
// })
}
//

View File

@ -61,7 +61,7 @@
</template> -->
<!-- 数据加载状态栏 -->
<div class="dialog-list" v-passive-touch="handleHidePanel">
<div class="dialog-list" @touchstart="handleHidePanel">
<div
class="message-item"
v-for="item in virtualList"
@ -146,8 +146,8 @@
<aside
class="avatar-column"
@click="toUserDetailPage(item)"
v-passive-touch="() => handleAvatarTouchStart(item)"
v-passive-end="handleAvatarTouchEnd"
@touchstart="() => handleAvatarTouchStart(item)"
@touchend="handleAvatarTouchEnd"
>
<!-- <im-avatar
class="pointer"
@ -229,10 +229,19 @@
>
<div
class="talk-tools voice-content"
v-if="item.voiceContent"
v-if="
item?.voiceContent ||
(!item?.voiceContent && item?.isVoiceToTexting)
"
@click="copyVoiceContent(item?.voiceContent || '')"
>
<span>{{ item.voiceContent }}</span>
<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>
</div>
</div>
@ -2710,6 +2719,12 @@ 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)
@ -2736,6 +2751,9 @@ const endRecord = (file, url, duration) => {
resp.catch(() => {})
}
//
const cancelRecord = () => {}
//
const sendMediaMessage = (mediaUrl, duration, size) => {
// console.log(mediaUrl, 'mediaUrl')
@ -2764,17 +2782,21 @@ 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
})
}
//
@ -2785,16 +2807,17 @@ const chatInputHeight = computed(() => {
//
const checkNeedAddFriend = () => {
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
}
})
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
// }
// })
}
//
@ -2817,9 +2840,16 @@ const copyVoiceContent = (voiceContent) => {
if (!voiceContent) {
return
}
clipboard(voiceContent, () => {
message.success('复制成功')
uni.setClipboardData({
data: voiceContent,
showToast: false,
success: () => {
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="talkListItems"
v-model="items"
@query="queryList"
:loading-more-enabled="false"
:refresher-end-bounce-enabled="false"
@ -18,7 +18,6 @@
:empty-view-show="isEmptyViewShow"
@refresherRefresh="onRefresh"
:show-scrollbar="false"
:auto-clean-list-when-reload="false"
>
<template #top>
<div>
@ -66,7 +65,9 @@
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]"
@ -85,7 +86,7 @@
</div>
</div>
<div class="divider"></div>
<div
<!-- <div
@click="toAddFriendPage"
class="flex items-center pl-[22rpx] py-[32rpx]"
>
@ -102,7 +103,7 @@
添加好友
</div>
</div>
<div class="divider"></div>
<div class="divider"></div> -->
<div
@click="toAddressBookPage"
class="flex items-center pl-[22rpx] py-[32rpx]"
@ -138,7 +139,7 @@
</div>
<div class="contentRoot">
<chatItem
v-for="(item, index) in talkListItems"
v-for="(item, index) in items"
:key="item.index_name"
:index="index"
:data="item"
@ -151,7 +152,7 @@
</template>
<script setup>
import customInput from '@/components/custom-input/custom-input.vue'
import { ref, watch, computed, onMounted, onUnmounted } from 'vue'
import { ref, watch, computed } from 'vue'
import { onShow, onLoad } from '@dcloudio/uni-app'
import { useChatList } from '@/store/chatList/index.js'
import { useAuth } from '@/store/auth'
@ -175,34 +176,23 @@ const dialogueParams = reactive({
const { userInfo } = useAuth()
const topItems = computed(() => talkStore.topItems)
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)
const items = 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(() => {
@ -255,14 +245,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(
@ -273,43 +263,28 @@ 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)
//
if (paging.value) {
paging.value.reload()
}
// 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 (talkListItems?.value?.length > 0) {
talkListItems.value.forEach((openSession) => {
if (items?.value?.length > 0) {
items.value.forEach((openSession) => {
if (openSession.index_name === options?.openSessionIndexName) {
setTimeout(() => {
dialogueStore.setDialogue(openSession)

View File

@ -5,6 +5,7 @@ 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 () => {
@ -40,19 +41,33 @@ 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 = {
@ -69,38 +84,27 @@ export const useDialogueListStore = createGlobalState(() => {
path: '_doc/chat.db',
},
}
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),
)}')`,
)
}
})
})
// 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),
// )}')`,
// )
}
// testDatabase()

View File

@ -2,6 +2,7 @@ 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', {
@ -103,23 +104,7 @@ export const useTalkStore = defineStore('talk', {
return resp.then(({ code, data }) => {
if (code == 200) {
//向OA的webview通信改变未读消息数量
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}')`)
}
})
})
}
handleFindWebview(`doUpdateUnreadNum('${data.unread_num}')`)
this.items = data.items.map((item) => {
const value = formatTalkItem(item)

View File

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

View File

@ -0,0 +1,130 @@
<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

@ -0,0 +1,83 @@
{
"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

@ -0,0 +1,18 @@
# 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"
v-passive-touch="touchStart"
v-passive-move="touchMove"
v-passive-end="endRecord"
@touchstart="touchStart"
@touchmove="touchMove"
@touchend="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 } from '@/utils/common'
import { multiplication, handleFindWebview } from '@/utils/common'
export default {
name: 'nbVoiceRecord',
/**
@ -355,7 +355,11 @@ export default {
// }, 1000)
if (Number(permissionStatus) === 1) {
that.continueAppMicro()
} else if (Number(permissionStatus) === -1) {
} else if (
Number(permissionStatus) === -1 ||
(Number(permissionStatus) === 0 &&
uni.getSystemInfoSync().osName === 'ios')
) {
uni.showModal({
title: '提示',
content: '检测到您还未授权麦克风哦',
@ -364,12 +368,10 @@ export default {
cancelText: '保持拒绝',
success: ({ confirm, cancel }) => {
if (confirm) {
let OAWebView = plus.webview.all()
OAWebView.forEach((webview, index) => {
if (webview.id === 'webviewId1') {
webview.evalJS(`handleRequestAndroidPermission('settings')`)
}
})
handleFindWebview(`handleRequestAndroidPermission('settings')`)
}
if (cancel) {
that.isCheckingPermission = false
}
},
})
@ -451,12 +453,7 @@ export default {
// #endif
// #ifdef H5
if (typeof plus !== 'undefined') {
let OAWebView = plus.webview.all()
OAWebView.forEach((webview, index) => {
if (webview.id === 'webviewId1') {
webview.evalJS(`handleRequestAndroidPermission('micro')`)
}
})
handleFindWebview(`handleRequestAndroidPermission('micro')`)
} else {
that.continueAppMicro(isFirstRequestPer)
}

View File

@ -1,14 +1,14 @@
<template>
<!-- #ifdef MP -->
<view v-passive-touch="touch.startDrag" v-passive-move.stop="touch.onDrag" v-passive-end="touch.endDrag" :data-prop="towxsShareData">
<view @touchstart="touch.startDrag" @touchmove.stop="touch.onDrag" @touchend="touch.endDrag" :data-prop="towxsShareData">
<!-- #endif -->
<!-- #ifdef H5||APP-VUE -->
<view v-passive-touch="touch.startDrag" v-passive-move="touch.onDrag" v-passive-end="touch.endDrag" :data-prop="towxsShareData">
<view @touchstart="touch.startDrag" @touchmove="touch.onDrag" @touchend="touch.endDrag" :data-prop="towxsShareData">
<!-- #endif -->
<!-- #ifdef APP-NVUE -->
<view >
<!-- #endif -->
<view v-passive-touch="touchstart" :style="{ left: _offset[0] + 'rpx', top: _offset[1] + 'rpx' }" class="div" id="adsorb" ref="adsorb">
<view @touchstart="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"
v-passive-touch="touchstart"
v-passive-end="touchend"
@touchstart="touchstart"
@touchend="touchend"
@longpress="emits('longpress', $event)"
@touchcancel="touchcancel"
v-passive-move="(e: Event) => emits('touchmove', e)"
@touchmove="emits('touchmove', $event)"
@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"
v-passive-touch="touchStart"
v-passive-move="touchMove"
v-passive-end="touchEnd"
@touchstart="touchStart"
@touchmove="touchMove"
@touchend="touchEnd"
:id="canvasId"
:canvas-id="canvasId"
class="canvas"
@ -26,9 +26,9 @@
<!-- #ifdef MP-WEIXIN || MP-QQ -->
<canvas
@click="emits('click', $event)"
v-passive-touch="touchStart"
v-passive-move="touchMove"
v-passive-end="touchEnd"
@touchstart="touchStart"
@touchmove="touchMove"
@touchend="touchEnd"
type="2d"
id="canvasId"
canvas-id="canvasId"
@ -39,9 +39,9 @@
<!-- #ifdef MP-ALIPAY -->
<canvas
@click="emits('click', $event)"
v-passive-touch="touchStart"
v-passive-move="touchMove"
v-passive-end="touchEnd"
@touchstart="touchStart"
@touchmove="touchMove"
@touchend="touchEnd"
type="2d"
:id="canvasId"
:canvas-id="canvasId"

View File

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

View File

@ -1,9 +1,9 @@
<template>
<view
@longpress=""
v-passive-touch="touchStart"
v-passive-move.stop.prevent="touchMove"
v-passive-end="touchEnd"
@touchstart="touchStart"
@touchmove.stop.prevent="touchMove"
@touchend="touchEnd"
@touchcancel="touchEnd"
@mousedown="touchStart"
@mousemove.stop.prevent="touchMove"
@ -34,7 +34,7 @@
v-if="url"
@error="imgError"
class="absolute l-0 t-0"
:userInteractionEnabled="false"
@load="imgLoad"
:src="url"

View File

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

View File

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

View File

@ -37,7 +37,7 @@
<!-- 背景遮罩,透明背景 -->
<view
@click="close"
v-passive-move.stop="stopEvent"
@touchmove.stop="stopEvent"
class="bg fixed"
:style="{
left: (isNaN(activeIndex) || isButton ? '-10000' : 0) + 'px',
@ -56,7 +56,7 @@
<!-- 动态菜单及内容的背景 -->
<view
@click="close"
v-passive-move.stop="stopEvent"
@touchmove.stop="stopEvent"
:class="[isNaN(activeIndex) ? 'bgAnioff' : 'bgAni']"
class="bgContent fixed"
:style="{
@ -70,7 +70,7 @@
<!-- 动态菜单及内容 -->
<view
@click="close"
v-passive-move.stop="stopEvent"
@touchmove.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' }]"
v-passive-touch="touchStart"
v-passive-move.stop.prevent="touchMove"
v-passive-end="touchEnd"
@touchstart="touchStart"
@touchmove.stop.prevent="touchMove"
@touchend="touchEnd"
id="navlist"
ref="navlist"
class="flex flex-col flex-center"

View File

@ -7,7 +7,7 @@
<!-- #endif -->
<view
v-passive-move.prevent=""
@touchmove.prevent=""
v-if="showMask"
class="l-0 t-0"
:style="[
@ -25,7 +25,7 @@
<view
ref="overlay"
:class="[
bgColor_rp && !props.transprent && ani ? 'blurOnOpacity' : 'blurOffOpacity',
bgColor_rp && !props.transprent && ani ? 'blurOnOpacity' : 'blurOffOpacity',
'overlay',
store.tmuiConfig?.themeConfig.overflowBlur&&bgColor_rp && !props.transprent && ani?'blurOn':'',
store.tmuiConfig?.themeConfig.overflowBlur&&bgColor_rp && !props.transprent && !ani?'blurOff':'',
@ -211,7 +211,7 @@ function close() {
clearTimeout(timerId);
timerId = NaN;
}
open(false);
}
@ -223,12 +223,12 @@ function closeByclick(e: Event) {
} catch (e) {
//TODO handle the exception
}
if (timerId) {
clearTimeout(timerId);
timerId = NaN;
}
emits("click", e);
if (!props.overlayClick) return;
open(false);
@ -299,7 +299,7 @@ function fadeInVue(off = false) {
if (showMask.value == off) return;
throttle(
function () {
if (off == false) {
ani.value = false;
setTimeout(function () {
@ -342,7 +342,7 @@ defineExpose({
opacity: 0;
}
.blur{
}
.blurOn {
/* #ifndef APP-PLUS-NVUE */

View File

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

View File

@ -3,9 +3,9 @@
<scroll-view
class="scroyy"
:scroll-top="scrollTop"
v-passive-touch="onTouchStart"
v-passive-move="onTouchMove"
v-passive-end="onTouchEnd"
@touchstart="onTouchStart"
@touchmove="onTouchMove"
@touchend="onTouchEnd"
@scroll="onScroll"
@scrolltoupper="onScrollToTop"
@scrolltolower="onScrollToBottom"
@ -59,11 +59,11 @@
</scroll-view>
<!-- #endif -->
<!-- #ifdef APP-NVUE -->
<scroll-view
enableBackToTop="true"
alwaysScrollableVertical="true"
scroll-y="true"
@scrolltolower="onScrollToBottom"
<scroll-view
enableBackToTop="true"
alwaysScrollableVertical="true"
scroll-y="true"
@scrolltolower="onScrollToBottom"
:style="[props.height ? { height: props.height + 'rpx' } : '', _style]" :class="_class">
<refresh @refresh="onrefresh" @pullingdown="onpullingdown" :display="showLoading ? 'show' : 'hide'" style="width: 750rpx">
<view :style="{ height: _barHeight / 2 + 'px' }">

View File

@ -11,8 +11,8 @@
:blurEffect="blurEffect"
@click="onClick"
@longpress="longpress"
v-passive-end="touchend"
v-passive-touch="touchstart"
@touchend="touchend"
@touchstart="touchstart"
@touchcancel="touchcancel"
@mousedown="mousedown"
@mouseup="mouseup"

View File

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

View File

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

View File

@ -2,7 +2,7 @@
<!-- #ifdef MP-WEIXIN -->
<!-- <view
data-text="hehe"
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"
@touchstart.stop="test.touchstart" @mousedown.stop="movestart" @touchmove.stop="test.touchmove" @mousemove.stop="moveing" @touchend.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
v-passive-touch.stop="movestart"
@touchstart.stop="movestart"
@mousedown.stop="movestart"
v-passive-move.stop="moveing"
@touchmove.stop="moveing"
@mousemove.stop="moveing"
v-passive-end.stop="moveend"
@touchend.stop="moveend"
@mouseup.stop="moveend"
@mouseleave.stop="moveend"
class="absolute"

View File

@ -1,6 +1,6 @@
<template>
<view id="box" ref="box" :style="{ width: props.width + 'rpx', height: props.height + 'rpx' }">
<!-- <view
<!-- <view
class="flex flex-row-top-start flex-row flex-wrap"
:style="{ width: props.width + 'rpx', height: props.height + 'rpx', background: 'red' }">
<view v-for="(item, index) in _data" :key="index"
@ -12,10 +12,10 @@
<movable-view
:class="[moveIndex === item._index ? 'opacity-6 zIndex-1' : 'zIndex-0']"
:animation="false"
v-passive-touch="drageStart"
v-passive-move="(e: Event) => onTouchMove(e, index)"
@touchstart="drageStart"
@touchmove="onTouchMove($event, index)"
@touchcancel="dragEnd($event, index)"
v-passive-end="(e: Event) => dragEnd(e, index)"
@touchend="dragEnd($event, 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('-')" v-passive-end="endlongpressEvent('-')"
<view @click="setStep('-')" @longpress="longpressEvent('-')" @touchend="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('+')" v-passive-end="endlongpressEvent('+')"
<view @click="setStep('+')" @longpress="longpressEvent('+')" @touchend="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"
v-passive-touch="scrollDong = 't'"
@touchstart="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)"
v-passive-touch="touchStartScroll(0)"
@touchstart="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
v-passive-touch="onScrollStart"
v-passive-end="onScrollEnd"
@touchStart="onScrollStart"
@touchend="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
v-passive-move="onMove"
v-passive-end="onEnd"
v-passive-touch="onStart"
@touchmove="onMove"
@touchend="onEnd"
@touchstart="onStart"
@mousemove="onMove"
@mouseup="onEnd"
@mouseleave="onEnd"
@ -28,11 +28,11 @@
</view>
<!-- #endif -->
<!-- #ifdef APP-NVUE -->
<!-- v-passive-move="onMove"
v-passive-end="onEnd"
v-passive-touch="onStart" -->
<!-- @touchmove="onMove"
@touchend="onEnd"
@touchstart="onStart" -->
<view
v-passive-touch="spinNvueAni"
@touchstart="spinNvueAni"
ref="tabsDom"
:style="{
width: props.swiper ? `${totalWidth}px` : `${props.width}rpx`,
@ -149,7 +149,7 @@
</tm-sheet>
</view>
</view>
<view
v-if="props.showTabsLineAni && props.itemWidth > 0 && props.showTabsLine"
class="anilineBar absolute l-0"
@ -351,9 +351,9 @@
<!-- #ifndef APP-NVUE -->
<view
id="webIdTabs"
v-passive-move="onMove"
v-passive-end="onEnd"
v-passive-touch="onStart"
@touchmove="onMove"
@touchend="onEnd"
@touchstart="onStart"
@touchcancel="onEnd"
@mousemove="onMove"
@mouseup="onEnd"
@ -372,13 +372,13 @@
</view>
<!-- #endif -->
<!-- #ifdef APP-NVUE -->
<!-- v-passive-move="onMove"
v-passive-end="onEnd"
v-passive-touch="onStart" -->
<!-- v-passive-move="onMove" v-passive-end="onEnd" @touchcancel="onEnd" -->
<!-- @touchmove="onMove"
@touchend="onEnd"
@touchstart="onStart" -->
<!-- @touchmove="onMove" @touchend="onEnd" @touchcancel="onEnd" -->
<view
v-passive-touch="spinNvueAni"
v-passive-move="onMove"
@touchstart="spinNvueAni"
@touchmove="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
v-passive-touch="touchstart"
v-passive-move="touchmove"
v-passive-end="touchend"
@touchstart="touchstart"
@touchmove="touchmove"
@touchend="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 v-passive-touch="touchstart">
<view @touchstart="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" v-passive-move="noop">
<view class="wd-picker__toolbar" @touchmove="noop">
<!--取消按钮-->
<view class="wd-picker__action wd-picker__action--cancel" @click="onCancel">
{{ cancelButtonText || translate('cancel') }}

View File

@ -1,8 +1,8 @@
<template>
<view
v-passive-move.stop.prevent="handleTouchMove"
v-passive-touch="handleTouchStart"
v-passive-end="handleTouchEnd"
@touchmove.stop.prevent="handleTouchMove"
@touchstart="handleTouchStart"
@touchend="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" v-passive-move="preventTouchMove">
<view v-if="modelValue" :class="`wd-img-cropper ${customClass}`" :style="customStyle" @touchmove="preventTouchMove">
<!-- 展示在用户面前的裁剪框 -->
<view class="wd-img-cropper__wrapper">
<!-- 画出裁剪框 -->
@ -39,9 +39,9 @@
:src="imgSrc"
:style="imageStyle"
:lazy-load="false"
v-passive-touch="handleImgTouchStart"
v-passive-move="handleImgTouchMove"
v-passive-end="handleImgTouchEnd"
@touchstart="handleImgTouchStart"
@touchmove="handleImgTouchMove"
@touchend="handleImgTouchEnd"
@error="handleImgLoadError"
@load="handleImgLoaded"
/>

View File

@ -8,8 +8,8 @@
</scroll-view>
<view
class="wd-index-bar__sidebar"
v-passive-move.stop.prevent="handleTouchMove"
v-passive-end.stop.prevent="handleTouchEnd"
@touchmove.stop.prevent="handleTouchMove"
@touchend.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' : ''}`" v-passive-touch="onTouchStart" v-passive-move="onTouchMove" v-passive-end="onTouchEnd">
<view :class="`wd-key-wrapper ${wider ? 'wd-key-wrapper--wider' : ''}`" @touchstart="onTouchStart" @touchmove="onTouchMove" @touchend="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"
v-passive-move.stop.prevent="lockScroll ? noop : ''"
@touchmove.stop.prevent="lockScroll ? noop : ''"
>
<slot></slot>
</wd-transition>

View File

@ -1,6 +1,6 @@
<template>
<view :class="`wd-password-input ${customClass}`" :style="customStyle">
<view v-passive-touch="onTouchStart" class="wd-password-input__security">
<view @touchstart="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" v-passive-move="noop">
<view class="wd-picker__toolbar" @touchmove="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"
v-passive-move="noop"
@touchmove="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" v-passive-move="noop">
<view v-if="loading" class="wd-select-picker__loading" @touchmove="noop">
<wd-loading :color="loadingColor" />
</view>
</scroll-view>

View File

@ -12,9 +12,9 @@
<view
class="wd-slider__button-wrapper"
:style="buttonLeftStyle"
v-passive-touch="onTouchStart"
v-passive-move="onTouchMove"
v-passive-end="onTouchEnd"
@touchstart="onTouchStart"
@touchmove="onTouchMove"
@touchend="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"
v-passive-touch="onTouchStartRight"
v-passive-move="onTouchMoveRight"
v-passive-end="onTouchEndRight"
@touchstart="onTouchStartRight"
@touchmove="onTouchMoveRight"
@touchend="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()"
v-passive-touch="startDrag"
v-passive-move="onDrag"
v-passive-end="endDrag"
@touchstart="startDrag"
@touchmove="onDrag"
@touchend="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" v-passive-touch="onTouchStart" v-passive-move="onTouchMove" v-passive-end="onTouchEnd" @touchcancel="onTouchEnd">
<view class="wd-tabs__container" @touchstart="onTouchStart" @touchmove="onTouchMove" @touchend="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" v-passive-touch="onTouchStart" v-passive-move="onTouchMove" v-passive-end="onTouchEnd" @touchcancel="onTouchEnd">
<view class="wd-tabs__container" @touchstart="onTouchStart" @touchmove="onTouchMove" @touchend="onTouchEnd" @touchcancel="onTouchEnd">
<view :class="['wd-tabs__body', animated ? 'is-animated' : '']" :style="bodyStyle">
<slot />
</view>

View File

@ -214,6 +214,27 @@ 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()
})
}
}
// 通用运算函数
/*
函数加法函数用来得到精确的加法结果
@ -223,16 +244,16 @@ export function handleSetWebviewStyle(hasTabBar) {
返回值两数相加的结果
*/
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
}
/*
@ -251,12 +272,20 @@ 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)));
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)))
}
/*
@ -267,10 +296,18 @@ export function multiplication(arg1, arg2) {
返回值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)));
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)))
}