| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- namespace App\Web\Components\Blog;
- use App\Exceptions\ApiException;
- use App\Web\Facades\BlogRenderFacade;
- use App\Web\Facades\WebFacade;
- use App\Web\Models\BlogPlateModel;
- use App\Web\Services\WebService;
- use Illuminate\View\Component;
- class VideoList extends Component
- {
- protected $page; //这是参数
- protected $pageSize;
- protected $viewFile; //视图地址
- protected $typeId;
- protected $tagId;
- protected $plateId;
- protected $keyword;
- protected $router_path;
- /**
- * @throws ApiException
- */
- public function __construct($viewFile = '', $params = [], $keyword = '',$routerPath='', $typeId = 0, $tagId = 0, $page = 1, $pageSize = 10)
- {
- if (empty($viewFile)) {
- throw new ApiException('common.page_none', '您访问的地址不存在~');
- }
- $this->keyword = $params['keyword'] ?? $keyword;
- $this->page = $params['page'] ?? $page;
- $this->pageSize = $params['page_size'] ?? $pageSize;
- $this->typeId = $params['type_id'] ?? $typeId;
- $this->tagId = $params['tag_id'] ?? $tagId;
- $this->plateId = BlogPlateModel::VIDEO;
- $this->viewFile = $viewFile;
- $this->router_path = $params['router_path'] ?? $routerPath;
- }
- /**
- * 视频列表组件
- */
- public function render()
- {
- $retData = [];
- $retData['news_list'] = BlogRenderFacade::getPublishBlogList(
- $this->plateId,
- $this->keyword,
- $this->page,
- $this->pageSize,
- [],
- (int)$this->typeId,
- (int)$this->tagId
- );
- if (!empty($this->router_path)) {
- $pageContent = WebFacade::getStaticPageInfo(['route_path' => $this->router_path]);
- $retData['page_content'] = $pageContent['page_content'];
- }
- $retData['menu_data']=WebFacade::getWebMenu();
- return view($this->viewFile, $retData);
- }
- }
|