mirror of
https://github.com/cuiocean/ZY-Player.git
synced 2026-05-05 08:33:32 +08:00
改为原来的更新组件,避免因为超时而中断卡住
This commit is contained in:
@@ -205,14 +205,11 @@
|
||||
<div class="wrapper">
|
||||
<div class="body">
|
||||
<div class="content" v-html="update.html"></div>
|
||||
<div class="progress" v-show="update.percent > 0">
|
||||
<el-progress :percentage="update.percent"></el-progress>
|
||||
<div class="size" style="font-size: 14px">更新包大小: {{update.size}} KB</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<el-button size="small" @click="cancelUpdate">取消</el-button>
|
||||
<el-button size="small" v-show="!update.downloaded" @click="startUpdate">更新</el-button>
|
||||
<el-button size="small" @click="closeUpdate">关闭</el-button>
|
||||
<el-button size="small" v-show="update.showDownload" @click="startUpdate">更新</el-button>
|
||||
<el-button size="small" v-show="!update.showDownload && !update.downloaded">正在更新...</el-button>
|
||||
<el-button size="small" v-show="update.downloaded" @click="installUpdate">安装</el-button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -258,9 +255,8 @@ export default {
|
||||
version: '',
|
||||
show: false,
|
||||
html: '',
|
||||
percent: 0,
|
||||
size: 0,
|
||||
downloaded: false
|
||||
downloaded: false,
|
||||
showDownload: true
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -498,15 +494,12 @@ export default {
|
||||
openUpdate () {
|
||||
this.update.show = true
|
||||
},
|
||||
cancelUpdate () {
|
||||
closeUpdate () {
|
||||
this.update.show = false
|
||||
},
|
||||
startUpdate () {
|
||||
this.update.showDownload = false
|
||||
ipcRenderer.send('downloadUpdate')
|
||||
ipcRenderer.on('download-progress', (info, progress) => {
|
||||
this.update.size = progress.total
|
||||
this.update.percent = parseFloat(progress.percent).toFixed(1)
|
||||
})
|
||||
ipcRenderer.on('update-downloaded', () => {
|
||||
this.update.downloaded = true
|
||||
})
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { BrowserWindow, ipcMain } from 'electron'
|
||||
const { autoUpdater } = require('@imjs/electron-differential-updater')
|
||||
const { autoUpdater } = require('electron-updater')
|
||||
|
||||
// electron-updater 增量更新时似乎无法显示进度
|
||||
export function initUpdater (win = BrowserWindow) {
|
||||
autoUpdater.autoDownload = false
|
||||
autoUpdater.autoInstallOnAppQuit = false
|
||||
autoUpdater.autoInstallOnAppQuit = true
|
||||
|
||||
// 主进程监听检查更新事件
|
||||
ipcMain.on('checkForUpdate', () => {
|
||||
@@ -41,8 +42,8 @@ export function initUpdater (win = BrowserWindow) {
|
||||
})
|
||||
|
||||
// 下载更新进度
|
||||
autoUpdater.on('download-progress', (info, progress) => {
|
||||
win.webContents.send('download-progress', info, progress)
|
||||
autoUpdater.on('download-progress', (progressObj) => {
|
||||
win.webContents.send('download-progress', progressObj)
|
||||
})
|
||||
|
||||
// 下载完成
|
||||
|
||||
Reference in New Issue
Block a user