钉钉入口单页模式扩到整个「财务经营风险管控」目录
上一版只对店铺违规信息预警单页;在钉钉里点该目录的另一个页签(流程统计)又会 冒出整排菜单。改成:只要属于 financial-risk-control 目录、且来自钉钉容器 (或显式 ?focus=1),就隐藏全局菜单,只保留该目录自己的页签。
This commit is contained in:
parent
7a5f04287c
commit
26b83bd8e7
@ -1,14 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html dir="{{ language()->direction() }}" lang="{{ app()->getLocale() }}">
|
||||
@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'
|
||||
$focusEntry = in_array($focusSection, ['financial-risk-control'], true)
|
||||
&& (request()->boolean('focus') || str_contains((string) request()->userAgent(), 'DingTalk'));
|
||||
@endphp
|
||||
|
||||
|
||||
@ -139,7 +139,8 @@ class StoreViolationAlertPageTest extends FeatureTestCase
|
||||
{
|
||||
$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', [
|
||||
@ -150,6 +151,16 @@ class StoreViolationAlertPageTest extends FeatureTestCase
|
||||
->assertDontSee('id="sidenav-main"', false)
|
||||
->assertSeeText('店铺违规信息预警');
|
||||
|
||||
// 同目录下的另一个页面(流程统计)在钉钉里同样是单页模式。
|
||||
$this->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' => 'process-statistics',
|
||||
]))
|
||||
->assertOk()
|
||||
->assertDontSee('id="sidenav-main"', false)
|
||||
->assertSeeText('流程统计');
|
||||
|
||||
// 网页端(非钉钉)照旧显示完整菜单。
|
||||
$this->withHeaders(['User-Agent' => 'Mozilla/5.0 (Macintosh) Safari/605.1.15'])
|
||||
->get(route('business.pages.show', [
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user