This commit is contained in:
pushuo 2023-02-03 16:33:24 +08:00 committed by Edward Yang
parent f0526c1177
commit 7a142b7c6c
15 changed files with 140 additions and 8 deletions

View File

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

View File

@ -0,0 +1,44 @@
<?php
/**
* Render.php
*
* @copyright 2022 beikeshop.com - All Rights Reserved
* @link https://beikeshop.com
* @author Edward Yang <yangjin@guangda.work>
* @created 2022-07-08 17:09:15
* @modified 2022-07-08 17:09:15
*/
namespace Beike\Admin\View\DesignBuilders;
use Illuminate\Contracts\View\View;
use Illuminate\View\Component;
class RichText 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' => 'rich_text',
'sort' => 0,
'name' => trans('admin/design_builder.module_rich_text'),
'icon' => '&#xe601;',
];
return view('admin::pages.design.module.rich_text', $data);
}
}

View File

@ -53,6 +53,8 @@ class DesignService
return self::handleProducts($content);
} elseif ($moduleCode == 'icons') {
return self::handleIcons($content);
} elseif ($moduleCode == 'rich_text') {
return self::handleRichText($content);
}
return $content;
@ -144,6 +146,19 @@ class DesignService
return $content;
}
/**
* 处理 rich_text 模块
*
* @param $content
* @return array
* @throws \Exception
*/
private static function handleRichText($content): array
{
$content['data'] = $content['text'][locale()] ?? '';
return $content;
}
/**
* 处理选项卡商品列表模块
*

View File

@ -16,6 +16,7 @@
<script src="{{ mix('build/beike/admin/js/app.js') }}"></script>
<script src="{{ asset('vendor/vue/Sortable.min.js') }}"></script>
<script src="{{ asset('vendor/vue/vuedraggable.js') }}"></script>
<script src="{{ asset('vendor/tinymce/5.9.1/tinymce.min.js') }}"></script>
<script src="{{ asset('vendor/element-ui/2.15.6/js.js') }}"></script>
<link rel="stylesheet" href="{{ asset('vendor/element-ui/2.15.6/css.css') }}">
<link rel="stylesheet" type="text/css" href="{{ asset('/build/beike/admin/css/design.css') }}">
@ -141,6 +142,7 @@
@include('admin::pages.design.builder.component.image_selector')
@include('admin::pages.design.builder.component.link_selector')
@include('admin::pages.design.builder.component.text_i18n')
@include('admin::pages.design.builder.component.rich_text_i18n')
<script>
let app = new Vue({

View File

@ -0,0 +1,55 @@
<template id="module-editor-rich-text-template">
<div class="image-edit-wrapper">
<div class="module-editor-row">{{ __('admin/builder.text_set_up') }}</div>
<div class="module-edit-group">
<div class="module-edit-title">{{ __('admin/builder.modules_content') }}</div>
<rich-text-i18n v-model="module.text"></rich-text-i18n>
</div>
</div>
</template>
<script type="text/javascript">
Vue.component('module-editor-rich-text', {
template: '#module-editor-rich-text-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(''),
text: {}
}
let register = @json($register);
register.make = make;
app.source.modules.push(register)
}, 100)
</script>

View File

@ -17,4 +17,5 @@ return [
'module_tab_products' => 'Tab-Produkte',
'module_product' => 'Warenmodul',
'module_icons' => 'Symbolmodul',
'module_rich_text' => 'Rich-Text',
];

View File

@ -10,11 +10,12 @@
*/
return [
'module_brand' => 'Brand Module',
'module_banner' => 'Banner Module',
'module_four_image_pro' => 'For Image PRO Module',
'module_slideshow' => 'Slideshow Module',
'module_tab_products' => 'Tab Products Module',
'module_product' => 'Products Module',
'module_icons' => 'Icon module',
'module_brand' => 'Brand',
'module_banner' => 'Banner',
'module_four_image_pro' => 'For Image PRO',
'module_slideshow' => 'Slideshow',
'module_tab_products' => 'Tab Products',
'module_product' => 'Products',
'module_icons' => 'Icons',
'module_rich_text' => 'Rich Text',
];

View File

@ -17,4 +17,5 @@ return [
'module_tab_products' => 'elemento de pestaña',
'module_product' => 'módulo de productos básicos',
'module_icons' => 'módulo de iconos',
'module_rich_text' => 'texto enriquecido',
];

View File

@ -17,4 +17,5 @@ return [
'module_tab_products' => 'onglet produits',
'module_product' => 'module marchandise',
'module_icons' => 'module d\'icônes',
'module_rich_text' => 'texte enrichi',
];

View File

@ -17,4 +17,5 @@ return [
'module_tab_products' => 'scheda prodotti',
'module_product' => 'modulo merci',
'module_icons' => 'modulo icona',
'module_rich_text' => 'rich text',
];

View File

@ -17,4 +17,5 @@ return [
'module_tab_products' => 'タブ製品',
'module_product' => '商品モジュール',
'module_icons' => 'アイコンモジュール',
'module_rich_text' => 'リッチテキスト',
];

View File

@ -17,4 +17,5 @@ return [
'module_tab_products' => 'элемент вкладки',
'module_product' => 'товарный модуль',
'module_icons' => 'модуль значков',
'module_rich_text' => 'форматированный текст',
];

View File

@ -17,4 +17,5 @@ return [
'module_tab_products' => '选项卡商品',
'module_product' => '商品模块',
'module_icons' => '图标模块',
'module_rich_text' => '富文本模块',
];

View File

@ -17,4 +17,5 @@ return [
'module_tab_products' => '選項卡商品',
'module_icons' => '圖標模塊',
'module_product' => '商品模塊',
'module_rich_text' => '富文本模塊',
];

View File

@ -0,0 +1,7 @@
<section class="module-item {{ $design ? 'module-item-design' : ''}}" id="module-{{ $module_id }}">
@include('design._partial._module_tool')
<div class="module-info mb-3 mb-md-5">
{!! $content['data'] !!}
</div>
</section>