This commit is contained in:
Edward Yang 2022-07-08 16:45:53 +08:00
parent 81595a5b18
commit c2d3d099c5
4 changed files with 36 additions and 5 deletions

View File

@ -10,6 +10,7 @@ class HomeController extends Controller
{ {
$data = [ $data = [
'category_products' => ProductRepo::getProductsByCategories([100002, 100003, 100004, 100005]), 'category_products' => ProductRepo::getProductsByCategories([100002, 100003, 100004, 100005]),
'renders' => ['dr-slide_show']
]; ];
return view('home', $data); return view('home', $data);

View File

@ -80,8 +80,30 @@ class ShopServiceProvider extends ServiceProvider
protected function loadDesignComponents() protected function loadDesignComponents()
{ {
$this->loadViewComponentsAs('de', [ $viewPath = base_path() . '/beike/Shop/View';
'slide_show' => \Beike\Shop\View\DesignEditor\SlideShow::class, $editorPath = $viewPath . '/DesignEditor/';
]); $renderPath = $viewPath . '/DesignRender/';
$editorFiles = glob($editorPath . '*');
foreach ($editorFiles as $editorFile) {
$editorName = basename($editorFile, '.php');
$editorAliasName = Str::snake($editorName);
$editorComponentName = Str::studly($editorName);
$fullName = "\\Beike\\Shop\\View\\DesignEditor\\{$editorComponentName}";
$this->loadViewComponentsAs('de', [
$editorAliasName => $fullName,
]);
}
$renderFiles = glob($renderPath . '*');
foreach ($renderFiles as $renderFile) {
$editorName = basename($renderFile, '.php');
$editorAliasName = Str::snake($editorName);
$editorComponentName = Str::studly($editorName);
$fullName = "\\Beike\\Shop\\View\\DesignRender\\{$editorComponentName}";
$this->loadViewComponentsAs('dr', [
$editorAliasName => $fullName,
]);
}
} }
} }

View File

@ -21,8 +21,9 @@ class SlideShow extends Component
* *
* @return void * @return void
*/ */
public function __construct() public function __construct($modules)
{ {
} }
/** /**
@ -32,6 +33,7 @@ class SlideShow extends Component
*/ */
public function render(): View public function render(): View
{ {
return view('design.module.slideshow.editor.index');
return view('design.module.slideshow.render.index');
} }
} }

View File

@ -1,6 +1,12 @@
@extends('layout.master') @extends('layout.master')
@section('body-class', 'page-home') @section('body-class', 'page-home')
@section('content') @section('content')
@foreach($renders as $render)
<x-dynamic-component :component="$render"/>
@endforeach
<section class="module-wrap mb-5"><img src="{{ asset('image/default/banner.png') }}" class="img-fluid"></section> <section class="module-wrap mb-5"><img src="{{ asset('image/default/banner.png') }}" class="img-fluid"></section>
{{-- @foreach ($categories as $category) {{-- @foreach ($categories as $category)
<a href="{{ shop_route('categories.show', $category) }}">{{ $category->description->name }}</a> <a href="{{ shop_route('categories.show', $category) }}">{{ $category->description->name }}</a>