Compare commits
13 Commits
wyfMain-de
...
main
Author | SHA1 | Date | |
---|---|---|---|
df588d379a | |||
455a1716b8 | |||
fa4c67e20b | |||
e2b41dcd8a | |||
b046388c86 | |||
227d8c7524 | |||
d76ec030e6 | |||
82e14bb969 | |||
6ae597c7f4 | |||
94ef829509 | |||
16c881acfd | |||
d3164014ee | |||
d81bfad19d |
1
components.d.ts
vendored
1
components.d.ts
vendored
@ -51,6 +51,7 @@ declare module 'vue' {
|
||||
SysGroupMemberRemovedMessage: typeof import('./src/components/talk/message/system/SysGroupMemberRemovedMessage.vue')['default']
|
||||
SysGroupMutedMessage: typeof import('./src/components/talk/message/system/SysGroupMutedMessage.vue')['default']
|
||||
SysGroupTransferMessage: typeof import('./src/components/talk/message/system/SysGroupTransferMessage.vue')['default']
|
||||
SysPushMessage: typeof import('./src/components/talk/message/system/sysPushMessage.vue')['default']
|
||||
SysTextMessage: typeof import('./src/components/talk/message/system/SysTextMessage.vue')['default']
|
||||
TabbarItem: typeof import('./src/components/x-tabbar/components/tabbar-item/index.vue')['default']
|
||||
TextMessage: typeof import('./src/components/talk/message/TextMessage.vue')['default']
|
||||
|
6
env/.env.dev
vendored
6
env/.env.dev
vendored
@ -5,8 +5,10 @@ VITE_SHOW_CONSOLE = true
|
||||
# 是否开启sourcemap
|
||||
VITE_SHOW_SOURCEMAP = true
|
||||
# baseUrl
|
||||
VITE_BASEURL = 'http://172.16.100.93:8503'
|
||||
# VITE_BASEURL = 'http://172.16.100.93:8503'
|
||||
VITE_BASEURL = 'http://192.168.88.47:9503'
|
||||
#VITE_SOCKET_API
|
||||
VITE_SOCKET_API = 'ws://172.16.100.93:8504'
|
||||
# VITE_SOCKET_API = 'ws://172.16.100.93:8504'
|
||||
VITE_SOCKET_API = 'ws://192.168.88.47:9504'
|
||||
# EPRAPI baseUrl
|
||||
VITE_EPR_BASEURL = 'http://114.218.158.24:9020'
|
||||
|
@ -5,6 +5,7 @@
|
||||
"packageManager": "pnpm@8.14.1",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"dev:h5": "uni --mode dev --port 2468",
|
||||
"test:h5": "uni --mode test --port 2468",
|
||||
"prod:h5": "uni --mode prod",
|
||||
"build:h5:test": "uni build --mode test",
|
||||
|
@ -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,
|
||||
})
|
||||
@ -249,3 +235,22 @@ export const ServeUserGroupChatList = (data) => {
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
//查询聊天助手是否开启
|
||||
export const ServeContactRobotQuery = (data) => {
|
||||
return request({
|
||||
url: '/api/v1/contact/robot/query',
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
//开关聊天助手
|
||||
export const ServeContactRobotUpdate = (data) => {
|
||||
return request({
|
||||
url: '/api/v1/contact/robot/update',
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
})
|
||||
|
@ -36,6 +36,7 @@
|
||||
<div class="mt-1">转文字</div>
|
||||
</div>
|
||||
<div
|
||||
v-if="props.isShowMultipleChoose && !props.isChatRobot"
|
||||
@click="() => itemClick('multipleChoose')"
|
||||
class="flex flex-col items-center justify-center"
|
||||
>
|
||||
@ -47,7 +48,7 @@
|
||||
<div class="mt-1">多选</div>
|
||||
</div>
|
||||
<div
|
||||
v-if="props.isShowCite"
|
||||
v-if="props.isShowCite && !props.isChatRobot"
|
||||
@click="() => itemClick('actionCite')"
|
||||
class="flex flex-col items-center justify-center"
|
||||
>
|
||||
@ -63,6 +64,7 @@
|
||||
<div class="mt-1">撤回</div>
|
||||
</div>
|
||||
<div
|
||||
:class="{ 'w-full': props.isChatRobot }"
|
||||
@click="() => itemClick('actionDelete')"
|
||||
class="flex flex-col items-center justify-center"
|
||||
>
|
||||
@ -110,14 +112,17 @@ const bubbleRef = ref(null)
|
||||
|
||||
const props = defineProps({
|
||||
isShowCopy: {
|
||||
//是否显示复制
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
isShowCite: {
|
||||
//是否显示引用
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
isShowWithdraw: {
|
||||
//是否显示撤回
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
@ -126,6 +131,16 @@ const props = defineProps({
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
isShowMultipleChoose: {
|
||||
//是否显示多选
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
isChatRobot: {
|
||||
//是否是智能助手
|
||||
type: Boolean,
|
||||
default: false,
|
||||
}
|
||||
})
|
||||
|
||||
const emits = defineEmits(['clickMenu'])
|
||||
|
@ -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
|
||||
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>
|
||||
<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);
|
||||
|
153
src/components/talk/message/system/sysPushMessage.vue
Normal file
153
src/components/talk/message/system/sysPushMessage.vue
Normal file
@ -0,0 +1,153 @@
|
||||
<script setup>
|
||||
import { handleFindWebview } from '@/utils/common'
|
||||
import noClockAfterWork from '@/static/image/chatBotMessageCard/noClockAfterWork.png'
|
||||
import noClockBeforeWork from '@/static/image/chatBotMessageCard/noClockBeforeWork.png'
|
||||
import copy from '@/static/image/chatBotMessageCard/copy.png'
|
||||
import errorClock from '@/static/image/chatBotMessageCard/errorClock.png'
|
||||
import prompt from '@/static/image/chatBotMessageCard/prompt.png'
|
||||
|
||||
const emits = defineEmits(['openPromptDrawer'])
|
||||
|
||||
const props = defineProps({
|
||||
extra: Object,
|
||||
data: Object,
|
||||
})
|
||||
|
||||
//聊天助手发送的系统消息卡片图片
|
||||
const getMessageCard = computed(() => {
|
||||
switch (props.data.msg_type) {
|
||||
case 1117: //催办提醒
|
||||
return prompt
|
||||
case 1118: //上班未打卡
|
||||
return noClockBeforeWork
|
||||
case 1119: //下班未打卡
|
||||
return noClockAfterWork
|
||||
case 1120: //待审批
|
||||
return prompt
|
||||
case 1121: //抄送
|
||||
return copy
|
||||
case 1122: //缺卡
|
||||
return errorClock
|
||||
case 1123: //迟到
|
||||
return errorClock
|
||||
case 1124: //早退
|
||||
return errorClock
|
||||
default:
|
||||
return ''
|
||||
}
|
||||
})
|
||||
|
||||
//聊天助手发送的系统消息文字颜色
|
||||
const getTextColor = computed(() => {
|
||||
const msgType = props.data.msg_type
|
||||
//审批催办、审批
|
||||
if ([1117, 1120].includes(msgType)) return '#2668BF'
|
||||
//上班未打卡、下班未打卡
|
||||
if ([1118, 1119].includes(msgType)) return '#46299D'
|
||||
//抄送
|
||||
if (msgType === 1121) return '#2099BE'
|
||||
//缺卡、迟到、早退
|
||||
if ([1122, 1123, 1124].includes(msgType)) return '#933BA3'
|
||||
return ''
|
||||
})
|
||||
|
||||
//聊天助手发送的系统消息文字内容
|
||||
const getTextContent = computed(() => {
|
||||
const msgType = props.data.msg_type
|
||||
//审批催办、审批
|
||||
if ([1117, 1120].includes(msgType)) return '立即审批'
|
||||
//上班未打卡、下班未打卡
|
||||
if ([1118, 1119].includes(msgType)) return '立即打卡'
|
||||
//抄送、缺卡、迟到、早退
|
||||
if ([1121, 1122, 1123, 1124].includes(msgType)) return '立即查看'
|
||||
return ''
|
||||
})
|
||||
|
||||
//点击向webview通信,处理智能助手系统消息
|
||||
const handleSysMessagePush = () => {
|
||||
if (props?.extra?.url) {
|
||||
//直接返回地址的,直接在当前页面弹出抽屉打开
|
||||
emits('openPromptDrawer', encodeURIComponent(props?.extra?.url))
|
||||
} else {
|
||||
handleFindWebview(
|
||||
`handleChatRobotSysMessagePush('${encodeURIComponent(
|
||||
JSON.stringify({
|
||||
url: props?.extra?.url,
|
||||
msg_type: props?.data?.msg_type,
|
||||
}),
|
||||
)}')`,
|
||||
)
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index',
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="sys-message-push" @click="handleSysMessagePush">
|
||||
<div class="sys-message-push-card">
|
||||
<span class="sys-message-push-card-title">{{ props.extra.title }}</span>
|
||||
<span
|
||||
class="sys-message-push-card-message"
|
||||
v-html="props.extra.message"
|
||||
></span>
|
||||
<img :src="getMessageCard" alt="" />
|
||||
</div>
|
||||
<div class="sys-message-push-card-btn">
|
||||
<span :style="{ color: getTextColor }">{{ getTextContent }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.sys-message-push {
|
||||
border-radius: 0 16rpx 16rpx 16rpx;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 6px 12px 2px rgba(188, 188, 188, 0.08);
|
||||
.sys-message-push-card {
|
||||
position: relative;
|
||||
width: 486rpx;
|
||||
height: 270rpx;
|
||||
.sys-message-push-card-title {
|
||||
position: absolute;
|
||||
top: 28rpx;
|
||||
left: 30rpx;
|
||||
font-size: 24rpx;
|
||||
line-height: 34rpx;
|
||||
color: rgba(255, 255, 255, 0.73);
|
||||
font-weight: 500;
|
||||
}
|
||||
.sys-message-push-card-message {
|
||||
position: absolute;
|
||||
bottom: 44rpx;
|
||||
left: 30rpx;
|
||||
font-size: 40rpx;
|
||||
line-height: 58rpx;
|
||||
color: #fff;
|
||||
font-weight: bold;
|
||||
min-width: 326rpx;
|
||||
max-width: 100%;
|
||||
}
|
||||
img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
.sys-message-push-card-btn {
|
||||
background-color: #fff;
|
||||
width: 486rpx;
|
||||
height: 78rpx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
text {
|
||||
color: #000;
|
||||
font-size: 28rpx;
|
||||
line-height: 40rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
@ -29,6 +29,14 @@ export const ChatMsgSysGroupTransfer = 1113 // 变更群主
|
||||
export const ChatMsgSysGroupAdmin = 1114 // 设置管理员
|
||||
export const ChatMsgSysGroupMemberRemoved = 1115 // 移出群成员消息(部门群、公司群自动移出)
|
||||
export const ChatMsgSysGroupInfoChange = 1116 // 管理员更新了群信息
|
||||
export const ChatMsgSysPush_PromptReminder = 1117 // 系统推送消息-催办提醒
|
||||
export const ChatMsgSysPush_NoClockReminderBeforeWork = 1118 // 系统推送消息-上班未打卡
|
||||
export const ChatMsgSysPush_NoClockReminderAfterWork = 1119 // 系统推送消息-下班未打卡
|
||||
export const ChatMsgSysPush_ApprovalReminder = 1120 // 系统推送消息-待审批提醒
|
||||
export const ChatMsgSysPush_CopyReminder = 1121 // 系统推送消息-抄送提醒
|
||||
export const ChatMsgSysPush_AbsentReminder = 1122 // 系统推送消息-缺卡提醒
|
||||
export const ChatMsgSysPush_LateReminder = 1123 // 系统推送消息-迟到提醒
|
||||
export const ChatMsgSysPush_EarlyReminder = 1124 // 系统推送消息-早退提醒
|
||||
|
||||
export const ChatMsgTypeMapping = {
|
||||
[ChatMsgTypeText]: '[文本消息]',
|
||||
@ -60,7 +68,15 @@ export const ChatMsgTypeMapping = {
|
||||
[ChatMsgSysGroupTransfer]: '[转让群主]',
|
||||
[ChatMsgSysGroupAdmin]: '[设置管理员]',
|
||||
[ChatMsgSysGroupMemberRemoved]: '[移出群成员消息]',
|
||||
[ChatMsgSysGroupInfoChange]: '[群信息更新]'
|
||||
[ChatMsgSysGroupInfoChange]: '[群信息更新]',
|
||||
[ChatMsgSysPush_PromptReminder]: '[催办提醒]',
|
||||
[ChatMsgSysPush_NoClockReminderBeforeWork]: '[未打卡提醒]',
|
||||
[ChatMsgSysPush_NoClockReminderAfterWork]: '[未打卡提醒]',
|
||||
[ChatMsgSysPush_ApprovalReminder]: '[审批提醒]',
|
||||
[ChatMsgSysPush_CopyReminder]: '[抄送提醒]',
|
||||
[ChatMsgSysPush_AbsentReminder]: '[异常卡提醒]',
|
||||
[ChatMsgSysPush_LateReminder]: '[异常卡提醒]',
|
||||
[ChatMsgSysPush_EarlyReminder]: '[异常卡提醒]'
|
||||
}
|
||||
|
||||
// 消息类型 - 消息组件 映射关系
|
||||
@ -93,7 +109,16 @@ export const MessageComponents = {
|
||||
[ChatMsgSysGroupTransfer]: 'sys-group-transfer-message',
|
||||
[ChatMsgSysGroupAdmin]:'sys-group-admin-message',
|
||||
[ChatMsgSysGroupMemberRemoved]:'sys-group-member-removed-message',
|
||||
[ChatMsgSysGroupInfoChange]:'sys-group-info-change-message'
|
||||
[ChatMsgSysGroupInfoChange]:'sys-group-info-change-message',
|
||||
// 智能助手推送的系统消息采用相同的模版
|
||||
[ChatMsgSysPush_PromptReminder]:'sys-push-message',
|
||||
[ChatMsgSysPush_NoClockReminderBeforeWork]:'sys-push-message',
|
||||
[ChatMsgSysPush_NoClockReminderAfterWork]:'sys-push-message',
|
||||
[ChatMsgSysPush_ApprovalReminder]:'sys-push-message',
|
||||
[ChatMsgSysPush_CopyReminder]:'sys-push-message',
|
||||
[ChatMsgSysPush_AbsentReminder]:'sys-push-message',
|
||||
[ChatMsgSysPush_LateReminder]:'sys-push-message',
|
||||
[ChatMsgSysPush_EarlyReminder]:'sys-push-message'
|
||||
}
|
||||
|
||||
// 可转发的消息类型
|
||||
|
@ -15,6 +15,7 @@ import {
|
||||
useDialogueListStore,
|
||||
useGroupStore,
|
||||
} from '@/store'
|
||||
import { handleFindWebview } from '@/utils/common'
|
||||
|
||||
/**
|
||||
* 好友状态事件
|
||||
@ -93,7 +94,11 @@ class Talk extends Base {
|
||||
*/
|
||||
getTalkText() {
|
||||
let text = ''
|
||||
if (this.resource.msg_type != message.ChatMsgTypeText) {
|
||||
if (
|
||||
this.resource.msg_type != message.ChatMsgTypeText &&
|
||||
//智能助手发送的系统消息,也直接显示内容
|
||||
this.resource.user_id !== 2
|
||||
) {
|
||||
text = message.ChatMsgTypeMapping[this.resource.msg_type]
|
||||
} else {
|
||||
text = this.resource.extra.content.replace(/<img .*?>/g, '')
|
||||
@ -154,23 +159,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()`)
|
||||
}
|
||||
|
||||
/**
|
||||
|
52
src/main.js
52
src/main.js
@ -16,8 +16,14 @@ import { vLoading } from '@/components/x-loading/index.js'
|
||||
import messagePopup from '@/components/x-message/useMessagePopup'
|
||||
import pageAnimation from '@/components/page-animation/index.vue'
|
||||
import * as plugins from './plugins'
|
||||
import { useDialogueStore, useTalkStore, useUserStore, useDialogueListStore } from '@/store'
|
||||
import {uniStorage} from "@/utils/uniStorage.js"
|
||||
import {
|
||||
useDialogueStore,
|
||||
useTalkStore,
|
||||
useUserStore,
|
||||
useDialogueListStore,
|
||||
} from '@/store'
|
||||
import { uniStorage } from '@/utils/uniStorage.js'
|
||||
import { handleFindWebview } from '@/utils/common'
|
||||
|
||||
const { showMessage } = messagePopup()
|
||||
dayjs.locale('zh-cn')
|
||||
@ -67,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}')`)
|
||||
}
|
||||
|
||||
//处理聊天推送弹窗点开
|
||||
@ -93,15 +94,15 @@ 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、墨册强制刷新时,聊天同步强制刷新
|
||||
window.doLocationRefresh = () => {
|
||||
@ -114,25 +115,32 @@ export function createApp() {
|
||||
|
||||
//检查聊天页面是否可用
|
||||
window.checkChatWebviewAvailable = () => {
|
||||
let OAWebView = plus.webview.all()
|
||||
OAWebView.forEach((webview, index) => {
|
||||
if (webview.id === 'webviewId1') {
|
||||
webview.evalJS(`doneCheckChatWebviewAvailable()`)
|
||||
}
|
||||
})
|
||||
handleFindWebview(`doneCheckChatWebviewAvailable()`)
|
||||
}
|
||||
|
||||
//获取从base传来的多选视频列表
|
||||
window.getBaseMulVideo = (videoList) => {
|
||||
const videos = JSON.parse(decodeURIComponent(videoList))
|
||||
console.error('=====videos', videos)
|
||||
if(videos.length > 0){
|
||||
if (videos.length > 0) {
|
||||
const videoUri = videos[0]
|
||||
console.error('=====videoUri', videoUri)
|
||||
}
|
||||
}
|
||||
|
||||
//检查是否是特殊测试用户,开启控制台
|
||||
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') {
|
||||
|
@ -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(() => {
|
||||
|
@ -28,8 +28,8 @@
|
||||
barIcon=""
|
||||
color="#46299D"
|
||||
unCheckedColor="#EEEEEE"
|
||||
:modelValue="modelValue"
|
||||
:defaultValue="modelValue"
|
||||
:modelValue="props?.item?.label === t('chat.settings.openReminder') ? openReminderStatus : modelValue"
|
||||
:defaultValue="props?.item?.label === t('chat.settings.openReminder') ? openReminderStatus : modelValue"
|
||||
@change="changeSwitch($event, props?.item)"
|
||||
></tm-switch>
|
||||
</div>
|
||||
@ -46,8 +46,8 @@
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { defineProps, defineEmits, computed } from 'vue'
|
||||
|
||||
import { defineProps, defineEmits, computed, ref, onMounted, watch } from 'vue'
|
||||
import { ServeContactRobotQuery } from '@/api/chat'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
const { t } = useI18n()
|
||||
|
||||
@ -103,6 +103,32 @@ const modelValue = computed(() => {
|
||||
return switchStatus
|
||||
})
|
||||
|
||||
// 仅用于“拒收消息”场景的本地状态
|
||||
const openReminderStatus = ref(false)
|
||||
const loadRefuseStatus = async () => {
|
||||
try {
|
||||
const res = await ServeContactRobotQuery()
|
||||
openReminderStatus.value = !!(res?.data?.Result)
|
||||
} catch (err) {
|
||||
openReminderStatus.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
if (props?.item?.label === t('chat.settings.openReminder')) {
|
||||
loadRefuseStatus()
|
||||
}
|
||||
})
|
||||
|
||||
watch(
|
||||
() => props?.item?.label,
|
||||
(newLabel) => {
|
||||
if (newLabel === t('chat.settings.openReminder')) {
|
||||
loadRefuseStatus()
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
//切换开关选择
|
||||
const changeSwitch = (e, item) => {
|
||||
emits('changeSwitch', e, item.label)
|
||||
|
@ -58,7 +58,7 @@
|
||||
:isManager="groupParams?.groupInfo?.is_manager"></settingFormItem>
|
||||
</div>
|
||||
</div>
|
||||
<div class="chat-records-search chat-settings-card">
|
||||
<div class="chat-records-search chat-settings-card" v-if="dialogueParams.type !== 1 || (dialogueParams.type === 1 && dialogueParams?.receiver_id !== 2)">
|
||||
<div @click="toSearchPage">
|
||||
<customInput :disabled="true"></customInput>
|
||||
</div>
|
||||
@ -81,7 +81,7 @@
|
||||
<settingFormItem :item="item" @toManagePage="toManagePage"></settingFormItem>
|
||||
</div>
|
||||
</div>
|
||||
<div class="chat-group-infos chat-settings-card">
|
||||
<div class="chat-group-infos chat-settings-card" v-if="dialogueParams.type !== 1 || (dialogueParams.type === 1 && dialogueParams?.receiver_id !== 2)">
|
||||
<div class="chat-group-infos-each" v-for="(item, index) in state.chatReport" :key="index">
|
||||
<settingFormItem :item="item" @toManagePage="toManagePage"></settingFormItem>
|
||||
</div>
|
||||
@ -151,7 +151,8 @@
|
||||
} from '@/api/group/index'
|
||||
import {
|
||||
ServeTopTalkList,
|
||||
ServeSetNotDisturb
|
||||
ServeSetNotDisturb,
|
||||
ServeContactRobotUpdate
|
||||
} from '@/api/chat/index'
|
||||
import {
|
||||
useI18n
|
||||
@ -283,6 +284,15 @@
|
||||
customInfo: 'switch',
|
||||
},
|
||||
]
|
||||
if(dialogueParams.type === 1 && dialogueParams?.receiver_id === 2){
|
||||
state.chatSettings.push({
|
||||
label: t('chat.settings.openReminder'),
|
||||
hasPointer: false,
|
||||
value: '',
|
||||
subValue: '',
|
||||
customInfo: 'switch',
|
||||
})
|
||||
}
|
||||
state.chatReport = [{
|
||||
label: t('chat.settings.report'),
|
||||
hasPointer: true,
|
||||
@ -483,6 +493,11 @@
|
||||
is_disturb: switchStatus ? 1 : 0, //是否开启免打扰,0不免打扰,1免打扰
|
||||
}
|
||||
resp = ServeSetNotDisturb(params)
|
||||
} else if (label == t('chat.settings.openReminder')) {
|
||||
params = {
|
||||
status: switchStatus,
|
||||
}
|
||||
resp = ServeContactRobotUpdate(params)
|
||||
}
|
||||
console.log(resp)
|
||||
resp.then(({
|
||||
@ -501,6 +516,8 @@
|
||||
index_name: dialogueParams.index_name,
|
||||
is_disturb: switchStatus ? 1 : 0,
|
||||
})
|
||||
} else if (label == t('chat.settings.openReminder')) {
|
||||
console.log("开关聊天助手")
|
||||
}
|
||||
} else {}
|
||||
})
|
||||
|
@ -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) => {
|
||||
|
@ -219,7 +219,7 @@ watch(
|
||||
onMounted(() => {
|
||||
talkStore.loadTalkList()
|
||||
console.log(talkStore.talkItems)
|
||||
items.value = lodash.cloneDeep(talkStore.talkItems).filter(item=>item.is_dismiss === 0 && item.is_quit === 0)
|
||||
items.value = lodash.cloneDeep(talkStore.talkItems).filter(item=>item.is_dismiss === 0 && item.is_quit === 0 && ((item.talk_type === 1 && item.receiver_id !== 2) || item.talk_type !== 1))
|
||||
})
|
||||
onUnmounted(() => {
|
||||
dialogueStore.setForwardType('')
|
||||
|
@ -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'],
|
||||
|
@ -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
|
||||
// }
|
||||
// })
|
||||
}
|
||||
|
||||
//主动加好友(单向好友)
|
||||
|
@ -84,7 +84,11 @@
|
||||
"
|
||||
>
|
||||
<!-- 系统消息 -->
|
||||
<div v-if="item.msg_type >= 1000" class="message-box">
|
||||
<!-- item.user_id = 2 是智能助手发送的系统消息,风格属于普通消息 -->
|
||||
<div
|
||||
v-if="item.msg_type >= 1000 && item.user_id !== 2"
|
||||
class="message-box"
|
||||
>
|
||||
<component
|
||||
:is="MessageComponents[item.msg_type] || 'unknown-message'"
|
||||
:extra="item.extra"
|
||||
@ -147,7 +151,7 @@
|
||||
class="avatar-column"
|
||||
@click="toUserDetailPage(item)"
|
||||
@touchstart="() => handleAvatarTouchStart(item)"
|
||||
@touchend="handleAvatarTouchEnd"
|
||||
@touchend="handleAvatarTouchEnd(item)"
|
||||
>
|
||||
<!-- <im-avatar
|
||||
class="pointer"
|
||||
@ -183,6 +187,14 @@
|
||||
<!-- <span class="at">@</span> -->
|
||||
{{ item.nickname }}
|
||||
</span>
|
||||
<!-- 智能助手发送的消息特殊处理 -->
|
||||
<span
|
||||
class="nickname pointer"
|
||||
v-show="talkParams.type == 1 && item.user_id === 2"
|
||||
>
|
||||
<!-- <span class="at">@</span> -->
|
||||
{{ '智能助手' || item?.extra?.title }}
|
||||
</span>
|
||||
<span>
|
||||
{{ parseTime(item.created_at, '{m}/{d} {h}:{i}') }}
|
||||
</span>
|
||||
@ -197,6 +209,7 @@
|
||||
:isShowCopy="isShowCopy(item)"
|
||||
:isShowWithdraw="isRevoke(talkParams.uid, item) || isLeader"
|
||||
:isShowConvertText="isShowConvertText(item)"
|
||||
:isChatRobot="item.user_id === 2"
|
||||
>
|
||||
<component
|
||||
class="component-content"
|
||||
@ -206,6 +219,7 @@
|
||||
:data="item"
|
||||
:max-width="true"
|
||||
:source="'panel'"
|
||||
@openPromptDrawer="openPromptDrawer"
|
||||
/>
|
||||
</deepBubble>
|
||||
<!-- <div class="talk-tools">
|
||||
@ -229,10 +243,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>
|
||||
|
||||
@ -285,7 +308,11 @@
|
||||
</div>
|
||||
</div>
|
||||
<template #bottom>
|
||||
<div class="footBox" id="footBoxArea">
|
||||
<div
|
||||
class="footBox"
|
||||
id="footBoxArea"
|
||||
v-if="talkParams.receiver_id !== 2"
|
||||
>
|
||||
<span
|
||||
class="flex items-center justify-center text-[24rpx] text-[#999999]"
|
||||
style="background-color: #e5e5e5; padding: 12rpx 24rpx;"
|
||||
@ -501,6 +528,9 @@
|
||||
</div>
|
||||
</tm-drawer>
|
||||
</div>
|
||||
<div id="footBoxArea" v-else>
|
||||
<div class="h-[68rpx] w-full bg-[#fff]"></div>
|
||||
</div>
|
||||
</template>
|
||||
</ZPaging>
|
||||
<tm-drawer
|
||||
@ -703,6 +733,24 @@
|
||||
</div>
|
||||
</template>
|
||||
</tm-alert>
|
||||
|
||||
<tm-drawer
|
||||
ref="calendarView"
|
||||
placement="bottom"
|
||||
v-model:show="state.isOpenChatBotIframe"
|
||||
width="100%"
|
||||
:height="state.iframeHeight"
|
||||
:hideHeader="true"
|
||||
:inContent="true"
|
||||
:teleport="false"
|
||||
>
|
||||
<iframe
|
||||
:src="state.chatBotIframeUrl"
|
||||
frameborder="0"
|
||||
class="chatBotIframeDrawer"
|
||||
scrolling="no"
|
||||
></iframe>
|
||||
</tm-drawer>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
@ -893,6 +941,9 @@ const state = ref({
|
||||
},
|
||||
],
|
||||
isProd: import.meta.env.PROD,
|
||||
chatBotIframeUrl: '', //聊天助手推送的系统消息携带的URL
|
||||
isOpenChatBotIframe: false, //聊天助手推送的系统消息携带的URL是否打开iframe抽屉
|
||||
iframeHeight: 0, //聊天助手推送的系统消息携带的URL iframe抽屉高度
|
||||
})
|
||||
|
||||
// 创建一个响应式的 Map 来维护已读数量
|
||||
@ -1901,6 +1952,10 @@ const toChatSettingsPage = () => {
|
||||
|
||||
//点击跳转到用户详情页面
|
||||
const toUserDetailPage = (userItem) => {
|
||||
//智能助手不可以查看详细信息
|
||||
if (userItem?.user_id === 2) {
|
||||
return
|
||||
}
|
||||
uni.navigateTo({
|
||||
url:
|
||||
'/pages/dialog/dialogDetail/userDetail?erpUserId=' + userItem.erp_user_id,
|
||||
@ -2064,8 +2119,9 @@ const queryRecordsByMsgInfo = async (msgInfo) => {
|
||||
})
|
||||
.exec()
|
||||
const footBoxAreaQuery = uni.createSelectorQuery()
|
||||
footBoxAreaQuery
|
||||
.select('#footBoxArea')
|
||||
const footBoxArea = footBoxAreaQuery.select('#footBoxArea')
|
||||
if (footBoxArea) {
|
||||
footBoxArea
|
||||
.boundingClientRect((res) => {
|
||||
if (res) {
|
||||
// console.log('元素高度:', res.height)
|
||||
@ -2073,6 +2129,7 @@ const queryRecordsByMsgInfo = async (msgInfo) => {
|
||||
}
|
||||
})
|
||||
.exec()
|
||||
}
|
||||
setTimeout(() => {
|
||||
zpagingRef.value.scrollIntoViewById(
|
||||
'zp-id-' + msgInfo.msg_id,
|
||||
@ -2183,6 +2240,10 @@ let avatarPressTimer = null
|
||||
let currentPressItem = null
|
||||
|
||||
const handleAvatarTouchStart = (item) => {
|
||||
//智能助手不可以长按@
|
||||
if (item?.user_id === 2) {
|
||||
return
|
||||
}
|
||||
currentPressItem = item
|
||||
avatarPressTimer = setTimeout(() => {
|
||||
if (!state.value.canUseQuillEditor) {
|
||||
@ -2193,7 +2254,11 @@ const handleAvatarTouchStart = (item) => {
|
||||
}, 500)
|
||||
}
|
||||
|
||||
const handleAvatarTouchEnd = () => {
|
||||
const handleAvatarTouchEnd = (item) => {
|
||||
//智能助手不可以长按@
|
||||
if (item?.user_id === 2) {
|
||||
return
|
||||
}
|
||||
if (avatarPressTimer) {
|
||||
clearTimeout(avatarPressTimer)
|
||||
avatarPressTimer = null
|
||||
@ -2710,6 +2775,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 +2807,9 @@ const endRecord = (file, url, duration) => {
|
||||
resp.catch(() => {})
|
||||
}
|
||||
|
||||
//取消录音
|
||||
const cancelRecord = () => {}
|
||||
|
||||
//发送语音消息
|
||||
const sendMediaMessage = (mediaUrl, duration, size) => {
|
||||
// console.log(mediaUrl, 'mediaUrl')
|
||||
@ -2764,18 +2838,24 @@ 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 }) => {
|
||||
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
|
||||
})
|
||||
}
|
||||
//语音输入框高度
|
||||
const chatInputHeight = computed(() => {
|
||||
@ -2785,16 +2865,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 +2898,24 @@ const copyVoiceContent = (voiceContent) => {
|
||||
if (!voiceContent) {
|
||||
return
|
||||
}
|
||||
clipboard(voiceContent, () => {
|
||||
uni.setClipboardData({
|
||||
data: voiceContent,
|
||||
showToast: false,
|
||||
success: () => {
|
||||
message.success('复制成功')
|
||||
},
|
||||
})
|
||||
// clipboard(voiceContent, () => {
|
||||
// message.success('复制成功')
|
||||
// })
|
||||
}
|
||||
|
||||
//处理聊天助手推送的携带URL的系统消息点击
|
||||
const openPromptDrawer = (url) => {
|
||||
const iframeUrl = decodeURIComponent(url)
|
||||
state.value.iframeHeight = pxTorPx(uni.getSystemInfoSync().windowHeight - 80) || 1300
|
||||
state.value.chatBotIframeUrl = iframeUrl
|
||||
state.value.isOpenChatBotIframe = true
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="less">
|
||||
@ -3299,3 +3395,9 @@ const copyVoiceContent = (voiceContent) => {
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<style>
|
||||
.chatBotIframeDrawer {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
|
@ -86,7 +86,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="divider"></div>
|
||||
<div
|
||||
<!-- <div
|
||||
@click="toAddFriendPage"
|
||||
class="flex items-center pl-[22rpx] py-[32rpx]"
|
||||
>
|
||||
@ -103,7 +103,7 @@
|
||||
添加好友
|
||||
</div>
|
||||
</div>
|
||||
<div class="divider"></div>
|
||||
<div class="divider"></div> -->
|
||||
<div
|
||||
@click="toAddressBookPage"
|
||||
class="flex items-center pl-[22rpx] py-[32rpx]"
|
||||
@ -245,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(
|
||||
|
BIN
src/static/image/chatBotMessageCard/copy.png
Normal file
BIN
src/static/image/chatBotMessageCard/copy.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
BIN
src/static/image/chatBotMessageCard/errorClock.png
Normal file
BIN
src/static/image/chatBotMessageCard/errorClock.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
BIN
src/static/image/chatBotMessageCard/noClockAfterWork.png
Normal file
BIN
src/static/image/chatBotMessageCard/noClockAfterWork.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.0 KiB |
BIN
src/static/image/chatBotMessageCard/noClockBeforeWork.png
Normal file
BIN
src/static/image/chatBotMessageCard/noClockBeforeWork.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
BIN
src/static/image/chatBotMessageCard/prompt.png
Normal file
BIN
src/static/image/chatBotMessageCard/prompt.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.0 KiB |
@ -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()
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
2
src/uni_modules/a-trumpet/changelog.md
Normal file
2
src/uni_modules/a-trumpet/changelog.md
Normal file
@ -0,0 +1,2 @@
|
||||
## 1.0.0(2023-09-05)
|
||||
实现基础功能
|
130
src/uni_modules/a-trumpet/components/a-trumpet/a-trumpet.vue
Normal file
130
src/uni_modules/a-trumpet/components/a-trumpet/a-trumpet.vue
Normal 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>
|
83
src/uni_modules/a-trumpet/package.json
Normal file
83
src/uni_modules/a-trumpet/package.json
Normal 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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
18
src/uni_modules/a-trumpet/readme.md
Normal file
18
src/uni_modules/a-trumpet/readme.md
Normal 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| 方向,上下左右 |
|
@ -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',
|
||||
/**
|
||||
@ -313,7 +313,7 @@ export default {
|
||||
let that = this
|
||||
|
||||
// 请求权限
|
||||
that.checkPermission(true)
|
||||
that.checkPermission()
|
||||
|
||||
// #ifdef APP-PLUS
|
||||
recorderManager.onStop((res) => {
|
||||
@ -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
|
||||
}
|
||||
},
|
||||
})
|
||||
@ -391,7 +393,7 @@ export default {
|
||||
that.permissionInfo = permissionInfo
|
||||
}
|
||||
},
|
||||
continueAppMicro(isFirstRequestPer = false) {
|
||||
continueAppMicro() {
|
||||
let that = this
|
||||
RecordApp.UniWebViewActivate(that) //App环境下必须先切换成当前页面WebView
|
||||
RecordApp.RequestPermission(
|
||||
@ -399,9 +401,11 @@ export default {
|
||||
console.log('已获得录音权限,可以开始录音了')
|
||||
that.permisionState = true
|
||||
that.isCheckingPermission = false
|
||||
if (isFirstRequestPer) {
|
||||
setTimeout(() => {
|
||||
if (!that.recordPopupShow) {
|
||||
that.stopRecord()
|
||||
}
|
||||
}, 2000)
|
||||
},
|
||||
(msg, isUserNotAllow) => {
|
||||
that.isCheckingPermission = false
|
||||
@ -413,7 +417,7 @@ export default {
|
||||
},
|
||||
)
|
||||
},
|
||||
async checkPermission(isFirstRequestPer = false) {
|
||||
async checkPermission() {
|
||||
let that = this
|
||||
// #ifdef APP-PLUS
|
||||
// 先判断os
|
||||
@ -451,14 +455,9 @@ 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)
|
||||
that.continueAppMicro()
|
||||
}
|
||||
// #endif
|
||||
// #endif
|
||||
|
@ -90,6 +90,7 @@
|
||||
"chat.settings.groupType": "群类型",
|
||||
"chat.settings.topSession": "置顶会话",
|
||||
"chat.settings.messageNoDisturb": "消息免打扰",
|
||||
"chat.settings.openReminder": "开启提醒",
|
||||
"chat.settings.groupGag": "群内禁言",
|
||||
"chat.settings.groupAdmin": "群管理员",
|
||||
"chat.settings.groupMember": "群成员",
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
/*
|
||||
@ -253,10 +274,18 @@ 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)))
|
||||
}
|
||||
|
||||
/*
|
||||
@ -269,8 +298,16 @@ 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)))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user