diff --git a/app/admin/controller/Design.php b/app/admin/controller/Design.php index 891683fa3..b7acb5ece 100644 --- a/app/admin/controller/Design.php +++ b/app/admin/controller/Design.php @@ -77,38 +77,39 @@ class Design extends Base // 模板数据 $assign = [ // 当前数据 - 'layout_data' => $layout_data, - 'data' => $data, + 'layout_data' => $layout_data, + 'data' => $data, // 页面列表 - 'pages_list' => BaseLayout::PagesList(), + 'pages_list' => BaseLayout::PagesList(), // 商品分类 - 'goods_category_list' => $goods_category, + 'goods_category_list' => $goods_category, // 商品搜索分类(分类) - 'layout_goods_category' => $goods_category, - 'layout_goods_category_field' => 'gci.category_id', + 'layout_goods_category' => $goods_category, + 'layout_goods_category_field' => 'gci.category_id', // 品牌 - 'brand_list' => BrandService::CategoryBrand(), + 'brand_list' => BrandService::CategoryBrand(), // 静态数据 - 'border_style_type_list' => BaseLayout::$border_style_type_list, - 'goods_view_list_show_style' => BaseLayout::$goods_view_list_show_style, - 'many_images_view_list_show_style' => BaseLayout::$many_images_view_list_show_style, - 'images_text_view_list_show_style' => BaseLayout::$images_text_view_list_show_style, + 'border_style_type_list' => BaseLayout::$border_style_type_list, + 'goods_view_list_show_style' => BaseLayout::$goods_view_list_show_style, + 'many_images_view_list_show_style' => BaseLayout::$many_images_view_list_show_style, + 'images_text_view_list_show_style' => BaseLayout::$images_text_view_list_show_style, + 'images_magic_cube_view_list_show_style' => BaseLayout::$images_magic_cube_view_list_show_style, // 首页商品排序规则 - 'goods_order_by_type_list' => MyConst('goods_order_by_type_list'), - 'goods_order_by_rule_list' => MyConst('goods_order_by_rule_list'), + 'goods_order_by_type_list' => MyConst('goods_order_by_type_list'), + 'goods_order_by_rule_list' => MyConst('goods_order_by_rule_list'), // 加载布局样式+管理 - 'is_load_layout' => 1, - 'is_load_layout_admin' => 1, + 'is_load_layout' => 1, + 'is_load_layout_admin' => 1, // 编辑器文件存放地址定义 - 'editor_path_type' => DesignService::AttachmentPathTypeValue($data['id']), + 'editor_path_type' => DesignService::AttachmentPathTypeValue($data['id']), ]; MyViewAssign($assign); return MyView(); diff --git a/app/layout/service/BaseLayout.php b/app/layout/service/BaseLayout.php index f4a5dd7a6..0d9c6b6f7 100644 --- a/app/layout/service/BaseLayout.php +++ b/app/layout/service/BaseLayout.php @@ -35,6 +35,7 @@ class BaseLayout // 商品样式类型 public static $goods_view_list_show_style = [ 'routine' => '常规模式', + 'leftright' => '左图右文', 'rolling' => '滚动模式', ]; @@ -52,6 +53,28 @@ class BaseLayout 'rolling' => '滚动模式', ]; + // 图片魔方样式类型 + public static $images_magic_cube_view_list_show_style = [ + 'g1' => '1图', + 'v2' => '2竖图', + 'v3' => '3竖图', + 'v4' => '4竖图', + 'h2' => '2横图', + 'h3' => '3横图', + 'h4' => '4横图', + 'lr12' => '1左右2', + 'lr13' => '1左右3', + 'lr21' => '2左右1', + 'lr31' => '3左右1', + 'tb12' => '1上下2', + 'tb13' => '1上下3', + 'tb21' => '2上下1', + 'tb31' => '3上下1', + 'lrv2h2'=> '2竖左右横2', + 'lrh2v2'=> '2横左右竖2', + 'g4' => '4图', + ]; + /** * 配置处理-保存 * @author Devil @@ -127,9 +150,25 @@ class BaseLayout } break; - // 自定义html custom - case 'custom' : - $vss['config']['custom'] = empty($vss['config']['custom']) ? '' : base64_decode($vss['config']['custom']); + // 图片魔方 images-magic-cube + case 'images-magic-cube' : + foreach($vss['config']['data_list'] as &$imc) + { + $imc['images'] = ResourcesService::AttachmentPathHandle($imc['images']); + } + $key = 'content_images_'; + foreach($vss['config'] as $mik=>$miv) + { + if(substr($mik, 0, strlen($key)) == $key) + { + $vss['config'][$mik] = ResourcesService::AttachmentPathHandle($miv); + } + } + break; + + // 商品 goods + case 'goods' : + unset($vss['config']['data_list']); break; } } @@ -165,12 +204,6 @@ class BaseLayout { foreach($config as &$v) { - // 配置信息处理 - if(!empty($v['config'])) - { - $v['config']['frontend_config'] = empty($v['config']['frontend_config']) ? '' : self::FrontendConfigHandle($v['config']['frontend_config']); - } - // 布局类型 $v['value_arr'] = explode(':', $v['value']); @@ -179,12 +212,6 @@ class BaseLayout { foreach($v['children'] as &$vs) { - // 配置信息处理 - if(!empty($vs['config'])) - { - $vs['config']['frontend_config'] = empty($vs['config']['frontend_config']) ? '' : self::FrontendConfigHandle($vs['config']['frontend_config']); - } - // 容器 if(!empty($vs['children']) && is_array($vs['children'])) { @@ -193,9 +220,6 @@ class BaseLayout { if(!empty($vss['value']) && !empty($vss['config'])) { - // 前端配置信息处理 - $vss['config']['frontend_config'] = empty($vss['config']['frontend_config']) ? '' : self::FrontendConfigHandle($vss['config']['frontend_config']); - // 滚动配置 if(array_key_exists('view_list_show_style_value', $vss['config'])) { @@ -247,6 +271,22 @@ class BaseLayout } break; + // 图片魔方 images-magic-cube + case 'images-magic-cube' : + foreach($vss['config']['data_list'] as &$imc) + { + $imc['images'] = ResourcesService::AttachmentPathViewHandle($imc['images']); + } + $key = 'content_images_'; + foreach($vss['config'] as $mik=>$miv) + { + if(substr($mik, 0, strlen($key)) == $key) + { + $vss['config'][$mik] = ResourcesService::AttachmentPathViewHandle($miv); + } + } + break; + // 商品 case 'goods' : $p = [ @@ -271,12 +311,6 @@ class BaseLayout $res = self::GoodsDataList($p); $vss['config']['data_list'] = $res['data']; break; - - // 自定义html - case 'custom' : - $vss['config']['custom'] = empty($vss['config']['custom']) ? '' : base64_encode(htmlspecialchars_decode($vss['config']['custom'])); - break; - } } } @@ -384,6 +418,15 @@ class BaseLayout } break; + // 图片魔方 images-magic-cube + case 'images-magic-cube' : + foreach($vss['config']['data_list'] as &$imc) + { + $imc['images'] = ResourcesService::AttachmentPathViewHandle($imc['images']); + $imc['url'] = self::LayoutUrlValueHandle($imc['type'], $imc['value']); + } + break; + // 商品 case 'goods' : $p = [ @@ -494,9 +537,6 @@ class BaseLayout } } - // 前端配置处理 - $config['frontend_config'] = empty($config['frontend_config']) ? '' : self::FrontendConfigHandle($config['frontend_config']); - // 滚动配置 if(array_key_exists('view_list_show_style_value', $config)) { @@ -717,35 +757,6 @@ class BaseLayout return $url; } - /** - * 前端配置处理 - * @author Devil - * @blog http://gong.gg/ - * @version 1.0.0 - * @date 2021-06-18 - * @desc description - * @param [array] $data [配偶者数据] - */ - public static function FrontendConfigHandle($data) - { - if(!empty($data) && is_array($data)) - { - foreach($data as &$v) - { - if(is_array($v)) - { - foreach($v as &$vs) - { - $vs = is_array($vs) ? $vs : (empty($vs) ? '' : urldecode($vs)); - } - } else { - $v = is_array($v) ? $v : (empty($v) ? '' : urldecode($v)); - } - } - } - return $data; - } - /** * 商品搜索 * @author Devil diff --git a/app/layout/view/base.html b/app/layout/view/base.html index 676c08492..39ee00799 100644 --- a/app/layout/view/base.html +++ b/app/layout/view/base.html @@ -36,6 +36,7 @@ + @@ -100,6 +101,7 @@ data-custom-url-name="自定义链接" data-custom-url-tips="请至少填写一个地址" data-data-show-modal-tips="请选择数据展示模式" + data-data-show-modal-error-tips="展示模式有误" > {{if !empty($layout_data) and is_array($layout_data)}} {{foreach $layout_data as $k=>$v}} @@ -111,7 +113,7 @@ -
+
{{foreach $v.children as $ks=>$vs}} {{if count($v['value_arr']) eq 1}} {{include file="../../../layout/view/public/common/module_admin" /}} @@ -141,6 +143,9 @@ {{include file="../../../layout/view/public/offcanvas/offcanvas_module_config_images_text" /}} + +{{include file="../../../layout/view/public/offcanvas/offcanvas_module_config_images_magic_cube" /}} + {{include file="../../../layout/view/public/offcanvas/offcanvas_module_config_video" /}} diff --git a/app/layout/view/form_back.html b/app/layout/view/form_back.html index f8d70ba09..36d038900 100644 --- a/app/layout/view/form_back.html +++ b/app/layout/view/form_back.html @@ -23,6 +23,12 @@ function FormBackModuleConfigImagesText(e) FormBackModuleConfigImagesTextHandle(e); } +// 图片魔方选择回调处理 +function FormBackModuleConfigImagesMagicCube(e) +{ + FormBackModuleConfigImagesMagicCubeHandle(e); +} + // 视频选择回调处理 function FormBackModuleConfigVideo(e) { diff --git a/app/layout/view/public/common/module_admin.html b/app/layout/view/public/common/module_admin.html index 128c15bff..e252e240a 100644 --- a/app/layout/view/public/common/module_admin.html +++ b/app/layout/view/public/common/module_admin.html @@ -1,4 +1,4 @@ -
+
@@ -11,7 +11,7 @@
-
+
{{if !empty($vss['config'])}}
{{switch vss.value}} @@ -132,6 +132,339 @@ {{/switch}} {{/case}} + {{case images-magic-cube}} +
+ {{switch vss.config.view_list_show_style}} + {{case g1}} +
+ + + +
+ {{/case}} + {{case v2}} +
+ + + +
+
+ + + +
+ {{/case}} + {{case v3}} +
+ + + +
+
+ + + +
+
+ + + +
+ {{/case}} + {{case v3}} +
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+ {{/case}} + {{case h2}} +
+ + + +
+
+ + + +
+ {{/case}} + {{case h3}} +
+ + + +
+
+ + + +
+
+ + + +
+ {{/case}} + {{case h4}} +
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+ {{/case}} + {{case lr12}} +
+ + + +
+ + {{/case}} + {{case lr13}} +
+ + + +
+ + {{/case}} + {{case lr21}} + +
+ + + +
+ {{/case}} + {{case lr31}} + +
+ + + +
+ {{/case}} + {{case tb12}} +
+ + + +
+
+
+ + + +
+
+ + + +
+
+ {{/case}} + {{case tb13}} +
+ + + +
+
+
+ + + +
+
+ + + +
+
+ + + +
+
+ {{/case}} + {{case tb21}} +
+
+ + + +
+
+ + + +
+
+
+ + + +
+ {{/case}} + {{case tb31}} +
+
+ + + +
+
+ + + +
+
+ + + +
+
+
+ + + +
+ {{/case}} + {{case lrv2h2}} +
+ + + +
+
+ + + +
+ + {{/case}} + {{case lrh2v2}} + +
+ + + +
+
+ + + +
+ {{/case}} + {{case g4}} +
+
+ + + +
+
+ + + +
+
+
+
+ + + +
+
+ + + +
+
+ {{/case}} + {{/switch}} +
+ {{/case}} {{case video}}
@@ -162,6 +495,25 @@
{{/case}} + {{case leftright}} +
    + {{foreach $vss.config.data_list as $ik=>$i}} +
  • +
    + + + +
    + +

    {{$currency_symbol}}{{$g.price}}

    +
    +
    +
  • + {{/foreach}} +
