diff --git a/web/index.html b/web/index.html index 7f114f9b..06ff7d4e 100644 --- a/web/index.html +++ b/web/index.html @@ -1,15 +1,18 @@ - + + - + + -
- +
+ - + + \ No newline at end of file diff --git a/web/package.json b/web/package.json index 153580a2..98a63abc 100644 --- a/web/package.json +++ b/web/package.json @@ -1,50 +1,51 @@ { - "name": "gin-vue-admin", - "version": "2.3.5", - "private": true, - "scripts": { - "serve": "node openDocument.js && vite --host --mode development", - "build": "vite build --mode production", - "preview": "vite preview" - }, - "dependencies": { - "@element-plus/icons": "0.0.11", - "axios": "^0.19.2", - "core-js": "^3.6.5", - "echarts": "4.9.0", - "element-plus": "^1.1.0-beta.24", - "highlight.js": "^10.6.0", - "marked": "^2.0.0", - "mitt": "^3.0.0", - "path": "^0.12.7", - "qs": "^6.8.0", - "quill": "^1.3.7", - "screenfull": "^5.0.2", - "script-ext-html-webpack-plugin": "^2.1.4", - "spark-md5": "^3.0.1", - "vue": "^3.2.0", - "vue-particle-line": "^0.1.4", - "vue-router": "^4.0.0-0", - "vuex": "^4.0.0-0", - "vuex-persist": "^2.1.0" - }, - "devDependencies": { - "@vitejs/plugin-legacy": "^1.4.4", - "@vitejs/plugin-vue": "latest", - "@vue/cli-plugin-babel": "~4.5.0", - "@vue/cli-plugin-eslint": "~4.5.0", - "@vue/cli-plugin-router": "~4.5.0", - "@vue/cli-plugin-vuex": "~4.5.0", - "@vue/cli-service": "~4.5.0", - "@vue/compiler-sfc": "^3.1.5", - "babel-eslint": "^10.1.0", - "babel-plugin-import": "^1.13.3", - "dotenv": "^10.0.0", - "eslint": "^6.7.2", - "eslint-plugin-vue": "^7.0.0", - "sass": "^1.26.5", - "sass-loader": "^8.0.2", - "vite": "2", - "vite-plugin-importer": "^0.2.5" - } + "name": "gin-vue-admin", + "version": "2.3.5", + "private": true, + "scripts": { + "serve": "node openDocument.js && vite --host --mode development", + "build": "vite build --mode production", + "preview": "vite preview" + }, + "dependencies": { + "axios": "^0.19.2", + "core-js": "^3.6.5", + "echarts": "4.9.0", + "element-plus": "^1.1.0-beta.8", + "highlight.js": "^10.6.0", + "marked": "^2.0.0", + "mitt": "^3.0.0", + "path": "^0.12.7", + "qs": "^6.8.0", + "quill": "^1.3.7", + "screenfull": "^5.0.2", + "script-ext-html-webpack-plugin": "^2.1.4", + "spark-md5": "^3.0.1", + "vue": "^3.2.0", + "vue-particle-line": "^0.1.4", + "vue-router": "^4.0.0-0", + "vuex": "^4.0.0-0", + "vuex-persist": "^2.1.0" + }, + "devDependencies": { + "@vitejs/plugin-legacy": "^1.4.4", + "@vitejs/plugin-vue": "latest", + "@vue/cli-plugin-babel": "~4.5.0", + "@vue/cli-plugin-eslint": "~4.5.0", + "@vue/cli-plugin-router": "~4.5.0", + "@vue/cli-plugin-vuex": "~4.5.0", + "@vue/cli-service": "~4.5.0", + "@vue/compiler-sfc": "^3.1.5", + "babel-eslint": "^10.1.0", + "babel-plugin-import": "^1.13.3", + "chalk": "^4.1.2", + "dotenv": "^10.0.0", + "eslint": "^6.7.2", + "eslint-plugin-vue": "^7.0.0", + "sass": "^1.26.5", + "sass-loader": "^8.0.2", + "vite": "2", + "vite-plugin-banner": "^0.1.3", + "vite-plugin-importer": "^0.2.5" + } } diff --git a/web/src/core/config.js b/web/src/core/config.js index 920dc908..3ad93751 100644 --- a/web/src/core/config.js +++ b/web/src/core/config.js @@ -3,8 +3,49 @@ */ const config = { - appName: 'Gin-Vue-Admin', - appLogo: 'https://www.gin-vue-admin.com/img/logo.png' + appName: 'Gin-Vue-Admin', + appLogo: 'https://www.gin-vue-admin.com/img/logo.png', + showViteLogo: true } -export default config + +export const viteLogo = (env) => { + if (config.showViteLogo) { + const chalk = require('chalk') + console.log( + chalk.green( + `> 欢迎使用Gin-Vue-Admin,开源地址:https://github.com/flipped-aurora/gin-vue-admin` + ) + ) + console.log( + chalk.green( + `> 当前版本:V2.4.6 Apache` + ) + ) + console.log( + chalk.green( + `> 加群方式:微信:shouzi_1994 QQ群:622360840` + ) + ) + console.log( + chalk.green( + `> 默认自动化文档地址:http://127.0.0.1:${env.VITE_SERVER_PORT}/swagger/index.html` + ) + ) + console.log( + chalk.green( + `> 默认自动化文档地址:http://127.0.0.1:${env.VITE_SERVER_PORT}/swagger/index.html` + ) + ) + console.log( + chalk.green( + `> 默认前端文件运行地址:http://127.0.0.1:${env.VITE_CLI_PORT}` + ) + ) + console.log('\n') + } +} + + + +export default config \ No newline at end of file diff --git a/web/src/view/login/index.vue b/web/src/view/login/index.vue index 080698be..e76c022d 100644 --- a/web/src/view/login/index.vue +++ b/web/src/view/login/index.vue @@ -84,7 +84,7 @@ @@ -94,6 +94,7 @@ import { mapActions } from 'vuex' import { captcha } from '@/api/user' import { checkDB } from '@/api/initdb' +import bootomInfo from '@/view/layout/bottomInfo/bottomInfo.vue' export default { name: 'Login', data() { @@ -112,7 +113,6 @@ export default { } } return { - curYear: 0, lock: 'lock', loginForm: { username: 'admin', @@ -133,9 +133,11 @@ export default { picPath: '' } }, + components:{ + bootomInfo + }, created() { this.loginVerify() - this.curYear = new Date().getFullYear() }, methods: { ...mapActions('user', ['LoginIn']), diff --git a/web/vite.config.js b/web/vite.config.js index 735f3580..af5b146a 100644 --- a/web/vite.config.js +++ b/web/vite.config.js @@ -1,83 +1,92 @@ -/* eslint-disable */ import legacyPlugin from '@vitejs/plugin-legacy'; // import usePluginImport from 'vite-plugin-importer'; +import { viteLogo } from './src/core/config' +import Banner from 'vite-plugin-banner' import * as path from 'path'; import * as dotenv from 'dotenv'; import * as fs from 'fs'; import vuePlugin from '@vitejs/plugin-vue'; // @see https://cn.vitejs.dev/config/ export default ({ - command, - mode + command, + mode }) => { - let NODE_ENV = process.env.NODE_ENV || 'development' - let envFiles=[ - `.env.${NODE_ENV}` - ] - for (const file of envFiles) { - const envConfig = dotenv.parse(fs.readFileSync(file)) - for (const k in envConfig) { - process.env[k] = envConfig[k] - } - } + let NODE_ENV = process.env.NODE_ENV || 'development' + let envFiles = [ + `.env.${NODE_ENV}` + ] + for (const file of envFiles) { + const envConfig = dotenv.parse(fs.readFileSync(file)) + for (const k in envConfig) { + process.env[k] = envConfig[k] + } + } - let rollupOptions = {}; + viteLogo(process.env) + let timestamp = Date.parse(new Date()) - let optimizeDeps = {}; + let rollupOptions = { + output: { + entryFileNames: `gva/gin-vue-admin-[name].${timestamp}.js`, + chunkFileNames: `js/gin-vue-admin-[name].${timestamp}.js`, + assetFileNames: `assets/gin-vue-admin-[name].${timestamp}.[ext]` + } + }; + let optimizeDeps = {}; - let alias = { - '@': path.resolve(__dirname, './src'), - 'vue$': 'vue/dist/vue.runtime.esm-bundler.js', - } + let alias = { + '@': path.resolve(__dirname, './src'), + 'vue$': 'vue/dist/vue.runtime.esm-bundler.js', + } - let esbuild = {} + let esbuild = {} - return { - base: './', // index.html文件所在位置 - root: './', // js导入的资源路径,src - resolve: { - alias, - }, - define: { - 'process.env': {} - }, - server: { - open:true, - port: process.env.VITE_CLI_PORT, - proxy:{ - // 把key的路径代理到target位置 - // detail: https://cli.vuejs.org/config/#devserver-proxy - [process.env.VITE_BASE_API]: { // 需要代理的路径 例如 '/api' - target: `${process.env.VITE_BASE_PATH}:${process.env.VITE_SERVER_PORT}/`, // 代理到 目标路径 - changeOrigin: true, - rewrite: path => path.replace(new RegExp('^' + process.env.VITE_BASE_API), ''), - } - }, - }, - build: { - target: 'es2015', - minify: 'terser', // 是否进行压缩,boolean | 'terser' | 'esbuild',默认使用terser - manifest: false, // 是否产出maifest.json - sourcemap: false, // 是否产出soucemap.json - outDir: 'dist', // 产出目录 - rollupOptions, - }, - esbuild, - optimizeDeps, - plugins: [ - legacyPlugin({ - targets: ['Android > 39', 'Chrome >= 60', 'Safari >= 10.1', 'iOS >= 10.3', 'Firefox >= 54', 'Edge >= 15'], - }), vuePlugin(), - ], - css: { - preprocessorOptions: { - less: { - // 支持内联 JavaScript - javascriptEnabled: true, - } - } - }, - } + return { + base: './', // index.html文件所在位置 + root: './', // js导入的资源路径,src + resolve: { + alias, + }, + define: { + 'process.env': {} + }, + server: { + open: true, + port: process.env.VITE_CLI_PORT, + proxy: { + // 把key的路径代理到target位置 + // detail: https://cli.vuejs.org/config/#devserver-proxy + [process.env.VITE_BASE_API]: { // 需要代理的路径 例如 '/api' + target: `${process.env.VITE_BASE_PATH}:${process.env.VITE_SERVER_PORT}/`, // 代理到 目标路径 + changeOrigin: true, + rewrite: path => path.replace(new RegExp('^' + process.env.VITE_BASE_API), ''), + } + }, + }, + build: { + target: 'es2015', + minify: 'terser', // 是否进行压缩,boolean | 'terser' | 'esbuild',默认使用terser + manifest: false, // 是否产出maifest.json + sourcemap: false, // 是否产出soucemap.json + outDir: 'dist', // 产出目录 + rollupOptions, + }, + esbuild, + optimizeDeps, + plugins: [ + legacyPlugin({ + targets: ['Android > 39', 'Chrome >= 60', 'Safari >= 10.1', 'iOS >= 10.3', 'Firefox >= 54', 'Edge >= 15'], + }), vuePlugin(), [Banner(`\n Build based on gin-vue-admin \n Time : ${timestamp}`)] + ], + css: { + preprocessorOptions: { + less: { + // 支持内联 JavaScript + javascriptEnabled: true, + } + } + }, + } } \ No newline at end of file diff --git a/web/yarn.lock b/web/yarn.lock index 1d454a8f..8c55fee1 100644 --- a/web/yarn.lock +++ b/web/yarn.lock @@ -2648,6 +2648,14 @@ chalk@^4.0.0, chalk@^4.1.0: ansi-styles "^4.1.0" supports-color "^7.1.0" +chalk@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" + integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + chardet@^0.7.0: version "0.7.0" resolved "https://registry.nlark.com/chardet/download/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" @@ -8775,6 +8783,11 @@ verror@1.10.0: core-util-is "1.0.2" extsprintf "^1.2.0" +vite-plugin-banner@^0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/vite-plugin-banner/-/vite-plugin-banner-0.1.3.tgz#d3d4e8e284added35feaa54ab8ca273a9d3349e0" + integrity sha512-Kbv4KzvhffQwbp3Sr2FA51hFaiEgACGNExYK07hj0m53At2FTnPver2TfGCulDpv4G9B8/flbEOdso3JWWpIEQ== + vite-plugin-importer@^0.2.5: version "0.2.5" resolved "https://registry.nlark.com/vite-plugin-importer/download/vite-plugin-importer-0.2.5.tgz#2363dc0d97d4ecec530ee40171310a17c2db077e"