解决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) => {
console.log("=======chatApp==UnreadNum",unReadNum)
console.log('=======chatApp==UnreadNum', unReadNum)
if (typeof plus !== 'undefined') {
let OAWebView = plus.webview.all()
//all里面第一个是入口webview
OAWebView[0].evalJS(`updateUnreadMsgNumReduce('${unReadNum}')`)
OAWebView.forEach((webview) => {
if (webview.id === 'webviewId1') {
webview.evalJS(`updateUnreadMsgNumReduce('${unReadNum}')`)
}
})
} else {
document.addEventListener('plusready', () => {
let OAWebView = plus.webview.all()
//all里面第一个是入口webview
OAWebView[0].evalJS(`updateUnreadMsgNumReduce('${unReadNum}')`)
OAWebView.forEach((webview) => {
if (webview.id === 'webviewId1') {
webview.evalJS(`updateUnreadMsgNumReduce('${unReadNum}')`)
}
})
})
}
return request({
@ -181,14 +187,15 @@ export const ServeConfirmVoteHandle = (data) => {
})
}
export const uploadImg = (data,onProgressFn) => {
export const uploadImg = (data, onProgressFn) => {
return request({
url: '/upload/img',
method: 'POST',
data:data,
baseURL:import.meta.env.VITE_EPR_BASEURL,
isFormData:true,
onUploadProgress:(progressEvent)=>onProgressFn(progressEvent,data.get('file'))
data: data,
baseURL: import.meta.env.VITE_EPR_BASEURL,
isFormData: true,
onUploadProgress: (progressEvent) =>
onProgressFn(progressEvent, data.get('file')),
})
}
// 根据msg_id获取消息

View File

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

View File

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

View File

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