diff --git a/src/views/dialogue/dialogueView.vue b/src/views/dialogue/dialogueView.vue index ef08dc972c6f7f901b6b7f22ce8c6ac2c38a4590..89c571efcf84c6018f07453a35bbd27d8db8ae95 100644 --- a/src/views/dialogue/dialogueView.vue +++ b/src/views/dialogue/dialogueView.vue @@ -215,8 +215,8 @@ const changeLanguagefun = (lang: 'CN' | 'EN') => { // 同步语言到iframe const iframe = document.querySelector('#my-iframe'); if (iframe?.contentWindow) { - const data = { lang: localStorage.getItem('localeLang') ?? 'CN' }; - let target = `${window.location.origin}/witchaind`; + const data = { lang: localStorage.getItem('localeLang') ?? 'CN' ,type: 'changeLanguage'}; + let target = window.location.origin.includes('localhost')?'http://localhost:3002/witchaind/' : `${window.location.origin}/witchaind/`; iframe.contentWindow.postMessage(data, target); } }; @@ -235,14 +235,13 @@ onMounted(() => { if (localStorage.getItem('kb_id')) { ruleForm.kb_id = localStorage.getItem('kb_id'); } - console.log('onMounted', window.location.host); initCopilot(); const iframe = document.getElementById('my-iframe') as HTMLIFrameElement; if (iframe) { if (window.location.origin === 'http://localhost:3000') { - iframe.src = `http://localhost:3002`; + iframe.src = `http://localhost:3002/witchaind/`; } else { - iframe.src = `${window.location.origin}/witchaind`; + iframe.src = `${window.location.origin}/witchaind/`; } } }); @@ -398,10 +397,10 @@ watch(
+ + + - - -
{ try { const language = localStorage.getItem('localeLang'); - const message = { StopActive: stopActive }; + const message = { StopActive: stopActive ,type: 'changeActive' }; iframe.contentWindow.postMessage({...message,lang:language}, iframeTarget); } catch (error) { console.error('发送消息到iframe失败:', error);