diff --git a/src/config.js b/src/config.js index d714edd..5d76423 100644 --- a/src/config.js +++ b/src/config.js @@ -13,6 +13,7 @@ export const OFFICEWEBVIEWERURL = "https://view.officeapps.live.com/op/embed.asp const __BUILD_VERSION__ = `__BUILD_VERSION__`.replace(/"/g, '') export const BUILD_VERSION = import.meta.env.PROD ? __BUILD_VERSION__ : import.meta.env.MODE; +export const GIT_HEAD = `__GIT_HEAD__`; // 权限常量定义 // 账号、权限管理 diff --git a/src/views/App.jsx b/src/views/App.jsx index 18c854b..2ac855e 100644 --- a/src/views/App.jsx +++ b/src/views/App.jsx @@ -13,7 +13,7 @@ import zhLocale from 'antd/locale/zh_CN' import enLocale from 'antd/locale/en_US' import 'dayjs/locale/zh-cn' import ErrorBoundary from '@/components/ErrorBoundary' -import { BUILD_VERSION, PERM_PRODUCTS_OFFER_PUT, PERM_PRODUCTS_INFO_PUT } from '@/config' +import { BUILD_VERSION, GIT_HEAD, PERM_PRODUCTS_INFO_PUT } from '@/config' import useNoticeStore from '@/stores/Notice' import useAuthStore from '@/stores/Auth' import { useThemeContext } from '@/stores/ThemeContext' @@ -150,7 +150,7 @@ function App() { {needToLogin ? <>login... : } - + diff --git a/src/views/Standlone.jsx b/src/views/Standlone.jsx index 142824e..d41f6fa 100644 --- a/src/views/Standlone.jsx +++ b/src/views/Standlone.jsx @@ -3,7 +3,7 @@ import { Layout, ConfigProvider, theme, Row, Col, App as AntApp } from "antd"; import "antd/dist/reset.css"; import AppLogo from "@/assets/highlights_travel_600_550.png"; import { useThemeContext } from "@/stores/ThemeContext"; -import { BUILD_VERSION } from "@/config"; +import { BUILD_VERSION, GIT_HEAD } from "@/config"; const { Header, Content, Footer } = Layout; @@ -26,7 +26,7 @@ function Standlone() { - + diff --git a/vite.config.js b/vite.config.js index f1abee4..7ea2ff9 100644 --- a/vite.config.js +++ b/vite.config.js @@ -3,6 +3,7 @@ import react from "@vitejs/plugin-react"; import WindiCSS from 'vite-plugin-windicss'; import packageJson from './package.json'; import dayjs from 'dayjs' +import { execSync } from 'child_process'; const today = new dayjs().format('YYYY-MM-DD HH:mm:ss') @@ -11,12 +12,10 @@ export default defineConfig({ define: { __BUILD_DATE__: JSON.stringify(`${today}`), __BUILD_VERSION__: JSON.stringify(`${packageJson.version}`), + __GIT_HEAD__: execSync('git rev-parse --short HEAD').toString().trim(), }, plugins: [ react(), WindiCSS(), - // legacy({ - // targets: ["defaults", "not IE 11"], - // }), ], server: { host: "0.0.0.0",