diff --git a/.eslintrc.js b/.eslintrc.js
index 22b3472b..247fdc3d 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -7,7 +7,8 @@ module.exports = {
defineProps: 'readonly',
defineEmits: 'readonly',
defineExpose: 'readonly',
- withDefaults: 'readonly'
+ withDefaults: 'readonly',
+ PROJECT_BUILD_TIME: 'readonly'
},
parser: 'vue-eslint-parser',
parserOptions: {
diff --git a/build/define/index.ts b/build/define/index.ts
new file mode 100644
index 00000000..d370c75c
--- /dev/null
+++ b/build/define/index.ts
@@ -0,0 +1,8 @@
+import dayjs from 'dayjs';
+
+/** 项目构建时间 */
+const PROJECT_BUILD_TIME = JSON.stringify(dayjs().format('YYYY-MM-DD HH:mm:ss'));
+
+export default {
+ PROJECT_BUILD_TIME
+};
diff --git a/build/index.ts b/build/index.ts
index bcb666cc..61c3ae69 100644
--- a/build/index.ts
+++ b/build/index.ts
@@ -1,4 +1,5 @@
import viteEnv from './env';
import plugins from './plugins';
+import define from './define';
-export { viteEnv, plugins };
+export { viteEnv, plugins, define };
diff --git a/src/typings/global.d.ts b/src/typings/global.d.ts
new file mode 100644
index 00000000..2305ae02
--- /dev/null
+++ b/src/typings/global.d.ts
@@ -0,0 +1,2 @@
+/** 构建时间 */
+declare const PROJECT_BUILD_TIME: string;
diff --git a/src/typings/makeit-captcha.d.ts b/src/typings/makeit-captcha.d.ts
deleted file mode 100644
index 3c91f4d8..00000000
--- a/src/typings/makeit-captcha.d.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-declare module 'makeit-captcha' {
- import _default from 'makeit-captcha/es/src';
-
- export default _default;
-}
diff --git a/src/utils/package/index.ts b/src/utils/package/index.ts
index 2267d1ce..e86882a8 100644
--- a/src/utils/package/index.ts
+++ b/src/utils/package/index.ts
@@ -1,5 +1,5 @@
import type { VersionInfo } from '@/interface';
-import version from './version.json';
+import packageJson from '../../../package.json';
interface Version {
dependencies: {
@@ -8,6 +8,7 @@ interface Version {
devDependencies: {
[key: string]: string;
};
+ [key: string]: any;
}
interface PackageVersion {
@@ -15,7 +16,7 @@ interface PackageVersion {
devDependencies: VersionInfo[];
}
-const versionWithType = version as Version;
+const versionWithType = packageJson as Version;
function transformVersionData(tuple: [string, string]): VersionInfo {
const [name, version] = tuple;
diff --git a/src/views/about/components/ProjectInfo/index.vue b/src/views/about/components/ProjectInfo/index.vue
index c3930ac4..61a1ae22 100644
--- a/src/views/about/components/ProjectInfo/index.vue
+++ b/src/views/about/components/ProjectInfo/index.vue
@@ -6,7 +6,7 @@
1.0.0
- 2021-11-05
+ {{ lastestBuildTime }}
Github地址
@@ -20,5 +20,7 @@
diff --git a/vite.config.ts b/vite.config.ts
index 946b38c2..02ccd87c 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -1,6 +1,6 @@
import { defineConfig } from 'vite';
import path from 'path';
-import { viteEnv, plugins } from './build';
+import { viteEnv, plugins, define } from './build';
export default defineConfig({
base: viteEnv.VITE_BASE_URL,
@@ -9,6 +9,7 @@ export default defineConfig({
'@': path.resolve(__dirname, './src')
}
},
+ define,
css: {
preprocessorOptions: {
scss: {