This commit is contained in:
gotoeasy 2023-10-12 12:07:30 +08:00
parent 3a7187bf9d
commit 8b1c2c9fd8
2 changed files with 22 additions and 6 deletions

View File

@ -9,8 +9,8 @@ dependencies:
specifier: ^2.1.0
version: 2.1.0(vue@3.3.4)
'@gotoeasy/glcui':
specifier: ^0.1.1
version: 0.1.1
specifier: ^0.1.2
version: 0.1.2
'@imengyu/vue3-context-menu':
specifier: ^1.3.0
version: 1.3.0
@ -772,8 +772,8 @@ packages:
resolution: {integrity: sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw==}
dev: true
/@gotoeasy/glcui@0.1.1:
resolution: {integrity: sha512-LKvrhxlNU3AP0Eb2M/ffZaXS8Bqy714kDeELozsyQctSFLtHdk/kkb7KtGdzFQ5lHra0uGbc1KTGT7BOWlzcjw==}
/@gotoeasy/glcui@0.1.2:
resolution: {integrity: sha512-ALDY/SirAm2rMLyJUde6Ree2QPJr0N3BCQwbT4RdXE2BMuugAbD9ehyg3DGLX40Ovo90sa0REa8R3p6SL1S+zg==}
dev: false
/@humanwhocodes/config-array@0.11.10:

View File

@ -2,7 +2,7 @@
<GxToolbar :height="themeStore.headerHeight">
<template #left>
<div style="display:flex;align-items:center;margin-left:8px;line-height: 30px;">
<div :title="VITE_GLC_INFO" style="width: 34px;color:white;text-align:center;cursor:pointer;" @click="clickLogo">
<div :title="verInfo" style="width: 34px;color:white;text-align:center;cursor:pointer;" @click="clickLogo">
<img src="/image/glc.png" style="width:34px;margin-top:9px;" />
</div>
<div style="text-align:center;">
@ -25,7 +25,7 @@ import { userLogout } from '~/api';
const { VITE_GLC_INFO } = import.meta.env;
const router = useRouter();
const verInfo = ref(VITE_GLC_INFO);
const tokenStore = useTokenStore();
const themeStore = useThemeStore();
const headerHeight = computed(() => `${themeStore.headerHeight}px`);
@ -63,6 +63,10 @@ const svgLogoColor = computed(() => {
return '#eeeeee';
});
onMounted(() => {
checkVersion();
});
async function logout() {
if (await $msg.confirm('确定要退出系统吗?')) {
userLogout();
@ -74,6 +78,18 @@ const clickLogo = () => {
window.open('https://github.com/gotoeasy/glogcenter', '_blank');
};
function checkVersion() {
!window.$checkVersionDone && (window.$checkVersionDone = 1) && fetch(`https://glc.gotoeasy.top/glogcenter/current/version.json?v=${VITE_GLC_INFO}`)
.then(response => response.text())
.then(data => {
const rs = JSON.parse(data)
if (rs.version && VITE_GLC_INFO < rs.version) {
verInfo.value = `当前版本 ${VITE_GLC_INFO} ,有新版本 ${rs.version} 可更新`
}
})
.catch(e => console.log(e));
}
</script>
<style lang="scss">