From 8e35cec123e6153883461cbc3f52dfe9b0a6097f Mon Sep 17 00:00:00 2001 From: yumoqing Date: Tue, 8 Sep 2026 15:58:56 +0800 Subject: [PATCH] =?UTF-8?q?refactor(front):=20=E5=88=A0index=5Ftab.js?= =?UTF-8?q?=E6=97=A7=E8=A1=A5=E4=B8=81=E2=80=94=E2=80=94=E5=8A=A8=E6=80=81?= =?UTF-8?q?tab=E5=B7=B2=E6=94=B6=E7=BC=96=E5=85=A5bricks=E6=A1=86=E6=9E=B6?= =?UTF-8?q?(mobile.js=E7=9A=84=5Fsid+tab.js=E7=9A=84open=5Ftab/add=5Ftab/s?= =?UTF-8?q?how=5Ftabcontent),=E6=A8=A1=E5=9D=97=E5=89=AF=E6=9C=AC=E4=BC=9A?= =?UTF-8?q?=E6=95=B4=E7=B1=BB=E8=A6=86=E7=9B=96=E6=A1=86=E6=9E=B6=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E5=B1=8F=E8=94=BDTabPanel=E5=88=A0tab/=E5=BC=80tab?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D(=C2=A716=E5=89=AF=E6=9C=AC=E5=9D=91);?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E6=B8=85=E7=90=86rp.json+load=5Fpath.py?= =?UTF-8?q?=E7=9A=84/index=5Ftab.js=E6=9D=83=E9=99=90=E6=B3=A8=E5=86=8C(20?= =?UTF-8?q?26-09-08)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/rp.json | 1 - scripts/load_path.py | 1 - wwwroot/index_tab.js | 88 -------------------------------------------- 3 files changed, 90 deletions(-) delete mode 100644 wwwroot/index_tab.js diff --git a/conf/rp.json b/conf/rp.json index 433b7b4..f5c79f6 100644 --- a/conf/rp.json +++ b/conf/rp.json @@ -12,7 +12,6 @@ "/rbac/user/logout.dspy", "/rbac/usermenu.ui", "/i18n_getmsgs", - "/index_tab.js", "/appbase/menu.ui", "/product_management/menu.ui", "/discount/menu.ui", diff --git a/scripts/load_path.py b/scripts/load_path.py index f9567fb..ace9fb7 100644 --- a/scripts/load_path.py +++ b/scripts/load_path.py @@ -56,7 +56,6 @@ PERMS = [ # 产线 shell(sdlc/core/ops/dist index.ui)须 logined,产线对匿名不可见。 ("/index.ui", "app", "any"), ("/todo_badge.js", "app", "any"), - ("/index_tab.js", "app", "any"), ("/theme_toggle.js", "app", "any"), # 手机端 H5 外壳(2026-09-07):「我的」整页(底部 TabBar 第4个 Tab) ("/mine.ui", "app", "logined"), diff --git a/wwwroot/index_tab.js b/wwwroot/index_tab.js deleted file mode 100644 index 1db7636..0000000 --- a/wwwroot/index_tab.js +++ /dev/null @@ -1,88 +0,0 @@ -// pipeline-app 首页 TabPanel 动态 tab 支持 -// 由 HTML shell 自动加载(configuredServer.get_js_files 收集 wwwroot 下 .js) - -// 每个浏览器 tab 一个 session_id(sessionStorage 隔离),用于多 tab 项目上下文隔离 -window._sid = function(){ - var sid = null; - try { sid = sessionStorage.getItem('pipeline_sid'); } catch(e){} - if(!sid){ sid = 's' + Date.now().toString(36) + Math.random().toString(36).slice(2,10); try{ sessionStorage.setItem('pipeline_sid', sid); }catch(e){} } - return sid; -}; - -(function(){ - if (typeof bricks === 'undefined' || !bricks.TabPanel) return; - if (bricks.TabPanel.prototype._dyn_patched) return; - bricks.TabPanel.prototype._dyn_patched = true; - - // 修复原生 add_tab 的 bug:this.add_removeable 不存在(应为 toolbar.add_removable), - // 且 createTool 内部已调用 add_removable,这里只需创建 tool 按钮 - bricks.TabPanel.prototype.add_tab = function(desc){ - this.toolbar.createTool(desc); - }; - - // 异步加载 tab 的 content(不阻塞 open_tab;401 会触发登录框,等登录后重试) - bricks.TabPanel.prototype._load_tab_content = async function(desc){ - if (this.content_buffer[desc.name]){ - if (this.cur_tab_name === desc.name) this.switch_content(this.content_buffer[desc.name]); - return; - } - var w = await bricks.widgetBuild(desc.content, this, {}); - this.content_buffer[desc.name] = w; - if (w && this.cur_tab_name === desc.name) this.switch_content(w); - }; - - // 动态打开 tab:已存在(opts.items 同名)则切换,不存在则新增。 - // 同步返回:立即创建/切换 + 高亮 tab 按钮,content 交由 _load_tab_content 异步加载, - // 避免 await widgetBuild 被 401 登录框阻塞导致 tab 不切换。 - bricks.TabPanel.prototype.open_tab = function(desc){ - var existing = null; - for (var i=0;i