处理审批催办页面跳转,用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

This commit is contained in:
wangyifeng 2025-08-08 14:45:27 +08:00
parent fa4c67e20b
commit 455a1716b8
6 changed files with 124 additions and 21 deletions

View File

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

View File

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

View File

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

View File

@ -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, //01
}
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 {}
})

View File

@ -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, //URLiframe
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>

View File

@ -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": "群成员",