From 61900b1f71f4c9048cbc48ed6f4b41ccfa1a6ce4 Mon Sep 17 00:00:00 2001
From: yyg1378265336 <1378265336@qq.com>
Date: 星期三, 26 二月 2025 09:16:16 +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