mirror of
https://gitee.com/HuLaSpark/HuLa.git
synced 2024-12-01 19:28:07 +08:00
fix(layout): 🐛 修复更新弹窗显示更新的内容
This commit is contained in:
parent
d0fd528d7c
commit
bd7f6fbe7f
@ -248,13 +248,41 @@ export const CheckUpdate = defineComponent(() => {
|
|||||||
|
|
||||||
const checkUpdate = async () => {
|
const checkUpdate = async () => {
|
||||||
checkLoading.value = true
|
checkLoading.value = true
|
||||||
|
|
||||||
|
const url = `https://gitee.com/api/v5/repos/HuLaSpark/HuLa/tags?access_token=${import.meta.env.VITE_GITEE_TOKEN}&sort=name&direction=desc&page=1&per_page=1`
|
||||||
|
|
||||||
await check()
|
await check()
|
||||||
.then((e) => {
|
.then((e) => {
|
||||||
if (!e?.available) {
|
if (!e?.available) {
|
||||||
checkLoading.value = false
|
checkLoading.value = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
newVersion.value = e?.version
|
// 检查版本之间不同的提交信息和提交日期
|
||||||
|
fetch(url).then((res) => {
|
||||||
|
res
|
||||||
|
.json()
|
||||||
|
.then(async () => {
|
||||||
|
await nextTick(() => {
|
||||||
|
let url = `https://gitee.com/api/v5/repos/HuLaSpark/HuLa/tags?access_token=${import.meta.env.VITE_GITEE_TOKEN}&sort=name&direction=asc&page=1`
|
||||||
|
fetch(url).then((res) => {
|
||||||
|
res.json().then(async (data) => {
|
||||||
|
const allVersion = [] as number[]
|
||||||
|
data.forEach((item: any) => {
|
||||||
|
// 只获取item.name中[1,4]的内容
|
||||||
|
allVersion.push(Number(item.name.slice(1, 4)))
|
||||||
|
})
|
||||||
|
newVersion.value = `v${Math.max(...allVersion)}.0`
|
||||||
|
url = `https://gitee.com/api/v5/repos/HuLaSpark/HuLa/releases/tags/${newVersion.value}?access_token=${import.meta.env.VITE_GITEE_TOKEN}`
|
||||||
|
getCommitLog(url, true)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
checkLoading.value = false
|
||||||
|
window.$message.error('请检查配置,配置好token后再试')
|
||||||
|
})
|
||||||
|
})
|
||||||
text.value = '立即更新'
|
text.value = '立即更新'
|
||||||
checkLoading.value = false
|
checkLoading.value = false
|
||||||
})
|
})
|
||||||
@ -268,10 +296,10 @@ export const CheckUpdate = defineComponent(() => {
|
|||||||
loading.value = true
|
loading.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(async () => {
|
||||||
init()
|
init()
|
||||||
getCommitLog(url.value)
|
getCommitLog(url.value)
|
||||||
checkUpdate()
|
await checkUpdate()
|
||||||
})
|
})
|
||||||
return () => (
|
return () => (
|
||||||
<NModal v-model:show={lock.value.modalShow} maskClosable={false} class="w-350px border-rd-8px">
|
<NModal v-model:show={lock.value.modalShow} maskClosable={false} class="w-350px border-rd-8px">
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
<span class="text-(15px #707070)">版本:{{ _pkg.version }}({{ osArch }})</span>
|
<span class="text-(15px #707070)">版本:{{ _pkg.version }}({{ osArch }})</span>
|
||||||
<span class="text-(15px #707070)">当前设备:{{ osType }}{{ osVersion }}</span>
|
<span class="text-(15px #707070)">当前设备:{{ osType }}{{ osVersion }}</span>
|
||||||
<n-flex vertical class="text-(12px #909090)" :size="8" align="center">
|
<n-flex vertical class="text-(12px #909090)" :size="8" align="center">
|
||||||
<span>Copyright © {{ currentYear - 1 }}-{{ currentYear }} nongyehong</span>
|
<span>Copyright © {{ currentYear - 1 }}-{{ currentYear }} HuLaSpark</span>
|
||||||
<span>All Rights Reserved.</span>
|
<span>All Rights Reserved.</span>
|
||||||
</n-flex>
|
</n-flex>
|
||||||
</n-flex>
|
</n-flex>
|
||||||
|
Loading…
Reference in New Issue
Block a user