diff --git a/application/admin/controller/Layout.php b/application/admin/controller/Layout.php new file mode 100644 index 0000000000000000000000000000000000000000..eb45ed69fc79797a6675800dce4508dad471a0f9 --- /dev/null +++ b/application/admin/controller/Layout.php @@ -0,0 +1,56 @@ +IsLogin(); + + // 权限校验 + $this->IsPower(); + } + + /** + * 前端首页布局保存 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2021-06-22 + * @desc description + */ + public function LayoutIndexHomeSave() + { + return LayoutService::LayoutConfigSave('home', $this->data_post); + } +} +?> \ No newline at end of file diff --git a/application/admin/view/default/site/siteset/index.html b/application/admin/view/default/site/siteset/index.html index e4181f788a6e4299946673deaac19242ceec58f4..a500f4fca5d75f98688d285a1fcb93ed10d7703f 100644 --- a/application/admin/view/default/site/siteset/index.html +++ b/application/admin/view/default/site/siteset/index.html @@ -43,6 +43,9 @@ {{/foreach}} +
+ 拖拽模式需要自行进入首页设计页面去设计页面 >> +
diff --git a/application/index/controller/Common.php b/application/index/controller/Common.php index 1e8fa1f1d593b64bb77f2e074eb16242b84e2522..38db6de4a2272dc87c95e9cb4842d4948fb0f526 100755 --- a/application/index/controller/Common.php +++ b/application/index/controller/Common.php @@ -417,6 +417,10 @@ class Common extends Controller $this->assign('home_site_security_record_name', MyC('home_site_security_record_name')); $this->assign('home_site_security_record_url', MyC('home_site_security_record_url')); + // 布局样式+管理 + $this->assign('is_load_layout', 0); + $this->assign('is_load_layout_admin', 0); + // 默认不加载放大镜 $this->assign('is_load_imagezoom', 0); diff --git a/application/index/controller/Index.php b/application/index/controller/Index.php index 1da253058a04c2c99c8cffa838851922306b9fa9..3b0d066e52f64d4cd6a27fca29622bc340f420de 100755 --- a/application/index/controller/Index.php +++ b/application/index/controller/Index.php @@ -11,11 +11,16 @@ namespace app\index\controller; use think\facade\Hook; +use app\layout\service\BaseLayout; +use app\service\SeoService; +use app\service\AdminService; use app\service\BannerService; use app\service\GoodsService; use app\service\ArticleService; use app\service\OrderService; use app\service\AppHomeNavService; +use app\service\BrandService; +use app\service\LayoutService; /** * 首页 @@ -52,25 +57,83 @@ class Index extends Common $banner = BannerService::Banner(); $this->assign('banner_list', $banner); - // H5导航 - $this->assign('navigation', AppHomeNavService::AppHomeNav()); + // 数据模式 + $floor_data_type = MyC('home_index_floor_data_type', 0, true); + $this->assign('floor_data_type', $floor_data_type); - // 楼层数据 - $this->assign('goods_floor_list', GoodsService::HomeFloorList()); + // 是否设计模式 + $is_design = (!empty($this->data_request['save_url']) && isset($this->data_request['is_design']) && $this->data_request['is_design'] == 1 && $floor_data_type == 2 && AdminService::LoginInfo()) ? 1 : 0; + $this->assign('is_design', $is_design); + if($is_design == 1) + { + // 保存数据地址 + $this->assign('layout_save_url', base64_decode(urldecode($this->data_request['save_url']))); - // 文章 - $params = [ - 'where' => ['is_enable'=>1, 'is_home_recommended'=>1], - 'field' => 'id,title,title_color,article_category_id', - 'm' => 0, - 'n' => 9, - ]; - $article_list = ArticleService::ArticleList($params); - $this->assign('article_list', $article_list['data']); + // 设计配置数据 + $layout_data = LayoutService::LayoutConfigAdminData('home'); + $this->assign('layout_data', $layout_data['data']); + + // 页面列表 + $pages_list = BaseLayout::PagesList(); + $this->assign('pages_list', $pages_list); + + // 商品搜索分类(分类) + $this->assign('layout_goods_category', GoodsService::GoodsCategoryAll()); + $this->assign('layout_goods_category_field', 'gci.category_id'); + + // 品牌 + $this->assign('brand_list', BrandService::CategoryBrand()); + + // 静态数据 + $this->assign('border_style_type_list', BaseLayout::$border_style_type_list); + $this->assign('goods_view_list_show_style', BaseLayout::$goods_view_list_show_style); + $this->assign('many_images_view_list_show_style', BaseLayout::$many_images_view_list_show_style); + + // 首页商品排序规则 + $this->assign('goods_order_by_type_list', lang('goods_order_by_type_list')); + $this->assign('goods_order_by_rule_list', lang('goods_order_by_rule_list')); - // 用户订单状态 - $user_order_status = OrderService::OrderStatusStepTotal(['user_type'=>'user', 'user'=>$this->user, 'is_comments'=>1]); - $this->assign('user_order_status', $user_order_status['data']); + // 浏览器名称 + $this->assign('home_seo_site_title', SeoService::BrowserSeoTitle('首页设计', 1)); + + // 编辑器文件存放地址定义 + $this->assign('editor_path_type', 'index-design'); + + // 加载布局样式+管理 + $this->assign('is_load_layout', 1); + $this->assign('is_load_layout_admin', 1); + } else { + // 数据模式 + if($floor_data_type == 2) + { + // 设计配置数据 + $layout_data = LayoutService::LayoutConfigData('home'); + $this->assign('layout_data', $layout_data['data']); + + // 加载布局样式 + $this->assign('is_load_layout', 1); + } else { + // H5导航 + $this->assign('navigation', AppHomeNavService::AppHomeNav()); + + // 楼层数据 + $this->assign('goods_floor_list', GoodsService::HomeFloorList()); + + // 文章 + $params = [ + 'where' => ['is_enable'=>1, 'is_home_recommended'=>1], + 'field' => 'id,title,title_color,article_category_id', + 'm' => 0, + 'n' => 9, + ]; + $article_list = ArticleService::ArticleList($params); + $this->assign('article_list', $article_list['data']); + + // 用户订单状态 + $user_order_status = OrderService::OrderStatusStepTotal(['user_type'=>'user', 'user'=>$this->user, 'is_comments'=>1]); + $this->assign('user_order_status', $user_order_status['data']); + } + } // 加载百度地图api // 存在地图事件则载入 diff --git a/application/index/controller/Layout.php b/application/index/controller/Layout.php new file mode 100644 index 0000000000000000000000000000000000000000..9166f8d968743a320495f59f77ec9382728049ed --- /dev/null +++ b/application/index/controller/Layout.php @@ -0,0 +1,87 @@ +error('非法访问'); + } + + // 获取数据 + $params = $this->data_post; + $params['user'] = $this->user; + $ret = BaseLayout::GoodsSearchList($params); + if($ret['code'] == 0) + { + $this->assign('data', $ret['data']['data']); + $ret['data']['data'] = $this->fetch('../../../layout/view/public/common/goodssearch'); + } + return $ret; + } + + /** + * 商品数据 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2020-10-16 + * @desc description + */ + public function GoodsData() + { + // 是否ajax请求 + if(!IS_AJAX) + { + return $this->error('非法访问'); + } + + // 获取数据 + $params = $this->data_post; + $params['user'] = $this->user; + return BaseLayout::GoodsDataList($params); + } +} +?> \ No newline at end of file diff --git a/application/index/view/default/index/index.html b/application/index/view/default/index/index.html index 8d4378d80614ec5e490f776f95149db039406957..6a4f23bb1b82f034a5e058fff4c878ecec959235 100755 --- a/application/index/view/default/index/index.html +++ b/application/index/view/default/index/index.html @@ -13,101 +13,104 @@ {{include file="public/header_nav" /}} - -{{include file="public/home_banner" /}} - {{include file="public/goods_category" /}} - -
- - {{include file="public/home_nav" /}} + +{{if !isset($floor_data_type) or $floor_data_type neq 2}} + + {{include file="public/home_banner" /}} - - {{if MyC('home_index_banner_right_status', 1) eq 1}} -