| 1234567891011121314151617181920212223242526272829303132333435363738 |
- <?php
- namespace App\Web\Components\Page;
- use App\Exceptions\ApiException;
- use App\Web\Facades\WebFacade;
- use App\Web\Services\WebService;
- use Illuminate\View\Component;
- class PageContent extends Component
- {
- protected $moduleKeyList; //这是参数
- protected $viewFile; //视图地址
- public function __construct($viewFile = "", $moduleKeyList=[])
- {
- if (empty($viewFile)) {
- throw new ApiException("common.page_none", '您访问的地址不存在~');
- }
- $this->moduleKeyList = $moduleKeyList ?? '';
- $this->viewFile= $viewFile;
- }
- /**
- * 获取页面数据
- */
- public function render()
- {
- $params = [
- "route_path"=>WebService::LAYOUTS_ROUTE,
- "module_key_list"=> $this->moduleKeyList
- ];
- $retData = WebFacade::getStaticPageInfo($params);
- $retData['menu_data']=WebFacade::getWebMenu();
- return view($this->viewFile, $retData);
- }
- }
|