发布于 6年前
                墨子题库系统自动显示电脑、手机页面的设置在哪里
功能实现文件
 \vendor\edwin404\laravel-common\src\Common\Support\TemplateViewTrait.php部分代码如下:
    protected function _view($view, $viewData = [])
    {
            $template = ConfigFacade::get('siteTemplate', 'default');
            $mobileView = 'theme.' . $template . '.m.' . $view;
            $PCView = 'theme.' . $template . '.pc.' . $view;
            $defaultMobileView = 'theme.default.m.' . $view;
            $defaultPCView = 'theme.default.pc.' . $view;
            if ($this->isMobile()) {
                    $frameLayoutView = 'theme.' . $template . '.m.frame';
                    if (!view()->exists($frameLayoutView)) {
                            $frameLayoutView = 'theme.default.m.frame';
                    }
            } else {
                    $frameLayoutView = 'theme.' . $template . '.pc.frame';
                    if (!view()->exists($frameLayoutView)) {
                            $frameLayoutView = 'theme.default.pc.frame';
                    }
            }
            View::share('_frameLayoutView', $frameLayoutView);
            if ($this->isMobile()) {
                    if (view()->exists($mobileView)) {
                            return view($mobileView, $viewData);
                    }
                    if (view()->exists($defaultMobileView)) {
                            return view($defaultMobileView, $viewData);
                    }
            }
            if (view()->exists($PCView)) {
                    return view($PCView, $viewData);
            }
            return view($defaultPCView, $viewData);
    }
pc 字样的为电脑端,m 字样的为手机端,根据需求调整即可
 
             
             
             
             
            