处理审批催办页面跳转,用iframe结合drawer实现;新增聊天助手开启提醒和关闭功能
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
fa4c67e20b
commit
455a1716b8
@ -234,4 +234,23 @@ export const ServeUserGroupChatList = (data) => {
|
||||
method: 'POST',
|
||||
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,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,8 @@ 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,
|
||||
@ -63,17 +65,22 @@ const getTextContent = computed(() => {
|
||||
|
||||
//点击向webview通信,处理智能助手系统消息
|
||||
const handleSysMessagePush = () => {
|
||||
handleFindWebview(
|
||||
`handleChatRobotSysMessagePush('${encodeURIComponent(
|
||||
JSON.stringify({
|
||||
url: props?.extra?.url,
|
||||
msg_type: props?.data?.msg_type,
|
||||
}),
|
||||
)}')`,
|
||||
)
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index',
|
||||
})
|
||||
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>
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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 {}
|
||||
})
|
||||
|
@ -86,10 +86,7 @@
|
||||
<!-- 系统消息 -->
|
||||
<!-- item.user_id = 2 是智能助手发送的系统消息,风格属于普通消息 -->
|
||||
<div
|
||||
v-if="
|
||||
item.msg_type >= 1000 &&
|
||||
item.user_id !== 2
|
||||
"
|
||||
v-if="item.msg_type >= 1000 && item.user_id !== 2"
|
||||
class="message-box"
|
||||
>
|
||||
<component
|
||||
@ -222,6 +219,7 @@
|
||||
:data="item"
|
||||
:max-width="true"
|
||||
:source="'panel'"
|
||||
@openPromptDrawer="openPromptDrawer"
|
||||
/>
|
||||
</deepBubble>
|
||||
<!-- <div class="talk-tools">
|
||||
@ -735,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>
|
||||
@ -925,6 +941,9 @@ const state = ref({
|
||||
},
|
||||
],
|
||||
isProd: import.meta.env.PROD,
|
||||
chatBotIframeUrl: '', //聊天助手推送的系统消息携带的URL
|
||||
isOpenChatBotIframe: false, //聊天助手推送的系统消息携带的URL是否打开iframe抽屉
|
||||
iframeHeight: 0, //聊天助手推送的系统消息携带的URL iframe抽屉高度
|
||||
})
|
||||
|
||||
// 创建一个响应式的 Map 来维护已读数量
|
||||
@ -2890,6 +2909,14 @@ const copyVoiceContent = (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">
|
||||
.dialog-page {
|
||||
@ -3368,3 +3395,9 @@ const copyVoiceContent = (voiceContent) => {
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<style>
|
||||
.chatBotIframeDrawer {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
|
@ -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": "群成员",
|
||||
|
Loading…
Reference in New Issue
Block a user