|
@@ -16,26 +16,14 @@
|
|
|
<div class="details" v-for="exe in exelist" :key="exe.id">
|
|
|
<div class="float-right">
|
|
|
<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="55%">
|
|
|
- <div class="modal-body" v-html="productVer"></div>
|
|
|
- <span slot="footer" class="dialog-footer">
|
|
|
- <button class="btn btn-sm btn-primary btn-blue" @click="downloadbtn(did, version)">下载更新</button>
|
|
|
- <button class="btn btn-sm btn-secondary" @click="ignorebtn(prid, doid)">忽略该版本</button>
|
|
|
- </span>
|
|
|
- </el-dialog>
|
|
|
</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="w-25 d-inline-block" v-if="exe.versionName !== ''"><a @click="openFolder(exe.path)" :title="exe.path">{{ exe.versionName }}</a></div>
|
|
|
+ <div v-else><a @click="openFolder(exe.path)" :title="exe.path">{{ exe.fileName }}</a></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="inline-block">{{ exe.fileDescription }}</div>
|
|
|
- <div class="software-stitle">{{ exe.path }}</div>
|
|
|
</div>
|
|
|
</el-tab-pane>
|
|
|
<el-tab-pane v-if="products.id != 1" class="software-content" name="second" v-html="products.content">
|
|
@@ -50,7 +38,6 @@
|
|
|
import mixin from '../mixin'
|
|
|
const path = require('path')
|
|
|
const fs = require('fs')
|
|
|
- const fse = require('fs-extra')
|
|
|
const ffi = require('ffi')
|
|
|
export default {
|
|
|
mixins: [mixin],
|
|
@@ -58,12 +45,7 @@
|
|
|
return {
|
|
|
activeName: 'first',
|
|
|
products: '',
|
|
|
- exelist: '',
|
|
|
- dialogVisible: false,
|
|
|
- productVer: '',
|
|
|
- did: '',
|
|
|
- version: '',
|
|
|
- prid: ''
|
|
|
+ exelist: ''
|
|
|
}
|
|
|
},
|
|
|
created () {
|
|
@@ -84,25 +66,8 @@
|
|
|
fetchData () {
|
|
|
let productid = this.$route.params.productid === undefined ? this.$db.read().get('sc_productData').last().value().id : this.$route.params.productid
|
|
|
this.$db.read().set('sc_hadInstall.url', '/softwarestartup/' + productid).write()
|
|
|
- let products = this.$db.read().get('sc_productData').getById(productid).value()
|
|
|
- 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 scdownlist = fse.readJsonSync(softwarejson).sc_down
|
|
|
- for (let i = 0; i < exelist.length; i++) {
|
|
|
- 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: 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
|
|
|
+ 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'
|
|
|
}
|
|
@@ -150,45 +115,6 @@
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
- updateExebtn (id) {
|
|
|
- let info = this.$db.read().get('sc_exeData').getById(id).value()
|
|
|
- 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> | 升级版本:<b>' + info.show_updateVersion + '</b></p>'
|
|
|
- this.productVer = addhtml + scdowninfo.versionDesc
|
|
|
- this.dialogVisible = true
|
|
|
- this.doid = info.id
|
|
|
- this.did = info.down_id
|
|
|
- this.version = scdowninfo.version
|
|
|
- this.prid = info.pid
|
|
|
- },
|
|
|
- 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) {
|
|
|
- this.$db.read().get('sc_exeData').updateById(id, { show_tip: false }).write()
|
|
|
- this.exelist = this.$db.read().get('sc_exeData').filter({ pid: pid }).orderBy('addtime', 'desc').value()
|
|
|
- this.dialogVisible = false
|
|
|
- },
|
|
|
checkOnline () {
|
|
|
if (!navigator.onLine) {
|
|
|
return false
|
|
@@ -207,6 +133,9 @@
|
|
|
} catch (err) {
|
|
|
console.error('ffi.Library', err)
|
|
|
}
|
|
|
+ },
|
|
|
+ openFolder (path) {
|
|
|
+ this.$electron.shell.openItem(path)
|
|
|
}
|
|
|
}
|
|
|
}
|