Преглед изворни кода

Merge branch 'master' of https://git.nanodreamtech.com/wkw/wallet_app

wkw пре 4 дана
родитељ
комит
2b2d411516
6 измењених фајлова са 54 додато и 13 уклоњено
  1. 3 2
      capacitor.config.ts
  2. 1 1
      package.json
  3. 1 0
      src/App.vue
  4. 3 3
      src/updater/update.json
  5. 40 7
      src/views/im/chat/index.vue
  6. 6 0
      src/views/im/hook/messagesHook.js

+ 3 - 2
capacitor.config.ts

@@ -7,7 +7,7 @@ import { CapacitorConfig } from '@capacitor/cli';
 // 获取本地服务
 console.log("import.meta.env=", process.env.DAPP_BUILD)
 
-const config: CapacitorConfig = {
+let config: CapacitorConfig = {
   appId: 'com.acc.app',
   appName: 'AngelTokens',
   webDir: 'dist',
@@ -54,7 +54,8 @@ const config: CapacitorConfig = {
 if (process.env.DAPP_BUILD != "1") {
   config.server = {
     url: 'https://192.168.0.59:5173',
-    cleartext: true,          // 允许HTTP明文通信(仅开发环境)
+    cleartext: false,          // 允许HTTP明文通信(仅开发环境)
+    androidScheme: 'https',  
     allowNavigation: ['*']    // 允许任意URL导航
   }
 } else {

+ 1 - 1
package.json

@@ -7,7 +7,7 @@
     "dev": "vite --host",
     "updata": "node ./updataSetVersion.js",
     "s": "cross-env DAPP_BUILD=1 npx cap sync",
-    "a": "npx cap run android --live-reload --host=192.168.0.70 --port=5173",
+    "a": "npx cap run android --live-reload",
     "app": "npx cap run android --live-reload --host=192.168.0.70 --port=5173",
     "ios": "npx cap run ios --live-reload --host=192.168.0.59 --port=5173",
     "android": "npx cap add android && npm run icon && npx cap sync",

+ 1 - 0
src/App.vue

@@ -60,6 +60,7 @@ onBeforeMount(async () => {
   notchStyle.value = {
     paddingTop: `${height.value}px`,
   };
+  console.log("process.env.NODE_ENV=",process.env.NODE_ENV)
   // 检查更新:开发环境不检测更新
   if (process.env.NODE_ENV !== "development") {
     checkAndUpdate();

+ 3 - 3
src/updater/update.json

@@ -1,7 +1,7 @@
 {
-  "version": "1.0.37",
-  "releaseDate": "2025-08-05 10:32:17",
-  "checksum": "6384cf5e11ad534a84fca6f1f2a545b24f6ad16977f78b6580a31bf38e0ad5d0",
+  "version": "1.0.38",
+  "releaseDate": "2025-08-08 09:51:51",
+  "checksum": "68fb75564bcebba9709488bd1f8446550b5b31757d0ed4c158bae046d2be726e",
   "minBinaryVersion": "1.0.0",
   "mandatory": true,
   "upDataDescription": "✨修正一些錯誤。。。。!!!"

+ 40 - 7
src/views/im/chat/index.vue

@@ -167,8 +167,19 @@
         </div>
       </div>
     </div>
-    <!-- 语音通话 -->
-    <CallController></CallController>
+
+    <!-- 来电弹窗 -->
+    <div v-if="rtcStore.imSate.videoCallModal && !inCall" class="call-modal">
+      <p>{{ rtcStore.imSate.callName }} 正在呼叫你</p>
+      <button @click="acceptCall">接听</button>
+      <button @click="rejectCall">拒接</button>
+    </div>
+
+    <!-- 通话中显示挂断按钮 -->
+    <div v-if="inCall" class="call-modal">
+      <p>与 {{ rtcStore.imSate.callName }} 通话中...</p>
+      <button @click="hangupCall">挂断</button>
+    </div>
   </div>
 </template>
 
@@ -205,7 +216,6 @@ const appBoxHeight = ref(210);
 const chatListRef = ref(null);
 const emojiRef = ref(null);
 const toolsRef = ref(null);
-const imState = reactive(rtcStore.imSate); // 来电弹窗显示,callName,fromUserUuid
 const inCall = ref(false); // 是否处于通话中
 
 // 示例用户
@@ -423,12 +433,35 @@ const beforeRead = (file) => {
 };
 
 //  创建呼叫:开启语音电话: 调试用,正式逻辑读src/views/im/hook/messagesHook.js
-const startVoiceCall = () => {
-  rtcStore.startCall({
-    type: "audio",
-    toUserUuid: route.query.uuid, // 当前聊天对象的 uuid
+// ==== 1. 发起语音通话 ====
+const startAudioOnline = async () => {
+  inCall.value = true
+  wsStore.sendMessage({
+    messageType: MESSAGE_TYPE_USER, // 单聊消息
+    contentType: Constant.DIAL_AUDIO_ONLINE,
+    type: Constant.MESSAGE_TRANS_TYPE,
   });
 };
+// ==== 2. 接听来电 ====
+async function acceptCall() {}
+
+// ==== 3. 拒接来电 ====
+function rejectCall() {
+  wsStore.sendMessage({
+    messageType: MESSAGE_TYPE_USER, // 单聊消息
+    contentType: Constant.REJECT_AUDIO_ONLINE,
+    type: Constant.MESSAGE_TRANS_TYPE,
+  });
+}
+
+// ==== 4. 挂断通话 ====
+function hangupCall() {
+  rtcStore.cleanup();
+}
+
+// ==== 5. 监听信令消息 ====
+// 建议你在 useWebSocketStore 里实现 onMessage 订阅信令消息
+// 这里模拟简易监听,示范关键流程
 
 // 时间格式化
 const formatTime = (timestamp) => {

+ 6 - 0
src/views/im/hook/messagesHook.js

@@ -75,18 +75,21 @@ export const handleMessageHook = (message, state) => {
     message.contentType === Constant.DIAL_AUDIO_ONLINE ||
     message.contentType === Constant.DIAL_VIDEO_ONLINE
   ) {
+    console.log("收到播号")
     const rtcStore = useWebRTCStore();
     rtcStore.imSate = {
       videoCallModal: true,
       callName: message.fromUsername,
       fromUserUuid: message.from,
     };
+    return
   }
   // 音频在线:取消
   if (
     message.contentType === Constant.CANCELL_AUDIO_ONLINE ||
     message.contentType === Constant.CANCELL_VIDEO_ONLINE
   ) {
+    console.log("音频在线:取消")
     const rtcStore = useWebRTCStore();
     rtcStore.videoCallModal = false;
     return;
@@ -96,6 +99,7 @@ export const handleMessageHook = (message, state) => {
     message.contentType === Constant.REJECT_AUDIO_ONLINE ||
     message.contentType === Constant.REJECT_VIDEO_ONLINE
   ) {
+    console.log("音频在线:拒接")
     const rtcStore = useWebRTCStore();
     rtcStore.videoCallModal = false;
     return;
@@ -105,6 +109,7 @@ export const handleMessageHook = (message, state) => {
     message.contentType === Constant.ACCEPT_VIDEO_ONLINE ||
     message.contentType === Constant.ACCEPT_AUDIO_ONLINE
   ) {
+     console.log("音频在线:接听")
     const video = message.contentType == ACCEPT_AUDIO_ONLINE
     startAudioOnline(video);
     return;
@@ -115,6 +120,7 @@ export const handleMessageHook = (message, state) => {
       message.contentType >= Constant.DIAL_MEDIA_START &&
       message.contentType <= Constant.DIAL_MEDIA_END
     ) {
+      console.log("音频通话")
       // 媒体通话处理
       // dealMediaCall(message);
       return;