From ae0398be3a751fd928d327f40ea4e68395813f1d Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Thu, 26 Feb 2026 17:42:22 +0800
Subject: [PATCH] Merge branch 'master' of http://139.196.74.78:10010/r/jagzwxm/ja_web
---
applications/mobile-web-view/src/axios.js | 10 ++--
applications/mobile-web-view/src/appPages/voiceCallDetail/index.vue | 7 +++
applications/mobile-web-view/vite.config.mjs | 17 ++++++--
uniapps/work-app/src/hooks/useGlobalWS.js | 14 +++++++
uniapps/work-app/src/subPackages/voiceCallDetail/index.vue | 6 +-
uniapps/work-app/src/utils/websocket.js | 22 +++++-----
6 files changed, 52 insertions(+), 24 deletions(-)
diff --git a/applications/mobile-web-view/src/appPages/voiceCallDetail/index.vue b/applications/mobile-web-view/src/appPages/voiceCallDetail/index.vue
index 9359c56..9387b7c 100644
--- a/applications/mobile-web-view/src/appPages/voiceCallDetail/index.vue
+++ b/applications/mobile-web-view/src/appPages/voiceCallDetail/index.vue
@@ -466,7 +466,8 @@
// 你后端没有 reject,用 busy 表示拒绝/不可接听
send('busy', incomingFrom, null)
log('❌ 已拒绝来电,发送 busy 给', incomingFrom)
-
+ const transmitData = { data: { type: 'hangupVoice' } }
+uni.postMessage(transmitData)
// 停止铃声
// const transmitData = { data: { type: 'stopVoice' } }
// uni.postMessage(transmitData)
@@ -572,6 +573,8 @@
} else {
log('❌ uni对象不存在,无法返回上一页')
}
+ const transmitData = { data: { type: 'hangupVoice' } }
+ uni.postMessage(transmitData)
} else {
// 对方挂断:显示提示,延迟10秒跳转
callEnded.value = true
@@ -585,6 +588,8 @@
} else {
log('❌ uni对象不存在,无法返回上一页')
}
+ const transmitData = { data: { type: 'hangupVoice' } }
+ uni.postMessage(transmitData)
// 重置通话结束状态
callEnded.value = false
}, 3000)
diff --git a/applications/mobile-web-view/src/axios.js b/applications/mobile-web-view/src/axios.js
index 6d74033..87997df 100644
--- a/applications/mobile-web-view/src/axios.js
+++ b/applications/mobile-web-view/src/axios.js
@@ -40,11 +40,11 @@
config => {
// 初始化错误提示状态
isErrorShown = false
- if (VITE_APP_ENV === 'development') {
- config.url = VITE_APP_API + config.url
- } else {
- config.url = VITE_APP_XT_URL + config.url
- }
+ // if (VITE_APP_ENV === 'development') {
+ // config.url = VITE_APP_API + config.url
+ // } else {
+ // config.url = VITE_APP_XT_URL + config.url
+ // }
config.headers['areaCode'] = store.state.user.selectedAreaCode
//安全请求header
config.headers['Blade-Requested-With'] = 'BladeHttpRequest'
diff --git a/applications/mobile-web-view/vite.config.mjs b/applications/mobile-web-view/vite.config.mjs
index 1277457..35b904e 100644
--- a/applications/mobile-web-view/vite.config.mjs
+++ b/applications/mobile-web-view/vite.config.mjs
@@ -6,7 +6,7 @@
import createVitePlugins from './vite/plugins'
import postCssPxToRem from 'postcss-pxtorem'
import { fileURLToPath, URL } from "node:url"
-
+import basic from '@vitejs/plugin-basic-ssl'
import fs from 'fs'
// https://vitejs.dev/config/
@@ -19,7 +19,8 @@
const {
VITE_APP_ENV,
VITE_APP_BASE,
- VITE_APP_XT_URL,
+ VITE_APP_API_URL,
+ VITE_APP_XT_URL,
VITE_APP_RECTANGLE,
VITE_APP_ARCGIS_URL,
VITE_APP_MAP_TILE_URL,
@@ -67,6 +68,7 @@
// key: fs.readFileSync('./127.0.0.1+3-key.pem'), // 私钥路径
// cert: fs.readFileSync('./127.0.0.1+3.pem'), // 证书路径
// },
+ https: true,
port: 5179,
proxy: {
'/aisky-webodm-vol': {
@@ -111,8 +113,14 @@
rewrite: path => path.replace(/^\/dji_in_rectangle/, ''),
},
- '/api': {
+ '/webservice': {
target: VITE_APP_XT_URL,
+ changeOrigin: true,
+ rewrite: path => path.replace(/^\/webservice/, '/webservice'),
+ },
+
+ '/api': {
+ target: VITE_APP_API_URL,
changeOrigin: true,
rewrite: path => path.replace(/^\/api/, ''),
}
@@ -149,7 +157,8 @@
]
}
},
- plugins: createVitePlugins(env, command === 'build'),
+ plugins: [...createVitePlugins(env, command === 'build'), basic()],
+ // plugins: createVitePlugins(env, command === 'build'),
build: buildConfig,
optimizeDeps: {
esbuildOptions: {
diff --git a/uniapps/work-app/src/hooks/useGlobalWS.js b/uniapps/work-app/src/hooks/useGlobalWS.js
index f44567d..9a4b8f4 100644
--- a/uniapps/work-app/src/hooks/useGlobalWS.js
+++ b/uniapps/work-app/src/hooks/useGlobalWS.js
@@ -15,6 +15,18 @@
// 存储铃声实例
let ringtoneInstance = null
+ // 监听WebView消息事件
+ if (typeof uni !== 'undefined' && uni.$on) {
+ uni.$on('webViewMessage', (data) => {
+ console.log('📨 useGlobalWS 收到 WebView 消息:', data)
+ // 处理挂断消息
+ if (data?.type === 'hangupVoice') {
+ console.log('📞 收到挂断消息')
+ initWS()
+ }
+ });
+ }
+
// 设置默认用户ID为3
const defaultUserId = '2021474815063486465';
// WebSocket基础URL
@@ -165,6 +177,7 @@
return
}
recoverTimer = setInterval(() => {
+ // console.log('shouldRecoverWS()',shouldRecoverWS(),'----------',websocketService.getConnected())
if (shouldRecoverWS() && !websocketService.getConnected()) {
initWS()
}
@@ -172,6 +185,7 @@
}
function initWS() {
+ websocketService.close()
const userStore = useUserStore()
accessToken.value =userStore?.userInfo.access_token
if (!accessToken.value || isVoiceCallDetailActive()) {
diff --git a/uniapps/work-app/src/subPackages/voiceCallDetail/index.vue b/uniapps/work-app/src/subPackages/voiceCallDetail/index.vue
index 710e6b2..a1a3606 100644
--- a/uniapps/work-app/src/subPackages/voiceCallDetail/index.vue
+++ b/uniapps/work-app/src/subPackages/voiceCallDetail/index.vue
@@ -79,9 +79,9 @@
function onPostMessage(data) {
// 将WebView消息传递给全局WebSocket处理
- // if (typeof uni !== 'undefined' && uni.$emit) {
- // uni.$emit('webViewMessage', data);
- // }
+ if (typeof uni !== 'undefined' && uni.$emit) {
+ uni.$emit('webViewMessage', data);
+ }
}
</script>
diff --git a/uniapps/work-app/src/utils/websocket.js b/uniapps/work-app/src/utils/websocket.js
index c9a5a2a..78ece56 100644
--- a/uniapps/work-app/src/utils/websocket.js
+++ b/uniapps/work-app/src/utils/websocket.js
@@ -114,8 +114,8 @@
this.socketTask.send({
data: JSON.stringify(message),
success: () => {
- // console.log('WebSocket消息发送成功:', message)
- useGlobalWS();
+ console.log('WebSocket消息发送成功:', message)
+ // useGlobalWS();
},
fail: (error) => {
// console.error('WebSocket消息发送失败:', error)
@@ -124,15 +124,15 @@
}
// 开始心跳检测
- startPing() {
- this.stopPing()
- // 每25秒发送一次心跳
- this.pingTimer = setInterval(() => {
- if (this.connected) {
- this.send('ping', 'system')
- }
- }, 25000)
- }
+ // startPing() {
+ // this.stopPing()
+ // // 每25秒发送一次心跳
+ // this.pingTimer = setInterval(() => {
+ // if (this.connected) {
+ // this.send('ping', 'system')
+ // }
+ // }, 25000)
+ // }
// 停止心跳检测
stopPing() {
--
Gitblit v1.9.3