功能:优化项目版本号展示

This commit is contained in:
宇阳
2024-12-12 14:17:13 +08:00
parent 2b09ee3a91
commit eb0755b528
3 changed files with 18 additions and 16 deletions

5
.env
View File

@@ -1,15 +1,12 @@
# 项目版本号
VITE_VERSION=2.1.6
VITE_VERSION=2.1.8
# 项目后端API地址
VITE_PROJECT_API=
# 百度统计相关配置
VITE_BAIDU_TONGJI_KEY=
VITE_BAIDU_TONGJI_SECRET_KEY=
VITE_BAIDU_TONGJI_SITE_ID=
VITE_BAIDU_TONGJI_ACCESS_TOKEN=
VITE_BAIDU_TONGJI_REFRESH_TOKEN=
# 星火AI相关配置
VITE_AI_APIPassword=

View File

@@ -28,17 +28,25 @@ const HeaderInfo = () => {
{/* 项目版本号 */}
<div className='hidden md:flex md:flex-col space-y-1 xl:mr-30'>
<div className='flex space-x-4'>
<p><b className='inline-block px-2 text-white bg-blue-400 rounded-md'>{import.meta.env.VITE_VERSION}</b></p>
<p><b className='inline-block px-2 text-white bg-red-500 rounded-md'>{version.tag_name}</b></p>
</div>
{
version.tag_name === import.meta.env.VITE_VERSION
? <p>🎉 <b className='inline-block px-2 text-white bg-green-600 rounded-md'>{version.tag_name} </b></p>
: (
<>
<div className='flex space-x-4'>
<p><b className='inline-block px-2 text-white bg-blue-400 rounded-md'>{import.meta.env.VITE_VERSION}</b></p>
<p><b className='inline-block px-2 text-white bg-red-500 rounded-md'>{version.tag_name}</b></p>
</div>
<p>{version.name}</p>
<p>{version.name}</p>
<div className='group flex items-center'>
<FaDownload className='group-hover:text-primary transition-colors' />
<a href={version.tarball_url} className='group-hover:text-primary pl-2 transition-colors'></a>
</div>
<div className='group flex items-center'>
<FaDownload className='group-hover:text-primary transition-colors' />
<a href={version.tarball_url} className='group-hover:text-primary pl-2 transition-colors'></a>
</div>
</>
)
}
</div>
</div>
);

3
src/types/env.d.ts vendored
View File

@@ -3,11 +3,8 @@ interface ImportMetaEnv {
readonly VITE_PROJECT_API: string;
readonly VITE_BAIDU_TONGJI_KEY: string;
readonly VITE_BAIDU_TONGJI_SECRET_KEY: string;
readonly VITE_BAIDU_TONGJI_SITE_ID: string;
readonly VITE_BAIDU_TONGJI_ACCESS_TOKEN: string;
readonly VITE_BAIDU_TONGJI_REFRESH_TOKEN: string;
readonly VITE_AI_APIPassword: string;
readonly VITE_AI_MODEL: string;