From 3bf0e1e45acfb85fb6054dc55d1c1204a6750998 Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期二, 24 九月 2024 23:53:53 +0800 Subject: [PATCH] 通用增删改模态窗口更新,工单维护更新 --- internal/vite-config/src/plugins/appConfig.ts | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/internal/vite-config/src/plugins/appConfig.ts b/internal/vite-config/src/plugins/appConfig.ts index a4fb954..7d50662 100644 --- a/internal/vite-config/src/plugins/appConfig.ts +++ b/internal/vite-config/src/plugins/appConfig.ts @@ -27,8 +27,8 @@ return { name: PLUGIN_NAME, async configResolved(_config) { - let appTitle = _config?.env?.VITE_GLOB_APP_TITLE ?? ''; - appTitle = appTitle.replace(/\s/g, '_').replace(/-/g, '_'); + const appTitle = _config?.env?.VITE_GLOB_APP_TITLE ?? ''; + // appTitle = appTitle.replace(/\s/g, '_').replace(/-/g, '_'); publicPath = _config.base; source = await getConfigSource(appTitle); }, @@ -74,7 +74,15 @@ * @param env */ const getVariableName = (title: string) => { - return `__PRODUCTION__${title || '__APP'}__CONF__`.toUpperCase().replace(/\s/g, ''); + function strToHex(str: string) { + const result: string[] = []; + for (let i = 0; i < str.length; ++i) { + const hex = str.charCodeAt(i).toString(16); + result.push(('000' + hex).slice(-4)); + } + return result.join('').toUpperCase(); + } + return `__PRODUCTION__${strToHex(title) || '__APP'}__CONF__`.toUpperCase().replace(/\s/g, ''); }; async function getConfigSource(appTitle: string) { -- Gitblit v1.9.3