From 3276e7d5cb4ddb8f993041eb8d0218535562ada2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=B2=A1=E5=A4=8D=E4=B9=A0?= <2353956224@qq.com>
Date: Sat, 28 Feb 2026 14:32:26 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=95=86=E5=BA=97=E5=A4=96?=
=?UTF-8?q?=E9=93=BE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.env.development | 2 +-
src/layout/WorkbenchLayout.vue | 38 +++++++++++++++++++++++++++++-----
2 files changed, 34 insertions(+), 6 deletions(-)
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 {