From d45408250b48b30e2fbdb2f32e33f6026502d42a Mon Sep 17 00:00:00 2001 From: DaxPay Date: Thu, 26 Sep 2024 14:40:59 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E8=87=AA=E5=8A=A8=E9=80=82=E9=85=8D?= =?UTF-8?q?=E6=9A=97=E9=BB=91=E6=A8=A1=E5=BC=8F,=20=E8=81=94=E8=B0=83?= =?UTF-8?q?=E9=80=9A=E9=81=93=E8=AE=A4=E8=AF=81=E5=8A=9F=E8=83=BD,=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=99=9A=E6=8B=9F=E6=8E=A7=E5=88=B6=E5=8F=B0?= =?UTF-8?q?=E8=B0=83=E8=AF=95=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 2 + .env.production | 3 + build/vite/plugin/index.ts | 10 ++- index.html | 5 +- package.json | 2 + pnpm-lock.yaml | 50 ++++++++++++++ src/main.ts | 1 - .../channel/alipay/AlipayAuthCallback.vue | 65 +++++++++++++++++-- .../channel/wechat/WechatAuthCallback.vue | 33 ++++++++-- types/global.d.ts | 1 + vite.config.ts | 2 +- 11 files changed, 161 insertions(+), 13 deletions(-) diff --git a/.env.development b/.env.development index 6bbcda6..d6a5e2c 100644 --- a/.env.development +++ b/.env.development @@ -13,5 +13,7 @@ VITE_GLOB_API_URL= # 接口前缀 VITE_GLOB_API_URL_PREFIX=/server +# 虚拟控制台 +VITE_V_CONSOLE=true diff --git a/.env.production b/.env.production index 5e25a52..fdfc2b2 100644 --- a/.env.production +++ b/.env.production @@ -11,6 +11,9 @@ VITE_GLOB_API_URL_PREFIX = /api # 是否删除console VITE_DROP_CONSOLE=true +# 虚拟控制台 +VITE_V_CONSOLE=false + # 是否启用gzip压缩或brotli压缩, 可选: gzip | brotli | none, 如果你需要多种形式,你可以用','来分隔 VITE_BUILD_COMPRESS='none' diff --git a/build/vite/plugin/index.ts b/build/vite/plugin/index.ts index 7e565f8..0d71aa1 100644 --- a/build/vite/plugin/index.ts +++ b/build/vite/plugin/index.ts @@ -1,14 +1,15 @@ +import * as path from 'node:path' import type { PluginOption } from 'vite' import Components from 'unplugin-vue-components/vite' import { VantResolver } from 'unplugin-vue-components/resolvers' import vue from '@vitejs/plugin-vue' import UnoCSS from 'unocss/vite' import AutoImport from 'unplugin-auto-import/vite' +import { viteVConsole } from 'vite-plugin-vconsole' import { configHtmlPlugin } from './html' import { configCompressPlugin } from './compress' import { configVisualizerConfig } from './visualizer' import { configSvgIconsPlugin } from './svgSprite' - /** * 配置 vite 插件 * @param viteEnv vite 环境变量配置文件键值队 object @@ -26,6 +27,13 @@ export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) { const vitePlugins: (PluginOption | PluginOption[])[] = [ // have to vue(), + viteVConsole({ + entry: path.resolve('src/main.ts'), // 或者可以使用这个配置: [path.resolve('src/main.ts')] + enabled: viteEnv.VITE_V_CONSOLE, // 可自行结合 mode 和 command 进行判断 + config: { + theme: 'dark', + }, + }), // 按需引入VantUi且自动创建组件声明 Components({ dts: true, diff --git a/index.html b/index.html index e0099b1..a93e310 100644 --- a/index.html +++ b/index.html @@ -10,14 +10,15 @@
diff --git a/src/views/daxpay/channel/wechat/WechatAuthCallback.vue b/src/views/daxpay/channel/wechat/WechatAuthCallback.vue index 15d4a4a..333783f 100644 --- a/src/views/daxpay/channel/wechat/WechatAuthCallback.vue +++ b/src/views/daxpay/channel/wechat/WechatAuthCallback.vue @@ -1,12 +1,19 @@ diff --git a/types/global.d.ts b/types/global.d.ts index 9edc09a..3fa51b6 100644 --- a/types/global.d.ts +++ b/types/global.d.ts @@ -61,6 +61,7 @@ declare global { VITE_GLOB_APP_TITLE: string VITE_GLOB_APP_SHORT_NAME: string VITE_DROP_CONSOLE: boolean + VITE_V_CONSOLE: boolean VITE_PROXY: [string, string][] VITE_BUILD_COMPRESS: 'gzip' | 'brotli' | 'none' VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE: boolean diff --git a/vite.config.ts b/vite.config.ts index 1fc4a25..57ab509 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -132,7 +132,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => { server: { host: true, // 服务启动时是否自动打开浏览器 - open: true, + open: false, // 服务端口号 port: Number(VITE_PORT), proxy: createProxy(VITE_PROXY),