This commit is contained in:
gyq
2025-03-26 10:42:38 +08:00
parent 95ab7730f5
commit dd6189b51b
7 changed files with 73 additions and 16160 deletions

View File

@@ -58,14 +58,14 @@
</div>
<div class="drawerbox_bo_box_icontext">叫号</div>
</div> -->
<div class="drawerbox_bo_box_itembox" @click="screenref.shows()">
<!-- <div class="drawerbox_bo_box_itembox" @click="screenref.shows()">
<div class="drawerbox_bo_box_icon">
<el-icon size="40">
<Lock />
</el-icon>
</div>
<div class="drawerbox_bo_box_icontext">锁屏</div>
</div>
</div> -->
<!-- <div class="drawerbox_bo_box_itembox" @click="to('webview', {
url: 'https://cashiernewadmin.sxczgkj.cn/',
title: '后台管理'

View File

@@ -57,10 +57,19 @@ async function findVersionAjax() {
let updateFlag = useStorage.get('updateFlag')
const res = await findVersion()
if (res && res.version) {
let reg = /\./g;
if (res.version.replace(reg, '') > packageData.version.replace(reg, '') && res.url && !updateFlag) {
showDialog.value = true
updataInfo.value = res
const newVersion = res.version;
const oldVersion = packageData.version;
const result = compareVersions(newVersion, oldVersion);
if (result > 0) {
console.log(`${newVersion}${oldVersion}`);
if (!updateFlag) {
showDialog.value = true
updataInfo.value = res
}
} else if (result < 0) {
console.log(`${newVersion}${oldVersion}`);
} else {
console.log(`${newVersion}${oldVersion} 相等`);
}
}
} catch (error) {
@@ -68,6 +77,25 @@ async function findVersionAjax() {
}
}
//
function compareVersions(version1, version2) {
const v1 = version1.split('.').map(Number);
const v2 = version2.split('.').map(Number);
const maxLength = Math.max(v1.length, v2.length);
for (let i = 0; i < maxLength; i++) {
const num1 = v1[i] || 0;
const num2 = v2[i] || 0;
if (num1 > num2) {
return 1;
} else if (num1 < num2) {
return -1;
}
}
return 0;
}
// 下载新版本
async function uplaodHandle() {
try {