优化版本更新
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user