优化版本更新

This commit is contained in:
gyq
2024-09-05 16:19:50 +08:00
parent 34f0b306c9
commit e17b12687f
6 changed files with 33 additions and 15841 deletions

View File

@@ -9,7 +9,7 @@
</div>
<template #footer>
<div class="footer" style="padding: 0 20px 20px;">
<el-button v-if="!updataInfo.isUp && !isUpload" @click="showDialog = false">下次更新</el-button>
<el-button v-if="!updataInfo.isUp && !isUpload" @click="closeHandle">下次更新</el-button>
<el-button type="primary" :loading="isUpload" @click="uplaodHandle">
<template v-if="!uploadSucess">
<template v-if="!isUpload">
@@ -33,6 +33,7 @@ import { onMounted, ref } from 'vue'
import { findVersion } from '@/api/user.js'
import packageData from "../../package.json";
import { ipcRenderer } from 'electron'
import useStorage from '@/utils/useStorage.js'
import { useUser } from "@/store/user.js";
@@ -46,12 +47,19 @@ const uploadSucess = ref(false)
const uploadResponse = ref({})
const tempFilePath = ref('')
// 关闭更新弹窗,下次登录在提示
function closeHandle() {
showDialog.value = false
useStorage.set('updateFlag', true)
}
// 检查版本更新
async function findVersionAjax() {
try {
let updateFlag = useStorage.get('updateFlag')
const res = await findVersion()
let reg = /\./g;
if (res.version.replace(reg, '') > packageData.version.replace(reg, '') && res.url) {
if (res.version.replace(reg, '') > packageData.version.replace(reg, '') && res.url && !updateFlag) {
showDialog.value = true
updataInfo.value = res
}