Sfoglia il codice sorgente

校园资讯bug修复,自动更新bug修复

zjinh 8 anni fa
parent
commit
2f47a42c96

+ 1 - 1
resources/app/about.html

@@ -46,7 +46,7 @@
     });
     ipcRenderer.on('check-for-update',function (event,message) {
         FeedBackContainer[6].innerHTML=message;
-        if(message==='最新版本已下载,点击安装进行更新'){
+        if(message==='最新版本已下载,点击安装进行更新'){
             FeedBackContainer[7].innerHTML='重启并安装更新';
             FeedBackContainer[7].onclick=function () {
                 ipc.send('update', 'event-update');

+ 1 - 1
resources/app/browser.html

@@ -6,7 +6,7 @@
     <link rel="stylesheet" href="./public/css/browser.css">
     <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css" rel="stylesheet">
 </head>
-<body>
+<body tabindex='-1'>
 <section style="-webkit-app-region: no-drag" class="bowerTop"></section>
 <section style="-webkit-app-region: drag" class="bowerHeader">
     <ul class="bowerCreaterWindow" style="-webkit-app-region: drag;padding:15px 0 0">

+ 15 - 28
resources/app/main.js

@@ -59,26 +59,13 @@ function getKey() {
 }
 function noop() {
 }
-function createCampusWindow(flag) {
+function createIndexWindow(flag) {
     if(CampusWindow){
         CampusWindow.show();
         CampusWindow.restore();
         CampusWindow.focus();
         return
     }
-    createIndexWindow(false);
-    if(!flag) {
-        setTimeout(function () {
-            if (CampusWindow) {
-                CampusWindow.show();
-                CampusWindow.restore();
-                CampusWindow.focus();
-            }
-        }, 1000 * 60*5);
-        return false;
-    }
-}
-function createIndexWindow(flag) {
     CampusWindow = new BrowserWindow({ width: 750, height: 540, maxWidth: 750, maxHeight: 540,resizable:false,frame: false });
     CampusWindow.loadURL(url.format({
         pathname: path.join(__dirname, 'index.html'),
@@ -94,12 +81,24 @@ function createIndexWindow(flag) {
     if(!flag) {
         CampusWindow.hide();
     }
+    if(!flag) {
+        setTimeout(function () {
+            if (CampusWindow) {
+                CampusWindow.show();
+                CampusWindow.restore();
+                CampusWindow.focus();
+            }
+        }, 1000 * 60*5);
+        return false;
+    }
 }
 autoUpdater.setFeedURL('http://client.1473.cn/update');//设置检查更新的 url,并且初始化自动更新。这个 url 一旦设置就无法更改。
 function createWindow(request_url) {
     if(mainWindow){
         mainWindow.show();
+        mainWindow.restore();
         mainWindow.focus();
+        mainWindow.webContents.send('url', request_url);
         return false;
     }
     mainWindow = new BrowserWindow({//游览器窗口
@@ -257,7 +256,7 @@ function BindIpc(){
         childProcess.exec(process.argv[0]);//启动新的浏览器
     });
     ipc.on('CampusInfo',function () {
-        createCampusWindow(true);
+        createIndexWindow(true);
     });
     ipc.on('window-all-closed', function () {//退出
         mainWindow.close();
@@ -323,25 +322,13 @@ app.on('ready',function () {
     createWindow();
     if(process.argv[1]==='start'){
         mainWindow.hide();
-        if (shouldQuit) {
-            if (CampusWindow){
-                CampusWindow.restore();
-                CampusWindow.focus();
-                CampusWindow.show();
-            }
-            app.quit();
-            return;
-        }
-        createCampusWindow();
+        createIndexWindow(false);
     }else{
         if(process.argv[1]&&process.argv[1].indexOf('--')<0) {
             createWindow(process.argv[1]);
         }
         createWindow();
         CreateAboutUs();
-       /* if(!CampusWindow&&!shouldQuit){//让校园资讯在多个浏览器窗口开启的情况下也只有一个实例存在
-            createCampusWindow();
-        }*/
     }
 } );
 app.on('window-all-closed', function () {

+ 2 - 2
resources/app/package.json

@@ -3,7 +3,7 @@
   "main": "main.js",
   "private": true,
   "productName": "Usestudio-Browser",
-  "version": "2.2.4",
+  "version": "2.3.0",
   "author": "ZJINH",
   "email": "211775259@qq.com",
   "dependencies": {
@@ -25,7 +25,7 @@
     },
     "win": {
       "icon": "public\\img\\tray\\app.ico",
-      "artifactName": "${productName}_setup_${version}.${ext}",
+      "artifactName": "${productName}_setup.${ext}",
       "target": [
         "nsis"
       ]

+ 3 - 0
resources/app/public/js/browser.js

@@ -410,10 +410,12 @@ US_Browser.Bind=function(){//绑定
                     US_Browser.BrowersTag[0].className='BrowerList Listindex';
                     US_Browser.BrowerContainer[j].style.opacity='0';
                     US_Browser.BrowerContainer[j].style.zIndex='1';
+                    US_Browser.BrowerContainer[j].style.left='-100%';
                 }
                 US_Browser.BrowersTag[i].className+=' BrowerActive';
                 US_Browser.BrowerContainer[i].style.opacity='1';
                 US_Browser.BrowerContainer[i].style.zIndex='1';
+                US_Browser.BrowerContainer[i].style.left='0';
                 US_Browser.Head[5].value=this.data.url;
                 US_Browser.SelecteWebview=US_Browser.BrowerContainer[i].children[0];
                 if(US_Browser.SelecteWebview.FindKey){
@@ -840,6 +842,7 @@ US_Browser.Init=function () {//初始化
     US_Browser.HeadBind();
     US_Browser.IpcBind();
     US_Browser.Loveitem();
+    document.body.focus();
 }();
 window.onload = function () {
     US_Browser.drag();