+ {{/case}} {{default /}}
    {{foreach $vss.config.data_list as $g}} @@ -207,7 +559,7 @@ {{/case}} {{case custom}} {{if !empty($vss['config']['custom'])}} - {{:base64_decode($vss.config.custom)}} + {{$vss.config.custom|raw}} {{/if}} {{/case}} {{/switch}} diff --git a/app/layout/view/public/common/module_view.html b/app/layout/view/public/common/module_view.html index 538477561..53f45f273 100644 --- a/app/layout/view/public/common/module_view.html +++ b/app/layout/view/public/common/module_view.html @@ -124,6 +124,339 @@
{{/switch}} {{/case}} + {{case images-magic-cube}} +
+ {{switch vss.config.view_list_show_style}} + {{case g1}} +
+ + + +
+ {{/case}} + {{case v2}} +
+ + + +
+
+ + + +
+ {{/case}} + {{case v3}} +
+ + + +
+
+ + + +
+
+ + + +
+ {{/case}} + {{case v3}} +
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+ {{/case}} + {{case h2}} +
+ + + +
+
+ + + +
+ {{/case}} + {{case h3}} +
+ + + +
+
+ + + +
+
+ + + +
+ {{/case}} + {{case h4}} +
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+ {{/case}} + {{case lr12}} +
+ + + +
+ + {{/case}} + {{case lr13}} +
+ + + +
+ + {{/case}} + {{case lr21}} + +
+ + + +
+ {{/case}} + {{case lr31}} + +
+ + + +
+ {{/case}} + {{case tb12}} +
+ + + +
+
+
+ + + +
+
+ + + +
+
+ {{/case}} + {{case tb13}} +
+ + + +
+
+
+ + + +
+
+ + + +
+
+ + + +
+
+ {{/case}} + {{case tb21}} +
+
+ + + +
+
+ + + +
+
+
+ + + +
+ {{/case}} + {{case tb31}} +
+
+ + + +
+
+ + + +
+
+ + + +
+
+
+ + + +
+ {{/case}} + {{case lrv2h2}} +
+ + + +
+
+ + + +
+ + {{/case}} + {{case lrh2v2}} + +
+ + + +
+
+ + + +
+ {{/case}} + {{case g4}} +
+
+ + + +
+
+ + + +
+
+
+
+ + + +
+
+ + + +
+
+ {{/case}} + {{/switch}} +
+ {{/case}} {{case video}}
@@ -154,6 +487,25 @@
{{/case}} + {{case leftright}} +
    + {{foreach $vss.config.data_list as $ik=>$i}} +
  • +
    + + + +
    + +

    {{$currency_symbol}}{{$g.price}}

    +
    +
    +
  • + {{/foreach}} +
