CaiWuXiTong/app/Utilities/FocusMode.php
renshen eb0f246765 财务经营风险管控:网页端不再重复显示目录页签
- 目录内页签(店铺违规信息预警/预览统计/流程统计)只在钉钉单页入口(?focus=1 或钉钉 UA)显示
- 网页端已有左侧菜单和已打开页面标签栏,页面内只保留内容本身
- 单页模式判断抽到 FocusMode,与布局共用
2026-10-19 14:56:08 +08:00

19 lines
682 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace App\Utilities;
class FocusMode
{
/**
* 单页模式(钉钉工作台入口,或显式 ?focus=1):只保留该目录自己的页签,隐藏全局菜单。
* 网页端正常登录时不启用,避免页面上的目录页签和左侧菜单、已打开页面标签栏重复。
*/
public static function activeFor(?string $sectionSlug = null): bool
{
$section = $sectionSlug ?: (string) (request()->route('section') ?: request()->segment(3));
return in_array($section, ['financial-risk-control'], true)
&& (request()->boolean('focus') || str_contains((string) request()->userAgent(), 'DingTalk'));
}
}