From 7a5f04287c3ecada45600f61ff14f9acc21a503d Mon Sep 17 00:00:00 2001 From: renshen <1005457301@qq.com> Date: Tue, 13 Oct 2026 13:28:49 +0800 Subject: [PATCH] =?UTF-8?q?=E9=92=89=E9=92=89=E5=B7=A5=E4=BD=9C=E5=8F=B0?= =?UTF-8?q?=E5=85=A5=E5=8F=A3=EF=BC=9A=E5=BA=97=E9=93=BA=E8=BF=9D=E8=A7=84?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E9=A2=84=E8=AD=A6=E6=95=B4=E9=A1=B5=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=EF=BC=88=E9=9A=90=E8=97=8F=E5=85=A8=E5=B1=80=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 钉钉工作台里点进来的这个入口,现在只显示这一张页面:不再渲染全局侧边栏, 内容区占满宽度,其余页面和网页端登录完全不受影响。 判断依据:当前页面是 financial-risk-control/store-violation-alert,且请求来自 钉钉容器(UA 含 DingTalk)或显式带 ?focus=1;路由参数取不到时按路径段兜底。 --- .../views/components/layouts/admin.blade.php | 18 +++++++++++-- .../Business/StoreViolationAlertPageTest.php | 25 +++++++++++++++++++ 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/resources/views/components/layouts/admin.blade.php b/resources/views/components/layouts/admin.blade.php index d3c4f797..485cffb4 100644 --- a/resources/views/components/layouts/admin.blade.php +++ b/resources/views/components/layouts/admin.blade.php @@ -1,5 +1,17 @@ + @php + // 钉钉工作台「财务系统」入口:只在店铺违规信息预警这一页隐藏全局菜单, + // 让这个入口点进去就只是一张页面;网页端登录(非钉钉容器)不受影响。 + // 也支持显式 ?focus=1,便于以后给别的入口做同样的单页模式。 + // 路由参数在部分上下文取不到时退回按路径段判断(与目录表同一套兼容写法)。 + $focusSection = (string) (request()->route('section') ?: request()->segment(3)); + $focusPage = (string) (request()->route('page') ?: request()->segment(4)); + $focusEntry = $focusSection === 'financial-risk-control' + && $focusPage === 'store-violation-alert' + && (request()->boolean('focus') || str_contains((string) request()->userAgent(), 'DingTalk')); + @endphp + @if (! empty($metaTitle)) @@ -20,11 +32,13 @@ @stack('body_start') - + @unless ($focusEntry) + + @endunless -
+
diff --git a/tests/Feature/Business/StoreViolationAlertPageTest.php b/tests/Feature/Business/StoreViolationAlertPageTest.php index 27e9a39e..a6e2bbf7 100644 --- a/tests/Feature/Business/StoreViolationAlertPageTest.php +++ b/tests/Feature/Business/StoreViolationAlertPageTest.php @@ -135,6 +135,31 @@ class StoreViolationAlertPageTest extends FeatureTestCase ->assertSee('data-platform-panel="jingxi"', false); } + public function test_dingtalk_entry_shows_only_this_page_without_the_global_menu(): void + { + $this->allowPage(); + + // 钉钉工作台入口:隐藏全局菜单,只留这一页。 + $this->loginAs() + ->withHeaders(['User-Agent' => 'Mozilla/5.0 (Macintosh) AppleWebKit/605.1.15 DingTalk(9.0.1-macOS-arm64) webDt/PC']) + ->get(route('business.pages.show', [ + 'section' => 'financial-risk-control', + 'page' => 'store-violation-alert', + ])) + ->assertOk() + ->assertDontSee('id="sidenav-main"', false) + ->assertSeeText('店铺违规信息预警'); + + // 网页端(非钉钉)照旧显示完整菜单。 + $this->withHeaders(['User-Agent' => 'Mozilla/5.0 (Macintosh) Safari/605.1.15']) + ->get(route('business.pages.show', [ + 'section' => 'financial-risk-control', + 'page' => 'store-violation-alert', + ])) + ->assertOk() + ->assertSee('id="sidenav-main"', false); + } + public function test_page_filters_by_keyword(): void { $this->allowPage();