wanglaoye 6 mesiacov pred
rodič
commit
6a8dacad71

+ 1 - 1
npminstall-debug.log

@@ -8,7 +8,7 @@
   env: {
     npm_config_registry: 'https://registry.npmmirror.com',
     npm_config_argv: '{"remain":[],"cooked":["--fix-bug-versions","--china","--userconfig=C:\\\\Users\\\\15432\\\\.cnpmrc","--disturl=https://npmmirror.com/mirrors/node","--registry=https://registry.npmmirror.com"],"original":["--fix-bug-versions","--china","--userconfig=C:\\\\Users\\\\15432\\\\.cnpmrc","--disturl=https://npmmirror.com/mirrors/node","--registry=https://registry.npmmirror.com"]}',
-    npm_config_user_agent: 'npminstall/7.5.2 npm/? node/v14.21.3 win32 ia32',
+    npm_config_user_agent: 'npminstall/7.5.2 npm/? node/v16.20.2 win32 ia32',
     NODE: 'C:\\Program Files (x86)\\nodejs\\',
     npm_node_execpath: 'C:\\Program Files (x86)\\nodejs\\',
     npm_execpath: 'C:\\Users\\15432\\AppData\\Roaming\\npm\\node_modules\\cnpm\\node_modules\\npminstall\\bin\\install.js',

+ 2 - 2
package.json

@@ -1,7 +1,7 @@
 {
   "name": "doctor-xklr",
   "productName": "星空路人-医生端",
-  "version": "1.2.6",
+  "version": "1.2.7",
   "private": false,
   "author": "wly",
   "scripts": {
@@ -23,7 +23,7 @@
     "prettier": "npx prettier --write ./src ./test",
     "doc": "docsify serve docs"
   },
-  "appId": "doctor-xklr",
+  "appId": "doctor.xklr.com",
   "main": "background.js",
   "dependencies": {
     "@vue/reactivity": "^3.2.47",

+ 23 - 23
src/main/main.js

@@ -30,14 +30,14 @@ const loadURL = isdev
 let mainWindow = null
 async function createWindow() {
   // Create the browser window.
-  const mainWindow = new BrowserWindow({
+  mainWindow = new BrowserWindow({
     width: 132, //悬浮窗口的宽度 比实际DIV的宽度要多2px 因为有1px的边框
     height: 80, //悬浮窗口的高度 比实际DIV的高度要多2px 因为有1px的边框
     frame: false,
     resizable: isdev,
     show: true,
     icon: iconSrc,
-    skipTaskbar: false, // 任务栏中不显示窗口
+    skipTaskbar: true, // 任务栏中不显示窗口
     autoHideMenuBar: false,// 任务栏中不显示窗口
     transparent: true, //设置透明
     hasShadow: process.platform !== "darwin", //不显示阴影
@@ -54,27 +54,7 @@ async function createWindow() {
       sandbox: false
     }
   })
-  //禁止程序多开,此处需要单例锁的打开注释即可
-  //只存在一个
-  const gotTheLock = app.requestSingleInstanceLock()
-  if (!gotTheLock) {
-    app.quit()
-  } {
-    app.on('second-instance', (event, argv) => {
-      if (process.platform === 'win32') {
-        if (win) {
-          if (win.isMinimized()) {
-            win.restore()
-          }
-          if (win.isVisible()) {
-            win.focus()
-          } else {
-            win.show()
-          }
-        }
-      }
-    })
-  }
+  global.mainWindow = mainWindow
   mainWindow.on('ready-to-show', () => {
     mainWindow.show()
   })
@@ -94,6 +74,26 @@ async function createWindow() {
   mainWinEvent(mainWindow)
   updatewin()
 }
+
+/* 限制只启动一个exe程序 */
+const additionalData = { myKey: "doctor-xklr" };
+const gotTheLock = app.requestSingleInstanceLock(additionalData);
+if (!gotTheLock) {
+  app.quit();
+  app.exit(0)
+} else {
+  app.on("second-instance",(event, commandLine, workingDirectory, additionalData) => {
+      //输入从第二个实例中接收到的数据
+      console.log(157,additionalData);
+      //有人试图运行第二个实例,我们应该关注我们的窗口
+      if (mainWindow) {
+        if (mainWindow.isMinimized()) mainWindow.restore();
+        /* 展示屏幕 */
+        mainWindow.show();
+      }
+    }
+  )
+}
 app.whenReady().then(async () => {
   // if (isdev && !process.env.IS_TEST) {
   // Install Vue Devtools

+ 1 - 1
src/main/windows/indexwin.js

@@ -35,7 +35,7 @@ const createIndexwin = function (BrowserWindow) {
         hasShadow: process.platform !== "darwin",
         alwaysOnTop: true,
         webPreferences: {
-            devTools: isdev,//isdev
+            devTools: isdev,
             contextIsolation: false,
             sandbox: false,
             nodeIntegration: true,

+ 1 - 1
src/main/windows/settingwin.js

@@ -34,7 +34,7 @@ const createSettingwin = function (BrowserWindow) {
         hasShadow: process.platform !== "darwin",
         alwaysOnTop: true,
         webPreferences: {
-            devTools: isdev,//isdev
+            devTools: isdev,
             contextIsolation: false,
             sandbox: false,
             nodeIntegration: true,

+ 21 - 1
src/main/windows/tray.js

@@ -4,7 +4,16 @@ import updatewin from './updaterwin'
 const iconSrc = __static + "/images/icon.ico";
 let ntray = null
 export default async function tray({ type, menu }) {
+  
   let trayMenu = [ //基础列表
+  {
+    label: '主窗口',
+    click: async function () {
+      // console.log(ipcMain,Main)
+      console.log(global.mainWindow.show())
+      // ipcMain.send("window-show")
+    }
+  },
     {
       label: '设置(Ctrl+L)',
       click: async function () {
@@ -29,8 +38,8 @@ export default async function tray({ type, menu }) {
     {
       label: '退出',
       click: function () {
-        app.quit();
         if (process.platform !== 'darwin') {
+          app.quit();
           ntray.destroy()
         }
       }
@@ -51,4 +60,15 @@ export default async function tray({ type, menu }) {
   let n = Menu.buildFromTemplate(trayMenu)
   ntray.setToolTip('星空路人-医生端')
   ntray.setContextMenu(n)
+  // 单击此图标显示窗口
+  ntray.on('click', () => {
+    //清除消息提醒
+    if (!global.mainWindow.isVisible()) {
+      global.mainWindow.show();
+      global.mainWindow.setSkipTaskbar(false);
+    } else if (global.mainWindow.isMinimized() || !global.mainWindow.isFocused()) {
+      global.mainWindow.restore()
+      global.mainWindow.focus()
+    }
+  })
 }

+ 1 - 1
src/main/windows/updaterwin.js

@@ -41,7 +41,7 @@ export default function updatewin() {
                 hasShadow: process.platform !== "darwin",
                 alwaysOnTop: true,
                 webPreferences: {
-                    devTools: true,//isdev
+                    devTools: isdev,
                     contextIsolation: false,
                     sandbox: false,
                     nodeIntegration: true,

+ 0 - 1
src/renderer/pages/patientlist/index.vue

@@ -200,7 +200,6 @@ export default {
     initList() {
       this.formData.pageNum=1
       this.paging('init')
-      
     },
     navto(data) {
       // console.log(this.$router)