模块优化

This commit is contained in:
pushuo 2022-07-19 20:48:39 +08:00
parent 32f0e836d1
commit 6bcec9cf37
5 changed files with 153 additions and 4 deletions

View File

@ -19,7 +19,7 @@ class DesignController extends Controller
public function index(Request $request): View
{
$data = [
'editors' => ['editor-slide_show', 'editor-image401', 'editor-tab_product', 'editor-image100'],
'editors' => ['editor-slide_show', 'editor-image401', 'editor-tab_product', 'editor-image100', 'editor-brand'],
'languages' => LanguageRepo::all(),
'design_settings' => system_setting('base.design_setting'),
];

View File

@ -0,0 +1,44 @@
<?php
/**
* Render.php
*
* @copyright 2022 opencart.cn - All Rights Reserved
* @link http://www.guangdawangluo.com
* @author Edward Yang <yangjin@opencart.cn>
* @created 2022-07-08 17:09:15
* @modified 2022-07-08 17:09:15
*/
namespace Beike\Admin\View\DesignBuilders;
use Illuminate\View\Component;
use Illuminate\Contracts\View\View;
class Brand extends Component
{
/**
* Create a new component instance.
*
* @return void
*/
public function __construct()
{
}
/**
* Get the view / contents that represent the component.
*
* @return View
*/
public function render(): View
{
$data['register'] = [
'code' => 'brand',
'sort' => 0,
'name' => '品牌模块',
'icon' => '&#xe634;',
];
return view('admin::pages.design.module.brand', $data);
}
}

View File

@ -41,10 +41,10 @@ class DesignService
{
if ($moduleCode == 'slideshow') {
return self::handleSlideShow($content);
} elseif ($moduleCode == 'image401') {
return self::handleImage401($content);
} elseif ($moduleCode == 'image100') {
} elseif (in_array($moduleCode, ['image401', 'image100'])) {
return self::handleImage401($content);
} elseif ($moduleCode == 'brand') {
return self::handleBrand($content);
} elseif ($moduleCode == 'tab_product') {
return self::handleTabProducts($content);
}
@ -70,6 +70,23 @@ class DesignService
return $content;
}
/**
* 处理 brand 模块
*
* @param $content
* @return array
* @throws \Exception
*/
private static function handleBrand($content): array
{
$brands = $content['brands'];
$content['brands'] = [];
$content['title'] = $content['title'][current_language_code()];
return $content;
}
/**
* 处理 SlideShow 模块

View File

@ -0,0 +1,63 @@
<template id="module-editor-brand-template">
<div class="image-edit-wrapper">
<div class="module-editor-row">设置</div>
<div class="module-edit-group">
<div class="module-edit-title">模块标题</div>
<text-i18n v-model="module.title"></text-i18n>
</div>
<div class="module-editor-row">内容</div>
<div class="module-edit-group">
<div class="module-edit-title">选择品牌</div>
</div>
</div>
</template>
<script type="text/javascript">
Vue.component('module-editor-brand', {
template: '#module-editor-brand-template',
props: ['module'],
data: function () {
return {
//
}
},
watch: {
module: {
handler: function (val) {
this.$emit('on-changed', val);
},
deep: true
}
},
created: function () {
//
},
methods: {
}
});
setTimeout(() => {
const make = {
style: {
background_color: ''
},
floor: languagesFill(''),
full: true,
title: languagesFill('推荐品牌模块'),
brands: []
}
let register = @json($register);
register.make = make;
app.source.modules.push(register)
}, 100)
</script>

View File

@ -0,0 +1,25 @@
<section class="module-item {{ $design ? 'module-item-design' : ''}}" id="module-{{ $module_id }}">
@if ($design)
<div class="module-edit">
<div class="edit-wrap">
<div class=""><i class="bi bi-chevron-down"></i></div>
<div class=""><i class="bi bi-chevron-up"></i></div>
<div class="delete"><i class="bi bi-x-lg"></i></div>
<div class="edit"><i class="bi bi-pencil-square"></i></div>
</div>
</div>
@endif
<div class="module-info module-brand mb-5">
<div class="module-title">{{ $content['title'] }}</div>
<div class="container">
<div class="row">
@for ($i = 0; $i < 8; $i++)
<div class="col-6 col-md-4 col-lg-3">
<div class="brand-item"><img src="{{ asset('image/default/banner-1.png') }}" class="img-fluid"></div>
</div>
@endfor
</div>
</div>
</div>
</section>