laiguoran 6 rokov pred
rodič
commit
ebd17ea988

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1 - 1
data/sc_software.json


+ 20 - 2
src/main/index.js

@@ -38,10 +38,10 @@ function initialize () {
      * Initial window options
      */
     const windowOptions = {
-      width: 900,
+      width: 1000,
       // width: 1450,
       height: 564,
-      minWidth: 900,
+      minWidth: 1000,
       minHeight: 564,
       // resizable: false,
       show: true,
@@ -123,3 +123,21 @@ initialize()
 if (process.platform === 'win32') {
   app.setAppUserModelId(pkg.build.appId)
 }
+
+const ipc = electron.ipcMain
+let newwin
+ipc.on('openWindow', (event, data) => {
+  console.log(data)
+  newwin = new BrowserWindow({
+    width: 800,
+    height: 600,
+    minWidth: 1000,
+    minHeight: 564,
+    parent: mainWindow,
+    fullscreenable: true
+  })
+  newwin.loadURL(data)
+  newwin.on('closed', () => {
+    newwin = null
+  })
+})

+ 2 - 1
src/main/main-process/updateInstall.js

@@ -127,7 +127,8 @@ const updateInstall = function (win) {
       let deleteExeData = await db.read().get('sc_exeData').filter({ auto: true, isshow: false }).value()
       for (let exe in deleteExeData) {
         let exePath = path.join(exe.path, exe.exeName)
-        if (fse.pathExistsSync(exePath)) {
+        let existExe = await db.read().get('sc_exeData').find({ path: exe.path, exeName: exe.exeName, isshow: true }).value()
+        if (fse.pathExistsSync(exePath) && !existExe) {
           db.read().get('sc_exeData').updateById(exe.id, { isshow: true }).write()
         }
       }

+ 24 - 8
src/main/main-process/usb-ffi.js

@@ -14,7 +14,7 @@ const electron = require('electron')
 const Notification = electron.Notification
 const ipcMain = electron.ipcMain
 const usb = require('usb')
-
+let usbFlag = false
 const usbffi = function (win) {
   ipcMain.on('testUsb', function () {
     testUsb(win.webContents)
@@ -22,13 +22,28 @@ const usbffi = function (win) {
   usb.on('attach', function (device) {
     testUsb(win.webContents, true)
   })
-  usb.on('detach', function (device) {
-    win.webContents.send('usbOut')
-    const notification = new Notification({
-      title: '软件锁',
-      body: '你的软件锁已拔出'
-    })
-    notification.show()
+  usb.on('detach', async function (device) {
+    if (usbFlag) {
+      try {
+        let pathstr = path.join('data/zhlData.dll')
+        let libm = ffi.Library(pathstr, {
+          'GetProductIDList': ['string', []]
+        })
+        // console.log(await libm.GetProductIDList())
+        let alllist = await libm.GetProductIDList()
+        if (alllist === '') {
+          usbFlag = false
+          win.webContents.send('usbOut')
+          const notification = new Notification({
+            title: '软件锁',
+            body: '你的软件锁已拔出'
+          })
+          notification.show()
+        }
+      } catch (err) {
+        console.error(err)
+      }
+    }
   })
 }
 /**
@@ -54,6 +69,7 @@ async function testUsb (webContents, usbIn = false) {
       let first = db.read().get('sc_hadInstall.first').value()
       webContents.send('usbIn', { lockmsg: alllist, first: first, usbIn: usbIn })
       if (usbIn) {
+        usbFlag = true
         const notification = new Notification({
           title: '软件锁',
           body: '启动器检测到软件锁'

+ 15 - 5
src/renderer/assets/global.css

@@ -195,7 +195,7 @@ body{
 .el-tabs__header {
   position: absolute!important;
   right: 2.5%!important;
-  top: 0!important;
+  top: 0px!important;
   padding-left: 1rem!important;
   border: 0!important;
   display: flex!important;
@@ -206,7 +206,7 @@ body{
   margin-top: 0!important;
 }
 .el-tabs__item .detail-title{
-  padding: 14px 25px;
+  padding: 12px 25px;
   display: block;
 }
 .el-tabs__item:hover{
@@ -262,11 +262,9 @@ body{
   color: #6c757d!important;
 }
 .badge-orange {
-  font-size: 12px;
   background: #ff9900;
 }
 .badge-red {
-  font-size: 12px;
   background: #f00;
 }
 .badge {
@@ -431,6 +429,10 @@ body{
   background: #0fb890;
   color: #fff;
 }
+.iconbg-yellow {
+  background: #bfad6a;
+  color: #fff;
+}
 .iconbg {
   display: block;
   width: 30px;
@@ -462,7 +464,7 @@ body{
   border:1px solid #ff6501;
 }
 .details-title {
-  width: 72%;
+  width: 85%;
   font-size: 16px;
   color: #333;
 }
@@ -547,6 +549,7 @@ body{
   background:#eee5df;
   margin:0 15px 15px 15px;
   border-radius: 3px;
+  padding: 0 0 5px 0;
 }
 .freewrap .col{
   padding:0;
@@ -597,4 +600,11 @@ body{
 .details-title a:hover{
   background:#fff;
   text-decoration: none;
+}
+.vide-title {
+  margin: 0 0 20px 0;
+  font-size: 16px;
+}
+.card-width {
+  width: 189px;
 }

+ 6 - 3
src/renderer/components/StartUpPage/DownloadHeader.vue

@@ -1,8 +1,8 @@
 <template>
   <el-dropdown class="download-header float-left mr-3" ref="downloadmenu" trigger="click" :hide-on-click=false>
     <span class="el-dropdown-link">
-      <span class="badge">
-        <i class="fas fa-download"></i><span v-show="downloadNum !== 0"> {{ downloadNum }}</span>
+       <span :class="[badge, downloadNum !== 0 ? badgeLight : '']">
+        <i class="fas fa-download" :class="downloadNum !== 0 ? textSecondary : ''"></i><span v-show="downloadNum !== 0" class="text-secondary"> {{ downloadNum }}</span>
       </span>
     </span>
     <!--<el-button @click="testbtn">test</el-button>-->
@@ -51,7 +51,10 @@
     data () {
       return {
         downloadNum: 0,
-        downloads: ''
+        downloads: '',
+        badge: 'badge',
+        badgeLight: 'badge-light',
+        textSecondary: 'text-secondary'
       }
     },
     created () {

+ 54 - 1
src/renderer/components/StartUpPage/SoftwareDetail.vue

@@ -24,6 +24,31 @@
         <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-tab-pane class="pl-3 software-content" name="third">
+          <span slot="label" class="detail-title"><span class="iconbg iconbg-yellow rounded"><i class="fas fa-video"></i></span>动画教程</span>
+          <h1 class="vide-title" v-if="video1.length > 0">专属教程</h1>
+          <div class="row" v-if="video1.length > 0">
+            <div class="col-auto mb-4" v-for="video in video1" :key="video.aid">
+              <div class="card card-width">
+                <img class="card-img-top" :src="SmartCostUrl+video.img_url" :alt="video.title">
+                <div class="card-body p-3">
+                  <button class="btn btn-success btn-block btn-sm" @click="showVideo(video.aid)"><i class="fas fa-play-circle pr-1"></i>播放</button>
+                </div>
+              </div>
+            </div>
+          </div>
+          <h1 class="vide-title">通用教程</h1>
+          <div class="row">
+            <div class="col-auto mb-4" v-for="video in video2" :key="video.aid">
+              <div class="card card-width">
+                <img class="card-img-top" :src="SmartCostUrl+video.img_url" :alt="video.title">
+                <div class="card-body p-3">
+                  <button class="btn btn-success btn-block btn-sm" @click="showVideo(video.aid)"><i class="fas fa-play-circle pr-1"></i>播放</button>
+                </div>
+              </div>
+            </div>
+          </div>
+        </el-tab-pane>
       </el-tabs>
     </div>
   </div>
@@ -40,7 +65,10 @@
         activeName: 'first',
         loading: false,
         items: '',
-        downlist: ''
+        downlist: '',
+        SmartCostUrl: 'https://smartcost.com.cn',
+        video1: '',
+        video2: ''
       }
     },
     created () {
@@ -52,6 +80,27 @@
           if (!this.checkOnline()) {
             this.$message.error('当前网络不可用,图片信息将无法加载')
           }
+        } else if (val === 'third') {
+          if (!this.checkOnline()) {
+            this.$message.error('当前网络不可用,无法获取视频信息')
+          } else {
+            let productid = this.$route.params.pid
+            let self2 = this
+            this.$http({
+              url: this.SmartCostUrl + '/animation/list?pid=' + productid,
+              method: 'get',
+              timeout: 5000
+            }).then(function (response) {
+              if (response.data.err === 0) {
+                self2.video1 = response.data.info.list1
+                self2.video2 = response.data.info.list2
+              } else {
+                this.$message.error(response.data.msg)
+              }
+            }).catch(function (error2) {
+              throw error2
+            })
+          }
         }
       }
     },
@@ -99,6 +148,10 @@
         } else {
           return true
         }
+      },
+      showVideo (id) {
+        let url = this.SmartCostUrl + '/video/' + id
+        this.$electron.shell.openItem(url)
       }
     }
   }

+ 19 - 23
src/renderer/components/StartUpPage/SoftwareList.vue

@@ -2,33 +2,29 @@
   <div class="software-list pt-3">
     <div class="freewrap">
       <div class="free-title"><img src="../../assets/img/mainlogo.png" class="mr-2">纵横造价免费网络版</div>
-      <div class="row">
-        <div class="col">
-          <div class="media free-content">
-            <img class="mr-3" :src="getProductImg(7)" width="60" height="60" alt="公路造价(增值税)">
-            <div class="media-body clearfix">
-              <div class="free-right">
-                <button @click="downloadSoftware(9)" class="btn btn-white btn-sm"><i class="fas fa-download mr-2"></i>立即下载</button>
-              </div>
-              <div class="software-body">
-                <div class="software-bodyleft">
-                  <h5 class="software-title mb-1">纵横公路工程造价管理系统</h5>
-                </div>
+      <div class="">
+        <div class="media free-content">
+          <img class="mr-3" :src="getProductImg(7)" width="60" height="60" alt="公路造价(增值税)">
+          <div class="media-body clearfix">
+            <div class="free-right">
+              <button @click="downloadSoftware(9)" class="btn btn-white btn-sm"><i class="fas fa-download mr-2"></i>立即下载</button>
+            </div>
+            <div class="software-body">
+              <div class="software-bodyleft">
+                <h5 class="software-title mb-1">纵横公路工程造价管理系统</h5>
               </div>
             </div>
           </div>
         </div>
-        <div class="col">
-          <div class="media free-content">
-            <img class="mr-3" :src="getProductImg(8)" width="60" height="60" alt="公路造价(增值税)">
-            <div class="media-body clearfix">
-              <div class="free-right">
-                <button @click="downloadSoftware(313)" class="btn btn-white btn-sm"><i class="fas fa-download mr-2"></i>立即下载</button>
-              </div>
-              <div class="software-body">
-                <div class="software-bodyleft">
-                  <h5 class="software-title mb-1">广东公路造价编审系统</h5>
-                </div>
+        <div class="media free-content">
+          <img class="mr-3" :src="getProductImg(8)" width="60" height="60" alt="公路造价(增值税)">
+          <div class="media-body clearfix">
+            <div class="free-right">
+              <button @click="downloadSoftware(313)" class="btn btn-white btn-sm"><i class="fas fa-download mr-2"></i>立即下载</button>
+            </div>
+            <div class="software-body">
+              <div class="software-bodyleft">
+                <h5 class="software-title mb-1">广东公路造价编审系统</h5>
               </div>
             </div>
           </div>

+ 1 - 1
src/renderer/components/StartUpPage/SoftwareStartup.vue

@@ -18,7 +18,7 @@
       <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>
+            <button style="width:100%;" class="btn btn-orange btn-sm" @click="openlist('software-list')">下载中心</button>
           </div>
           <div class="p-2 flex-fill dropup">
             <el-dropdown placement="top" trigger="click" style="width:100%;" @command="clickbtn">

+ 72 - 4
src/renderer/components/StartUpPage/SoftwareStartupDetail.vue

@@ -29,6 +29,35 @@
         <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-tab-pane v-if="products.id != 1" class="software-content" name="third">
+          <span slot="label" class="detail-title"><span class="iconbg iconbg-yellow rounded"><i class="fas fa-video"></i></span>动画教程</span>
+          <h1 class="vide-title" v-if="video1.length > 0">专属教程</h1>
+          <div class="row" v-if="video1.length > 0">
+            <div class="col-auto mb-4" v-for="video in video1" :key="video.aid">
+              <div class="card card-width">
+                <img class="card-img-top" :src="SmartCostUrl+video.img_url" :alt="video.title">
+                <div class="card-body p-3">
+                  <button class="btn btn-success btn-block btn-sm" @click="showVideo(video.aid)"><i class="fas fa-play-circle pr-1"></i>播放</button>
+                </div>
+              </div>
+            </div>
+          </div>
+          <h1 class="vide-title">通用教程</h1>
+          <div class="row">
+            <div class="col-auto mb-4" v-for="video in video2" :key="video.aid">
+              <div class="card card-width">
+                <img class="card-img-top" :src="SmartCostUrl+video.img_url" :alt="video.title">
+                <div class="card-body p-3">
+                  <button class="btn btn-success btn-block btn-sm" @click="showVideo(video.aid)"><i class="fas fa-play-circle pr-1"></i>播放</button>
+                </div>
+              </div>
+            </div>
+          </div>
+          <!--<div class="row">-->
+            <!--&lt;!&ndash;<iframe class="col-12" scrolling=auto src="http://ol.smartcost.com.cn/loginbanner.html" frameborder="0"></iframe>&ndash;&gt;-->
+            <!--<webview id="banner" style="width:100%; height:360px" src="http://ol.smartcost.com.cn/loginbanner.html"></webview>-->
+          <!--</div>-->
+        </el-tab-pane>
       </el-tabs>
     </div>
   </div>
@@ -45,12 +74,27 @@
       return {
         activeName: 'first',
         products: '',
-        exelist: ''
+        exelist: '',
+        SmartCostUrl: 'https://smartcost.com.cn',
+        video1: '',
+        video2: ''
       }
     },
     created () {
       this.fetchData()
     },
+    //  mounted () {
+    //    this.$nextTick(() => {
+    //      document.getElementById('banner').addEventListener('new-window', (e) => {
+    //        const protocol = require('url').parse(e.url).protocol
+    //        if (protocol === 'http:' || protocol === 'https:') {
+    //          //      electron.shell.openExternal(e.url)
+    //          this.$electron.ipcRenderer.send('openWindow', e.url)
+    //          //      window.open(e.url)
+    //        }
+    //      })
+    //    })
+    //  },
     watch: {
       // 如果路由有变化,会再次执行该方法
       '$route': 'fetchData',
@@ -59,6 +103,28 @@
           if (!this.checkOnline()) {
             this.$message.error('当前网络不可用,图片信息将无法加载')
           }
+        } else if (val === 'third') {
+          if (!this.checkOnline()) {
+            this.$message.error('当前网络不可用,无法获取视频信息')
+          } else {
+            let productid = this.$route.params.productid === undefined ? this.$db.read().get('sc_productData').last().value().id : this.$route.params.productid
+            let productInfo = this.$db.read().get('sc_productData').getById(productid).value()
+            let self2 = this
+            this.$http({
+              url: this.SmartCostUrl + '/animation/list?pid=' + productInfo.product_id,
+              method: 'get',
+              timeout: 5000
+            }).then(function (response) {
+              if (response.data.err === 0) {
+                self2.video1 = response.data.info.list1
+                self2.video2 = response.data.info.list2
+              } else {
+                this.$message.error(response.data.msg)
+              }
+            }).catch(function (error2) {
+              throw error2
+            })
+          }
         }
       }
     },
@@ -68,9 +134,7 @@
         this.$db.read().set('sc_hadInstall.url', '/softwarestartup/' + productid).write()
         this.products = this.$db.read().get('sc_productData').getById(productid).value()
         this.exelist = this.$db.read().get('sc_exeData').filter({ pid: productid }).orderBy('addtime', 'desc').value()
-        if (productid === '1') {
-          this.activeName = 'first'
-        }
+        this.activeName = 'first'
       },
       openExebtn (id) {
         let info = this.$db.read().get('sc_exeData').getById(id).value()
@@ -136,6 +200,10 @@
       },
       openFolder (path) {
         this.$electron.shell.openItem(path)
+      },
+      showVideo (id) {
+        let url = this.SmartCostUrl + '/video/' + id
+        this.$electron.shell.openItem(url)
       }
     }
   }

+ 9 - 4
src/renderer/components/StartUpPage/UpdateHeader.vue

@@ -1,8 +1,8 @@
 <template>
   <el-dropdown ref="updatemenu" class="update-header float-left mr-3" trigger="click" :hide-on-click=false>
     <span class="el-dropdown-link">
-      <span class="badge">
-        <i class="fas fa-arrow-up"></i><span v-show="updateNum !== 0"> {{ updateNum }}</span></span>
+      <span :class="[badge, updateNum !== 0 ? badgeLight : '']">
+        <i class="fas fa-arrow-up" :class="updateNum !== 0 ? textSecondary : ''"></i><span v-show="updateNum !== 0" class="text-secondary"> {{ updateNum }}</span></span>
     </span>
     <el-dropdown-menu slot="dropdown" class="updatelist">
       <div v-if="updateNum === 0">
@@ -27,7 +27,10 @@
     mixins: [mixin],
     data: () => ({
       updates: '',
-      updateNum: 0
+      updateNum: 0,
+      badge: 'badge',
+      badgeLight: 'badge-light',
+      textSecondary: 'text-secondary'
     }),
     created () {
       this.fetchData()
@@ -39,6 +42,7 @@
         let scdownlist = fse.readJsonSync(softwarejson).sc_down
         let notUpdateDownIDList = [] // 获取不需要更新的down_id
         let updateExeList = [] // 获取需要更新的down_id
+        this.$db.read().get('sc_exeData').updateWhere({ show_tip: true }, { show_tip: false }).write()
         for (let i = 0; i < exelist.length; i++) {
           let scdownInfo = scdownlist.find(function (item) {
             return item.down_id === exelist[i].down_id
@@ -68,7 +72,7 @@
                   updateVersion: exe.show_updateVersion
                 }
                 updateExeMsgList.push(updateInfo)
-              } else if (version > updateExeMsgList[exeMsgIndex].version) {
+              } else if (version > updateExeMsgList[exeMsgIndex].version.split('.').join('')) {
                 let updateInfo = {
                   down_id: exe.down_id,
                   version: version,
@@ -85,6 +89,7 @@
           // 再把所有notUpdateDownIDList 里down_id相同的软件进行更新提示消除
           for (let notUpdateDownID of notUpdateDownIDList) {
             this.$db.read().get('sc_exeData').updateWhere({ down_id: notUpdateDownID }, { show_tip: false }).write()
+            this.$db.read().get('sc_exeData').updateWhere({ exeName: 'BillsEditor.exe' }, { show_tip: false }).write()
           }
         }
         this.updateNum = this.$db.read().get('sc_exeData').filter({ show_tip: true }).size().value()

+ 20 - 7
src/renderer/components/StartUpPage/UsbHeader.vue

@@ -1,12 +1,14 @@
 <template>
   <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 :class="[badge, usbNum !== 0 ? badgeLight : '']">
+        <i class="fab fa-usb" :class="usbNum !== 0 ? textSecondary : ''"></i><span v-show="usbNum !== 0" class="text-secondary"> {{ usbNum }}</span>
+      </span>
     </span>
     <el-dropdown-menu slot="dropdown" class="usblist">
       <div class="downloading" v-for="lock in lockList">
         <div class="border-bottom">
-          <span class="float-right"></span>
+          <span class="float-right" v-if="lock.date !== ''">期限: {{ lock.date }}</span>
           <h5>{{ lock.name }}</h5>
         </div>
         <div class="pt-3 pb-2" v-for="product in lock.prolist">
@@ -29,13 +31,18 @@
   export default {
     mixins: [mixin],
     data: () => ({
+      usbNum: 0,
       usbshow: false,
       lockList: '',
-      first2: false
+      first2: false,
+      badge: 'badge',
+      badgeLight: 'badge-light',
+      textSecondary: 'text-secondary'
     }),
     created () {
       this.$electron.ipcRenderer.send('testUsb')
       this.$electron.ipcRenderer.on('usbIn', async (event, result) => {
+        this.usbNum = 0
         this.usbshow = true
         if (result.first === false) {
           this.first2 = false
@@ -49,9 +56,10 @@
           for (let i in productlist) {
             let productNum = productlist[i].split(':')[0]
             let productVerList = productlist[i].split(':')[1].split(';')
-            productNum = await this.getkeynum(productNum)
+            let productMsg = await this.getkeynum(productNum)
             let data = {
-              name: productNum
+              name: productMsg[0] !== undefined ? productMsg[0] : productNum,
+              date: productMsg[1] !== undefined && productMsg[1] !== '' ? productMsg[1] : ''
             }
             let prolist = []
             for (let j in productVerList) {
@@ -68,6 +76,7 @@
                   }
                   flag = false
                   prolist.push(pdata)
+                  this.usbNum++
                 }
               }
               if (flag) {
@@ -83,6 +92,7 @@
                     }
                     flag = false
                     prolist.push(pdata)
+                    this.usbNum++
                     break
                   }
                 }
@@ -92,6 +102,9 @@
             locklist.push(data)
           }
           this.lockList = locklist
+          if (this.usbNum > 99) {
+            this.usbNum = '99+'
+          }
           if (this.$refs.usbmenu !== undefined && result.usbIn === true) {
             this.$refs.usbmenu.show()
           }
@@ -158,9 +171,9 @@
               }
             }).then(function (response) {
               if (response.data.error === 0) {
-                resolve(response.data.info)
+                resolve([response.data.info, response.data.alloted_time])
               } else {
-                resolve(num)
+                resolve([num, ''])
               }
             }).catch(function () {
               reject(num)