moshaorui 4 luni în urmă
părinte
comite
94e1072a9b
1 a modificat fișierele cu 13 adăugiri și 13 ștergeri
  1. 13 13
      app/Distributor/Controllers/SitePagesController.php

+ 13 - 13
app/Distributor/Controllers/SitePagesController.php

@@ -35,13 +35,13 @@ class SitePagesController extends AdminDistController
      */
     public function index(Content $content)
     {
-        if (isset($_GET['type'])) {
-            $pageType =  $_GET['type'] == 1 ? 1 : 0;
+        if (isset($_GET['location'])) {
+            $location =  $_GET['location'] == 1 ? 1 : 0;
             //保存临时变量
-            setTempValue('location', $pageType);
+            setTempValue('location', $location);
         } else {
-            $pageType = getTempValue('location');
-        //    return redirect('/dist/site-pages?type='.$pageType);
+            $location = getTempValue('location');
+            return redirect('/dist/site-pages?location='.$location);
         }
 
         return $content
@@ -61,7 +61,7 @@ class SitePagesController extends AdminDistController
         //页面类型
         return Grid::make(SitePages::with(['pagesTag']), function (Grid $grid) {
             //页面类型
-            $pageType = getTempValue('location');
+            $location = getTempValue('location');
             //默认分页条数
             $grid->paginate(config('admin.per_page'));
             $grid->column('id')->display(function () {
@@ -91,7 +91,7 @@ class SitePagesController extends AdminDistController
                 $filter->equal('pagesTag.id',admin_trans_label('tags'))->select('api/tag')->width(2);
             });
             //权限与条件
-            $grid->model()->where('dist_id', getDistributorId())->where('page_type', $pageType)->orderBy('id', 'desc');
+            $grid->model()->where('dist_id', getDistributorId())->where('page_type', $location)->orderBy('id', 'desc');
         });
     }
 
@@ -106,10 +106,10 @@ class SitePagesController extends AdminDistController
     {
         return Show::make($id, Model::with(['pagesTag']), function (Show $show) {
             //页面类型
-            $pageType = getTempValue('location');
+            $location = getTempValue('location');
             $pagesTag  = $show->model()->pagesTag->toArray();
             $show->field('title');
-            if ($pageType == 1) {
+            if ($location == 1) {
                 $show->field('template_file');
             }
             $show->field('pagesTag',admin_trans_label('tags'))->as(function ($value) use ($pagesTag) {
@@ -148,9 +148,9 @@ class SitePagesController extends AdminDistController
     {
         return Form::make(SitePages::with(['pagesTag']), function (Form $form) {
             //页面类型
-            $pageType = getTempValue('location');
+            $location = getTempValue('location');
             $form->text('title')->required();
-            if ($pageType == 1) {
+            if ($location == 1) {
                 $options = DistAppearanceTemplate::getLandingPageTemplateOptions();
                 $form->select('template_file')->options($options)->default(current($options))->required();
             }
@@ -188,11 +188,11 @@ class SitePagesController extends AdminDistController
             });
 
             //保存前
-            $form->saving(function (Form $form) use ($pageType) {
+            $form->saving(function (Form $form) use ($location) {
                 //强制写死dist_id
                 $form->dist_id = getDistributorId();
                 //强制写死page_type
-                $form->page_type = $pageType;
+                $form->page_type = $location;
                 //slug配置是否重复
                 $id = $form->getKey();
                 if ($form->slug != '') {