diff --git a/deploy/prod/Dockerfile b/deploy/prod/Dockerfile index a01ebb90a62710c90e3ec406fdda8013ca01fcaf..8941a4a252a72cdc146fec44b0b9542fe1665f8d 100644 --- a/deploy/prod/Dockerfile +++ b/deploy/prod/Dockerfile @@ -23,7 +23,7 @@ RUN sed -i 's|repo.openeuler.org|mirrors.nju.edu.cn/openeuler|g' /etc/yum.repos. useradd -m -u 1001 -g eulercopilot -s /sbin/nologin eulercopilot && \ passwd -l eulercopilot -COPY --from=0 /opt/eulerCopilot-web/dist /usr/share/nginx/html +COPY --from=0 /opt/eulerCopilot-web/dist/render /usr/share/nginx/html COPY --from=0 /opt/eulerCopilot-web/public /usr/share/nginx/html COPY --from=0 /opt/eulerCopilot-web/deploy/prod/nginx.conf.tmpl /home/eulercopilot/nginx.conf.tmpl COPY --from=0 /opt/eulerCopilot-web/deploy/prod/start.sh /home/eulercopilot/start.sh diff --git a/electron/main/common/conf.ts b/electron/main/common/conf.ts index 5f4c99ef5d9a0f81797a6c502a30ee268daeb533..d5ce45ff943cf56df37cfe901220071e984607bb 100644 --- a/electron/main/common/conf.ts +++ b/electron/main/common/conf.ts @@ -14,7 +14,7 @@ import { productObj } from './product'; interface ICacheConf { theme: 'system' | 'light' | 'dark'; - userLocale; + userLocale: string; } export const userDataPath = getUserDataPath(productObj.name); diff --git a/electron/main/common/constants.ts b/electron/main/common/constants.ts new file mode 100644 index 0000000000000000000000000000000000000000..859ab7b1e870de22c8a10b99b19069c6b8416f59 --- /dev/null +++ b/electron/main/common/constants.ts @@ -0,0 +1,8 @@ +const THEME_COLOR_MAP = { + 'dark': '#1f2329', + 'light': '#ffffff' +} + +export { + THEME_COLOR_MAP +} \ No newline at end of file diff --git a/electron/main/window/create.ts b/electron/main/window/create.ts index 1f29b725c379ef45c243dfa3d93ad10eba5336fb..87c4bf10b441767280eb963b1a42ff9f136d4e5b 100644 --- a/electron/main/window/create.ts +++ b/electron/main/window/create.ts @@ -13,6 +13,7 @@ import { BrowserWindow, app, globalShortcut, ipcMain } from 'electron'; import { options as allWindow } from './options'; import { updateConf } from '../common/conf'; import { isLinux } from '../common/platform'; +import {THEME_COLOR_MAP} from '../common/constants' // 存储所有创建的窗口实例,用于全局访问 const windowInstances: Map = new Map(); @@ -22,12 +23,16 @@ export function createWindow( hash: string, id?: string, ): BrowserWindow { + const theme = process.env['EULERCOPILOT_THEME'] || 'light'; + const backgroundColor = THEME_COLOR_MAP[theme] || '#ffffff'; const win = new BrowserWindow({ ...options, + backgroundColor, webPreferences: { nodeIntegration: true, contextIsolation: false, preload: path.join(__dirname, '../preload/index.js'), + devTools: !app.isPackaged, }, }); @@ -37,7 +42,7 @@ export function createWindow( } if (app.isPackaged) { - win.loadFile(path.join(__dirname, `../index.html`), { hash }); + win.loadFile(path.join(__dirname, `../render/index.html`), { hash }); } else { win.loadURL(`http://localhost:${process.env.PORT}/#${hash}`); } diff --git a/src/store/lang.ts b/src/store/lang.ts index ef1f1796096384b511113ea1cd9f5a6b0b29a30b..cde209bc3f0bcaa9d97da2cab28151e7d2355f73 100644 --- a/src/store/lang.ts +++ b/src/store/lang.ts @@ -23,6 +23,8 @@ export const useLangStore = defineStore('lang', () => { electronProcess.env['EULERCOPILOT_NLS_CONFIG'] && changeLanguage(nlsConfig.userLocale); + } else { + changeLanguage(language.value as 'zh_cn' | 'en'); } }); return { diff --git a/vite.config.ts b/vite.config.ts index 4e3ead95b625ea961423b28b8423df61285a4f08..90e864cea2b56dcc5783030287174f4f92d631f0 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -38,6 +38,7 @@ export default ({ mode }): UserConfigExport => { }), ], build: { + outDir: 'dist/render', rollupOptions: { output: { manualChunks(id) {