处理审批催办页面跳转,用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
@ -235,3 +235,22 @@ export const ServeUserGroupChatList = (data) => {
|
|||||||
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,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@ import copy from '@/static/image/chatBotMessageCard/copy.png'
|
|||||||
import errorClock from '@/static/image/chatBotMessageCard/errorClock.png'
|
import errorClock from '@/static/image/chatBotMessageCard/errorClock.png'
|
||||||
import prompt from '@/static/image/chatBotMessageCard/prompt.png'
|
import prompt from '@/static/image/chatBotMessageCard/prompt.png'
|
||||||
|
|
||||||
|
const emits = defineEmits(['openPromptDrawer'])
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
extra: Object,
|
extra: Object,
|
||||||
data: Object,
|
data: Object,
|
||||||
@ -63,6 +65,10 @@ const getTextContent = computed(() => {
|
|||||||
|
|
||||||
//点击向webview通信,处理智能助手系统消息
|
//点击向webview通信,处理智能助手系统消息
|
||||||
const handleSysMessagePush = () => {
|
const handleSysMessagePush = () => {
|
||||||
|
if (props?.extra?.url) {
|
||||||
|
//直接返回地址的,直接在当前页面弹出抽屉打开
|
||||||
|
emits('openPromptDrawer', encodeURIComponent(props?.extra?.url))
|
||||||
|
} else {
|
||||||
handleFindWebview(
|
handleFindWebview(
|
||||||
`handleChatRobotSysMessagePush('${encodeURIComponent(
|
`handleChatRobotSysMessagePush('${encodeURIComponent(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
@ -74,6 +80,7 @@ const handleSysMessagePush = () => {
|
|||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url: '/pages/index/index',
|
url: '/pages/index/index',
|
||||||
})
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -28,8 +28,8 @@
|
|||||||
barIcon=""
|
barIcon=""
|
||||||
color="#46299D"
|
color="#46299D"
|
||||||
unCheckedColor="#EEEEEE"
|
unCheckedColor="#EEEEEE"
|
||||||
:modelValue="modelValue"
|
:modelValue="props?.item?.label === t('chat.settings.openReminder') ? openReminderStatus : modelValue"
|
||||||
:defaultValue="modelValue"
|
:defaultValue="props?.item?.label === t('chat.settings.openReminder') ? openReminderStatus : modelValue"
|
||||||
@change="changeSwitch($event, props?.item)"
|
@change="changeSwitch($event, props?.item)"
|
||||||
></tm-switch>
|
></tm-switch>
|
||||||
</div>
|
</div>
|
||||||
@ -46,8 +46,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<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'
|
import { useI18n } from 'vue-i18n'
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
|
|
||||||
@ -103,6 +103,32 @@ const modelValue = computed(() => {
|
|||||||
return switchStatus
|
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) => {
|
const changeSwitch = (e, item) => {
|
||||||
emits('changeSwitch', e, item.label)
|
emits('changeSwitch', e, item.label)
|
||||||
|
@ -151,7 +151,8 @@
|
|||||||
} from '@/api/group/index'
|
} from '@/api/group/index'
|
||||||
import {
|
import {
|
||||||
ServeTopTalkList,
|
ServeTopTalkList,
|
||||||
ServeSetNotDisturb
|
ServeSetNotDisturb,
|
||||||
|
ServeContactRobotUpdate
|
||||||
} from '@/api/chat/index'
|
} from '@/api/chat/index'
|
||||||
import {
|
import {
|
||||||
useI18n
|
useI18n
|
||||||
@ -283,6 +284,15 @@
|
|||||||
customInfo: 'switch',
|
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 = [{
|
state.chatReport = [{
|
||||||
label: t('chat.settings.report'),
|
label: t('chat.settings.report'),
|
||||||
hasPointer: true,
|
hasPointer: true,
|
||||||
@ -483,6 +493,11 @@
|
|||||||
is_disturb: switchStatus ? 1 : 0, //是否开启免打扰,0不免打扰,1免打扰
|
is_disturb: switchStatus ? 1 : 0, //是否开启免打扰,0不免打扰,1免打扰
|
||||||
}
|
}
|
||||||
resp = ServeSetNotDisturb(params)
|
resp = ServeSetNotDisturb(params)
|
||||||
|
} else if (label == t('chat.settings.openReminder')) {
|
||||||
|
params = {
|
||||||
|
status: switchStatus,
|
||||||
|
}
|
||||||
|
resp = ServeContactRobotUpdate(params)
|
||||||
}
|
}
|
||||||
console.log(resp)
|
console.log(resp)
|
||||||
resp.then(({
|
resp.then(({
|
||||||
@ -501,6 +516,8 @@
|
|||||||
index_name: dialogueParams.index_name,
|
index_name: dialogueParams.index_name,
|
||||||
is_disturb: switchStatus ? 1 : 0,
|
is_disturb: switchStatus ? 1 : 0,
|
||||||
})
|
})
|
||||||
|
} else if (label == t('chat.settings.openReminder')) {
|
||||||
|
console.log("开关聊天助手")
|
||||||
}
|
}
|
||||||
} else {}
|
} else {}
|
||||||
})
|
})
|
||||||
|
@ -86,10 +86,7 @@
|
|||||||
<!-- 系统消息 -->
|
<!-- 系统消息 -->
|
||||||
<!-- item.user_id = 2 是智能助手发送的系统消息,风格属于普通消息 -->
|
<!-- item.user_id = 2 是智能助手发送的系统消息,风格属于普通消息 -->
|
||||||
<div
|
<div
|
||||||
v-if="
|
v-if="item.msg_type >= 1000 && item.user_id !== 2"
|
||||||
item.msg_type >= 1000 &&
|
|
||||||
item.user_id !== 2
|
|
||||||
"
|
|
||||||
class="message-box"
|
class="message-box"
|
||||||
>
|
>
|
||||||
<component
|
<component
|
||||||
@ -222,6 +219,7 @@
|
|||||||
:data="item"
|
:data="item"
|
||||||
:max-width="true"
|
:max-width="true"
|
||||||
:source="'panel'"
|
:source="'panel'"
|
||||||
|
@openPromptDrawer="openPromptDrawer"
|
||||||
/>
|
/>
|
||||||
</deepBubble>
|
</deepBubble>
|
||||||
<!-- <div class="talk-tools">
|
<!-- <div class="talk-tools">
|
||||||
@ -735,6 +733,24 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</tm-alert>
|
</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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
@ -925,6 +941,9 @@ const state = ref({
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
isProd: import.meta.env.PROD,
|
isProd: import.meta.env.PROD,
|
||||||
|
chatBotIframeUrl: '', //聊天助手推送的系统消息携带的URL
|
||||||
|
isOpenChatBotIframe: false, //聊天助手推送的系统消息携带的URL是否打开iframe抽屉
|
||||||
|
iframeHeight: 0, //聊天助手推送的系统消息携带的URL iframe抽屉高度
|
||||||
})
|
})
|
||||||
|
|
||||||
// 创建一个响应式的 Map 来维护已读数量
|
// 创建一个响应式的 Map 来维护已读数量
|
||||||
@ -2890,6 +2909,14 @@ const copyVoiceContent = (voiceContent) => {
|
|||||||
// message.success('复制成功')
|
// 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>
|
</script>
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
.dialog-page {
|
.dialog-page {
|
||||||
@ -3368,3 +3395,9 @@ const copyVoiceContent = (voiceContent) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
<style>
|
||||||
|
.chatBotIframeDrawer {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
@ -90,6 +90,7 @@
|
|||||||
"chat.settings.groupType": "群类型",
|
"chat.settings.groupType": "群类型",
|
||||||
"chat.settings.topSession": "置顶会话",
|
"chat.settings.topSession": "置顶会话",
|
||||||
"chat.settings.messageNoDisturb": "消息免打扰",
|
"chat.settings.messageNoDisturb": "消息免打扰",
|
||||||
|
"chat.settings.openReminder": "开启提醒",
|
||||||
"chat.settings.groupGag": "群内禁言",
|
"chat.settings.groupGag": "群内禁言",
|
||||||
"chat.settings.groupAdmin": "群管理员",
|
"chat.settings.groupAdmin": "群管理员",
|
||||||
"chat.settings.groupMember": "群成员",
|
"chat.settings.groupMember": "群成员",
|
||||||
|
Loading…
Reference in New Issue
Block a user