Browse Source

0.1.6 测试版

laiguoran 7 năm trước cách đây
mục cha
commit
bee8828e42

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 1
data/sc_software.json


+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "startup",
-  "version": "0.1.3",
+  "version": "0.1.6",
   "author": "珠海纵横软件有限公司",
   "description": "启动器",
   "license": null,

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 4 - 3
src/database/index.js


+ 5 - 3
src/main/index.js

@@ -38,10 +38,12 @@ function initialize () {
      * Initial window options
      */
     const windowOptions = {
-      width: 900,
-      // width: 1450,
+      // width: 900,
+      width: 1450,
       height: 564,
-      resizable: false,
+      minWidth: 900,
+      minHeight: 564,
+      // resizable: false,
       show: true,
       frame: false,
       fullscreenable: false,

+ 8 - 5
src/main/main-process/downloads.js

@@ -60,11 +60,14 @@ const downloads = function (win) {
       onCancel: function () {
         console.log('cancel download')
         try {
-          info.start = true
-          info.pause = false
-          info.resume = false
-          db.read().get('sc_download').getById(args.id).assign(info).write()
-          fse.removeSync(path.join(__appPath, folderpath, info.savepath))
+          // info.start = true
+          // info.pause = false
+          // info.resume = false
+          // db.read().get('sc_download').getById(args.id).assign(info).write()
+          let delpath = path.join(__appPath, folderpath, info.savepath)
+          if (fs.existsSync(delpath)) {
+            fse.removeSync(delpath)
+          }
         } catch (err) {
           console.log(err)
         }

+ 21 - 2
src/main/main-process/exe-install.js

@@ -23,7 +23,7 @@ const exeinstall = function (win) {
     let info = args.info
     try {
       // 先检查数据库中是否已存在该注册表软件的信息,有则退出,无则继续
-      let exesqlinfo = db.read().get('sc_exeData').find({ regeditName: info.regedit, fileVersion: info.version }).value()
+      let exesqlinfo = db.read().get('sc_exeData').find({ regeditName: info.regedit, product_version: info.version }).value()
       if (exesqlinfo !== undefined) {
         event.sender.send('InstallResult', { status: 400, msg: `启动器已存在相同版本的 ${info.fulltitle} 软件`, id: info.id, index: args.index })
       } else {
@@ -58,10 +58,11 @@ const exeinstall = function (win) {
               exeinfo.productVersion = data[i].ProductVersion
               exeinfo.fileDescription = data[i].FileDescription
               exeinfo.addtime = Date.parse(new Date()) / 1000
+              exeinfo.id = GetFileNameNoExt(exeinfo.exeName) + '-' + RndNum(10)
               db.read().get('sc_exeData').insert(exeinfo).write()
             }
-            db.read().get('sc_productData').updateById(info.pid, { isshow: true }).write()
             await db.read().get('sc_productData').updateById(info.pid, { isshow: true }).write()
+            await db.read().set('sc_hadInstall.first', false).write()
             await db.read().set('sc_hadInstall.url', '/softwarestartup/' + info.pid).write()
             event.sender.send('InstallResult', { status: 200, msg: data.length, id: info.id, index: args.index })
             win.webContents.send('successUpdate', { id: info.pid, num: data.length, delnum: 0 })
@@ -75,6 +76,24 @@ const exeinstall = function (win) {
     }
   })
 
+  // 取文件名不带后缀
+  function GetFileNameNoExt (filepath) {
+    if (filepath !== '') {
+      let names = filepath.split('\\')
+      let pos = names[names.length - 1].lastIndexOf('.')
+      return names[names.length - 1].substring(0, pos)
+    }
+  }
+
+  // 产生随机数函数
+  function RndNum (n) {
+    let rnd = ''
+    for (let i = 0; i < n; i++) {
+      rnd += Math.floor(Math.random() * 10)
+    }
+    return rnd
+  }
+
   /**
    * 判断文件名是否包含纵横软件exe的部分名称
    * @param item

+ 42 - 21
src/main/main-process/file-select.js

@@ -116,7 +116,8 @@ async function checkExeName (Directory, files) {
           show_updateVersion: regeditMsg.product_version,
           addtime: Date.parse(new Date()) / 1000,
           isshow: true,
-          auto: false
+          auto: false,
+          id: GetFileNameNoExt(files[i].exeName) + '-' + RndNum(10)
         }
         await db.read().get('sc_exeData').insert(exeData).write()
         ++addnum
@@ -130,6 +131,24 @@ const sleep = (timeout = 2000) => new Promise(resolve => {
   setTimeout(resolve, timeout)
 })
 
+// 取文件名不带后缀
+function GetFileNameNoExt (filepath) {
+  if (filepath !== '') {
+    let names = filepath.split('\\')
+    let pos = names[names.length - 1].lastIndexOf('.')
+    return names[names.length - 1].substring(0, pos)
+  }
+}
+
+// 产生随机数函数
+function RndNum (n) {
+  let rnd = ''
+  for (let i = 0; i < n; i++) {
+    rnd += Math.floor(Math.random() * 10)
+  }
+  return rnd
+}
+
 /**
  * 判断文件名是否包含纵横软件exe的部分名称
  * @param item
@@ -148,6 +167,15 @@ function existSoftwareName (item) {
   return flag
 }
 
+function inArray (val, arr) {
+  for (let i in arr) {
+    if (arr[i] === val) {
+      return true
+    }
+  }
+  return false
+}
+
 /**
  * 纵横注册表信息中是否存在该文件夹,存在则返回该注册表信息,并加入到产品数据库中
  * @param directory
@@ -176,34 +204,29 @@ async function checkRegeditbyDirectory (directory) {
             let values = result2.data.values
             let directoryPath = values['Inno Setup: App Path'].value
             if (directoryPath === directory) {
-              let simpleVersion = values['DisplayVersion'] === undefined || values['DisplayVersion'] === null ? '' : values['DisplayVersion'].value.split('_')
               regeditMsg.name = values['DisplayName'].value
               regeditMsg.fileName = values['Inno Setup: Icon Group'].value
               regeditMsg.regeditName = softwarelist[i]
-              regeditMsg.simpleName = simpleVersion === '' ? '' : simpleVersion[0]
-              regeditMsg.versionName = simpleVersion === '' ? '' : simpleVersion[1]
               let softwarejson = path.join('data/sc_software.json')
               let downlist = fse.readJsonSync(softwarejson).sc_down
               let downinfo = downlist.find(function (item) {
-                return item.regedit === regeditMsg.regeditName
+                return inArray(regeditMsg.regeditName, item.regedits)
               })
-              let ptitle = downinfo !== undefined ? downinfo.product_title : regeditMsg.simpleName
+              // let ptitle = downinfo !== undefined ? downinfo.product_title : ''
               // 查找数据库是否存在该产品,有则添加,无则根据simplename 新增产品,simplename为空的话,则为未分类
               // 新方法,先关联注册表名查找数据,然后再关联产品数据库生成
-              if (ptitle !== '') {
-                if (regeditMsg.simpleName === '') {
-                  regeditMsg.simpleName = downinfo.product_title
-                  regeditMsg.versionName = downinfo.title
-                }
-                let productInfo = db.read().get('sc_productData').find({ title: ptitle }).value()
+              if (downinfo !== undefined) {
+                regeditMsg.simpleName = downinfo.product_title
+                regeditMsg.versionName = downinfo.title
+                let productInfo = db.read().get('sc_productData').find({ product_id: downinfo.product_id }).value()
                 if (productInfo !== undefined) {
                   regeditMsg.pid = productInfo.id
-                  regeditMsg.product_version = productInfo.version
+                  db.read().get('sc_productData').updateById(productInfo.id, { isshow: true }).write()
                 } else {
                   // 查找sc_software.json文件,有则新增产品,无则为未分类(旧的也会归这类)
                   let scproductlist = fse.readJsonSync(softwarejson).sc_product
                   let scproductinfo = scproductlist.find(function (item) {
-                    return item.title === ptitle
+                    return item.product_id === downinfo.product_id
                   })
                   if (scproductinfo !== undefined) {
                     let addproduct = scproductinfo
@@ -211,7 +234,6 @@ async function checkRegeditbyDirectory (directory) {
                     addproduct.isshow = false
                     let info = db.read().get('sc_productData').insert(addproduct).write()
                     regeditMsg.pid = info.id
-                    regeditMsg.product_version = info.version
                   }
                 }
                 // 锁号和锁类型添加
@@ -219,12 +241,11 @@ async function checkRegeditbyDirectory (directory) {
                 // let downinfo = downlist.find(function (item) {
                 //   return item.product_title === regeditMsg.simpleName && item.title === regeditMsg.versionName
                 // })
-                if (downinfo !== undefined) {
-                  regeditMsg.keyNumber = downinfo.key_number
-                  regeditMsg.keytype = downinfo.keytype
-                  regeditMsg.product_id = downinfo.product_id
-                  regeditMsg.down_id = downinfo.down_id
-                }
+                regeditMsg.keyNumber = downinfo.key_number
+                regeditMsg.keytype = downinfo.keytype
+                regeditMsg.product_id = downinfo.product_id
+                regeditMsg.down_id = downinfo.down_id
+                regeditMsg.product_version = downinfo.version
               }
               return regeditMsg
             }

+ 45 - 30
src/main/main-process/updateInstall.js

@@ -38,18 +38,29 @@ const updateInstall = function (win) {
             promiseArr2.push(getExeDataList(softwarelist[i]))
           }
         }
+        await sleep(2000)
         await Promise.all(promiseArr2)
           .then(async function (result) {
             await sleep(5000)
             if (globalSoftware !== []) {
               for (let i in globalSoftware) {
-                globalSoftware[i].exeName = globalExe[i]
-                promiseArr.push(insertData(globalSoftware[i]))
+                (async function () {
+                  globalSoftware[i].exeName = globalExe[i]
+                  await promiseArr.push(insertData(globalSoftware[i]))
+                })(i)
               }
             }
+            let one = globalSoftware.length
+            console.log(one)
+            await sleep(2000)
+            let two = globalSoftware.length
+            console.log(two)
+            if (one !== two) {
+              console.log(globalSoftware)
+            }
             await Promise.all(promiseArr)
               .then(async function (result) {
-                console.log(globalSoftware)
+                // console.log(globalSoftware)
                 let delnum = await delProductAndExeDataAsync()
                 await db.read().set('sc_hadInstall.first', false).write()
                 let exeInfo = await db.read().get('sc_exeData').last().value()
@@ -154,6 +165,15 @@ const updateInstall = function (win) {
     return flag
   }
 
+  function inArray (val, arr) {
+    for (let i in arr) {
+      if (arr[i] === val) {
+        return true
+      }
+    }
+    return false
+  }
+
   /**
    * 数据入库
    *
@@ -176,28 +196,24 @@ const updateInstall = function (win) {
         let softwarejson = path.join('data/sc_software.json')
         let downlist = fse.readJsonSync(softwarejson).sc_down
         let downinfo = downlist.find(function (item) {
-          return item.regedit === exeData.regeditName
+          return inArray(exeData.regeditName, item.regedits)
         })
-        let ptitle = downinfo !== undefined ? downinfo.product_title : exeData.simpleName
-        if (ptitle !== '') {
-          if (exeData.simpleName === '') {
-            exeData.simpleName = downinfo.product_title
-            exeData.versionName = downinfo.title
-          }
-          let productInfo = db.read().get('sc_productData').find({ title: ptitle }).value()
+        // let ptitle = downinfo !== undefined ? downinfo.product_title : ''
+        if (downinfo !== undefined) {
+          exeData.simpleName = downinfo.product_title
+          exeData.versionName = downinfo.title
+          let productInfo = db.read().get('sc_productData').find({ product_id: downinfo.product_id }).value()
           if (productInfo === undefined || productInfo === null) {
-            let productlist = fse.readJsonSync(softwarejson).sc_product
-            for (let i in productlist) {
-              if (productlist[i].title === ptitle) {
-                let productInfo2 = productlist[i]
-                productInfo2.addtime = Date.parse(new Date()) / 1000
-                productInfo2.isshow = true
-                let insertproudct = db.read().get('sc_productData').insert(productInfo2).write()
-                exeData.pid = insertproudct.id
-                productInfo = insertproudct
-                break
-              }
-            }
+            let scproductlist = fse.readJsonSync(softwarejson).sc_product
+            let scproductInfo = scproductlist.find(function (item) {
+              return item.product_id === downinfo.product_id
+            })
+            let productInfo2 = scproductInfo
+            productInfo2.addtime = Date.parse(new Date()) / 1000
+            productInfo2.isshow = true
+            let insertproudct = db.read().get('sc_productData').insert(productInfo2).write()
+            exeData.pid = insertproudct.id
+            productInfo = insertproudct
           } else {
             exeData.pid = productInfo.id
             db.read().get('sc_productData').updateById(productInfo.id, { isshow: true }).write()
@@ -210,21 +226,23 @@ const updateInstall = function (win) {
               exeData.keytype = downlist[j].keytype
               exeData.product_id = downlist[j].product_id
               exeData.down_id = downlist[j].down_id
-              exeData.product_version = productInfo.version
+              exeData.product_version = downlist[j].version
               exeData.show_tip = false
-              exeData.show_updateVersion = productInfo.version
+              exeData.show_updateVersion = downlist[j].version
               break
             }
           }
         } else {
           exeData.pid = '1'
+          exeData.simpleName = ''
+          exeData.versionName = ''
           exeData.keyNumber = ''
           exeData.keytype = ''
           exeData.product_id = ''
           exeData.down_id = ''
           exeData.product_version = ''
           exeData.show_tip = false
-          exeData.show_updateVersion = exeData.fileVersion
+          exeData.show_updateVersion = ''
           db.read().get('sc_productData').updateById('1', { isshow: true }).write()
         }
         exeData.addtime = Date.parse(new Date()) / 1000
@@ -250,14 +268,11 @@ const updateInstall = function (win) {
     // setTimeout(function () {
       regedit.list(regeditPath + '\\' + Info).on('data', async function (result) {
         let values = result.data.values
-        let simpleVersion = values['DisplayVersion'] === undefined || values['DisplayVersion'] === null ? '' : values['DisplayVersion'].value.split('_')
         let regeditData = {
           path: values['Inno Setup: App Path'].value,
           name: values['DisplayName'].value,
           regeditName: Info,
-          fileName: values['Inno Setup: Icon Group'].value,
-          simpleName: simpleVersion === '' ? '' : simpleVersion[0],
-          versionName: simpleVersion === '' ? '' : simpleVersion[1]
+          fileName: values['Inno Setup: Icon Group'].value
         }
         let dirname = await fs.readdirSync(regeditData.path)
         for (let i in dirname) {

+ 3 - 1
src/main/main-process/usb-ffi.js

@@ -7,6 +7,7 @@
  * @date 2018/6/20
  * @version
  */
+import db from '../../database'
 const path = require('path')
 const ffi = require('ffi')
 const electron = require('electron')
@@ -45,7 +46,8 @@ async function testUsb (webContents) {
       //   let productNum = productlist[i].split(':')[0]
       //   let productVerList = productlist[i].split(':')[1].split(';')
       // }
-      webContents.send('usbIn', { lockmsg: alllist })
+      let first = db.read().get('sc_hadInstall.first').value()
+      webContents.send('usbIn', { lockmsg: alllist, first: first })
       const notification = new Notification({
         title: '软件锁',
         body: '启动器检测到软件锁'

+ 2 - 162
src/renderer/App.vue

@@ -13,166 +13,6 @@
 <style>
   /* CSS */
   @import "assets/font-awesome/fontawesome-all.css";
-
-  #app {
-    overflow: hidden;
-  }
-  body {
-    margin: 0;
-    font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";
-    font-size: 1rem;
-    font-weight: 400;
-    line-height: 1.5;
-    color: #212529;
-    text-align: left;
-    background-color: #fff;
-  }
-  .h1, .h2, .h3, .h4, .h5, .h6, h1, h2, h3, h4, h5, h6 {
-    margin-bottom: .5rem;
-    font-family: inherit;
-    font-weight: 500;
-    line-height: 1.2;
-    color: inherit;
-  }
-  .h4, h4 {
-    margin-top: 0;
-    font-size: 1.5rem;
-  }
-
-  .pl-0, .px-0 {
-    padding-left: 0!important;
-  }
-  .pr-0, .px-0 {
-    padding-right: 0!important;
-  }
-  .shadow-sm {
-    box-shadow: 0 .125rem .25rem rgba(0,0,0,.075)!important;
-  }
-  .rounded {
-    border-radius: .25rem!important;
-  }
-  .border {
-    border: 1px solid #dee2e6!important;
-  }
-  .pt-1, .py-1 {
-    padding-top: .25rem!important;
-  }
-  .pt-4, .py-4 {
-    padding-top: 1.5rem!important;
-  }
-  .pb-2, .py-2 {
-    padding-bottom: .5rem!important;
-  }
-  .pl-2, .py-2 {
-    padding-left: .5rem!important;
-  }
-  .pt-2, .py-2 {
-    padding-top: .5rem!important;
-  }
-  .mt-1, .my-1 {
-    margin-top: .25rem!important;
-  }
-  .mt-2, .my-2 {
-    margin-top: .5rem!important;
-  }
-  .ml-2, .mx-2 {
-    margin-left: .5rem!important;
-  }
-  .ml-3, .mx-3 {
-    margin-left: 1rem!important;
-  }
-  .mt-4, .my-4 {
-    margin-top: 1.5rem!important;
-  }
-  .pl-3, .px-3 {
-    padding-left: 1rem!important;
-  }
-  .pt-3, .py-3 {
-    padding-top: 1rem!important;
-  }
-  .p-2 {
-    padding: .5rem!important;
-  }
-  .p-3 {
-    padding: 1rem!important;
-  }
-  .shadow-sm {
-    box-shadow: 0 .125rem .25rem rgba(0,0,0,.075)!important;
-  }
-  .border-bottom {
-    border-bottom: 1px solid #dee2e6!important;
-  }
-  .media {
-    display: -ms-flexbox;
-    display: flex;
-    -ms-flex-align: start;
-    align-items: flex-start;
-  }
-  .mr-2, .mx-2 {
-    margin-right: .5rem!important;
-  }
-  .mt-1, .my-1 {
-    margin-top: .25rem!important;
-  }
-  .h5, h5 {
-    margin-top: 0;
-    font-size: 1.25rem;
-  }
-
-  .fa, .fas {
-    font-family: 'Font Awesome 5 Free';
-    font-weight: 900;
-  }
-  .fa, .fas, .far, .fal, .fab {
-    -moz-osx-font-smoothing: grayscale;
-    -webkit-font-smoothing: antialiased;
-    display: inline-block;
-    font-style: normal;
-    font-variant: normal;
-    text-rendering: auto;
-    line-height: 1;
-    cursor: pointer;
-  }
-  .fa-th-large:before {
-    content: "\f009";
-  }
-
-  .float-right {
-    float: right!important;
-  }
-  .mr-3, .mx-3 {
-    margin-right: 1rem!important;
-  }
-  .mt-1, .my-1 {
-    margin-top: .25rem!important;
-  }
-  .float-left {
-    float: left!important;
-  }
-  .el-dropdown {
-    color: #212529;
-    font-size: 1rem;
-  }
-  ::-webkit-scrollbar {
-    width: 5px;
-    height: 5px;
-  }
-  ::-webkit-scrollbar-thumb {
-    background-color: #e0e0e0;
-  }
-  ::-webkit-scrollbar-track {
-    background-color: #fff;
-  }
-
-  .btn-blue {
-    color: #fff !important;
-    background-color: #2daebf !important;
-    border-color: #2daebf !important;
-  }
-  a {
-    color: #007bff;
-    text-decoration: none;
-    background-color: transparent;
-    -webkit-text-decoration-skip: objects;
-  }
+  @import "assets/bootstrap.min.css";
+  @import "assets/global.css";
 </style>

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 7 - 0
src/renderer/assets/bootstrap-grid.min.css


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 8 - 0
src/renderer/assets/bootstrap-reboot.min.css


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 7 - 0
src/renderer/assets/bootstrap.min.css


+ 534 - 0
src/renderer/assets/global.css

@@ -0,0 +1,534 @@
+@charset "utf-8";
+/*样式初始化*/
+body{
+  font-size:12px !important;
+}
+#app {
+  overflow: hidden;
+}
+.el-dropdown {
+  color: #212529;
+}
+::-webkit-scrollbar {
+  width: 5px;
+  height: 5px;
+}
+::-webkit-scrollbar-thumb {
+  background-color: #ddd5cf;
+}
+::-webkit-scrollbar-track {
+  background-color: #fff;
+}
+
+.btn-white {
+  color: #333;
+  background-color: #fff;
+  border-color: #ddd;
+}
+
+.btn-orange {
+  color: #fff;
+  background-color: #ff6501;
+  border-color: #ff6501;
+}
+.btn-orange:hover {
+  color: #fff;
+  background-color: #e55a00;
+  border-color: #e55a00;
+}
+
+.btn-orange:focus, .btn-orange.focus {
+  box-shadow: 0 0 0 0.2rem rgba(45, 174, 191, 0.5);
+}
+
+.btn-orange.disabled, .btn-orange:disabled {
+  color: #fff;
+  background-color: #e55a00;
+  border-color: #e55a00;
+}
+
+.btn-orange:not(:disabled):not(.disabled):active, .btn-orange:not(:disabled):not(.disabled).active,
+.show > .btn-orange.dropdown-toggle {
+  color: #fff;
+  background-color: #e55a00;
+  border-color: #e55a00;
+}
+
+.btn-orange:not(:disabled):not(.disabled):active:focus, .btn-orange:not(:disabled):not(.disabled).active:focus,
+.show > .btn-orange.dropdown-toggle:focus {
+  box-shadow: 0 0 0 0.2rem rgba(45, 174, 191, 0.5);
+}
+
+.btn-blue {
+  color: #fff;
+  background-color: #14a5e8;
+  border-color: #14a5e8;
+}
+
+.btn-blue:hover {
+  color: #fff;
+  background-color: #0e90cc;
+  border-color: #0e90cc;
+}
+
+.btn-blue:focus, .btn-blue.focus {
+  box-shadow: 0 0 0 0.2rem rgba(45, 174, 191, 0.5);
+}
+
+.btn-blue.disabled, .btn-blue:disabled {
+  color: #fff;
+  background-color: #0e90cc;
+  border-color: #0e90cc;
+}
+
+.btn-blue:not(:disabled):not(.disabled):active, .btn-blue:not(:disabled):not(.disabled).active,
+.show > .btn-blue.dropdown-toggle {
+  color: #fff;
+  background-color: #0e90cc;
+  border-color: #0e90cc;
+}
+
+.btn-blue:not(:disabled):not(.disabled):active:focus, .btn-blue:not(:disabled):not(.disabled).active:focus,
+.show > .btn-blue.dropdown-toggle:focus {
+  box-shadow: 0 0 0 0.2rem rgba(45, 174, 191, 0.5);
+}
+/*a {
+  color: #007bff;
+  text-decoration: none;
+  background-color: transparent;
+  -webkit-text-decoration-skip: objects;
+}*/
+.container-width{
+  /*position:relative;*/
+  padding:20px;
+  /*width:900px;
+  height:564px;*/
+  /*overflow: hidden;*/
+  background: -prefix-linear-gradient(left top,#6d5855,#3b2d2a);
+  background: linear-gradient(to bottom right,#6d5855,#3b2d2a);
+  position:absolute;
+  left:0;
+  top:0;
+  width:100%;
+  height:100%;
+}
+
+.el-header {
+  padding: 5px 0 0 0 !important;
+}
+
+.header{
+  /*background-color: rgba(0,153,204,1);*/
+  /*color: #fff;*/
+  -webkit-app-region: drag;
+  margin-top: -20px;
+  padding-top: 5px;
+  height: 60px;
+  color: #fff;
+  background: url(../assets/img/header-bg.png) no-repeat 140px 0;
+}
+
+.header i {
+  color: #fff;
+}
+.webkit-drag {
+  -webkit-app-region: no-drag
+}
+
+.media-body {
+  -ms-flex: 1;
+  flex: 1;
+}
+
+.border {
+  border-color: rgba(0,153,204,0.8) !important
+}
+
+.btn-block {
+  display: block;
+  width: 100%;
+}
+
+.el-button--medium {
+  padding: .375rem .75rem;
+  font-size: 1rem;
+  line-height: 1.5;
+  border-radius: .25rem;
+}
+.el-main {
+  padding: 0!important;
+  position: relative;
+  background: #fbf6f3;
+  overflow: hidden;
+}
+.el-loading-mask {
+  position: fixed !important;
+}
+.el-tabs__item.is-active {
+  color: #495057!important;
+  background-color: #fff;
+  border-color: #fff;
+}
+.el-tabs__item {
+  padding: 0!important;
+  height: auto!important;
+  line-height: initial!important;
+  /*border: 1px solid transparent;*/
+  border-left: none!important;
+  font-size: 12px!important;
+  color: #007bff!important;
+  /*font-weight: 500!important;*/
+}
+.el-tabs--card>.el-tabs__header .el-tabs__nav{
+  border: none!important;
+}
+.version-name {
+  margin-left: 15px;
+  color: #ddd;
+  font-size: 12px;
+}
+.el-tabs__header {
+  position: absolute!important;
+  right: 2.5%!important;
+  top: 0!important;
+  padding-left: 1rem!important;
+  border: 0!important;
+  display: flex!important;
+  -ms-flex-wrap: wrap!important;
+  flex-wrap: wrap!important;
+  margin-bottom: 0!important;
+  list-style: none!important;
+  margin-top: 0!important;
+}
+.el-tabs__item .detail-title{
+  padding: 14px 25px;
+  display: block;
+}
+.el-tabs__item:hover{
+  background-color: #fff;
+  border-color: #fff;
+}
+
+.el-tabs__content{
+  position: absolute!important;
+  top:80px!important;
+  width: 95%;
+  bottom: 15px;
+  margin: 0 2.5%;
+  background-color: #fff;
+}
+
+.downloaditem {
+  background: #fbf6f3;
+  border-radius: 3px;
+  padding: 10px;
+  font-size: 14px;
+  border: 2px solid #fbf6f3;
+  margin: 10px 0 10px 0;
+}
+
+.downloaditem button{
+  font-size: 12px;
+}
+
+.text-danger {
+  color: #dc3545!important;
+}
+.el-progress-bar {
+  vertical-align: -webkit-baseline-middle !important;
+}
+.el-progress.is-success .el-progress-bar__inner {
+  background-color: #28a745 !important;
+}
+.el-progress-bar__inner,.el-progress-bar__outer {
+  border-radius: .25rem !important;
+}
+.download-header {
+  cursor: pointer;
+  font-size: 12px !important;
+}
+.progress-content .float-right {
+  font-size: 16px;
+}
+.progress-width {
+  width: 85%;
+}
+.text-secondary {
+  color: #6c757d!important;
+}
+.badge-orange {
+  font-size: 12px;
+  background: #ff9900;
+}
+.software-list{
+  position: absolute;
+  top: 0;
+  bottom: 0;
+  width: 100%;
+  overflow-y: auto!important;
+}
+.software-item {
+  background: #fff;
+  border: 2px solid #fff;
+  border-radius: 3px;
+  padding: 12px;
+  margin: 0 15px 15px;
+}
+.software-title {
+  font-size: 16px;
+  font-weight: bold;
+}
+.software-body {
+  width: 50%;
+}
+.software-item .software-body{
+  width:85% !important;
+}
+.software-item a{
+  color:#333;
+}
+.software-item a:hover{
+  text-decoration: none;
+}
+
+.software-version {
+  font-size: 14px;
+  color: #888;
+}
+.software-left {
+  position: absolute;
+  width: 27%;
+  top: 0;
+  bottom: 0;
+  left: 0;
+}
+
+.open-left {
+  position: absolute;
+  top: 45%;
+  left: 100%;
+  z-index: 100;
+}
+.open-left span {
+  display: inline-block;
+  font-size: 16px;
+  width: 12px;
+  text-align: center;
+  padding: 10px 0;
+  background: #fff;
+  color: #574542;
+  cursor: pointer;
+}
+.software-num{
+  position:absolute;
+  top:15px;
+  right:0;
+  background:#e9e9e9;
+  color:#555;
+  display:inline-block;
+  padding:3px 8px;
+}
+.software-left-bottom {
+  z-index: 999;
+  position:absolute;
+  width:100%;
+  bottom:0;
+  left:0;
+  background:#fff;
+  height:55px;
+}
+
+.local-software {
+  position: absolute;
+  width: 100%;
+  top: 0;
+  left: 0;
+  bottom: 47px;
+  background: #fff;
+  overflow-y: auto;
+}
+.local-software a{
+  text-decoration: none;
+}
+.software {
+  position: relative;
+  padding: 12px 0;
+  margin: 0 15px;
+  border-bottom: 1px solid #f5ede7;
+  cursor: pointer;
+}
+.software.active {
+  font-weight: bold;
+  color: #ff6501;
+}
+.software.active a {
+  color: #ff6501;
+}
+.software a {
+  color: #333;
+  text-decoration: none;
+  display: block;
+}
+.software:hover a{
+  color:#ff6501;
+}
+.software.active:before{
+  position:absolute;
+  content: "";
+  top:20px;
+  right:-15px;
+  height: 0px;
+  width: 0px;
+  border-top: 7px solid transparent;
+  border-right: 8px solid #fbf6f3;
+  border-bottom: 8px solid transparent;
+}
+.software.active .software-num,.software:hover .software-num{
+  background:#ff6501;
+  color:#fff;
+}
+.command-menu {
+  padding: .5rem 0 !important;
+  color: #212529 !important;
+  border-radius: .25rem !important;
+  margin: .125rem 0 0 !important;
+  font-size: 1rem !important;
+}
+.command-item {
+  font-size: 1rem !important;
+}
+.el-popper[x-placement^=top] {
+  margin-bottom: 5px!important;
+}
+
+.software-startup-detail {
+  position:absolute;
+  top: 0;
+  left:27%;
+  bottom:0;
+  width:73%;
+  overflow-y:auto;
+}
+
+.iconbg-purple {
+  background: #8a7bfd;
+  color: #fff;
+}
+.iconbg-green {
+  background: #0fb890;
+  color: #fff;
+}
+.iconbg {
+  display: block;
+  width: 30px;
+  padding: 8px 0;
+  margin: 0 0 5px 9px;
+  text-align: center;
+}
+
+.software-content {
+  height: 100%;
+  overflow-y: auto;
+  padding: 15px;
+}
+.details {
+  background: #fbf6f3;
+  padding: 15px;
+  border: 2px solid #fff;
+  border-radius: 3px;
+  margin: 0 0 15px;
+  color: #888;
+  font-size: 14px;
+}
+.software-item:hover,.details:hover{
+  border:2px solid rgba(255,101,5,0.2);
+}
+.software-item:hover .btn-white,.details:hover .btn-white{
+  background:#ff6501;
+  color:#fff;
+  border:1px solid #ff6501;
+}
+.details-title {
+  width: 72%;
+  font-size: 16px;
+  color: #333;
+}
+.software-stitle {
+  font-size: 14px;
+  color: #888;
+}
+.details .details-title .w-25 {
+  font-size: 16px;
+  color: #333;
+  font-weight: 500;
+  width: 35%!important;
+}
+.details .w-25 {
+  font-size: 16px;
+  font-weight: bold;
+  color: #333;
+}
+
+.software-content a{
+  cursor: pointer;
+  color: #007bff!important;
+}
+.btn-success {
+  color: #fff !important;
+  background-color: #28a745 !important;
+  border-color: #28a745 !important;
+}
+.modal-body {
+  max-height: 300px;
+  overflow-y: auto;
+}
+.btn-secondary {
+  color: #fff;
+  background-color: #6c757d;
+  border-color: #6c757d;
+}
+.btn-secondary:hover {
+  color: #fff;
+  background-color: #5a6268;
+  border-color: #545b62;
+}
+
+.usb-header {
+  cursor: pointer;
+  font-size: 12px !important;
+}
+.downloadlist {
+  min-width: 500px!important;
+  max-height: 450px!important;
+  padding: 10px 15px!important;
+  overflow-y: auto!important;
+}
+.usblist {
+  min-width: 550px!important;
+  max-height: 450px!important;
+  padding: 10px 15px!important;
+  overflow-y: auto!important;
+}
+.downloading {
+  font-size: 14px;
+}
+.downloading button{
+  font-size: 12px;
+}
+.text-orange {
+  color: #ff6501;
+  padding: 0 10px;
+}
+.header-return {
+  display: inline-block;
+  font-size: 20px;
+  font-weight: bold;
+  padding: 13px 5px 0 0;
+}
+.el-dialog__body {
+  margin: 10px 0 !important;
+  padding: 0 0 10px 0 !important;
+  border-bottom: 1px solid #e9ecef !important;
+  border-top: 1px solid #e9ecef !important;
+  font-size: 12px !important;
+}

BIN
src/renderer/assets/img/header-bg.png


BIN
src/renderer/assets/img/logo.jpg


BIN
src/renderer/assets/logo.png


+ 83 - 113
src/renderer/components/StartUpPage.vue

@@ -1,26 +1,44 @@
 <template>
-  <el-container class="container container-width border rounded pl-0 pr-0">
-    <el-header class="media p-3 header border-bottom shadow-sm">
-      <div class="media-body">
-        <div class="float-right webkit-drag">
-          <usb-header ref="usb" v-on:softwareDownload="relationDownload"></usb-header>
-          <download-header ref="download"></download-header>
-          <div class="float-left mr-3"><i class="fas fa-minus" @click="minimizeWindow"></i></div>
-          <div class="float-right"><i class="fas fa-times" @click="closeWindow"></i></div>
+  <el-container class="container-width rounded">
+    <el-header class="header">
+      <div class="d-flex">
+        <div class="" v-show="iconShow">
+          <span class="header-return webkit-drag">
+            <a @click="goURL">
+            <i class="fas fa-angle-left" style="vertical-align: text-top"></i>
+            </a>
+          </span>
+        </div>
+        <div v-if="iconShow" class="p-2"><img src="../assets/img/logo.jpg" width="30" height="30"></div>
+        <div class="pt-2 pb-2 pr-2" v-else ><img src="../assets/img/logo.jpg" width="30" height="30"></div>
+        <div class="p-2"><h5 class="mt-1">纵横启动器 <span class="version-name">版本:V{{ version }}</span></h5></div>
+        <div class="ml-auto p-2 pt-3 webkit-drag">
+          <div class="d-flex flex-wrap">
+            <div class="">
+              <usb-header ref="usb" v-on:softwareDownload="relationDownload"></usb-header>
+            </div>
+            <div class="">
+              <download-header ref="download"></download-header>
+            </div>
+            <div class="">
+              <div class="mr-3"><i class="fas fa-minus" @click="minimizeWindow"></i></div>
+            </div>
+            <div class="">
+              <div class=""><i class="fas fa-times" @click="closeWindow"></i></div>
+            </div>
+          </div>
         </div>
-        <h5><a class="mr-2 webkit-drag" @click="goURL"><i class="fas fa-th-large"></i></a>纵横启动器</h5>
-        <!--<h5 class="webkit-drag"><router-link to="/firstopen">open</router-link>&nbsp;<router-link to="/softwarelist">softwarelist</router-link></h5>-->
       </div>
     </el-header>
     <el-main>
       <router-view v-on:softwareDownload="relationDownload"></router-view>
-      <!--<first-open></first-open>-->
     </el-main>
     <software-update></software-update>
   </el-container>
 </template>
 
 <script>
+  import pkg from '../../../package.json'
   import mixin from './mixin'
   import SoftwareUpdate from './StartUpPage/SoftwareUpdate'
   import UsbHeader from './StartUpPage/UsbHeader'
@@ -34,6 +52,14 @@
     name: 'element-page',
     mixins: [mixin],
     components: { SoftwareUpdate, UsbHeader, DownloadHeader },
+    data: () => ({
+      version: pkg.version,
+      iconShow: false
+    }),
+    watch: {
+      // 如果路由有变化,会再次执行该方法
+      '$route': 'iconshow'
+    },
     created () {
       // 更改为启动前获取最新官网产品数据
       let softwarejson = path.join('data/sc_software.json')
@@ -50,6 +76,32 @@
             self.$http.get('https://smartcost.com.cn/startup/sc_software.json?' + self.RndNum())
               .then(function (response2) {
                 fs.writeJsonSync(softwarejson, response2.data)
+                // 还要更新本地数据
+                let scproductlist = response2.data.sc_product
+                let productlist = self.$db.read().get('sc_productData').value()
+                for (let i in productlist) {
+                  let scproductinfo = scproductlist.find(function (item) {
+                    return item.product_id === productlist[i].product_id
+                  })
+                  self.$db.read().get('sc_productData').updateById(productlist[i].id, scproductinfo).write()
+
+                  let scdownlist = response2.data.sc_down
+                  let downlist = self.$db.read().get('sc_exeData').value()
+                  for (let j in downlist) {
+                    let scdowninfo = scdownlist.find(function (item) {
+                      return item.dwon_id === downlist[j].down_id
+                    })
+                    if (scdowninfo !== undefined) {
+                      let setinfo = {
+                        keyNumber: scdowninfo.key_number,
+                        keytype: scdowninfo.keytype,
+                        simpleName: scdowninfo.product_title,
+                        versionName: scdowninfo.title
+                      }
+                      self.$db.read().get('sc_exeData').updateById(downlist[j].id, setinfo).write()
+                    }
+                  }
+                }
               })
               .catch(function (error2) {
                 throw error2
@@ -58,10 +110,11 @@
         }).catch(function () {
         })
 
-        // 启动前检测数据库一些异常情况,恢复到上一个状态,暂时包含下载列,安装列
-        let downinfo = this.$db.read().get('sc_download').find({ start: false, pause: true }).value()
+        // 启动前检测数据库一些异常情况,恢复到上一个状态,暂时包含下载列,安装列, 删除标记delete的字段
+        this.$db.read().get('sc_download').removeWhere({ delete: true }).write()
+        let downinfo = this.$db.read().get('sc_download').find({ status: 5 }).value()
         if (downinfo !== undefined) {
-          this.$db.read().get('sc_download').updateById(downinfo.id, { start: true, pause: false }).write()
+          this.$db.read().get('sc_download').updateById(downinfo.id, { show: true, start: true, pause: false, resume: false }).write()
         }
         this.$db.read().get('sc_download').updateWhere({ status: 3 }, { status: 2 }).write()
       }
@@ -76,9 +129,21 @@
         window.close()
       },
       goURL () {
-        let first = this.$db.read().get('sc_hadInstall.first').value()
-        let url = first ? { path: '/firstopen' } : { path: this.$db.read().get('sc_hadInstall.url').value() }
-        this.$router.push(url)
+        if (this.$route.path === '/softwarelist') {
+          let first = this.$db.read().get('sc_hadInstall.first').value()
+          let url = first ? { path: '/firstopen' } : { path: this.$db.read().get('sc_hadInstall.url').value() }
+          this.$router.push(url)
+        } else {
+          this.$router.push({ path: '/softwarelist' })
+        }
+      },
+      iconshow () {
+        let path = this.$route.path
+        if (path === '/softwarelist' || path.indexOf('/softwaredetail') !== -1) {
+          this.iconShow = true
+        } else {
+          this.iconShow = false
+        }
       },
       relationDownload (downID) {
         this.$refs.download.adddownload(downID)
@@ -100,99 +165,4 @@
       }
     }
   }
-</script>
-<style>
-  .container {
-    width: 100%;
-    padding-right: 15px;
-    padding-left: 15px;
-    margin-right: auto;
-    margin-left: auto;
-  }
-
-  .container-width {
-    position: relative;
-    width: 900px;
-    height: 564px;
-    position: relative;
-    overflow: hidden;
-    background: url(../assets/img/bg.jpg);
-  }
-
-  .header{
-    background-color: rgba(0,153,204,1);
-    color: #fff;
-    -webkit-app-region: drag
-  }
-  .header i {
-    color: #fff;
-  }
-  .webkit-drag {
-    -webkit-app-region: no-drag
-  }
-
-  .media-body {
-    -ms-flex: 1;
-    flex: 1;
-  }
-
-  .border {
-    border-color: rgba(0,153,204,0.8) !important
-  }
-
-  .btn-block {
-    display: block;
-    width: 100%;
-  }
-  .el-button--primary:focus, .el-button--primary:hover {
-    background: #0fa2bf !important;
-    border-color: #0fa2bf !important;
-    color: #fff !important;
-  }
-  .el-button--medium {
-    padding: .375rem .75rem;
-    font-size: 1rem;
-    line-height: 1.5;
-    border-radius: .25rem;
-  }
-  .el-main {
-    padding: 0!important;
-  }
-  .el-loading-mask {
-    position: fixed !important;
-  }
-  .el-tabs__item.is-active {
-    color: #495057!important;
-    /*border-bottom: 1px solid transparent!important;*/
-    /*border-top: 1px solid #dee2e6!important;*/
-    /*border-left: 1px solid #dee2e6!important;*/
-    /*border-right: 1px solid #dee2e6!important;*/
-    border-top-left-radius: .25rem;
-    border-top-right-radius: .25rem;
-  }
-  .el-tabs__item {
-    border: 1px solid transparent;
-    border-left: none!important;
-    font-size: 1rem!important;
-    color: #007bff!important;
-    font-weight: 500!important;
-
-  }
-  .el-tabs__nav-wrap {
-    padding-left: 1rem!important;
-  }
-  .el-tabs--card>.el-tabs__header .el-tabs__nav{
-    border: none!important;
-  }
-  .el-tabs--card>.el-tabs__header .el-tabs__item.is-active{
-    border-top-color: #dee2e6;
-    border-left: 1px solid #dee2e6!important;
-    border-right-color: #dee2e6;
-  }
-  .btn-sm {
-    padding: .25rem .5rem !important;
-    font-size: .875rem !important;
-    line-height: 1.5 !important;
-    border-radius: .2rem !important;
-  }
-</style>
+</script>

+ 79 - 92
src/renderer/components/StartUpPage/DownloadHeader.vue

@@ -1,33 +1,35 @@
 <template>
   <el-dropdown class="download-header float-left mr-3" ref="downloadmenu" trigger="click" :hide-on-click=false>
     <span class="el-dropdown-link">
-      <i class="fas fa-download"></i><span class="badge badge-pill badge-info ml-2" v-show="downloadNum !== 0">{{ downloadNum }}</span>
+      <i class="fas fa-download"></i><span class="badge badge-pill badge-info badge-orange ml-2" v-show="downloadNum !== 0">{{ downloadNum }}</span>
     </span>
     <!--<el-button @click="testbtn">test</el-button>-->
     <el-dropdown-menu slot="dropdown" class="downloadlist">
       <div v-for="(item, index) in downloads" v-show="!item.delete" :key="item.id" class="downloaditem">
-        <div class="pb-2" v-if="item.isfinish === false">
-          <span class="float-right">
-            <span v-if="item.show">
-              <i v-show="item.pause" class="far fa-pause-circle" @click="operationDownload('pause', item.id, index)"></i>
-              <i v-show="item.resume" class="far fa-play-circle" @click="operationDownload('resume', item.id, index)"></i>
-              <i v-show="item.start" class="far fa-play-circle" @click="operationDownload('start', item.id, index)"></i>
-            </span>
-            &nbsp;&nbsp;{{ item.size }}
-          </span>
-          {{ item.fulltitle }}
+        <div class="pb-2"><span class="float-right">{{ item.size }}</span>{{ item.fulltitle }}</div>
+        <div class="pb-2">
+          <div class="progress-content" v-if="item.isfinish === false">
+            <div class="float-right">
+              <span v-if="item.show">
+                <i v-show="item.pause" class="far fa-pause-circle text-secondary mr-2" @click="operationDownload('pause', item.id, index)"></i>
+                <i v-show="item.resume" class="far fa-play-circle text-secondary mr-2" @click="operationDownload('resume', item.id, index)"></i>
+                <i v-show="item.start" class="far fa-play-circle text-secondary mr-2" @click="operationDownload('start', item.id, index)"></i>
+              </span>
+              <i class="fas fa-times text-danger" @click="deleteDownload(item.id, index)"></i>
+            </div>
+            <div class="progress-width">
+              <el-progress :text-inside="true" :stroke-width="18" :percentage="item.percent" status="success"></el-progress>
+            </div>
+          </div>
+          <div class="progress-content" v-else>
+            <div class="float-right"><i class="fas fa-times text-danger" @click="deleteDownload(item.id, index)"></i></div>
+            <div class="progress-width">
+              <button v-if="item.status === 2" @click="installbtn(item.id, index)" class="btn btn-blue btn-sm btn-lg btn-block">安装软件</button>
+              <button v-else-if="item.status === 3" class="btn btn-secondary btn-sm btn-lg btn-block">正在安装本软件...</button>
+              <button v-else-if="item.status === 4" class="btn btn-success btn-sm btn-lg btn-block">已安装</button>
+            </div>
+          </div>
         </div>
-        <div class="pb-2" v-else>
-          <span class="float-right">
-            <i class="fas fa-times text-danger" @click="deleteDownload(item.id, index)"></i>
-          </span>{{ item.fulltitle }}
-        </div>
-        <div class="pb-2" v-if="item.status === 1">
-          <el-progress :text-inside="true" :stroke-width="18" :percentage="item.percent" status="success"></el-progress>
-        </div>
-        <el-button v-else-if="item.status === 2" @click="installbtn(item.id, index)" type="primary" size="medium" class="btn-sm btn-block btn-blue">安装软件</el-button>
-        <el-button v-else-if="item.status === 3" type="primary" size="medium" class="btn-sm btn-block btn-blue">正在安装本软件...</el-button>
-        <el-button v-else-if="item.status === 4" type="primary" size="medium" class="btn-sm btn-block btn-blue">已安装</el-button>
       </div>
     </el-dropdown-menu>
   </el-dropdown>
@@ -54,6 +56,9 @@
         info.percent = percent
         console.log(info)
         this.downloads.splice(msg.index, 1, info)
+        if (!this.checkOnline() && info.pause === true) {
+          this.operationDownload('pause', msg.id, msg.index)
+        }
       })
       this.$db._.mixin(lodashId)
       this.downloads = this.$db.read().get('sc_download').value()
@@ -69,18 +74,21 @@
         this.$db.read().get('sc_download').getById(msg.id).assign(info).write()
         // 通知下载完成
         let notification = {
-          title: '下载器',
+          title: '启动器',
           body: info.fulltitle + '下载完成'
         }
         let myNotification = new window.Notification(notification.title, notification)
         this.downloads.splice(msg.index, 1, info)
         // 下载完成当前后 获取下一个info并启动它,没有则停止
-        let info2 = this.$db.read().get('sc_download').find({isfinish: false}).value()
+        let info2 = this.$db.read().get('sc_download').find({ status: 1 }).value()
         if (info2 !== undefined) {
           info2.show = true
+          info2.status = 5
           this.$db.read().get('sc_download').getById(info2.id).assign(info2).write()
-          let index = this.downloads.length - this.$db.read().get('sc_download').filter({isfinish: false}).size().value()
-          console.log(index)
+          // let index = this.downloads.length - this.$db.read().get('sc_download').filter({ status: 6 }).size().value()
+          let index = this.downloads.findIndex(function (item) {
+            return item.id === info2.id
+          })
           this.downloads.splice(index, 1, info2)
           this.operationDownload('start', info2.id, index)
         }
@@ -115,36 +123,61 @@
         }
       },
       operationDownload (status, id, index) {
+        let info = this.$db.read().get('sc_download').getById(id).value()
         if (this.checkOnline()) {
-          let info = this.$db.read().get('sc_download').getById(id).value()
           if (status === 'start') {
             this.$electron.ipcRenderer.send('download', {id: id, index: index})
             info.start = false
             info.resume = false
             info.pause = true
-          } else if (status === 'pause') {
-            this.$electron.ipcRenderer.send(status, id)
-            info.pause = false
-            info.resume = true
-            info.start = false
           } else if (status === 'resume') {
             this.$electron.ipcRenderer.send(status, id)
             info.pause = true
             info.resume = false
             info.start = false
           }
-          this.downloads.splice(index, 1, info)
-          this.$db.read().get('sc_download').getById(id).assign(info).write()
         }
+        if (status === 'pause') {
+          this.$electron.ipcRenderer.send(status, id)
+          info.pause = false
+          info.resume = true
+          info.start = false
+        }
+        this.downloads.splice(index, 1, info)
+        this.$db.read().get('sc_download').getById(id).assign(info).write()
       },
       deleteDownload (id, index) {
         try {
           let info = this.$db.read().get('sc_download').getById(id).value()
+          if (info.status === 5) {
+            if (info.start === false) {
+              this.$electron.ipcRenderer.send('cancel', id)
+              info.show = false
+              info.start = true
+              info.pause = false
+              info.resume = false
+            }
+            // 改变下一个数据的下载状态,没有则结束
+            let info2 = this.$db.read().get('sc_download').find({status: 1}).value()
+            if (info2 !== undefined) {
+              info2.show = true
+              info2.status = 5
+              this.$db.read().get('sc_download').getById(info2.id).assign(info2).write()
+              let index2 = this.downloads.findIndex(function (item) {
+                return item.id === info2.id
+              })
+              console.log('info2:' + index2)
+              this.downloads.splice(index2, 1, info2)
+              // this.operationDownload('start', info2.id, index)
+            }
+          }
           info.delete = true
-          // this.$db.read().get('sc_download').removeById(id).write()
-          // this.downloads.splice(index, 1)
+          info.status = 6
           this.$db.read().get('sc_download').getById(id).assign(info).write()
+          console.log('info:' + index)
           this.downloads.splice(index, 1, info)
+          // this.$db.read().get('sc_download').removeById(id).write()
+          // this.downloads.splice(index, 1)
           this.downloadNum = this.$db.read().get('sc_download').filter({delete: false}).size().value()
           // fs.removeSync(info.savepath)
         } catch (err) {
@@ -159,6 +192,9 @@
           let downinfo = downlist.find(function (item) {
             return item.down_id === downID
           })
+          delete downinfo.regedits
+          delete downinfo.versionDesc
+
           downinfo.isfinish = false
           downinfo.percent = 0
           downinfo.savepath = downinfo.down_url.substring(downinfo.down_url.lastIndexOf('/') + 1)
@@ -181,28 +217,29 @@
             productinfo = this.$db.read().get('sc_productData').insert(scproductinfo).write()
           }
           downinfo.pid = productinfo.id
-          downinfo.version = productinfo.version
           let info = this.$db.read().get('sc_download').insert(downinfo).write()
           this.downloads.push(downinfo)
           this.downloadNum = this.$db.read().get('sc_download').filter({delete: false}).size().value()
           // 如果downloads中没有未下载的info,就让新增的info进入下载过程
-          let info2 = this.$db.read().get('sc_download').find({isfinish: false}).value()
-          if (info2 !== undefined && info.id === info2.id) {
+          let info2 = this.$db.read().get('sc_download').find({status: 5}).value()
+          let info3 = this.$db.read().get('sc_download').find({status: 1}).value()
+          if (info2 === undefined && info.id === info3.id) {
             info.show = true
+            info.status = 5
             this.$db.read().get('sc_download').getById(info.id).assign(info).write()
             this.operationDownload('start', info.id, this.downloads.length - 1)
           }
         }
       },
       testbtn () {
-        this.adddownload('326')
+        console.log(this.$route.path)
       },
       installbtn (id, index) {
         // 安装exe监测,5s后开始监听安装状态
         let info = this.$db.read().get('sc_download').getById(id).value()
         if (info.status === 2) {
           // 判断启动器是否已安装本软件
-          let exesqlinfo = this.$db.read().get('sc_exeData').find({ regeditName: info.regedit, fileVersion: info.version }).value()
+          let exesqlinfo = this.$db.read().get('sc_exeData').find({ regeditName: info.regedit, product_version: info.version }).value()
           if (exesqlinfo !== undefined) {
             this.$message({
               message: `启动器已存在相同版本的 ${info.fulltitle} 软件`,
@@ -257,54 +294,4 @@
       }
     }
   }
-</script>
-
-<style>
-  .downloadlist {
-    min-width: 400px!important;
-    max-height: 450px!important;
-    padding: 10px 15px!important;
-    overflow-y: auto!important;
-  }
-
-  .downloaditem {
-    border: 1px solid #dee2e6;
-    background: #fefaf9;
-    border-radius: 7px;
-    padding: 10px;
-    margin: 15px 0;
-  }
-
-  .text-danger {
-    color: #dc3545!important;
-  }
-  .el-progress.is-success .el-progress-bar__inner {
-    background-color: #28a745 !important;
-  }
-  .el-progress-bar__inner,.el-progress-bar__outer {
-    border-radius: .25rem !important;
-  }
-  .badge-info {
-    color: #fff;
-    background-color: #ff9900;
-  }
-  .badge-pill {
-    padding-right: .6em;
-    padding-left: .6em;
-    border-radius: 10rem;
-  }
-  .badge {
-    display: inline-block;
-    padding-top: .25em;
-    padding-bottom: .25em;
-    font-size: 75%;
-    font-weight: 700;
-    line-height: 1;
-    text-align: center;
-    white-space: nowrap;
-    vertical-align: baseline;
-  }
-  .download-header {
-     cursor: pointer;
-  }
-</style>
+</script>

+ 11 - 39
src/renderer/components/StartUpPage/FirstOpen.vue

@@ -1,15 +1,15 @@
 <template>
-  <div class="first-open software-wrap p-3" v-loading="loading" element-loading-text="正在获取本地数据中,请稍候...">
+  <div class="first-open software-wrap p-3">
     <div style="margin-top: 80px;">
       <el-row type="flex" :gutter="30">
-        <el-col :span="6"></el-col>
-        <el-col :span="6">
-          <el-button type="primary" size="medium" class="btn btn-primary btn-blue btn-block" @click="openlist('software-list')">下载软件</el-button>
+        <el-col :span="5"></el-col>
+        <el-col :span="7">
+          <button size="medium" class="btn btn-orange btn-block" @click="openlist('software-list')"><i class="fas fa-download mr-2"></i>下载软件</button>
         </el-col>
-        <el-col :span="6">
-          <el-button type="primary" size="medium" class="btn btn-primary btn-blue btn-block" @click="updateInstalledSoftware">添加已安装软件</el-button>
+        <el-col :span="7">
+          <button size="medium" class="btn btn-blue btn-block" @click="updateInstalledSoftware"><i class="fas fa-plus mr-2"></i>添加已安装软件</button>
         </el-col>
-        <el-col :span="6"></el-col>
+        <el-col :span="5"></el-col>
       </el-row>
     </div>
   </div>
@@ -19,29 +19,6 @@
   import mixin from '../mixin'
   export default {
     mixins: [mixin],
-    data: () => ({
-      loading: false
-    }),
-    created () {
-      let self = this
-      this.$electron.ipcRenderer.once('successUpdate', (event, msg) => {
-        self.loading = false
-        let id = msg.id
-        self.$router.push({
-          name: 'software-startup-detail',
-          params: { productid: id }
-        })
-      })
-
-      this.$electron.ipcRenderer.on('failedUpdate', (event, msg) => {
-        self.loading = false
-        let id = msg.id
-        self.$router.push({
-          name: 'software-startup-detail',
-          params: { productid: id }
-        })
-      })
-    },
     methods: {
       openlist (index) {
         this.$router.push({
@@ -49,16 +26,11 @@
         })
       },
       updateInstalledSoftware () {
-        this.loading = true
-        this.$electron.ipcRenderer.send('updateInstall')
-        // this.$router.push({
-        // name: 'software-startup'
-        // })
+        this.$router.push({
+          name: 'software-startup-detail',
+          params: {productid: '1'}
+        })
       }
     }
   }
 </script>
-
-<style>
-
-</style>

+ 9 - 46
src/renderer/components/StartUpPage/SoftwareDetail.vue

@@ -1,7 +1,6 @@
 <template>
   <div class="software-detail" v-loading="loading">
-    <div class="pt-3 pl-3">
-      <div class="mt-2 pt-1 mr-2 float-left"><a class="software-detail-a" @click="$router.back(-1)"><h4><i class="fas fa-angle-left"></i></h4></a></div>
+    <div class="pt-3" style="padding-left: 2.5%">
       <div class="media">
         <img class="mr-3" :src="items.src" width="50" height="50" :alt="items.title">
         <div class="media-body">
@@ -13,16 +12,17 @@
     <div class="pt-3">
       <el-tabs v-model="activeName" type="card" @tab-click="checkOnline">
         <el-tab-pane class="pl-3 software-content" name="first">
-          <span slot="label">下载软件</span>
+          <span slot="label" class="detail-title"><span class="iconbg iconbg-purple rounded"><i class="fas fa-download"></i></span>下载软件</span>
           <div class="details" v-for="down in downlist">
-            <h5 class="w-25 d-inline-block">{{ down.title }}</h5>
-            <div class="w-50 d-inline-block"><span v-if="down.key_number !== ''">锁号:{{ down.key_number }}</span></div>
             <div class="float-right">
-              <el-button type="primary" @click="downloadSoftware(down.down_id, down.version)" class="btn btn-primary btn-blue btn-sm d-inline-block">下载</el-button>
+              <button @click="downloadSoftware(down.down_id, down.version)" class="btn btn-white btn-sm"><i class="fas fa-download mr-2"></i>下载</button>
             </div>
+            <h5 class="w-25 d-inline-block">{{ down.title }}</h5>
+            <div class="w-50 d-inline-block"><span v-if="down.key_number !== ''">锁号:{{ down.key_number }}</span></div>
           </div>
         </el-tab-pane>
-        <el-tab-pane label="软件详情" class="pl-3 software-content" name="second" v-html="items.content">
+        <el-tab-pane class="pl-3 software-content" name="second" v-html="items.content">
+          <span slot="label" class="detail-title"><span class="iconbg iconbg-green rounded"><i class="fas fa-info"></i></span>软件详情</span>
         </el-tab-pane>
       </el-tabs>
     </div>
@@ -78,7 +78,7 @@
       },
       downloadSoftware (downID, version) {
         // 先判断是否已在下载列表中,再加入列表中
-        let downloaditem = this.$db.read().get('sc_download').find({ down_id: downID, version: version }).value()
+        let downloaditem = this.$db.read().get('sc_download').find({ down_id: downID, version: version, delete: false }).value()
         if (!downloaditem) {
           this.$emit('softwareDownload', downID)
         } else {
@@ -111,41 +111,4 @@
   window.openURL = function (url) {
     electron.shell.openExternal(url)
   }
-</script>
-
-<style>
-  .software-detail {
-    width: 100%;
-    height: 497px;
-    overflow-y: auto;
-  }
-  .software-detail-a {
-    color: #007bff;
-    text-decoration: none;
-    background-color: transparent;
-  }
-  .details {
-    padding: 15px 0;
-    border-bottom: 1px dotted #ccc;
-  }
-  .details:hover{
-    border-bottom:1px solid #ff6501;
-  }
-  .w-25 {
-    width: 25%!important;
-  }
-  .w-50 {
-    width: 50%!important;
-  }
-  .software-content {
-    height: 337px;
-    overflow-y: auto;
-    padding-right: 15px;
-  }
-  .d-inline-block {
-    display: inline-block!important;
-  }
-  .software-content a{
-    cursor: pointer;
-  }
-</style>
+</script>

+ 13 - 46
src/renderer/components/StartUpPage/SoftwareList.vue

@@ -1,22 +1,22 @@
 <template>
-  <div class="software-list pt-4 pb-2">
+  <div class="software-list pt-3">
     <el-row type="flex" justify="center" v-for="software in softwarelist" :key="software.product_id">
-      <el-col :span="22" class="software-item">
+      <el-col :span="24" class="software-item">
         <router-link :to="{ name: 'software-detail', params: { pid: software.product_id }}">
           <div class="media">
             <img class="mr-3" :src="software.src" width="40" height="40" :alt="software.title">
-            <div class="media-body">
-              <div class="software-body float-left">
-                <h5 class="software-title mb-1">{{ software.title }}</h5>
-                <div>{{ software.productName }}</div>
-              </div>
-              <div class="float-left">
-                版本号:{{ software.version }}
-                <br>
-                更新时间:{{ software.updateTime }}
-              </div>
+            <div class="media-body clearfix">
               <div class="float-right">
-                <el-button type="primary" class="btn btn-primary btn-blue btn-sm mt-2">详情</el-button>
+                <button class="btn btn-white btn-sm mt-2"><i class="fas fa-align-left mr-2"></i>详情</button>
+              </div>
+              <div class="software-body">
+                <div class="float-right">
+                  <div class="software-version">更新时间:{{ software.updateTime }}</div>
+                </div>
+                <div class="software-bodyleft">
+                  <h5 class="software-title mb-1">{{ software.title }}</h5>
+                  <div class="software-stitle">{{ software.productName }}</div>
+                </div>
               </div>
             </div>
           </div>
@@ -43,36 +43,3 @@
     }
   }
 </script>
-
-<style>
-  .software-list{
-    overflow-y: auto!important;
-  }
-  .software-item {
-    float: left;
-    background: #fefaf9;
-    border: 1px solid #ddd;
-    border-radius: 7px;
-    padding: 15px;
-    margin-top: 5px;
-    margin-bottom: 15px;
-  }
-  .software-item:hover{
-    background:#fdf5f2;
-    border:1px solid #ff6501;
-  }
-  .software-item a {
-    color: #333;
-  }
-  .software-item a:hover{
-    text-decoration: none;
-  }
-  .software-title {
-    font-size: 16px;
-    font-weight: bold;
-  }
-  .software-body {
-    width: 50%;
-  }
-
-</style>

+ 29 - 106
src/renderer/components/StartUpPage/SoftwareStartup.vue

@@ -1,24 +1,30 @@
 <template>
   <div class="software-startup software-wrap" v-loading="loading" element-loading-text="正在获取本地数据中,请稍候...">
-    <div class="software-left border-right border-top">
+    <div class="software-left">
+      <div class="open-left">
+        <span><i class="fas fa-chevron-left"></i></span>
+      </div>
       <div class="local-software">
-        <div class="software media p-3" v-for="product in productlist" :key="product.id" :class="[products.id === product.id ? 'active' : '']">
+        <router-link v-for="product in productlist" :key="product.id" :to="{ name: 'software-startup-detail', params: { productid: product.id } }">
+        <div class="software media" :class="[products.id === product.id ? 'active' : '']">
           <img class="mr-2" :src="product.src" width="25" height="25" :alt="product.title">
-          <div class="media-body">
-            <div class="mt-0 mb-1"><router-link :to="{ name: 'software-startup-detail', params: { productid: product.id } }">{{ product.title }}</router-link></div>
+          <div class="media-body left-media-body">
+            <div class="mt-1 mb-1"><router-link :to="{ name: 'software-startup-detail', params: { productid: product.id } }">{{ product.title }}</router-link></div>
+            <span class="software-num rounded">{{ product.pnum }}</span>
           </div>
         </div>
+        </router-link>
       </div>
-      <div class="software-left-bottom border-top">
-        <div class="d-flex bd-highlight">
-          <div class="p-2 flex-fill bd-highlight">
-            <el-button style="width:100%;" type="primary" class="btn btn-primary btn-blue btn-sm" @click="openlist('software-list')">下载软件</el-button>
+      <div class="software-left-bottom">
+        <div class="d-flex">
+          <div class="p-2 flex-fill">
+            <button style="width:100%;" class="btn btn-orange btn-sm" @click="openlist('software-list')">下载软件</button>
           </div>
-          <div class="p-2 flex-fill bd-highlight">
+          <div class="p-2 flex-fill dropup">
             <el-dropdown placement="top" trigger="click" style="width:100%;" @command="clickbtn">
-              <el-button type="primary" style="width:100%;" class="btn btn-primary btn-blue btn-sm">
+              <button style="width:100%;" class="btn btn-blue btn-sm">
                 添加软件<i class="el-icon-arrow-up el-icon--right"></i>
-              </el-button>
+              </button>
               <el-dropdown-menu class="command-menu" slot="dropdown">
                 <el-dropdown-item class="command-item" command="auto">自动获取</el-dropdown-item>
                 <el-dropdown-item class="command-item" command="manual">手动添加</el-dropdown-item>
@@ -47,6 +53,7 @@
       }
     },
     created () {
+      this.checkfirst()
       this.fetchData()
       let self = this
       this.$electron.ipcRenderer.on('successUpdate', (event, msg) => {
@@ -143,7 +150,17 @@
       fetchData () {
         let pid = this.$route.params.productid === undefined ? this.$db.read().get('sc_productData').last().value().id : this.$route.params.productid
         this.products = this.$db.read().get('sc_productData').getById(pid).value()
-        this.productlist = this.$db.read().get('sc_productData').filter({ isshow: true }).orderBy('addtime', 'desc').value()
+        let plist = this.$db.read().get('sc_productData').filter({ isshow: true }).orderBy('orders', 'asc').value()
+        for (let i in plist) {
+          plist[i]['pnum'] = this.$db.read().get('sc_exeData').filter({ pid: plist[i].id }).size().value()
+        }
+        this.productlist = plist
+      },
+      checkfirst () {
+        let first = this.$db.read().get('sc_hadInstall.first').value()
+        if (first) {
+          this.clickbtn('auto')
+        }
       },
       openlist (index) {
         this.$router.push({
@@ -161,97 +178,3 @@
     }
   }
 </script>
-
-<style>
-  .software-left {
-    position: absolute;
-    width: 250px;
-    top: 59px;
-    bottom: 0;
-    left: 0;
-  }
-  .border-right {
-    border-right: 1px solid #dee2e6!important;
-  }
-  .border-top {
-    border-top: 1px solid #dee2e6!important;
-  }
-  .local-software {
-    position: absolute;
-    width: 100%;
-    top: 0;
-    left: 0;
-    bottom: 50px;
-    /* background: #f9f9f9; */
-    background-color: rgba(254,250,249,0.3);
-    overflow-y: auto;
-  }
-  .software-left-bottom {
-    background-color: rgba(251,231,216,0.5);
-    z-index: 999;
-    position: absolute;
-    width: 100%;
-    bottom: 0;
-    left: 0;
-  }
-  .local-install {
-    position: absolute;
-    top: 80px;
-    right: 0;
-    bottom: 0;
-    width: 648px;
-    overflow-y: auto;
-  }
-  .software.active {
-    background: #fdf5f2;
-    border-left: 3px solid #ff6501;
-  }
-  .software.active a {
-    color: #333;
-  }
-  .software a {
-    text-decoration: none;
-  }
-  .d-flex {
-    display: -ms-flexbox!important;
-    display: flex!important;
-  }
-  .flex-fill {
-    -ms-flex: 1 1 auto!important;
-    flex: 1 1 auto!important;
-  }
-  .software-content {
-    height: 337px;
-    overflow-y: auto;
-    padding-right: 15px;
-  }
-  .details {
-    padding: 15px 0;
-    border-bottom: 1px dotted #ccc;
-  }
-  .details:hover{
-    border-bottom:1px solid #ff6501;
-  }
-  .w-25 {
-    width: 25%!important;
-  }
-  .w-50 {
-    width: 50%!important;
-  }
-  .d-inline-block {
-    display: inline-block!important;
-  }
-  .command-menu {
-    padding: .5rem 0 !important;
-    color: #212529 !important;
-    border-radius: .25rem !important;
-    margin: .125rem 0 0 !important;
-    font-size: 1rem !important;
-  }
-  .command-item {
-    font-size: 1rem !important;
-  }
-  .el-popper[x-placement^=top] {
-    margin-bottom: 5px!important;
-  }
-</style>

+ 61 - 137
src/renderer/components/StartUpPage/SoftwareStartupDetail.vue

@@ -1,41 +1,45 @@
 <template>
   <div class="software-startup-detail">
-    <div class="media pl-3">
-      <img class="mr-3" :src="products.src" width="50" height="50" :alt="products.title">
-      <div class="media-body">
-        <h5 class="mt-0 mb-1">{{ products.title }}</h5>
-        {{ products.productName }}&nbsp;
+    <div class="software-detail-top pt-3" style="padding-left: 2.5%">
+      <div class="media">
+        <img class="mr-3" :src="products.src" width="50" height="50" :alt="products.title">
+        <div class="media-body">
+          <h5 class="mt-0 mb-1">{{ products.title }}</h5>
+          {{ products.productName }}&nbsp;
+        </div>
       </div>
     </div>
-    <div class="mt-4">
+    <div class="pt-3">
       <el-tabs v-model="activeName" type="card">
-        <el-tab-pane class="pl-3 software-content" name="first">
-          <span slot="label">启动软件</span>
+        <el-tab-pane class="software-content" name="first">
+          <span slot="label" class="detail-title"><span class="iconbg iconbg-purple rounded"><i class="fas fa-download"></i></span>启动软件</span>
           <div class="details" v-for="exe in exelist" :key="exe.id">
-            <h5 class="w-25 d-inline-block" v-if="exe.versionName !== ''">{{ exe.versionName }}</h5>
-            <h5 v-else>{{ exe.fileName }}</h5>
-            <div class="w-50 d-inline-block" v-if="exe.keyNumber !== ''">锁号:{{ exe.keyNumber }}</div>
-            <div class="w-25 d-inline-block"><b>{{ exe.fileVersion }}</b></div>
-            <div class="w-50 d-inline-block">{{ exe.fileDescription }}</div>
             <div class="float-right">
-              <el-button type="primary" class="btn btn-primary btn-blue btn-sm d-inline-block" @click="openExebtn(exe.id)">启动软件</el-button>
-              <b></b>
-              <el-button type="success" v-if="exe.show_tip === true" class="btn btn-success btn-sm d-inline-block" @click="updateExebtn(exe.id)">新版本</el-button>
+              <button class="btn btn-white btn-sm" @click="openExebtn(exe.id)"><i class="fas fa-play mr-2"></i>启动</button>
+              <button v-if="exe.show_tip === true" class="btn btn-success btn-sm ml-2" @click="updateExebtn(exe.id)">新版本</button>
               <el-dialog
                       title="软件更新"
                       :visible.sync="dialogVisible"
                       width="60%">
                 <div class="modal-body" v-html="productVer"></div>
                 <span slot="footer" class="dialog-footer">
-                  <el-button class="btn btn-sm btn-primary btn-blue" type="primary" @click="downloadbtn(did)">下载更新</el-button>
+                  <el-button class="btn btn-sm btn-primary btn-blue" @click="downloadbtn(did, version)">下载更新</el-button>
                   <el-button class="btn btn-sm btn-secondary" @click="ignorebtn(prid, did)">忽略该版本</el-button>
                 </span>
               </el-dialog>
             </div>
-            <div>{{ exe.path }}</div>
+            <div class="details-title">
+              <div class="w-25 d-inline-block" v-if="exe.versionName !== ''">{{ exe.versionName }}</div>
+              <div v-else>{{ exe.fileName }}</div>
+              <div class="d-inline-block" v-if="exe.keyNumber !== ''">锁号:{{ exe.keyNumber }}</div>
+            </div>
+            <div class="w-25 d-inline-block">{{ exe.fileVersion }}</div>
+            <div class="d-inline-block">{{ exe.fileDescription }}</div>
+            <div class="software-stitle">{{ exe.path }}</div>
           </div>
         </el-tab-pane>
-        <el-tab-pane label="软件详情" v-if="products.id != 1" class="pl-3 software-content" name="second" v-html="products.content">
+        <el-tab-pane v-if="products.id != 1" class="software-content" name="second" v-html="products.content">
+          <span slot="label" class="detail-title"><span class="iconbg iconbg-green rounded"><i class="fas fa-info"></i></span>软件详情</span>
         </el-tab-pane>
       </el-tabs>
     </div>
@@ -58,6 +62,7 @@
         dialogVisible: false,
         productVer: '',
         did: '',
+        version: '',
         prid: ''
       }
     },
@@ -83,15 +88,18 @@
         this.products = products
         let exelist = this.$db.read().get('sc_exeData').filter({ pid: productid }).orderBy('addtime', 'desc').value()
         let softwarejson = path.join('data/sc_software.json')
-        let productlist = fse.readJsonSync(softwarejson).sc_product
-        let scproductInfo = productlist.find(function (item) {
-          return item.product_id === products.product_id
-        })
+        let scdownlist = fse.readJsonSync(softwarejson).sc_down
         for (let i = 0; i < exelist.length; i++) {
-          if (scproductInfo !== undefined && scproductInfo.version !== exelist[i].show_updateVersion) {
-            exelist[i].show_updateVersion = scproductInfo.version
+          let scdownInfo = scdownlist.find(function (item) {
+            return item.down_id === exelist[i].down_id
+          })
+          if (scdownInfo !== undefined && scdownInfo.version !== exelist[i].show_updateVersion) {
+            exelist[i].show_updateVersion = scdownInfo.version
             exelist[i].show_tip = true
-            this.$db.read().get('sc_exeData').updateById(exelist[i].id, { show_updateVersion: scproductInfo.version, show_tip: true }).write()
+            this.$db.read().get('sc_exeData').updateById(exelist[i].id, { show_updateVersion: scdownInfo.version, show_tip: true }).write()
+          } else if (scdownInfo !== undefined && scdownInfo.version === exelist[i].product_version) {
+            exelist[i].show_tip = false
+            this.$db.read().get('sc_exeData').updateById(exelist[i].id, { show_updateVersion: scdownInfo.version, show_tip: false }).write()
           }
         }
         this.exelist = exelist
@@ -144,13 +152,35 @@
       },
       updateExebtn (id) {
         let info = this.$db.read().get('sc_exeData').getById(id).value()
-        let productInfo = this.$db.read().get('sc_productData').getById(info.pid).value()
-        this.productVer = productInfo.versionDesc
+        let softwarejson = path.join('data/sc_software.json')
+        let scdownlist = fse.readJsonSync(softwarejson).sc_down
+        let scdowninfo = scdownlist.find(function (item) {
+          return item.down_id === info.down_id
+        })
+        let addhtml = '<p>当前版本:<b>' + info.product_version + '</b>&nbsp;&nbsp;|&nbsp;&nbsp;升级版本:<b>' + info.show_updateVersion + '</b></p>'
+        this.productVer = addhtml + scdowninfo.versionDesc
         this.dialogVisible = true
-        this.did = id
+        this.did = info.down_id
+        this.version = scdowninfo.version
         this.prid = info.pid
       },
-      downloadbtn (id) {
+      downloadbtn (id, version) {
+        let downloaditem = this.$db.read().get('sc_download').find({ down_id: id, version: version, delete: false }).value()
+        if (!downloaditem) {
+          this.$parent.$emit('softwareDownload', id)
+        } else {
+          let softwarejson = path.join('data/sc_software.json')
+          let scdownlist = fse.readJsonSync(softwarejson).sc_down
+          let scdowninfo = scdownlist.find(function (item) {
+            return item.down_id === id
+          })
+          this.$message({
+            showClose: true,
+            message: scdowninfo.fulltitle + '已存在下载列中',
+            iconClass: '',
+            type: 'warning'
+          })
+        }
         this.dialogVisible = false
       },
       ignorebtn (pid, id) {
@@ -188,110 +218,4 @@
   window.openURL = function (url) {
     electron.shell.openExternal(url)
   }
-</script>
-
-<style>
-  .software-left {
-    position: absolute;
-    width: 250px;
-    top: 59px;
-    bottom: 0;
-    left: 0;
-  }
-  .border-right {
-    border-right: 1px solid #dee2e6!important;
-  }
-  .border-top {
-    border-top: 1px solid #dee2e6!important;
-  }
-  .local-software {
-    position: absolute;
-    width: 100%;
-    top: 0;
-    left: 0;
-    bottom: 50px;
-    /* background: #f9f9f9; */
-    background-color: rgba(254,250,249,0.3);
-    overflow-y: auto;
-  }
-  .software-left-bottom {
-    background-color: rgba(251,231,216,0.5);
-    z-index: 999;
-    position: absolute;
-    width: 100%;
-    bottom: 0;
-    left: 0;
-  }
-  .software-startup-detail {
-    position: absolute;
-    top: 80px;
-    right: 0;
-    bottom: 0;
-    width: 648px;
-    overflow-y: auto;
-  }
-  .software.active {
-    background: #fdf5f2;
-    border-left: 3px solid #ff6501;
-  }
-  .software.active a {
-    color: #333;
-  }
-  .software a {
-    text-decoration: none;
-  }
-  .d-flex {
-    display: -ms-flexbox!important;
-    display: flex!important;
-  }
-  .flex-fill {
-    -ms-flex: 1 1 auto!important;
-    flex: 1 1 auto!important;
-  }
-  .software-content {
-    height: 337px;
-    overflow-y: auto;
-    padding-right: 15px;
-  }
-  .details {
-    padding: 15px 0;
-    border-bottom: 1px dotted #ccc;
-  }
-  .details:hover{
-    border-bottom:1px solid #ff6501;
-  }
-  .w-25 {
-    width: 25%!important;
-  }
-  .w-50 {
-    width: 50%!important;
-  }
-  .d-inline-block {
-    display: inline-block!important;
-  }
-  .software-content a{
-    cursor: pointer;
-  }
-  .software-content img{
-    width: 100%;
-  }
-  .btn-success {
-    color: #fff !important;
-    background-color: #28a745 !important;
-    border-color: #28a745 !important;
-  }
-  .modal-body {
-    max-height: 230px;
-    overflow-y: auto;
-  }
-  .btn-secondary {
-    color: #fff;
-    background-color: #6c757d;
-    border-color: #6c757d;
-  }
-  .btn-secondary:hover {
-    color: #fff;
-    background-color: #5a6268;
-    border-color: #545b62;
-  }
-</style>
+</script>

+ 3 - 3
src/renderer/components/StartUpPage/SoftwareUpdate.vue

@@ -38,9 +38,9 @@
     },
     methods: {
       openUpdateDialog () {
-        this.$confirm('更新内容:1:添加XXX功能<br>' +
-          '2:修改XXXbug<br>' +
-          '3:提高了响应速度', '新版本更新提示', {
+        this.$confirm('1.添加版本更新功能<br>' +
+          '2:修复部分已知bug<br>' +
+          '3:内容页样式更新', 'V0.1.5版本更新提示', {
           confirmButtonText: '马上更新',
           cancelButtonText: '稍后再说',
           center: true,

+ 78 - 58
src/renderer/components/StartUpPage/UsbHeader.vue

@@ -1,24 +1,25 @@
 <template>
-  <el-dropdown ref="usbmenu" v-if="usbshow" class="usb-header float-left mr-3" trigger="click" :hide-on-click=false>
+  <el-dropdown ref="usbmenu" v-if="usbshow && !first2" class="usb-header float-left mr-3" trigger="click" :hide-on-click=false>
     <span class="el-dropdown-link">
       <i class="fab fa-usb"></i>
     </span>
-    <el-dropdown-menu slot="dropdown" class="downloadlist">
+    <el-dropdown-menu slot="dropdown" class="usblist">
       <div class="downloading" v-for="lock in lockList">
-        <div class="pb-2 border-bottom">
+        <div class="border-bottom">
           <span class="float-right"></span>
-          <h4>{{ lock.name }}</h4>
+          <h5>{{ lock.name }}</h5>
         </div>
         <div class="pt-3 pb-2" v-for="product in lock.prolist">
           <div class="float-right">
-            <el-button type="primary" class="btn btn-primary btn-blue btn-sm" v-if="product.status === 1" @click="openProduct(product.startpath)">启动</el-button>
-            <el-button type="primary" class="btn btn-primary btn-blue btn-sm" v-else-if="product.status === 2" @click="downloadProduct(product.down_id, product.version)">下载</el-button>
+            <button class="btn btn-success btn-sm" v-if="product.status === 1" @click="openProduct(product.startpath)"><i class="fas fa-play mr-2"></i>启动</button>
+            <button class="btn btn-orange btn-sm" v-else-if="product.status === 2" @click="downloadProduct(product.down_id, product.version)"><i class="fas fa-download mr-2"></i>下载</button>
           </div>
-          {{ product.title }}
+          {{ product.title }}&nbsp;<span class="text-orange">{{ product.version1 }}</span>&nbsp;<span class="software-stitle">{{ product.version2 }}</span>
         </div>
       </div>
     </el-dropdown-menu>
   </el-dropdown>
+  <div class="usb-header float-left mr-3" v-else-if="usbshow && first2" @click="openconfirm()"><i class="fab fa-usb"></i></div>
 </template>
 
 <script>
@@ -29,61 +30,74 @@
     mixins: [mixin],
     data: () => ({
       usbshow: false,
-      lockList: ''
+      lockList: '',
+      first2: false
     }),
     created () {
       this.$electron.ipcRenderer.send('testUsb')
       this.$electron.ipcRenderer.on('usbIn', async (event, result) => {
         this.usbshow = true
-        let alllist = result.lockmsg
-        let productlist = alllist.split('|')
-        let locklist = []
-        let softwarejson = path.join('data/sc_software.json')
-        let downlist = fs.readJsonSync(softwarejson).sc_down
-        let exelist = await this.$db.read().get('sc_exeData').value()
-        // 锁号先关联已安装软件列表提供启动,若不存在则再关联官网软件列表提供下载
-        for (let i in productlist) {
-          let productNum = productlist[i].split(':')[0]
-          let productVerList = productlist[i].split(':')[1].split(';')
-          let data = {
-            name: productNum
-          }
-          let prolist = []
-          for (let j in productVerList) {
-            let pdata
-            let flag = true
-            for (let z in exelist) {
-              if (exelist[z].keytype !== '' && this.in_array(productVerList[j], exelist[z].keytype.split(','))) {
-                pdata = {
-                  title: exelist[z].simpleName + ' ' + exelist[z].versionName + ' ' + exelist[z].fileDescription,
-                  status: 1,
-                  startpath: path.join(exelist[z].path, exelist[z].exeName)
-                }
-                flag = false
-                prolist.push(pdata)
-              }
+        if (result.first === false) {
+          this.first2 = false
+          let alllist = result.lockmsg
+          let productlist = alllist.split('|')
+          let locklist = []
+          let softwarejson = path.join('data/sc_software.json')
+          let downlist = fs.readJsonSync(softwarejson).sc_down
+          let exelist = await this.$db.read().get('sc_exeData').value()
+          // 锁号先关联已安装软件列表提供启动,若不存在则再关联官网软件列表提供下载
+          for (let i in productlist) {
+            let productNum = productlist[i].split(':')[0]
+            let productVerList = productlist[i].split(':')[1].split(';')
+            let data = {
+              name: productNum
             }
-            if (flag) {
-              for (let z in downlist) {
-                if (this.in_array(productVerList[j], downlist[z].keytype.split(','))) {
+            let prolist = []
+            for (let j in productVerList) {
+              let pdata
+              let flag = true
+              for (let z in exelist) {
+                if (exelist[z].keytype !== '' && this.in_array(productVerList[j], exelist[z].keytype.split(','))) {
                   pdata = {
-                    title: downlist[z].product_title + ' ' + downlist[z].title,
-                    status: 2,
-                    down_id: downlist[z].down_id,
-                    version: downlist[z].version
+                    title: exelist[z].simpleName,
+                    version1: exelist[z].versionName,
+                    version2: exelist[z].fileDescription,
+                    status: 1,
+                    startpath: path.join(exelist[z].path, exelist[z].exeName)
                   }
                   flag = false
                   prolist.push(pdata)
-                  break
+                }
+              }
+              if (flag) {
+                for (let z in downlist) {
+                  if (this.in_array(productVerList[j], downlist[z].keytype.split(','))) {
+                    pdata = {
+                      title: downlist[z].product_title,
+                      version1: downlist[z].title,
+                      version2: '',
+                      status: 2,
+                      down_id: downlist[z].down_id,
+                      version: downlist[z].version
+                    }
+                    flag = false
+                    prolist.push(pdata)
+                    break
+                  }
                 }
               }
             }
+            data.prolist = prolist
+            locklist.push(data)
+          }
+          this.lockList = locklist
+          if (this.$refs.usbmenu !== undefined) {
+            this.$refs.usbmenu.show()
           }
-          data.prolist = prolist
-          locklist.push(data)
+        } else {
+          this.first2 = true
+          this.openconfirm()
         }
-        this.lockList = locklist
-        this.$refs.usbmenu.show()
       })
       this.$electron.ipcRenderer.on('usbOut', (event) => {
         this.usbshow = false
@@ -103,7 +117,7 @@
       },
       downloadProduct (downID, version) {
         // 先判断是否已在下载列表中,再加入列表中
-        let downloaditem = this.$db.read().get('sc_download').find({ down_id: downID, version: version }).value()
+        let downloaditem = this.$db.read().get('sc_download').find({ down_id: downID, version: version, delete: false }).value()
         if (!downloaditem) {
           this.$refs.usbmenu.hide()
           this.$emit('softwareDownload', downID)
@@ -115,16 +129,22 @@
             type: 'warning'
           })
         }
+      },
+      openconfirm () {
+        if (this.first2) {
+          this.$confirm('先检测本地安装软件才可以读取软件锁信息,是否添加本地已安装软件的信息?', '软件锁', {
+            confirmButtonText: '确定',
+            cancelButtonText: '取消',
+            type: ''
+          }).then(() => {
+            this.$router.push({
+              name: 'software-startup-detail',
+              params: { productid: '1' }
+            })
+          }).catch(() => {
+          })
+        }
       }
     }
   }
-</script>
-
-<style>
-  .downloadlist {
-    min-width: 400px!important;
-    max-height: 450px!important;
-    padding: 10px 15px!important;
-    overflow-y: auto!important;
-  }
-</style>
+</script>