+ {{/case}} {{default /}}
    {{foreach $vss.config.data_list as $g}} diff --git a/app/layout/view/public/content/images_magic_cube_show_style.html b/app/layout/view/public/content/images_magic_cube_show_style.html new file mode 100644 index 000000000..d50dc76bb --- /dev/null +++ b/app/layout/view/public/content/images_magic_cube_show_style.html @@ -0,0 +1,9 @@ +
    + {{foreach $images_magic_cube_view_list_show_style as $k=>$v}} + + {{/foreach}} + +
    \ No newline at end of file diff --git a/app/layout/view/public/content/images_text_show_style.html b/app/layout/view/public/content/images_text_show_style.html index 078bf0383..301692d62 100644 --- a/app/layout/view/public/content/images_text_show_style.html +++ b/app/layout/view/public/content/images_text_show_style.html @@ -1,11 +1,8 @@ -
    - -
    - {{foreach $images_text_view_list_show_style as $k=>$v}} - - {{/foreach}} - -
    +
    + {{foreach $images_text_view_list_show_style as $k=>$v}} + + {{/foreach}} +
    \ No newline at end of file diff --git a/app/layout/view/public/content/many_images_show_style.html b/app/layout/view/public/content/many_images_show_style.html index 571f5f519..7772c7dac 100644 --- a/app/layout/view/public/content/many_images_show_style.html +++ b/app/layout/view/public/content/many_images_show_style.html @@ -1,11 +1,8 @@ -
    - -
    - {{foreach $many_images_view_list_show_style as $k=>$v}} - - {{/foreach}} - -
    +
    + {{foreach $many_images_view_list_show_style as $k=>$v}} + + {{/foreach}} +
    \ No newline at end of file diff --git a/app/layout/view/public/offcanvas/offcanvas_module_config_goods.html b/app/layout/view/public/offcanvas/offcanvas_module_config_goods.html index eda88cf42..4c9e2e8cc 100644 --- a/app/layout/view/public/offcanvas/offcanvas_module_config_goods.html +++ b/app/layout/view/public/offcanvas/offcanvas_module_config_goods.html @@ -63,6 +63,9 @@
    内容样式
    + + {{include file="../../../layout/view/public/content/goods_show_style" /}} + {{include file="../../../layout/view/public/content/view_list_number" /}} @@ -83,9 +86,6 @@ {{include file="../../../layout/view/public/style/padding_4" key="_module" /}} - - - {{include file="../../../layout/view/public/content/goods_show_style" /}}
    diff --git a/app/layout/view/public/offcanvas/offcanvas_module_config_images_magic_cube.html b/app/layout/view/public/offcanvas/offcanvas_module_config_images_magic_cube.html new file mode 100644 index 000000000..03777814d --- /dev/null +++ b/app/layout/view/public/offcanvas/offcanvas_module_config_images_magic_cube.html @@ -0,0 +1,41 @@ + +
    +
    +
    +
    + +
    +
    展示模式必选
    +
    + {{include file="../../../layout/view/public/content/images_magic_cube_show_style" /}} +
    +
    + + +
    +
    内容设置必传
    +
    +
    +

    请先选择展示模式

    +
    +
    + + +
    +
    样式设置
    +
    + + {{include file="../../../layout/view/public/style/border_radius" max="1000" key="_item" required="" /}} + + + {{include file="../../../layout/view/public/style/margin" key="" /}} +
    +
    + +
    + +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/app/layout/view/public/offcanvas/offcanvas_module_config_images_text.html b/app/layout/view/public/offcanvas/offcanvas_module_config_images_text.html index 3c370c244..1879020d7 100644 --- a/app/layout/view/public/offcanvas/offcanvas_module_config_images_text.html +++ b/app/layout/view/public/offcanvas/offcanvas_module_config_images_text.html @@ -3,6 +3,15 @@
    + +
    +
    展示模式必选
    +
    + {{include file="../../../layout/view/public/content/images_text_show_style" /}} +
    +
    + +
    内容设置图片和标题必填一项
    @@ -11,15 +20,6 @@
    - -
    -
    内容样式
    -
    - - {{include file="../../../layout/view/public/content/images_text_show_style" /}} -
    -
    -
    样式设置
    diff --git a/app/layout/view/public/offcanvas/offcanvas_module_config_many_images.html b/app/layout/view/public/offcanvas/offcanvas_module_config_many_images.html index 2cdede17f..6010e7712 100644 --- a/app/layout/view/public/offcanvas/offcanvas_module_config_many_images.html +++ b/app/layout/view/public/offcanvas/offcanvas_module_config_many_images.html @@ -3,6 +3,16 @@
    + +
    +
    展示模式必选
    +
    + + {{include file="../../../layout/view/public/content/many_images_show_style" /}} +
    +
    + +
    内容设置必传
    @@ -11,15 +21,6 @@
    - -
    -
    内容样式
    -
    - - {{include file="../../../layout/view/public/content/many_images_show_style" /}} -
    -
    -
    样式设置
    diff --git a/public/static/common/css/layout.admin.css b/public/static/common/css/layout.admin.css index c3b6f5a1f..c545d848e 100644 --- a/public/static/common/css/layout.admin.css +++ b/public/static/common/css/layout.admin.css @@ -285,6 +285,14 @@ border-color: #ddd; } +/** + * 图片魔方展示类型 + */ +.config-view-show-style-images-magic-cube label:nth-child(7), +.config-view-show-style-images-magic-cube label:nth-child(13) { + margin-left: 0; +} + /** * 表单小组合组件 */ @@ -566,9 +574,6 @@ .layout-category-choice .goods-category-choice-content ul li:not(:nth-child(-n+7)):last-child { border-bottom: 0; } -.layout-category-choice .goods-category-choice-content ul li:first-child { - border-bottom: 1px solid #dedede; -} .layout-category-choice .goods-category-choice-content ul li a { text-decoration: none; } diff --git a/public/static/common/css/layout.css b/public/static/common/css/layout.css index e9d375590..864e8bb57 100644 --- a/public/static/common/css/layout.css +++ b/public/static/common/css/layout.css @@ -2,7 +2,7 @@ * 公共 */ .layout-container [class*="am-u-"] {padding-left:0;padding-right:0;} -.layout-container a {text-decoration: none;color: #333;} +.layout-container a {text-decoration: none;} .layout-container img {-webkit-transition: transform .3s ease-in;-moz-transition: transform .3s ease-in;-ms-transition: transform .3s ease-in;-o-transition: transform .3s ease-in;transition: transform .3s ease-in;} .layout-container img:hover {transform: scale(1.03);-moz-transform: scale(1.03);-webkit-transform: scale(1.03);-o-transform: scale(1.03);-ms-transform: scale(1.03);} @@ -1929,4 +1929,12 @@ .module-fixed-doc-ent-width{width:100%} .module-fixed-doc-ent-height{height:100%} .module-fixed-doc-ent-auto{margin:0 auto} -.module-fixed-doc-ent-cover{object-fit:cover} \ No newline at end of file +.module-fixed-doc-ent-cover{object-fit:cover} + +/** + * 图片魔方 + */ +.layout-module-images-magic-cube a img { + width: 100%; + height: 100%; +} \ No newline at end of file diff --git a/public/static/common/images/layout/g1.png b/public/static/common/images/layout/g1.png new file mode 100644 index 000000000..2973620c3 Binary files /dev/null and b/public/static/common/images/layout/g1.png differ diff --git a/public/static/common/images/layout/g4.png b/public/static/common/images/layout/g4.png new file mode 100644 index 000000000..eb2e33767 Binary files /dev/null and b/public/static/common/images/layout/g4.png differ diff --git a/public/static/common/images/layout/h2.png b/public/static/common/images/layout/h2.png new file mode 100644 index 000000000..59e3f1434 Binary files /dev/null and b/public/static/common/images/layout/h2.png differ diff --git a/public/static/common/images/layout/h3.png b/public/static/common/images/layout/h3.png new file mode 100644 index 000000000..e1ca39f3c Binary files /dev/null and b/public/static/common/images/layout/h3.png differ diff --git a/public/static/common/images/layout/h4.png b/public/static/common/images/layout/h4.png new file mode 100644 index 000000000..475b388a6 Binary files /dev/null and b/public/static/common/images/layout/h4.png differ diff --git a/public/static/common/images/layout/lr12.png b/public/static/common/images/layout/lr12.png new file mode 100644 index 000000000..02c3ff0fd Binary files /dev/null and b/public/static/common/images/layout/lr12.png differ diff --git a/public/static/common/images/layout/lr13.png b/public/static/common/images/layout/lr13.png new file mode 100644 index 000000000..6bbf323a3 Binary files /dev/null and b/public/static/common/images/layout/lr13.png differ diff --git a/public/static/common/images/layout/lr21.png b/public/static/common/images/layout/lr21.png new file mode 100644 index 000000000..9ebc60a00 Binary files /dev/null and b/public/static/common/images/layout/lr21.png differ diff --git a/public/static/common/images/layout/lr31.png b/public/static/common/images/layout/lr31.png new file mode 100644 index 000000000..fdf8efe3f Binary files /dev/null and b/public/static/common/images/layout/lr31.png differ diff --git a/public/static/common/images/layout/lrh2v2.png b/public/static/common/images/layout/lrh2v2.png new file mode 100644 index 000000000..18f37bcc8 Binary files /dev/null and b/public/static/common/images/layout/lrh2v2.png differ diff --git a/public/static/common/images/layout/lrv2h2.png b/public/static/common/images/layout/lrv2h2.png new file mode 100644 index 000000000..b1a71791d Binary files /dev/null and b/public/static/common/images/layout/lrv2h2.png differ diff --git a/public/static/common/images/layout/tb12.png b/public/static/common/images/layout/tb12.png new file mode 100644 index 000000000..667d8b263 Binary files /dev/null and b/public/static/common/images/layout/tb12.png differ diff --git a/public/static/common/images/layout/tb13.png b/public/static/common/images/layout/tb13.png new file mode 100644 index 000000000..ef12d0f99 Binary files /dev/null and b/public/static/common/images/layout/tb13.png differ diff --git a/public/static/common/images/layout/tb21.png b/public/static/common/images/layout/tb21.png new file mode 100644 index 000000000..db811eef4 Binary files /dev/null and b/public/static/common/images/layout/tb21.png differ diff --git a/public/static/common/images/layout/tb31.png b/public/static/common/images/layout/tb31.png new file mode 100644 index 000000000..b3a082ebc Binary files /dev/null and b/public/static/common/images/layout/tb31.png differ diff --git a/public/static/common/images/layout/v2.png b/public/static/common/images/layout/v2.png new file mode 100644 index 000000000..7cc67b393 Binary files /dev/null and b/public/static/common/images/layout/v2.png differ diff --git a/public/static/common/images/layout/v3.png b/public/static/common/images/layout/v3.png new file mode 100644 index 000000000..e2da5248d Binary files /dev/null and b/public/static/common/images/layout/v3.png differ diff --git a/public/static/common/images/layout/v4.png b/public/static/common/images/layout/v4.png new file mode 100644 index 000000000..f11ef5d95 Binary files /dev/null and b/public/static/common/images/layout/v4.png differ diff --git a/public/static/common/js/layout.admin.js b/public/static/common/js/layout.admin.js index a0b4efe64..e036b5086 100644 --- a/public/static/common/js/layout.admin.js +++ b/public/static/common/js/layout.admin.js @@ -3,6 +3,7 @@ FromInit('form.form-validation-layout-config'); FromInit('form.form-validation-module-offcanvas-images'); FromInit('form.form-validation-module-offcanvas-many-images'); FromInit('form.form-validation-module-offcanvas-images-text'); +FromInit('form.form-validation-module-offcanvas-images-magic-cube'); FromInit('form.form-validation-module-offcanvas-video'); FromInit('form.form-validation-module-offcanvas-goods'); FromInit('form.form-validation-module-offcanvas-title'); @@ -26,6 +27,7 @@ var $offcanvas_layout_config = $('#offcanvas-layout-config'); var $offcanvas_config_images = $('#offcanvas-module-config-images'); var $offcanvas_config_many_images = $('#offcanvas-module-config-many-images'); var $offcanvas_config_images_text = $('#offcanvas-module-config-images-text'); +var $offcanvas_config_images_magic_cube = $('#offcanvas-module-config-images-magic-cube'); var $offcanvas_config_video = $('#offcanvas-module-config-video'); var $offcanvas_config_goods = $('#offcanvas-module-config-goods'); var $offcanvas_config_title = $('#offcanvas-module-config-title'); @@ -199,7 +201,7 @@ function ModuleToPrompt(to_name) * @param {[object]} data [数据] * @param {[string]} key [key] * @param {[array]} replace_rules [替换规则] - * @param {[array]} exclude [排除样式] + * @param {[array]} exclude [排除css] */ function StyleBaseHandle(data, key, replace_rules, exclude) { @@ -245,10 +247,26 @@ function StyleBaseHandle(data, key, replace_rules, exclude) var l = data[key+type+'_left'] || value; if((t != 0 || r != 0 || b != 0 || l != 0) || (t != '' || r != '' || b != '' || l != '')) { - if((exclude || null) == null || exclude.indexOf(arr[i]['css']) == -1) + if((exclude || null) != null) { - style += arr[i]['css']+':'+ t+unit+' '+r+unit+' '+b+unit+' '+l+unit+';'; + if(exclude.indexOf(arr[i][t]) != -1) + { + t = 0; + } + if(exclude.indexOf(arr[i][r]) != -1) + { + r = 0; + } + if(exclude.indexOf(arr[i][b]) != -1) + { + b = 0; + } + if(exclude.indexOf(arr[i][l]) != -1) + { + l = 0; + } } + style += arr[i]['css']+':'+ t+unit+' '+r+unit+' '+b+unit+' '+l+unit+';'; } } @@ -340,6 +358,56 @@ function StyleBaseHandle(data, key, replace_rules, exclude) return style; } +/** + * 表单回调数据列表处理 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2022-11-25 + * @desc description + * @param {[object]} data [表单数据] + * @param {[object]} fields [处理字段] + */ +function FormBackDataListHandle(data, fields) +{ + var key_temp = []; + var data_list = []; + for(var i in data) + { + var loc = i.lastIndexOf('_'); + if(loc != -1) + { + var key = i.substr(0, loc+1); + var last = i.substr(loc+1); + for(var f in fields) + { + if(key == f) + { + // 临时索引记录 + var index = key_temp.indexOf(last); + if(index == -1) + { + key_temp.push(last); + index = key_temp.length-1; + } + + // 数据组合 + if(data_list[index] == undefined) + { + data_list[index] = {}; + } + data_list[index][fields[f]] = (fields[f] != 'value' || (data[i] || null) == null) ? data[i] : (JSON.parse(decodeURIComponent(data[i])) || ''); + delete data[i]; + } + } + } + } + return { + data: data, + data_list: data_list + } +} + /** * 元素固定处理 * @author Devil @@ -468,7 +536,7 @@ function FormBackLayoutConfigHandle(data) "style": style, "ent": ent } - $layout_content_obj.attr('data-json', encodeURIComponent(JSON.stringify(data))); + $layout_content_obj.attr('data-json', encodeURIComponent(CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(JSON.stringify(data))))); $offcanvas_layout_config.offCanvas('close'); } @@ -518,7 +586,7 @@ function FormBackModuleConfigImagesHandle(data) "style": style, "media_fixed": media_fixed } - $doc.attr('data-json', encodeURIComponent(JSON.stringify(data))); + $doc.attr('data-json', encodeURIComponent(CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(JSON.stringify(data))))); $offcanvas_config_images.offCanvas('close'); } @@ -548,38 +616,9 @@ function FormBackModuleConfigManyImagesHandle(data) "content_to_type_": "type", "content_to_value_": "value" }; - var key_temp = []; - var data_list = []; - for(var i in data) - { - var loc = i.lastIndexOf('_'); - if(loc != -1) - { - var key = i.substr(0, loc+1); - var last = i.substr(loc+1); - for(var f in fields) - { - if(key == f) - { - // 临时索引记录 - var index = key_temp.indexOf(last); - if(index == -1) - { - key_temp.push(last); - index = key_temp.length-1; - } - - // 数据组合 - if(data_list[index] == undefined) - { - data_list[index] = {}; - } - data_list[index][fields[f]] = (fields[f] != 'value' || (data[i] || null) == null) ? data[i] : (JSON.parse(decodeURIComponent(data[i])) || ''); - delete data[i]; - } - } - } - } + var res = FormBackDataListHandle(data, fields); + data = res.data; + var data_list = res.data_list; if(data_list.length <= 0) { Prompt($layout.data('config-images-tips') || '请先添加图片并配置'); @@ -713,7 +752,7 @@ function FormBackModuleConfigManyImagesHandle(data) "media_fixed": media_fixed } data['data_list'] = data_list; - $doc.attr('data-json', encodeURIComponent(JSON.stringify(data))); + $doc.attr('data-json', encodeURIComponent(CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(JSON.stringify(data))))); // 滚动初始化 if(show_style != 'list') @@ -765,38 +804,9 @@ function FormBackModuleConfigImagesTextHandle(data) "content_to_type_": "type", "content_to_value_": "value" }; - var key_temp = []; - var data_list = []; - for(var i in data) - { - var loc = i.lastIndexOf('_'); - if(loc != -1) - { - var key = i.substr(0, loc+1); - var last = i.substr(loc+1); - for(var f in fields) - { - if(key == f) - { - // 临时索引记录 - var index = key_temp.indexOf(last); - if(index == -1) - { - key_temp.push(last); - index = key_temp.length-1; - } - - // 数据组合 - if(data_list[index] == undefined) - { - data_list[index] = {}; - } - data_list[index][fields[f]] = (fields[f] != 'value' || (data[i] || null) == null) ? data[i] : (JSON.parse(decodeURIComponent(data[i])) || ''); - delete data[i]; - } - } - } - } + var res = FormBackDataListHandle(data, fields); + data = res.data; + var data_list = res.data_list; if(data_list.length <= 0) { Prompt($layout.data('config-images-text-tips') || '请先添加图文并配置'); @@ -815,7 +825,7 @@ function FormBackModuleConfigImagesTextHandle(data) if(show_style == null) { Prompt($layout.data('data-show-modal-tips') || '请选择数据展示模式'); - return false; + return false; } // 样式处理 @@ -956,7 +966,7 @@ function FormBackModuleConfigImagesTextHandle(data) "media_fixed": media_fixed } data['data_list'] = data_list; - $doc.attr('data-json', encodeURIComponent(JSON.stringify(data))); + $doc.attr('data-json', encodeURIComponent(CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(JSON.stringify(data))))); // 滚动初始化 if(show_style == 'rolling') @@ -966,6 +976,571 @@ function FormBackModuleConfigImagesTextHandle(data) $offcanvas_config_images_text.offCanvas('close'); } +/** + * 模块-图片魔方处理 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2021-05-18 + * @desc description + * @param {[object]} data [表单数据] + */ +function FormBackModuleConfigImagesMagicCubeHandle(data) +{ + // 基础信息 + var doc = $offcanvas_config_images_magic_cube.attr('data-doc') || null; + if(doc == null) + { + Prompt($layout.data('module-tab-tips') || '模块标记有误'); + return false; + } + + // 数据字段 + var fields = { + "content_images_": "images", + "content_to_name_": "name", + "content_to_type_": "type", + "content_to_value_": "value" + }; + var res = FormBackDataListHandle(data, fields); + data = res.data; + var data_list = res.data_list; + for(var i in data_list) + { + if((data_list[i]['images'] || null) == null) + { + Prompt($layout.data('upload-images-tips') || '请上传图片'); + return false; + } + } + // 展示模式 + var show_style = data.view_list_show_style || null; + if(show_style == null) + { + Prompt($layout.data('data-show-modal-tips') || '请选择数据展示模式'); + return false; + } + + // 外边距 + var margin = parseInt(data.style_margin || 0); + data['style_item_margin_top'] = margin; + data['style_item_margin_left'] = margin; + + // 样式处理 + var images_style = StyleBaseHandle(data, 'style_item_'); + + // 设置了外边距,则计算平均移动值 + var list_ent = (margin > 0) ? 'module-list-content-avg-'+margin : ''; + + // 数据处理 + var html = ''; + var item_style = []; + switch(show_style) + { + // 1图 + case 'g1' : + item_style[0] = 'width:100%;'; + html += `
    +
    + + + +
    +
    `; + break; + + // 2竖图 + case 'v2' : + item_style[0] = 'width:50%;'; + item_style[1] = 'width:50%;'; + html += `
    +
    + + + +
    +
    + + + +
    +
    `; + break; + + // 3竖图 + case 'v3' : + item_style[0] = 'width:33.33%;'; + item_style[1] = 'width:33.33%;'; + item_style[2] = 'width:33.33%;'; + html += `
    +
    + + + +
    +
    + + + +
    +
    + + + +
    +
    `; + break; + + // 4竖图 + case 'v4' : + item_style[0] = 'width:25%;'; + item_style[1] = 'width:25%;'; + item_style[2] = 'width:25%;'; + item_style[3] = 'width:25%;'; + html += `
    +
    + + + +
    +
    + + + +
    +
    + + + +
    +
    + + + +
    +
    `; + break; + + // 2横图 + case 'h2' : + item_style[0] = 'width:100%;'; + item_style[1] = 'width:100%;'; + html += `
    +
    + + + +
    +
    + + + +
    +
    `; + break; + + // 3横图 + case 'h3' : + item_style[0] = 'width:100%;'; + item_style[1] = 'width:100%;'; + item_style[2] = 'width:100%;'; + html += `
    +
    + + + +
    +
    + + + +
    +
    + + + +
    +
    `; + break; + + // 4横图 + case 'h4' : + item_style[0] = 'width:100%;'; + item_style[1] = 'width:100%;'; + item_style[2] = 'width:100%;'; + item_style[3] = 'width:100%;'; + html += `
    +
    + + + +
    +
    + + + +
    +
    + + + +
    +
    + + + +
    +
    `; + break; + + // 1左右2 + case 'lr12' : + if(margin > 0) + { + item_style[0] = 'width:calc(50% + '+(margin/2)+'px);'; + item_style[1] = 'width:calc(50% - '+(margin/2)+'px);'; + } else { + item_style[0] = 'width:50%;'; + item_style[1] = 'width:50%;'; + } + html += `
    +
    + + + +
    + +
    `; + break; + + // 1左右3 + case 'lr13' : + if(margin > 0) + { + item_style[0] = 'width:calc(50% + '+margin+'px);'; + item_style[1] = 'width:calc(50% - '+margin+'px);'; + } else { + item_style[0] = 'width:50%;'; + item_style[1] = 'width:50%;'; + } + html += `
    +
    + + + +
    + +
    `; + break; + + // 2左右1 + case 'lr21' : + if(margin > 0) + { + item_style[0] = 'width:calc(50% - '+(margin/2)+'px);'; + item_style[1] = 'width:calc(50% + '+(margin/2)+'px);'; + } else { + item_style[0] = 'width:50%;'; + item_style[1] = 'width:50%;'; + } + html += `
    + +
    + + + +
    +
    `; + break; + + // 3左右1 + case 'lr31' : + if(margin > 0) + { + item_style[0] = 'width:calc(50% - '+margin+'px);'; + item_style[1] = 'width:calc(50% + '+margin+'px);'; + } else { + item_style[0] = 'width:50%;'; + item_style[1] = 'width:50%;'; + } + html += `
    + +
    + + + +
    +
    `; + break; + + // 1上下2 + case 'tb12' : + item_style[0] = 'width:100%;'; + item_style[1] = 'width:50%;'; + item_style[2] = 'width:50%;'; + html += `
    +
    + + + +
    +
    +
    + + + +
    +
    + + + +
    +
    +
    `; + break; + + // 1上下3 + case 'tb13' : + item_style[0] = 'width:100%;'; + item_style[1] = 'width:33.33%;'; + item_style[2] = 'width:33.33%;'; + item_style[3] = 'width:33.33%;'; + html += `
    +
    + + + +
    +
    +
    + + + +
    +
    + + + +
    +
    + + + +
    +
    +
    `; + break; + + // 2上下1 + case 'tb21' : + item_style[0] = 'width:50%;'; + item_style[1] = 'width:50%;'; + item_style[2] = 'width:100%;'; + html += `
    +
    +
    + + + +
    +
    + + + +
    +
    +
    + + + +
    +
    `; + break; + + // 3上下1 + case 'tb31' : + item_style[0] = 'width:33.33%;'; + item_style[1] = 'width:33.33%;'; + item_style[2] = 'width:33.33%;'; + item_style[3] = 'width:100%;'; + html += `
    +
    +
    + + + +
    +
    + + + +
    +
    + + + +
    +
    +
    + + + +
    +
    `; + break; + + // 2竖左右横2 + case 'lrv2h2' : + if(margin > 0) + { + item_style[0] = 'width:calc(25% + '+(margin/2)+'px);'; + item_style[1] = 'width:calc(25% + '+(margin/2)+'px);'; + item_style[2] = 'width:calc(50% - '+margin+'px);'; + } else { + item_style[0] = 'width:25%;'; + item_style[1] = 'width:25%;'; + item_style[2] = 'width:50%;'; + } + html += `
    +
    + + + +
    +
    + + + +
    + +
    `; + break; + + // 2横左右竖2 + case 'lrh2v2' : + if(margin > 0) + { + item_style[0] = 'width:calc(50% - '+margin+'px);'; + item_style[1] = 'width:calc(25% + '+(margin/2)+'px);'; + item_style[2] = 'width:calc(25% + '+(margin/2)+'px);'; + } else { + item_style[0] = 'width:50%;'; + item_style[1] = 'width:25%;'; + item_style[2] = 'width:25%;'; + } + html += `
    + +
    + + + +
    +
    + + + +
    +
    `; + break; + + // 4图 + case 'g4' : + item_style[0] = 'width:50%;'; + item_style[1] = 'width:50%;'; + item_style[2] = 'width:50%;'; + item_style[3] = 'width:50%;'; + html += `
    +
    +
    + + + +
    +
    + + + +
    +
    +
    +
    + + + +
    +
    + + + +
    +
    +
    `; + break; + } + + // 模块容器设置 + var $doc = $(doc); + $doc.html(html); + + // 数据加入配置 + data['frontend_config'] = { + list_ent: list_ent, + item_style: item_style, + images_style: images_style + } + data['data_list'] = data_list; + $doc.attr('data-json', encodeURIComponent(CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(JSON.stringify(data))))); + $offcanvas_config_images_magic_cube.offCanvas('close'); +} + /** * 模块-视频处理 * @author Devil @@ -1012,7 +1587,7 @@ function FormBackModuleConfigVideoHandle(data) "style": style, "media_fixed": media_fixed } - $doc.attr('data-json', encodeURIComponent(JSON.stringify(data))); + $doc.attr('data-json', encodeURIComponent(CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(JSON.stringify(data))))); $offcanvas_config_video.offCanvas('close'); } @@ -1122,19 +1697,19 @@ function FormBackModuleConfigGoodsHandle(data) var item_html = ''; for(var i in list) { - item_html += '
  • '; - item_html += '
    '; - item_html += ''; - item_html += ''+list[i]['title']+''; - item_html += ''; - item_html += '
    '; - item_html += '
    '; - item_html += ''+list[i]['title']+''; - item_html += '
    '; - item_html += '

    '+__currency_symbol__+list[i]['price']+'

    '; - item_html += '
    '; - item_html += '
    '; - item_html += '
  • '; + item_html += `
  • ; +
    + + `+list[i]['title']+` + +
    + +

    `+__currency_symbol__+list[i]['price']+`

    +
    +
    +
  • `; } // 商品容器 @@ -1146,6 +1721,7 @@ function FormBackModuleConfigGoodsHandle(data) // 展示模式 var nav_dot_ent = ''; var list_ent = ''; + var item_right_style = ''; var show_style = data.view_list_show_style || 'routine'; switch(show_style) { @@ -1173,6 +1749,34 @@ function FormBackModuleConfigGoodsHandle(data) } break; + // 左图右文 + case 'leftright' : + var style_media_fixed_width = parseInt(data.style_media_fixed_width || 0); + item_right_style = 'margin-left:10px;'+((style_media_fixed_width > 0) ? 'width: calc(100% - '+(style_media_fixed_width+10)+'px);' : ''); + // 设置了外边距,则计算平均移动值 + var avg = (margin > 0) ? 'module-list-content-avg-'+margin : ''; + // 列表class + list_ent = avg+' module-list-sm-'+sm+' module-list-md-'+md+' module-list-lg-'+md+' '; + html += '
      '; + for(var i in list) + { + html += `
    • +
      + + + +
      + +

      `+__currency_symbol__+list[i]['price']+`

      +
      +
      +
    • `; + } + html += '
    '; + break; + // 常规、默认 default : // 设置了外边距,则计算平均移动值 @@ -1201,11 +1805,12 @@ function FormBackModuleConfigGoodsHandle(data) data['frontend_config'] = { "style": style, "item_style": item_style, + "item_right_style": item_right_style, "nav_dot_ent": nav_dot_ent, "list_ent": list_ent, "media_fixed": media_fixed } - $doc.attr('data-json', encodeURIComponent(JSON.stringify(data))); + $doc.attr('data-json', encodeURIComponent(CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(JSON.stringify(data))))); // 组件参数 if(JSON.stringify(option) !== '{}') @@ -1330,7 +1935,7 @@ function FormBackModuleConfigTitleHandle(data) "style_title_vice": style_title_vice, "style_title_more": style_title_more } - $doc.attr('data-json', encodeURIComponent(JSON.stringify(data))); + $doc.attr('data-json', encodeURIComponent(CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(JSON.stringify(data))))); $offcanvas_config_title.offCanvas('close'); } @@ -1357,14 +1962,8 @@ function FormBackModuleConfigCustomHandle(data) var $doc = $(doc); $doc.html(data.custom || ''); - // 自定义html、转为base64 - if((data['custom'] || null) != null) - { - data['custom'] = CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(data.custom)); - } - // 数据加入配置 - $doc.attr('data-json', encodeURIComponent(JSON.stringify(data))); + $doc.attr('data-json', encodeURIComponent(CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(JSON.stringify(data))))); $offcanvas_config_custom.offCanvas('close'); } @@ -1413,7 +2012,7 @@ function FormBackModuleConfigBorderHandle(data) data['frontend_config'] = { "style": style } - $doc.attr('data-json', encodeURIComponent(JSON.stringify(data))); + $doc.attr('data-json', encodeURIComponent(CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(JSON.stringify(data))))); $offcanvas_config_border.offCanvas('close'); } @@ -1457,7 +2056,7 @@ function FormBackModuleConfigHeightHandle(data) data['frontend_config'] = { "style": style } - $doc.attr('data-json', encodeURIComponent(JSON.stringify(data))); + $doc.attr('data-json', encodeURIComponent(CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(JSON.stringify(data))))); $offcanvas_config_height.offCanvas('close'); } @@ -1697,28 +2296,28 @@ function ModuleConfigGoodsItemContentHtml(data) function ModuleConfigManyImagesItemContentHtml(images, type, name, value) { var index = parseInt(Math.random()*1000001); - var html = '
    '; - html += ''; - html += '
    '; - html += '
      '; - html += '
    • '; - html += ''; - html += ''; - html += '
    • '; - html += '
    '; - html += '
    +'+($layout.data('upload-images-name') || '上传图片')+'
    '; - html += '
    '; - html += '
    '; - html += '
    '; - html += ''; - html += ''; - html += ''; - html += '
    '; - html += ModuleConfigImagesToContentHtml(name); - html += '
    '; - html += '
    '; - html += '
    '; - html += '
    '; + var html = `
    + +
    +
      +
    • + + +
    • +
    +
    +`+($layout.data('upload-images-name') || '上传图片')+`
    +
    +
    +
    + + + +
    + `+ModuleConfigImagesToContentHtml(name)+` +
    +
    +
    +
    `; return html; } @@ -1832,6 +2431,88 @@ function ModuleConfigImagesTextItemContentHtml(data) return html; } +/** + * 模块-图片魔方信息生成 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2021-05-18 + * @desc description + * @param {[object]} data [配置数据] + */ +function ModuleConfigImagesMagicCubeItemContentHtml(data) +{ + // 基础处理 + if((data || null) == null) + { + data = {}; + } + + // 展示模式 + var value = (((data.view_list_show_style || null) == null) ? $offcanvas_config_images_magic_cube.find('input[name="view_list_show_style"]:checked').val() : data.view_list_show_style) || null; + if(value == null) + { + Prompt($layout.data('data-show-modal-tips') || '请选择数据展示模式'); + return false; + } + var modal_arr = {g1:1, v2:2, v3:3, v4:4, h2:2, h3:3, h4:4, lr12:3, lr13:4, lr21:3, lr31:4, tb12:3, tb13:4, tb21:3, tb31:4, lrv2h2:4, lrh2v2:4, g4:4}; + if(modal_arr[value] == undefined) + { + Prompt(($layout.data('data-show-modal-error-tips') || '展示模式有误')+'('+value+')'); + return false; + } + + // 编辑则重新添加 + var count = 0; + if(JSON.stringify(data) == '{}') + { + // 已有数据条数、满足数量则不增加,多余则移除 + count = $offcanvas_config_images_magic_cube.find('.config-images-magic-cube-container > .am-panel').length; + var max = modal_arr[value]-count; + if(max < 0) + { + for(var i=count;i>=modal_arr[value];i--) + { + $offcanvas_config_images_magic_cube.find('.config-images-magic-cube-container > .am-panel:eq('+i+')').remove(); + } + } + if(max <= 0) + { + return false; + } + } + + // 生成数据 + var html = ''; + var data_list = data.data_list || []; + for(var i=count;i +
    +
      +
    • + + +
    • +
    +
    +`+($layout.data('upload-images-name') || '上传图片')+`
    +
    +
    +
    + + + +
    + `+ModuleConfigImagesToContentHtml(item.name)+` +
    +
    +
    +
    `; + } + return html; +} + /** * 模块-标题关键字 * @author Devil @@ -2025,8 +2706,8 @@ function OffcanvasConfigPagesChoice(obj, event) // 获取已选择的数据 var $parent = $page_parent_obj.parents('.form-view-choice-container'); - var key = $parent.data('key') || null; - var index = (key == null) ? '' : '_'+key; + var key = $parent.data('key') ; + var index = (key == undefined) ? '' : '_'+key; var to_type = $parent.find('input[name="content_to_type'+index+'"]').val() || null; var to_name = $parent.find('input[name="content_to_name'+index+'"]').val() || null; var to_value = $parent.find('input[name="content_to_value'+index+'"]').val() || null; @@ -2097,8 +2778,8 @@ function OffcanvasConfigPagesRemove(obj, event) { var $parent = obj.parents('.form-view-choice-container'); var $content = $parent.find('.form-view-choice-container-content'); - var key = $parent.data('key') || null; - var index = (key == null) ? '' : '_'+key; + var key = $parent.data('key'); + var index = (key == undefined) ? '' : '_'+key; $content.html(ModuleConfigImagesToContentHtml()); $parent.find('input[name="content_to_type'+index+'"]').val(''); $parent.find('input[name="content_to_name'+index+'"]').val(''); @@ -2151,7 +2832,7 @@ function LayoutViewConfig() var layout_temp = { "value": $(this).data('value').toString(), "status": ($(this).find('.layout-content-submit input[type="checkbox"]:checked').val() == 'on') ? 1 : 0, - "config": (json == null) ? {} : JSON.parse(decodeURIComponent(json)), + "config": (json == null) ? {} : JSON.parse(CryptoJS.enc.Base64.parse(decodeURIComponent(json)).toString(CryptoJS.enc.Utf8)), "children": [] }; @@ -2161,7 +2842,7 @@ function LayoutViewConfig() // 容器数据 var json = $(this).attr('data-json') || null; var content_temp = { - "config": (json == null) ? {} : JSON.parse(decodeURIComponent(json)), + "config": (json == null) ? {} : JSON.parse(CryptoJS.enc.Base64.parse(decodeURIComponent(json)).toString(CryptoJS.enc.Utf8)), "children": [] }; @@ -2174,7 +2855,7 @@ function LayoutViewConfig() var module_config = { "value": value, "name": layout_module_type_arr[value], - "config": (json == null) ? {} : JSON.parse(decodeURIComponent(json)) + "config": (json == null) ? {} : JSON.parse(CryptoJS.enc.Base64.parse(decodeURIComponent(json)).toString(CryptoJS.enc.Utf8)) }; // 商品模块移除商品列表 if(value == 'goods') @@ -2327,7 +3008,7 @@ $(function() if(json != null) { // 数据解析 - json = JSON.parse(decodeURIComponent(json)) || null; + json = JSON.parse(CryptoJS.enc.Base64.parse(decodeURIComponent(json)).toString(CryptoJS.enc.Utf8)) || null; } // 获取表单字段并赋空值 if((json || null) == null) @@ -2383,7 +3064,7 @@ $(function() if(json != null) { // 数据解析 - json = JSON.parse(decodeURIComponent(json)) || null; + json = JSON.parse(CryptoJS.enc.Base64.parse(decodeURIComponent(json)).toString(CryptoJS.enc.Utf8)) || null; } // 获取表单字段并赋空值 if((json || null) == null) @@ -2528,7 +3209,7 @@ $(function() if(json != null) { // 数据解析 - json = JSON.parse(decodeURIComponent(json)) || null; + json = JSON.parse(CryptoJS.enc.Base64.parse(decodeURIComponent(json)).toString(CryptoJS.enc.Utf8)) || null; } // 配置模块 @@ -2568,7 +3249,6 @@ $(function() { // 图片模块 case 'images' : - // 图片处理 var default_images = $config.data('default-images'); var html = '
  • '; html += ''; @@ -2582,7 +3262,6 @@ $(function() // 多图 case 'many-images' : - // 多图图片 var html = ''; if((json.data_list || null) != null && json.data_list.length > 0) { @@ -2596,7 +3275,6 @@ $(function() // 图文 case 'images-text' : - // 多图图片 var html = ''; if((json.data_list || null) != null && json.data_list.length > 0) { @@ -2607,8 +3285,29 @@ $(function() } $config.find('.config-images-text-container').html(html); // 展示模式默认空,必须要选择 - var images_text_show_style_arr = ['updown', 'leftright', 'rolling']; - if(images_text_show_style_arr.indexOf(json.view_list_show_style) == -1) + if((json.view_list_show_style || null) == null) + { + json['view_list_show_style'] = ''; + } + break; + + // 图片魔方 + case 'images-magic-cube' : + var html = ''; + if((json.data_list || null) != null && json.data_list.length > 0) + { + html += ModuleConfigImagesMagicCubeItemContentHtml(json); + } + $config.find('.config-images-magic-cube-container').html(html); + var $tips_msg = $offcanvas_config_images_magic_cube.find('.tips-msg'); + if((html || null) == null) + { + $tips_msg.removeClass('am-hide'); + } else { + $tips_msg.addClass('am-hide'); + } + // 展示模式默认空,必须要选择 + if((json.view_list_show_style || null) == null) { json['view_list_show_style'] = ''; } @@ -2694,11 +3393,6 @@ $(function() $config.find('.form-view-choice-container-content').html(ModuleConfigImagesToContentHtml(json.content_to_name || '')); break; - // 自定义html - case 'custom' : - json['custom'] = ((json['custom'] || null) == null) ? '' : CryptoJS.enc.Base64.parse(json.custom).toString(CryptoJS.enc.Utf8); - break; - default : if($config.length == 0) { @@ -2947,8 +3641,8 @@ $(function() // 设置数据 var $parent = $page_parent_obj.parents('.form-view-choice-container'); - var key = $parent.data('key') || null; - var index = (key == null) ? '' : '_'+key; + var key = $parent.data('key'); + var index = (key == undefined) ? '' : '_'+key; $parent.find('input[name="content_to_type'+index+'"]').val(to_type); $parent.find('input[name="content_to_name'+index+'"]').val(to_name); $parent.find('input[name="content_to_value'+index+'"]').val(to_value); @@ -3492,6 +4186,59 @@ $(function() }); + // 配置图片魔方 - 选择页面事件 + $offcanvas_config_images_magic_cube.on('click', '.form-view-choice-container-submit', function(e) + { + OffcanvasConfigPagesChoice($(this), e); + }); + + // 左侧配置 - 配置图片魔方 - 链接地址 - 移除 + $offcanvas_config_images_magic_cube.on('click', '.form-view-choice-container-active i.am-icon-close', function(e) + { + OffcanvasConfigPagesRemove($(this), e); + }); + + // 配置图片魔方 - 展示模式切换 + $(document).on('click', '#offcanvas-module-config-images-magic-cube input[name="view_list_show_style"]', function() + { + var html = ModuleConfigImagesMagicCubeItemContentHtml(); + if(html !== false) + { + $offcanvas_config_images_magic_cube.find('.config-images-magic-cube-container').append(html); + } + }); + + // 配置商品 - 展示模式切换 + $(document).on('click', '#offcanvas-module-config-goods input[name="view_list_show_style"]', function() + { + $base_show_style_value_obj = $(this).parents('.config-view-show-style').find('input[name="view_list_show_style_value"]'); + switch($(this).val()) + { + // 滚动 + case 'rolling' : + // 数据填充 + var json = ViewRollingShowStyleValueHandle($base_show_style_value_obj.val()); + if(json['item_margin'] <= 0) + { + json['item_margin'] = ''; + } + FormDataFill(json, '#modal-module-rolling-config'); + + // 开关状态 + $modal_rolling_config.find('input[name="is_auto_play"]').bootstrapSwitch('state', json.is_auto_play); + $modal_rolling_config.find('input[name="is_nav_dot"]').bootstrapSwitch('state', json.is_nav_dot); + + // 开启弹窗 + $modal_rolling_config.modal({ + width: 260, + height: 370, + closeViaDimmer: false + }); + break; + } + }); + + // 左侧配置 - 标题 - 右侧按钮 - 选择页面事件 $offcanvas_config_title.on('click', '.form-view-choice-container-submit', function(e) {