修正 BUILD_TIMESTAMP 字符串格式

This commit is contained in:
洛洛希雅 2024-04-26 22:40:06 +08:00
parent 385779744e
commit 82d999071e

View File

@ -57,13 +57,10 @@ import { getMyRole, login } from '@/api/user'
import type { FormInstance, InputInstance } from 'element-plus' import type { FormInstance, InputInstance } from 'element-plus'
import { settings as viteSettings } from '@/settings' import { settings as viteSettings } from '@/settings'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import moment from 'moment'
const buildEnv = (() => { const buildEnv = (() => {
let time = import.meta.env.VITE_BUILD_TIMESTAMP const time = import.meta.env.VITE_BUILD_TIMESTAMP
if (!time) return null if (!time) return null
const date = new Date(Number.parseInt(time))
time = `${moment(date).format('YYYY-mm-dd HH:mm:ss')} GMT+8`
const build = import.meta.env.VITE_BUILD_DISPLAY_NAME const build = import.meta.env.VITE_BUILD_DISPLAY_NAME
const hash = (import.meta.env.VITE_GIT_COMMIT || '').slice(0, 8) const hash = (import.meta.env.VITE_GIT_COMMIT || '').slice(0, 8)
return `构建 ${build} ${hash} ${time}` return `构建 ${build} ${hash} ${time}`