优化。

pull/303/head
王良 2024-04-23 16:40:14 +08:00
parent f7bc297b40
commit 6d40299c3f
3 changed files with 13 additions and 11 deletions

View File

@ -132,7 +132,7 @@ function updateHandle (app, api, win, beforeQuit, quit, log) {
win.webContents.send('update', { win.webContents.send('update', {
key: 'available', key: 'available',
value: { value: {
version: versionData.tag_name, version,
releaseNotes: '发布公告:' + (versionData.html_url || ('https://github.com/docmirror/dev-sidecar/releases/tag/' + versionData.tag_name)) releaseNotes: '发布公告:' + (versionData.html_url || ('https://github.com/docmirror/dev-sidecar/releases/tag/' + versionData.tag_name))
} }
}) })

View File

@ -134,7 +134,7 @@ function install (app, api) {
} }
console.log(value) console.log(value)
app.$confirm({ app.$confirm({
title: '发现新版本:' + value.version, title: '发现新版本:v' + value.version,
cancelText: '暂不升级', cancelText: '暂不升级',
okText: '升级', okText: '升级',
width: 710, width: 710,
@ -163,24 +163,26 @@ function install (app, api) {
function newUpdateIsReady (value) { function newUpdateIsReady (value) {
updateParams.downloading = false updateParams.downloading = false
console.log(value)
app.$confirm({ app.$confirm({
title: `新版本(v${value.version})已准备好,是否立即升级?`, title: `新版本(v${value.version})已准备好是否立即升级?`,
cancelText: '暂不升级', cancelText: '暂不升级',
okText: '立即升级', okText: '立即升级',
content: h => { content: h => {
console.log(value)
if (value.releaseNotes) { if (value.releaseNotes) {
const notes = [] if (typeof value.releaseNotes === 'string') {
for (const note of value.releaseNotes) { return <div>{value.releaseNotes}</div>
notes.push(<li>{note}</li>) } else {
const notes = []
for (const note of value.releaseNotes) {
notes.push(<li>{note}</li>)
}
return <div><div>更新内容</div><ol>{notes}</ol></div>
} }
return <div><div>更新内容</div><ol>{notes}</ol></div>
} }
}, },
onOk () { onOk () {
api.update.doUpdateNow() api.update.doUpdateNow()
},
onCancel () {
} }
}) })
} }

View File

@ -171,7 +171,7 @@ export default {
this.switchBtns = this.createSwitchBtns() this.switchBtns = this.createSwitchBtns()
this.$set(this, 'update', this.$global.update) this.$set(this, 'update', this.$global.update)
if (!this.update.autoChecked && this.config.app.autoChecked) { if (!this.update.autoChecked && this.config.app.autoChecked) {
this.update.autoChecked = true // this.update.autoChecked = true //
this.doCheckUpdate(false) this.doCheckUpdate(false)
} }
this.$api.info.get().then(ret => { this.$api.info.get().then(ret => {