解决IOS或其他设备推送时可能找不到webview的问题
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-03-25 13:12:06 +08:00
parent 04dcbdf331
commit 17d9ed737d
4 changed files with 36 additions and 19 deletions

View File

@ -39,16 +39,22 @@ export const ServeTopTalkList = (data) => {
// 清除聊天消息未读数服务接口 // 清除聊天消息未读数服务接口
export const ServeClearTalkUnreadNum = (data, unReadNum) => { export const ServeClearTalkUnreadNum = (data, unReadNum) => {
console.log("=======chatApp==UnreadNum",unReadNum) console.log('=======chatApp==UnreadNum', unReadNum)
if (typeof plus !== 'undefined') { if (typeof plus !== 'undefined') {
let OAWebView = plus.webview.all() let OAWebView = plus.webview.all()
//all里面第一个是入口webview OAWebView.forEach((webview) => {
OAWebView[0].evalJS(`updateUnreadMsgNumReduce('${unReadNum}')`) if (webview.id === 'webviewId1') {
webview.evalJS(`updateUnreadMsgNumReduce('${unReadNum}')`)
}
})
} else { } else {
document.addEventListener('plusready', () => { document.addEventListener('plusready', () => {
let OAWebView = plus.webview.all() let OAWebView = plus.webview.all()
//all里面第一个是入口webview OAWebView.forEach((webview) => {
OAWebView[0].evalJS(`updateUnreadMsgNumReduce('${unReadNum}')`) if (webview.id === 'webviewId1') {
webview.evalJS(`updateUnreadMsgNumReduce('${unReadNum}')`)
}
})
}) })
} }
return request({ return request({
@ -188,7 +194,8 @@ export const uploadImg = (data,onProgressFn) => {
data: data, data: data,
baseURL: import.meta.env.VITE_EPR_BASEURL, baseURL: import.meta.env.VITE_EPR_BASEURL,
isFormData: true, isFormData: true,
onUploadProgress:(progressEvent)=>onProgressFn(progressEvent,data.get('file')) onUploadProgress: (progressEvent) =>
onProgressFn(progressEvent, data.get('file')),
}) })
} }
// 根据msg_id获取消息 // 根据msg_id获取消息

View File

@ -127,13 +127,19 @@ class Talk extends Base {
this.updateTalkItem() this.updateTalkItem()
if (typeof plus !== 'undefined') { if (typeof plus !== 'undefined') {
let OAWebView = plus.webview.all() let OAWebView = plus.webview.all()
//all里面第一个是入口webview OAWebView.forEach((webview) => {
OAWebView[0].evalJS(`updateUnreadMsgNumAdd()`) if (webview.id === 'webviewId1') {
webview.evalJS(`updateUnreadMsgNumAdd()`)
}
})
} else { } else {
document.addEventListener('plusready', () => { document.addEventListener('plusready', () => {
let OAWebView = plus.webview.all() let OAWebView = plus.webview.all()
//all里面第一个是入口webview OAWebView.forEach((webview) => {
OAWebView[0].evalJS(`updateUnreadMsgNumAdd()`) if (webview.id === 'webviewId1') {
webview.evalJS(`updateUnreadMsgNumAdd()`)
}
})
}) })
} }
} }

View File

@ -60,16 +60,20 @@ export function createApp() {
) { ) {
return return
} }
console.log('===准备创建本地通知栏消息')
let OAWebView = plus.webview.all() let OAWebView = plus.webview.all()
//all里面第一个是入口webview OAWebView.forEach((webview, index) => {
OAWebView[0].evalJS(`doCreatePushMessage('${msg}')`) if (webview.id === 'webviewId1') {
webview.evalJS(`doCreatePushMessage('${msg}')`)
}
})
} }
//处理聊天推送弹窗点开 //处理聊天推送弹窗点开
window.openUniPushMsg = (msg) => { window.openUniPushMsg = (msg) => {
console.log("=====点击通知栏消息") console.log('=====点击通知栏消息')
let pushMsg = JSON.parse(decodeURIComponent(msg)) let pushMsg = JSON.parse(decodeURIComponent(msg))
console.log("=====pushMsg",pushMsg) console.log('=====pushMsg', pushMsg)
//由于弹窗前处理了不该弹窗的场景,因此这里弹窗可以一并处理 //由于弹窗前处理了不该弹窗的场景,因此这里弹窗可以一并处理
//也就是都跳转到聊天页面 //也就是都跳转到聊天页面
const talkStore = useTalkStore() const talkStore = useTalkStore()

View File

@ -432,7 +432,7 @@ const getHasMoreResult = (searchResultKey) => {
case 'general_infos': case 'general_infos':
if ( if (
state.searchResult['record_count'] && state.searchResult['record_count'] &&
state.searchResult['record_count'] > 3 state.searchResult['record_count'] >= 3
) { ) {
has_more_result = t('has_more') + t('chat.type.record') has_more_result = t('has_more') + t('chat.type.record')
} }