优化版本更新操作
This commit is contained in:
@@ -1,17 +1,24 @@
|
||||
<template lang="pug">
|
||||
dt#update {{$t('setting__update')}}
|
||||
dd
|
||||
p.small
|
||||
| {{$t('setting__update_latest_label')}}{{versionInfo.newVersion ? versionInfo.newVersion.version : $t('setting__update_unknown')}}
|
||||
p.small(@click="handleOPenDevTools") {{$t('setting__update_current_label')}}{{versionInfo.version}}
|
||||
p.small(v-if="versionInfo.downloadProgress" style="line-height: 1.5;")
|
||||
| {{$t('setting__update_downloading')}}
|
||||
br
|
||||
| {{$t('setting__update_progress')}}{{downloadProgress}}
|
||||
p(v-if="versionInfo.newVersion")
|
||||
span(v-if="versionInfo.isLatestVer") {{$t('setting__update_latest')}}
|
||||
base-btn.btn.gap-left(v-else min @click="showUpdateModal") {{$t('setting__update_open_version_modal_btn')}}
|
||||
p.small(v-else) {{$t('setting__update_checking')}}
|
||||
.gap-top
|
||||
base-checkbox(id="setting__update_tryAutoUpdate" :modelValue="appSetting['common.tryAutoUpdate']" @update:modelValue="updateSetting({'common.tryAutoUpdate': $event})" :label="$t('setting__update_try_auto_update')")
|
||||
.gap-top
|
||||
p.small
|
||||
| {{$t('setting__update_latest_label')}}{{versionInfo.newVersion ? versionInfo.newVersion.version : $t('setting__update_unknown')}}
|
||||
p.small(@click="handleOpenDevTools") {{$t('setting__update_current_label')}}{{versionInfo.version}}
|
||||
p.small(v-if="downloadProgress" style="line-height: 1.5;")
|
||||
| {{$t('setting__update_downloading')}}
|
||||
br
|
||||
| {{$t('setting__update_progress')}}{{downloadProgress}}
|
||||
template(v-if="versionInfo.newVersion")
|
||||
p(v-if="versionInfo.isLatest")
|
||||
span {{$t('setting__update_latest')}}
|
||||
p(v-else-if="versionInfo.status != 'downloading'")
|
||||
span {{ $t('setting__update_new_version') }}
|
||||
p
|
||||
base-btn.btn.gap-left(min @click="showUpdateModal") {{$t('setting__update_open_version_modal_btn')}}
|
||||
p.small(v-else-if="versionInfo.status =='checking'") {{$t('setting__update_checking')}}
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -21,6 +28,7 @@ import { sizeFormate } from '@common/utils/common'
|
||||
// import { openDirInExplorer, selectDir } from '@renderer/utils'
|
||||
import { openDevTools } from '@renderer/utils/ipc'
|
||||
import { useI18n } from '@renderer/plugins/i18n'
|
||||
import { appSetting, updateSetting } from '@renderer/store/setting'
|
||||
|
||||
export default {
|
||||
name: 'SettingUpdate',
|
||||
@@ -30,7 +38,7 @@ export default {
|
||||
|
||||
const t = useI18n()
|
||||
|
||||
const handleOPenDevTools = () => {
|
||||
const handleOpenDevTools = () => {
|
||||
if (window.performance.now() - lastClickTime > 1000) {
|
||||
if (clickNum > 0) clickNum = 0
|
||||
} else {
|
||||
@@ -45,9 +53,11 @@ export default {
|
||||
}
|
||||
|
||||
const downloadProgress = computed(() => {
|
||||
return versionInfo.downloadProgress
|
||||
? `${versionInfo.downloadProgress.percent.toFixed(2)}% - ${sizeFormate(versionInfo.downloadProgress.transferred)}/${sizeFormate(versionInfo.downloadProgress.total)} - ${sizeFormate(versionInfo.downloadProgress.bytesPerSecond)}/s`
|
||||
: t('setting__update_init')
|
||||
return versionInfo.status == 'downloading'
|
||||
? versionInfo.downloadProgress
|
||||
? `${versionInfo.downloadProgress.percent.toFixed(2)}% - ${sizeFormate(versionInfo.downloadProgress.transferred)}/${sizeFormate(versionInfo.downloadProgress.total)} - ${sizeFormate(versionInfo.downloadProgress.bytesPerSecond)}/s`
|
||||
: t('setting__update_init')
|
||||
: ''
|
||||
})
|
||||
|
||||
const showUpdateModal = () => {
|
||||
@@ -57,8 +67,10 @@ export default {
|
||||
return {
|
||||
versionInfo,
|
||||
downloadProgress,
|
||||
handleOPenDevTools,
|
||||
handleOpenDevTools,
|
||||
showUpdateModal,
|
||||
appSetting,
|
||||
updateSetting,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user