Browse Source

修复退出还原窗口大小

Caner 2 years ago
parent
commit
c7c4796baa
2 changed files with 4 additions and 7 deletions
  1. 2 0
      electron/main.js
  2. 2 7
      src/App.vue

+ 2 - 0
electron/main.js

@@ -148,6 +148,8 @@ class MainSerivce {
       } else if (evt === 'loginMqtt') {
       } else if (evt === 'loginMqtt') {
         this.#initMqtt(data)
         this.#initMqtt(data)
       } else if (evt === 'closeMqtt') {
       } else if (evt === 'closeMqtt') {
+        this.mainWin.setBounds({ width: 1300, height: 760 })
+        this.mainWin.center()
         this.#closeMqtt()
         this.#closeMqtt()
       } else if (evt === 'sendMqtt') {
       } else if (evt === 'sendMqtt') {
         try {
         try {

+ 2 - 7
src/App.vue

@@ -58,6 +58,7 @@ function close(err?: string) {
   winMaxOrMin.value = false
   winMaxOrMin.value = false
   cancelAnimationFrame(conctrlAnimation.value)
   cancelAnimationFrame(conctrlAnimation.value)
   window.$electron.send('closeMqtt')
   window.$electron.send('closeMqtt')
+  console.log('close mqtt')
 }
 }
 
 
 // 初始化rtc
 // 初始化rtc
@@ -135,13 +136,7 @@ function sendAudio(blob: Blob) {
 // 窗口事件
 // 窗口事件
 function titleEvent(type: string) {
 function titleEvent(type: string) {
   if (type === 'maxWin') winMaxOrMin.value = !winMaxOrMin.value
   if (type === 'maxWin') winMaxOrMin.value = !winMaxOrMin.value
-  if (type === 'closeWin') {
-    if (winMaxOrMin.value) window.$electron?.send('maxWin', false)
-    close()
-    console.log('MQTT and RTC close')
-  } else {
-    window.$electron?.send(type, winMaxOrMin.value)
-  }
+  if (type === 'closeWin') { close() } else { window.$electron?.send(type, winMaxOrMin.value) }
 }
 }
 
 
 // mqtt
 // mqtt