diff --git a/src/views/dialogue/components/TitleBar.vue b/src/views/dialogue/components/TitleBar.vue index 4ce5d02546ae98419d8ee33a91826d52f9dd5a96..99671aff5f8ba294959ce000847eefef248b2c55 100644 --- a/src/views/dialogue/components/TitleBar.vue +++ b/src/views/dialogue/components/TitleBar.vue @@ -23,9 +23,14 @@ onMounted(async () => { const baseUrl = await getBaseUrl(); const origin = window.location.origin; const isElectron = window.navigator.userAgent.includes('Electron'); - iframeTarget.value = isElectron - ? `${baseUrl}/witchaind` - : `${origin}/witchaind`; + const isLocalHost = + window.location.origin.includes('localhost') || + window.location.origin.includes('127.0.0.1'); + iframeTarget.value = isLocalHost + ? 'http://127.0.0.1:9888/witchaind' + : isElectron + ? `${baseUrl}/witchaind` + : `${origin}/witchaind`; }); const changeLanguagefun = (lang: 'zh_cn' | 'en') => { diff --git a/src/views/dialogue/dialogueView.vue b/src/views/dialogue/dialogueView.vue index b968bf51c4abef644a98f18c3eca06ebd7630a82..b065bb07915e358273570209193e51a54a16060c 100644 --- a/src/views/dialogue/dialogueView.vue +++ b/src/views/dialogue/dialogueView.vue @@ -170,9 +170,14 @@ onMounted(async () => { const baseUrl = await getBaseUrl(); const origin = window.location.origin; const isElectron = window.navigator.userAgent.includes('Electron'); - const iframeTarget = isElectron - ? `${baseUrl}/witchaind` - : `${origin}/witchaind`; + const isLocalHost = + window.location.origin.includes('localhost') || + window.location.origin.includes('127.0.0.1'); + const iframeTarget = isLocalHost + ? 'http://127.0.0.1:9888/witchaind' + : isElectron + ? `${baseUrl}/witchaind` + : `${origin}/witchaind`; if (localStorage.getItem('theme')) { // document.body.setAttribute( diff --git a/src/views/tools/index.vue b/src/views/tools/index.vue index 7f5fe2c874f3229730e3f617a165d68f299b47c3..0e826aeab8aafcab55a04185cf6b0be7398e4cda 100644 --- a/src/views/tools/index.vue +++ b/src/views/tools/index.vue @@ -33,7 +33,14 @@ async function getIframeTarget() { const origin = window.location.origin; // Electron 环境的判断 const isElectron = window.navigator.userAgent.includes('Electron'); - const target = isElectron ? `${baseUrl}/witchaind` : `${origin}/witchaind`; + const isLocalHost = + window.location.origin.includes('localhost') || + window.location.origin.includes('127.0.0.1'); + const target = isLocalHost + ? 'http://127.0.0.1:9888/witchaind' + : isElectron + ? `${baseUrl}/witchaind` + : `${origin}/witchaind`; return target; }