diff --git a/.env.development b/.env.development index 262321a..591f558 100644 --- a/.env.development +++ b/.env.development @@ -5,4 +5,4 @@ VITE_REGISTER_API_URL=http://192.168.2.22:48080 # pk api地址 VITE_PK_MINI_API_URL=http://192.168.2.22:8086 # 商店地址 -VITE_SHOP_URL=http://192.168.2.128:8085 +VITE_SHOP_URL=https://ck.ninisc.cn/ diff --git a/src/layout/WorkbenchLayout.vue b/src/layout/WorkbenchLayout.vue index 70a8de2..e3d8d19 100644 --- a/src/layout/WorkbenchLayout.vue +++ b/src/layout/WorkbenchLayout.vue @@ -138,13 +138,17 @@ - +
+
+ 正在进入商店... +
@@ -173,7 +177,8 @@ const emit = defineEmits(['logout', 'go-back', 'stop-all']) const currentView = ref('tk') // Default Tab const autoDmMode = ref('config') // Default Sub-state: 'config' or 'browser' -const adminLoaded = ref(false) // 懒加载:首次切换到管理后台时才加载 iframe +const adminLoaded = ref(false) // Web iframe 懒加载(仅非 Electron) +const shopOpened = ref(false) // Electron 只首开加载一次 const shopUrl = ENV.SHOP_URL const handleGoToBrowser = async () => { @@ -196,13 +201,36 @@ const handleStopAll = () => { // Watch for view changes to manage native Electron BrowserViews watch(currentView, async (newVal, oldVal) => { - // 懒加载管理后台 iframe - if (newVal === 'shop' && !adminLoaded.value) { + // 懒加载 Web 端 iframe(仅非 Electron) + if (newVal === 'shop' && !adminLoaded.value && !isElectron()) { adminLoaded.value = true } if (!isElectron()) return + if (newVal === 'shop') { + if (!shopOpened.value) { + shopOpened.value = true + try { + await window.electronAPI.openShop(shopUrl) + } catch (e) { + console.error('打开商店失败:', e) + } + } else { + try { + await window.electronAPI.openShop(shopUrl) + } catch (e) { + console.error('打开商店失败:', e) + } + } + } else if (oldVal === 'shop') { + try { + await window.electronAPI.hideShop() + } catch (e) { + console.error('隐藏商店失败:', e) + } + } + if (newVal === 'auto_dm' && autoDmMode.value === 'browser') { // Switching TO Auto DM tab AND we are in browser mode: Show views try {