新增智能助手推送的系统消息类型对接,并处理对应类型消息的卡片展示和交互细节
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
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
This commit is contained in:
parent
227d8c7524
commit
b046388c86
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",
|
||||
|
@ -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'])
|
||||
|
133
src/components/talk/message/system/sysPushMessage.vue
Normal file
133
src/components/talk/message/system/sysPushMessage.vue
Normal file
@ -0,0 +1,133 @@
|
||||
<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 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 = () => {
|
||||
handleFindWebview(`handleSysMessagePush('${encodeURIComponent(props?.extra?.url)}')`)
|
||||
}
|
||||
</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;
|
||||
max-width: 326rpx;
|
||||
}
|
||||
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'
|
||||
}
|
||||
|
||||
// 可转发的消息类型
|
||||
|
@ -94,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, '')
|
||||
|
@ -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>
|
||||
|
@ -84,7 +84,14 @@
|
||||
"
|
||||
>
|
||||
<!-- 系统消息 -->
|
||||
<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 +154,7 @@
|
||||
class="avatar-column"
|
||||
@click="toUserDetailPage(item)"
|
||||
@touchstart="() => handleAvatarTouchStart(item)"
|
||||
@touchend="handleAvatarTouchEnd"
|
||||
@touchend="handleAvatarTouchEnd(item)"
|
||||
>
|
||||
<!-- <im-avatar
|
||||
class="pointer"
|
||||
@ -183,6 +190,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 +212,7 @@
|
||||
:isShowCopy="isShowCopy(item)"
|
||||
:isShowWithdraw="isRevoke(talkParams.uid, item) || isLeader"
|
||||
:isShowConvertText="isShowConvertText(item)"
|
||||
:isChatRobot="item.user_id === 2"
|
||||
>
|
||||
<component
|
||||
class="component-content"
|
||||
@ -294,7 +310,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;"
|
||||
@ -510,6 +530,9 @@
|
||||
</div>
|
||||
</tm-drawer>
|
||||
</div>
|
||||
<div id="footBoxArea" v-else>
|
||||
<div class="h-[68rpx] w-full bg-[#fff]"></div>
|
||||
</div>
|
||||
</template>
|
||||
</ZPaging>
|
||||
<tm-drawer
|
||||
@ -1910,6 +1933,10 @@ const toChatSettingsPage = () => {
|
||||
|
||||
//点击跳转到用户详情页面
|
||||
const toUserDetailPage = (userItem) => {
|
||||
//智能助手不可以查看详细信息
|
||||
if (userItem?.user_id === 2) {
|
||||
return
|
||||
}
|
||||
uni.navigateTo({
|
||||
url:
|
||||
'/pages/dialog/dialogDetail/userDetail?erpUserId=' + userItem.erp_user_id,
|
||||
@ -2073,8 +2100,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)
|
||||
@ -2082,6 +2110,7 @@ const queryRecordsByMsgInfo = async (msgInfo) => {
|
||||
}
|
||||
})
|
||||
.exec()
|
||||
}
|
||||
setTimeout(() => {
|
||||
zpagingRef.value.scrollIntoViewById(
|
||||
'zp-id-' + msgInfo.msg_id,
|
||||
@ -2192,6 +2221,10 @@ let avatarPressTimer = null
|
||||
let currentPressItem = null
|
||||
|
||||
const handleAvatarTouchStart = (item) => {
|
||||
//智能助手不可以长按@
|
||||
if (item?.user_id === 2) {
|
||||
return
|
||||
}
|
||||
currentPressItem = item
|
||||
avatarPressTimer = setTimeout(() => {
|
||||
if (!state.value.canUseQuillEditor) {
|
||||
@ -2202,7 +2235,11 @@ const handleAvatarTouchStart = (item) => {
|
||||
}, 500)
|
||||
}
|
||||
|
||||
const handleAvatarTouchEnd = () => {
|
||||
const handleAvatarTouchEnd = (item) => {
|
||||
//智能助手不可以长按@
|
||||
if (item?.user_id === 2) {
|
||||
return
|
||||
}
|
||||
if (avatarPressTimer) {
|
||||
clearTimeout(avatarPressTimer)
|
||||
avatarPressTimer = null
|
||||
@ -2788,14 +2825,16 @@ const convertText = (msgItem) => {
|
||||
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(() => {
|
||||
})
|
||||
.catch(() => {
|
||||
msgItem.isVoiceToTexting = false
|
||||
})
|
||||
}
|
||||
|
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 |
Loading…
Reference in New Issue
Block a user