MeetingList.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. namespace App\Web\Components\Meeting;
  3. use App\Exceptions\ApiException;
  4. use App\Web\Facades\MeetingFacade;
  5. use App\Web\Facades\WebFacade;
  6. use App\Web\Services\WebService;
  7. use Illuminate\View\Component;
  8. class MeetingList extends Component
  9. {
  10. protected $page; //这是参数
  11. protected $pageSize;
  12. protected $viewFile; //视图地址
  13. protected $typeIds;
  14. protected $tagIds;
  15. protected $keyword;
  16. protected $country;
  17. protected $expo_date;
  18. protected $router_path;
  19. public function __construct($viewFile = "", $params = [], $page = 1, $pageSize = 10,$routerPath = '',$typeIds = [],$tagIds=[],$keyword='',$country='',$expo_date='')
  20. {
  21. if (empty($viewFile)) {
  22. throw new ApiException("common.page_none", '您访问的地址不存在~');
  23. }
  24. $this->page = isset($params['page']) ? $params['page'] : $page;
  25. $this->pageSize = isset($params['page_size']) ? $params['page_size'] : $pageSize;
  26. $this->typeIds = isset($params['type_ids']) ? $params['type_ids'] : $typeIds;
  27. $this->tagIds = isset($params['tag_ids']) ? $params['tag_ids'] : $tagIds;
  28. $this->keyword = isset($params['keyword']) ? $params['keyword'] : $keyword;
  29. $this->country = isset($params['country']) ? $params['country'] : $country;
  30. $this->expo_date = isset($params['expo_date']) ? $params['expo_date'] : $expo_date;
  31. $this->router_path = $params['router_path'] ?? $routerPath;
  32. $this->viewFile= $viewFile;
  33. }
  34. /**
  35. * 资讯列表组件
  36. */
  37. public function render()
  38. {
  39. $params = [
  40. "page" => $this->page,
  41. "page_size" => $this->pageSize,
  42. "type_ids" => $this->typeIds,
  43. "tag_ids" => $this->tagIds,
  44. "keyword" => $this->keyword,
  45. "country" => $this->country,
  46. "expo_date" => $this->expo_date
  47. ];
  48. $params['status']=0;
  49. $params['sort']= [];
  50. $params['is_paginate']=1;
  51. $retData = MeetingFacade::getPublishMeetingList($params);
  52. if (!empty($this->router_path)) {
  53. $pageContent = WebFacade::getStaticPageInfo(['route_path' => $this->router_path]);
  54. $retData['page_content'] = $pageContent['page_content'];
  55. $retData['router_path'] = $this->router_path;
  56. }
  57. $retData['menu_data']=WebFacade::getWebMenu();
  58. return view($this->viewFile, $retData);
  59. }
  60. }