可视化限宽优化、支持背景图片
parent
c23b1707cc
commit
6406069737
|
|
@ -92,11 +92,23 @@ class BaseLayout
|
|||
{
|
||||
foreach($config as &$v)
|
||||
{
|
||||
// 配置信息处理
|
||||
if(!empty($v['config']))
|
||||
{
|
||||
$v['config'] = self::ConfigSaveFieldHandle($v['config']);
|
||||
}
|
||||
|
||||
// 布局
|
||||
if(!empty($v['children']) && is_array($v['children']))
|
||||
{
|
||||
foreach($v['children'] as &$vs)
|
||||
{
|
||||
// 配置信息处理
|
||||
if(!empty($vs['config']))
|
||||
{
|
||||
$vs['config'] = self::ConfigSaveFieldHandle($vs['config']);
|
||||
}
|
||||
|
||||
// 容器
|
||||
if(!empty($vs['children']) && is_array($vs['children']))
|
||||
{
|
||||
|
|
@ -105,6 +117,9 @@ class BaseLayout
|
|||
{
|
||||
if(!empty($vss['value']) && !empty($vss['config']))
|
||||
{
|
||||
// 配置信息处理
|
||||
$vss['config'] = self::ConfigSaveFieldHandle($vss['config']);
|
||||
|
||||
// 根据模块类型处理
|
||||
switch($vss['value'])
|
||||
{
|
||||
|
|
@ -204,6 +219,12 @@ class BaseLayout
|
|||
{
|
||||
foreach($config as &$v)
|
||||
{
|
||||
// 配置信息处理
|
||||
if(!empty($v['config']))
|
||||
{
|
||||
$v['config'] = self::ConfigViewFieldHandle($v['config']);
|
||||
}
|
||||
|
||||
// 布局类型
|
||||
$v['value_arr'] = explode(':', $v['value']);
|
||||
|
||||
|
|
@ -212,6 +233,12 @@ class BaseLayout
|
|||
{
|
||||
foreach($v['children'] as &$vs)
|
||||
{
|
||||
// 配置信息处理
|
||||
if(!empty($vs['config']))
|
||||
{
|
||||
$vs['config'] = self::ConfigViewFieldHandle($vs['config']);
|
||||
}
|
||||
|
||||
// 容器
|
||||
if(!empty($vs['children']) && is_array($vs['children']))
|
||||
{
|
||||
|
|
@ -220,11 +247,8 @@ class BaseLayout
|
|||
{
|
||||
if(!empty($vss['value']) && !empty($vss['config']))
|
||||
{
|
||||
// 滚动配置
|
||||
if(array_key_exists('view_list_show_style_value', $vss['config']))
|
||||
{
|
||||
$vss['config']['view_list_show_style_value_arr'] = empty($vss['config']['view_list_show_style_value']) ? '' : json_decode(urldecode($vss['config']['view_list_show_style_value']), true);
|
||||
}
|
||||
// 配置信息处理
|
||||
$vss['config'] = self::ConfigViewFieldHandle($vss['config']);
|
||||
|
||||
// 根据模块类型处理
|
||||
switch($vss['value'])
|
||||
|
|
@ -337,184 +361,171 @@ class BaseLayout
|
|||
{
|
||||
if(!empty($config))
|
||||
{
|
||||
// 缓存key
|
||||
$cache_key = md5(is_array($config) ? json_encode($config, JSON_UNESCAPED_UNICODE) : $config).APPLICATION_CLIENT_TYPE;
|
||||
$data = MyCache($cache_key);
|
||||
if(empty($data) || MyEnv('app_debug'))
|
||||
// 是否数组
|
||||
if(!is_array($config))
|
||||
{
|
||||
// 是否数组
|
||||
if(!is_array($config))
|
||||
$config = json_decode($config, true);
|
||||
}
|
||||
if(!empty($config))
|
||||
{
|
||||
foreach($config as &$v)
|
||||
{
|
||||
$config = json_decode($config, true);
|
||||
}
|
||||
if(!empty($config))
|
||||
{
|
||||
foreach($config as &$v)
|
||||
// 配置信息处理
|
||||
if(!empty($v['config']))
|
||||
{
|
||||
// 配置信息处理
|
||||
if(!empty($v['config']))
|
||||
$v['config'] = self::ConfigViewFieldHandle($v['config'], true);
|
||||
}
|
||||
|
||||
// 布局类型
|
||||
$v['value_arr'] = explode(':', $v['value']);
|
||||
|
||||
// 布局
|
||||
if(!empty($v['children']) && is_array($v['children']))
|
||||
{
|
||||
foreach($v['children'] as &$vs)
|
||||
{
|
||||
// 配置信息处理
|
||||
$v['config'] = self::ConfigViewFieldHandle($v['config']);
|
||||
}
|
||||
|
||||
// 布局类型
|
||||
$v['value_arr'] = explode(':', $v['value']);
|
||||
|
||||
// 布局
|
||||
if(!empty($v['children']) && is_array($v['children']))
|
||||
{
|
||||
foreach($v['children'] as &$vs)
|
||||
if(!empty($vs['config']))
|
||||
{
|
||||
// 配置信息处理
|
||||
if(!empty($vs['config']))
|
||||
{
|
||||
// 配置信息处理
|
||||
$vs['config'] = self::ConfigViewFieldHandle($vs['config']);
|
||||
}
|
||||
$vs['config'] = self::ConfigViewFieldHandle($vs['config'], true);
|
||||
}
|
||||
|
||||
// 容器
|
||||
if(!empty($vs['children']) && is_array($vs['children']))
|
||||
// 容器
|
||||
if(!empty($vs['children']) && is_array($vs['children']))
|
||||
{
|
||||
// 模块
|
||||
foreach($vs['children'] as &$vss)
|
||||
{
|
||||
// 模块
|
||||
foreach($vs['children'] as &$vss)
|
||||
if(!empty($vss['value']) && !empty($vss['config']))
|
||||
{
|
||||
if(!empty($vss['value']) && !empty($vss['config']))
|
||||
// 配置信息处理
|
||||
$vss['config'] = self::ConfigViewFieldHandle($vss['config'], true);
|
||||
|
||||
// 根据模块类型处理
|
||||
switch($vss['value'])
|
||||
{
|
||||
// 配置信息处理
|
||||
$vss['config'] = self::ConfigViewFieldHandle($vss['config']);
|
||||
// 视频 video
|
||||
case 'video' :
|
||||
$vss['config']['video'] = ResourcesService::AttachmentPathViewHandle($vss['config']['content_video']);
|
||||
unset($vss['config']['content_video']);
|
||||
break;
|
||||
|
||||
// 根据模块类型处理
|
||||
switch($vss['value'])
|
||||
{
|
||||
// 视频 video
|
||||
case 'video' :
|
||||
$vss['config']['video'] = ResourcesService::AttachmentPathViewHandle($vss['config']['content_video']);
|
||||
unset($vss['config']['content_video']);
|
||||
break;
|
||||
// 单图 images
|
||||
case 'images' :
|
||||
// 配置重新组合
|
||||
$vss['config'] = [
|
||||
'frontend_config' => $vss['config']['frontend_config'],
|
||||
'images' => ResourcesService::AttachmentPathViewHandle($vss['config']['content_images']),
|
||||
'url' => self::LayoutUrlValueHandle($vss['config']['content_to_type'], $vss['config']['content_to_value']),
|
||||
];
|
||||
break;
|
||||
|
||||
// 单图 images
|
||||
case 'images' :
|
||||
// 配置重新组合
|
||||
$vss['config'] = [
|
||||
'frontend_config' => $vss['config']['frontend_config'],
|
||||
'images' => ResourcesService::AttachmentPathViewHandle($vss['config']['content_images']),
|
||||
'url' => self::LayoutUrlValueHandle($vss['config']['content_to_type'], $vss['config']['content_to_value']),
|
||||
// 多图 many-images
|
||||
case 'many-images' :
|
||||
foreach($vss['config']['data_list'] as &$mil)
|
||||
{
|
||||
$mil = [
|
||||
'images' => ResourcesService::AttachmentPathViewHandle($mil['images']),
|
||||
'url' => self::LayoutUrlValueHandle($mil['type'], $mil['value']),
|
||||
];
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
// 多图 many-images
|
||||
case 'many-images' :
|
||||
foreach($vss['config']['data_list'] as &$mil)
|
||||
// 图文 images-text
|
||||
case 'images-text' :
|
||||
foreach($vss['config']['data_list'] as &$itl)
|
||||
{
|
||||
$itl['images'] = ResourcesService::AttachmentPathViewHandle($itl['images']);
|
||||
$itl['url'] = self::LayoutUrlValueHandle($itl['type'], $itl['value']);
|
||||
}
|
||||
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 = [
|
||||
'data_type' => $vss['config']['goods_data_type'],
|
||||
];
|
||||
switch($vss['config']['goods_data_type'])
|
||||
{
|
||||
// 指定商品
|
||||
case 'goods' :
|
||||
$p['goods_ids'] = $vss['config']['goods_ids'];
|
||||
break;
|
||||
|
||||
// 商品分类
|
||||
case 'category' :
|
||||
$category = json_decode(urldecode($vss['config']['goods_category_value']), true);
|
||||
$p['category_id'] = $category[count($category)-1]['id'];
|
||||
$p['order_limit_number'] = empty($vss['config']['goods_order_limit_number']) ? 0 : $vss['config']['goods_order_limit_number'];
|
||||
$p['order_by_type'] = isset($vss['config']['goods_order_by_type']) ? $vss['config']['goods_order_by_type'] : 0;
|
||||
$p['order_by_rule'] = isset($vss['config']['goods_order_by_rule']) ? $vss['config']['goods_order_by_rule'] : 0;
|
||||
break;
|
||||
}
|
||||
$res = self::GoodsDataList($p);
|
||||
if(!empty($res['data']) && is_array($res['data']))
|
||||
{
|
||||
foreach($res['data'] as &$g)
|
||||
{
|
||||
$mil = [
|
||||
'images' => ResourcesService::AttachmentPathViewHandle($mil['images']),
|
||||
'url' => self::LayoutUrlValueHandle($mil['type'], $mil['value']),
|
||||
$g['goods_url'] = self::LayoutUrlValueHandle('goods', $g);
|
||||
}
|
||||
}
|
||||
$vss['config']['data_list'] = $res['data'];
|
||||
break;
|
||||
|
||||
// 标题
|
||||
case 'title' :
|
||||
// 关键字
|
||||
$keywords_list = [];
|
||||
if(!empty($vss['config']['keywords_list']))
|
||||
{
|
||||
foreach($vss['config']['keywords_list'] as $wd)
|
||||
{
|
||||
$keywords_list[] = [
|
||||
'keywords' => $wd['content_keywords'],
|
||||
'color' => empty($wd['style_keywords_color']) ? '' : $wd['style_keywords_color'],
|
||||
'url' => self::LayoutUrlValueHandle($wd['content_to_type'], $wd['content_to_value']),
|
||||
];
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// 图文 images-text
|
||||
case 'images-text' :
|
||||
foreach($vss['config']['data_list'] as &$itl)
|
||||
{
|
||||
$itl['images'] = ResourcesService::AttachmentPathViewHandle($itl['images']);
|
||||
$itl['url'] = self::LayoutUrlValueHandle($itl['type'], $itl['value']);
|
||||
}
|
||||
break;
|
||||
// 配置重新组合
|
||||
$vss['config'] = [
|
||||
'frontend_config' => $vss['config']['frontend_config'],
|
||||
'title' => $vss['config']['content_title'],
|
||||
'title_vice' => $vss['config']['content_title_vice'],
|
||||
'title_more' => $vss['config']['content_title_more'],
|
||||
'title_more_url' => self::LayoutUrlValueHandle($vss['config']['content_to_type'], $vss['config']['content_to_value']),
|
||||
'keywords_list' => $keywords_list,
|
||||
];
|
||||
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 = [
|
||||
'data_type' => $vss['config']['goods_data_type'],
|
||||
];
|
||||
switch($vss['config']['goods_data_type'])
|
||||
{
|
||||
// 指定商品
|
||||
case 'goods' :
|
||||
$p['goods_ids'] = $vss['config']['goods_ids'];
|
||||
break;
|
||||
|
||||
// 商品分类
|
||||
case 'category' :
|
||||
$category = json_decode(urldecode($vss['config']['goods_category_value']), true);
|
||||
$p['category_id'] = $category[count($category)-1]['id'];
|
||||
$p['order_limit_number'] = empty($vss['config']['goods_order_limit_number']) ? 0 : $vss['config']['goods_order_limit_number'];
|
||||
$p['order_by_type'] = isset($vss['config']['goods_order_by_type']) ? $vss['config']['goods_order_by_type'] : 0;
|
||||
$p['order_by_rule'] = isset($vss['config']['goods_order_by_rule']) ? $vss['config']['goods_order_by_rule'] : 0;
|
||||
break;
|
||||
}
|
||||
$res = self::GoodsDataList($p);
|
||||
if(!empty($res['data']) && is_array($res['data']))
|
||||
{
|
||||
foreach($res['data'] as &$g)
|
||||
{
|
||||
$g['goods_url'] = self::LayoutUrlValueHandle('goods', $g);
|
||||
}
|
||||
}
|
||||
$vss['config']['data_list'] = $res['data'];
|
||||
break;
|
||||
|
||||
// 标题
|
||||
case 'title' :
|
||||
// 关键字
|
||||
$keywords_list = [];
|
||||
if(!empty($vss['config']['keywords_list']))
|
||||
{
|
||||
foreach($vss['config']['keywords_list'] as $wd)
|
||||
{
|
||||
$keywords_list[] = [
|
||||
'keywords' => $wd['content_keywords'],
|
||||
'color' => empty($wd['style_keywords_color']) ? '' : $wd['style_keywords_color'],
|
||||
'url' => self::LayoutUrlValueHandle($wd['content_to_type'], $wd['content_to_value']),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
// 配置重新组合
|
||||
$vss['config'] = [
|
||||
'frontend_config' => $vss['config']['frontend_config'],
|
||||
'title' => $vss['config']['content_title'],
|
||||
'title_vice' => $vss['config']['content_title_vice'],
|
||||
'title_more' => $vss['config']['content_title_more'],
|
||||
'title_more_url' => self::LayoutUrlValueHandle($vss['config']['content_to_type'], $vss['config']['content_to_value']),
|
||||
'keywords_list' => $keywords_list,
|
||||
];
|
||||
break;
|
||||
|
||||
// 自定义html
|
||||
case 'custom' :
|
||||
$vss['config']['custom'] = empty($vss['config']['custom']) ? '' : htmlspecialchars_decode($vss['config']['custom']);
|
||||
break;
|
||||
}
|
||||
// 自定义html
|
||||
case 'custom' :
|
||||
$vss['config']['custom'] = empty($vss['config']['custom']) ? '' : htmlspecialchars_decode($vss['config']['custom']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 存储缓存
|
||||
MyCache($cache_key, $config, 180);
|
||||
}
|
||||
} else {
|
||||
$config = $data;
|
||||
}
|
||||
}
|
||||
return $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置信息字段处理
|
||||
* 配置信息字段保存处理
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
|
|
@ -522,37 +533,79 @@ class BaseLayout
|
|||
* @desc description
|
||||
* @param [array] $config [配置信息]
|
||||
*/
|
||||
public static function ConfigViewFieldHandle($config)
|
||||
public static function ConfigSaveFieldHandle($config)
|
||||
{
|
||||
if(!empty($config) && is_array($config))
|
||||
{
|
||||
// 配置信息多余字段移除
|
||||
$arr = [
|
||||
'style_',
|
||||
'content_item_keywords_',
|
||||
'content_images_',
|
||||
'content_to_type_',
|
||||
'content_to_name_',
|
||||
'content_to_value_',
|
||||
'view_list_number_',
|
||||
];
|
||||
foreach($config as $k=>$v)
|
||||
// 背景图片地址
|
||||
$fields = ['style_background_images'];
|
||||
foreach($fields as $v)
|
||||
{
|
||||
foreach($arr as $f)
|
||||
if(!empty($config[$v]))
|
||||
{
|
||||
$length = strlen($f);
|
||||
if(substr($k, 0, $length) == $f)
|
||||
{
|
||||
unset($config[$k]);
|
||||
}
|
||||
$config[$v] = ResourcesService::AttachmentPathHandle($config[$v]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置信息字段展示处理
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2021-06-22
|
||||
* @desc description
|
||||
* @param [array] $config [配置信息]
|
||||
* @param [boolean] $is_del_surplus_field [移除多余字段]
|
||||
*/
|
||||
public static function ConfigViewFieldHandle($config, $is_del_surplus_field = false)
|
||||
{
|
||||
if(!empty($config) && is_array($config))
|
||||
{
|
||||
// 滚动配置
|
||||
if(array_key_exists('view_list_show_style_value', $config))
|
||||
{
|
||||
$config['view_list_show_style_value_arr'] = empty($config['view_list_show_style_value']) ? '' : json_decode(urldecode($config['view_list_show_style_value']), true);
|
||||
unset($config['view_list_show_style_value']);
|
||||
}
|
||||
|
||||
// 附件
|
||||
$attachment_fields = ['style_background_images'];
|
||||
foreach($attachment_fields as $av)
|
||||
{
|
||||
if(!empty($config[$av]))
|
||||
{
|
||||
$config[$av] = ResourcesService::AttachmentPathViewHandle($config[$av]);
|
||||
}
|
||||
}
|
||||
|
||||
// 配置信息多余字段移除
|
||||
if($is_del_surplus_field)
|
||||
{
|
||||
$fields = [
|
||||
'style_',
|
||||
'content_item_keywords_',
|
||||
'content_images_',
|
||||
'content_to_type_',
|
||||
'content_to_name_',
|
||||
'content_to_value_',
|
||||
'view_list_number_',
|
||||
];
|
||||
foreach($config as $k=>$v)
|
||||
{
|
||||
if(!in_array($k, $attachment_fields))
|
||||
{
|
||||
foreach($fields as $f)
|
||||
{
|
||||
$length = strlen($f);
|
||||
if(substr($k, 0, $length) == $f)
|
||||
{
|
||||
unset($config[$k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $config;
|
||||
|
|
|
|||
|
|
@ -1,20 +1,17 @@
|
|||
<!-- 布局/模块导航-->
|
||||
<div class="am-tabs renovation-tabs">
|
||||
<div class="am-tabs renovation-tabs" data-am-tabs="{noSwipe: 1}" data-am-sticky>
|
||||
<ul class="am-tabs-nav am-nav am-nav-tabs">
|
||||
<li class="am-active" data-value="structure"><a href="#renovation-tabs-structure">布局</a></li>
|
||||
<li data-value="module"><a href="#renovation-tabs-module">模块</a></li>
|
||||
<li class="am-active" data-value="structure">
|
||||
<a href="#renovation-tabs-structure">布局</a>
|
||||
</li>
|
||||
<li data-value="module">
|
||||
<a href="#renovation-tabs-module">模块</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="am-tabs-bd am-padding-sm">
|
||||
<!-- 布局 -->
|
||||
<div class="renovation-panel am-active" id="renovation-tabs-structure">
|
||||
<div class="am-alert" data-am-alert>
|
||||
<button type="button" class="am-close">×</button>
|
||||
<p>1. 手机模式下每一块布局全部自动100%展示、从左往右依次往下排版</p>
|
||||
<p>2. 布局宽度以100%分为12块、每一块占比(8.33%)</p>
|
||||
<p>3. 小屏(640px及以下)、中屏(641px及以上)、大屏(1025px及以上)</p>
|
||||
</div>
|
||||
|
||||
<div class="structure-drag scrollspy-nav" data-am-tabs="{noSwipe: 1}" data-am-sticky>
|
||||
<div class="structure-drag scrollspy-nav">
|
||||
<button type="button" draggable="true" class="am-btn am-btn-default am-radius am-btn-xs am-margin-xs" data-value="100">100%</button>
|
||||
<button type="button" draggable="true" class="am-btn am-btn-default am-radius am-btn-xs am-margin-xs" data-value="6:6">6 : 6</button>
|
||||
<button type="button" draggable="true" class="am-btn am-btn-default am-radius am-btn-xs am-margin-xs" data-value="8:4">8 : 4</button>
|
||||
|
|
@ -32,7 +29,7 @@
|
|||
|
||||
<!-- 模块 -->
|
||||
<div class="renovation-panel am-hide" id="renovation-tabs-module">
|
||||
<div class="renovation-drag scrollspy-nav" data-am-tabs="{noSwipe: 1}" data-am-sticky>
|
||||
<div class="renovation-drag scrollspy-nav">
|
||||
<button type="button" draggable="true" class="am-btn am-btn-default am-radius am-btn-xs am-margin-xs" data-value="images">单图</button>
|
||||
<button type="button" draggable="true" class="am-btn am-btn-default am-radius am-btn-xs am-margin-xs" data-value="many-images">多图</button>
|
||||
<button type="button" draggable="true" class="am-btn am-btn-default am-radius am-btn-xs am-margin-xs" data-value="images-text">图文</button>
|
||||
|
|
@ -113,7 +110,7 @@
|
|||
<button type="button" class="am-btn am-btn-secondary am-radius am-btn-xs am-icon-square-o layout-submit layout-submit-set"> 布局设置</button>
|
||||
<button type="button" class="am-btn am-btn-danger am-radius am-btn-xs am-icon-trash-o layout-submit layout-submit-del"> 布局移除</button>
|
||||
</div>
|
||||
<div class="layout-content-children {{if !empty($v['config']) and !empty($v['config']['frontend_config'])}}{{$v.config.frontend_config.ent}}{{/if}}" data-json="{{if !empty($v['config'])}}{{:urlencode(base64_encode(json_encode($v['config'])))}}{{/if}}" style="{{if !empty($v['config']) and !empty($v['config']['frontend_config'])}}{{$v.config.frontend_config.style}}{{/if}}">
|
||||
<div class="layout-content-children {{if !empty($v['config']) and !empty($v['config']['frontend_config'])}}{{$v.config.frontend_config.ent}}{{/if}}" data-json="{{if !empty($v['config'])}}{{:urlencode(base64_encode(json_encode($v['config'])))}}{{/if}}" style="{{if !empty($v['config']) and !empty($v['config']['frontend_config'])}}{{$v.config.frontend_config.style}}{{/if}}{{if !empty($v['config']['style_background_images'])}}background-image:url({{$v.config.style_background_images}});{{/if}}">
|
||||
{{foreach $v.children as $ks=>$vs}}
|
||||
{{if count($v['value_arr']) eq 1}}
|
||||
{{include file="../../../layout/view/public/common/module_admin" /}}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<div class="layout-content-container {{if !empty($vs['config']) and !empty($vs['config']['frontend_config'])}}{{$vs.config.frontend_config.ent}}{{/if}}" data-json="{{if !empty($vs['config'])}}{{:urlencode(base64_encode(json_encode($vs['config'])))}}{{/if}}" style="{{if !empty($vs['config']) and !empty($vs['config']['frontend_config'])}}{{$vs.config.frontend_config.style}}{{/if}}">
|
||||
<div class="layout-content-container {{if !empty($vs['config']) and !empty($vs['config']['frontend_config'])}}{{$vs.config.frontend_config.ent}}{{/if}}" data-json="{{if !empty($vs['config'])}}{{:urlencode(base64_encode(json_encode($vs['config'])))}}{{/if}}" style="{{if !empty($vs['config']) and !empty($vs['config']['frontend_config'])}}{{$vs.config.frontend_config.style}}{{/if}}{{if !empty($vs['config']['style_background_images'])}}background-image:url({{$vs.config.style_background_images}});{{/if}}">
|
||||
<div class="layout-content-submit-container">
|
||||
<button type="button" class="am-btn am-btn-secondary am-radius am-btn-xs am-icon-gear layout-submit layout-content-submit-set"></button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<div class="layout-content-container {{if !empty($vs['config']) and !empty($vs['config']['frontend_config'])}}{{$vs.config.frontend_config.ent}}{{/if}}" style="{{if !empty($vs['config']) and !empty($vs['config']['frontend_config'])}}{{$vs.config.frontend_config.style}}{{/if}}">
|
||||
<div class="layout-content-container {{if !empty($vs['config']) and !empty($vs['config']['frontend_config'])}}{{$vs.config.frontend_config.ent}}{{/if}}" style="{{if !empty($vs['config']) and !empty($vs['config']['frontend_config'])}}{{$vs.config.frontend_config.style}}{{/if}}{{if !empty($vs['config']['style_background_images'])}}background-image:url({{$vs.config.style_background_images}});{{/if}}">
|
||||
<div class="layout-content">
|
||||
{{if !empty($vs['children']) and is_array($vs['children'])}}
|
||||
{{foreach $vs.children as $kss=>$vss}}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,24 @@
|
|||
<div class="am-panel am-panel-default">
|
||||
<div class="am-panel-hd">基础样式</div>
|
||||
<div class="am-panel-bd">
|
||||
<!-- 背景图 -->
|
||||
<div class="am-form-group am-form-file am-form-group-refreshing">
|
||||
<label class="block">背景图</label>
|
||||
<ul class="plug-file-upload-view layout-style-background-images-view" data-form-name="style_background_images" data-max-number="1" data-delete="1" data-dialog-type="images"></ul>
|
||||
<div>
|
||||
<span class="plug-file-upload-submit" data-view-tag="ul.layout-style-background-images-view">+上传图片</span>
|
||||
<label class="am-checkbox-inline am-margin-left-sm">
|
||||
<input type="checkbox" name="style_background_images_position_center" value="1" data-am-ucheck /> 居中
|
||||
</label>
|
||||
<label class="am-checkbox-inline">
|
||||
<input type="checkbox" name="style_background_images_size_cover" value="1" data-am-ucheck /> 铺满
|
||||
</label>
|
||||
<label class="am-checkbox-inline">
|
||||
<input type="checkbox" name="style_background_images_no_repeat" value="1" data-am-ucheck /> 不重复
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 背景色 -->
|
||||
{{include file="../../../layout/view/public/style/background_color" key="" required="" /}}
|
||||
|
||||
|
|
@ -15,7 +33,7 @@
|
|||
|
||||
<!-- 系统标准限宽 -->
|
||||
<label class="am-checkbox-inline">
|
||||
<input type="checkbox" name="width_max_limit_value" value="1" data-am-ucheck checked /> 系统标准限宽(1000px、1200px)
|
||||
<input type="checkbox" name="style_width_max_limit_value" value="1" data-am-ucheck /> 系统标准限宽(1000px、1200px)
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
{{foreach $layout_data as $k=>$v}}
|
||||
{{if !empty($v['value']) and !empty($v['children']) and is_array($v['children']) and !empty($v['value_arr']) and count($v['children']) eq count($v['value_arr']) and $v['status'] eq 1}}
|
||||
<div class="layout-view">
|
||||
<div class="layout-content-children {{if !empty($v['config']) and !empty($v['config']['frontend_config'])}}{{$v.config.frontend_config.ent}}{{/if}}" style="{{if !empty($v['config']) and !empty($v['config']['frontend_config'])}}{{$v.config.frontend_config.style}}{{/if}}">
|
||||
<div class="layout-content-children {{if !empty($v['config']) and !empty($v['config']['frontend_config'])}}{{$v.config.frontend_config.ent}}{{/if}}" style="{{if !empty($v['config']) and !empty($v['config']['frontend_config'])}}{{$v.config.frontend_config.style}}{{/if}}{{if !empty($v['config']['style_background_images'])}}background-image:url({{$v.config.style_background_images}});{{/if}}">
|
||||
{{foreach $v.children as $ks=>$vs}}
|
||||
{{if count($v['value_arr']) eq 1}}
|
||||
{{include file="../../../layout/view/public/common/module_view" /}}
|
||||
|
|
|
|||
|
|
@ -389,12 +389,26 @@ class DesignService
|
|||
// 开始处理数据
|
||||
foreach($config as &$v)
|
||||
{
|
||||
// 配置处理
|
||||
if(!empty($v['config']))
|
||||
{
|
||||
$v['config'] = self::ConfigAttachmentDownloadHandle($dir, $data_id, $v['config']);
|
||||
}
|
||||
|
||||
// 是否存在下级数据
|
||||
if(empty($v['children']))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
foreach($v['children'] as &$vs)
|
||||
{
|
||||
// 配置处理
|
||||
if(!empty($vs['config']))
|
||||
{
|
||||
$vs['config'] = self::ConfigAttachmentDownloadHandle($dir, $data_id, $vs['config']);
|
||||
}
|
||||
|
||||
// 是否存在下级数据
|
||||
if(empty($vs['children']))
|
||||
{
|
||||
continue;
|
||||
|
|
@ -405,6 +419,11 @@ class DesignService
|
|||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// 配置处理
|
||||
$vss['config'] = self::ConfigAttachmentDownloadHandle($dir, $data_id, $vss['config']);
|
||||
|
||||
// 根据模块处理
|
||||
switch($vss['value'])
|
||||
{
|
||||
// 单图
|
||||
|
|
@ -457,6 +476,28 @@ class DesignService
|
|||
return $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置信息附件处理
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2021-06-22
|
||||
* @desc description
|
||||
* @param [string] $dir [存储路径]
|
||||
* @param [int] $data_id [数据id]
|
||||
* @param [array] $config [配置信息]
|
||||
*/
|
||||
public static function ConfigAttachmentDownloadHandle($dir, $data_id, $config)
|
||||
{
|
||||
// 背景图片
|
||||
if(!empty($config['style_background_images']))
|
||||
{
|
||||
$config['style_background_images'] = self::FileSave($data_id, $config['style_background_images'], 'images', $dir);
|
||||
}
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件保存
|
||||
* @author Devil
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
.renovation-tabs li:not(.am-active) a:hover {
|
||||
border-color: transparent !important;
|
||||
}
|
||||
.renovation-tabs .renovation-panel .scrollspy-nav.am-sticky {
|
||||
.renovation-tabs.am-sticky {
|
||||
background: #fff;
|
||||
border: 1px solid #eee;
|
||||
border-top: 0;
|
||||
|
|
@ -252,6 +252,7 @@
|
|||
-webkit-box-shadow: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
.module-offcanvas-container .layout-style-background-images-view li,
|
||||
.module-offcanvas-container .module-images-type-images-view li,
|
||||
.module-offcanvas-container .module-slider-type-images-view li {
|
||||
width: 100%;
|
||||
|
|
|
|||
|
|
@ -632,7 +632,14 @@ function FormDataFill(json, tag)
|
|||
// input radio
|
||||
$form.find('input[type="radio"][name="'+i+'"]').each(function(k, v)
|
||||
{
|
||||
this.checked = (json[i] == $(this).val());
|
||||
this.checked = json[i] == $(this).val();
|
||||
$(this).trigger('change');
|
||||
});
|
||||
// input checkbox
|
||||
$form.find('input[type="checkbox"][name="'+i+'"]').each(function(k, v)
|
||||
{
|
||||
var temp_value = (typeof(json[i]) != 'object') ? json[i].toString().split(',') : json[i];
|
||||
this.checked = temp_value.indexOf($(this).val()) != -1;
|
||||
$(this).trigger('change');
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -511,8 +511,8 @@ function FormBackLayoutConfigHandle(data)
|
|||
ent += 'layout-'+size_arr[i]+'-border-radius-'+data[key]+' ';
|
||||
}
|
||||
}
|
||||
// 系统标准限宽
|
||||
if((data['width_max_limit_value'] || null) != null)
|
||||
// 系统标准限宽、兼容老版本的参数
|
||||
if((data['style_width_max_limit_value'] || null) != null || (data['width_max_limit_value'] || null) != null)
|
||||
{
|
||||
ent += 'am-container ';
|
||||
}
|
||||
|
|
@ -531,9 +531,32 @@ function FormBackLayoutConfigHandle(data)
|
|||
style += 'border-color:'+data['style_border_color']+';';
|
||||
}
|
||||
|
||||
// 背景样式
|
||||
// 是否不允许重复
|
||||
if(parseInt(data.style_background_images_no_repeat || 0) == 1)
|
||||
{
|
||||
style += 'background-repeat:no-repeat;';
|
||||
}
|
||||
// 是否铺满
|
||||
if(parseInt(data.style_background_images_size_cover || 0) == 1)
|
||||
{
|
||||
style += 'background-size:cover;';
|
||||
}
|
||||
// 是否居中
|
||||
if(parseInt(data.style_background_images_position_center || 0) == 1)
|
||||
{
|
||||
style += 'background-position:center;';
|
||||
}
|
||||
// 背景图片
|
||||
var temp_style = style;
|
||||
if((data.style_background_images || null) != null)
|
||||
{
|
||||
temp_style += 'background-image:url('+data.style_background_images+');';
|
||||
}
|
||||
|
||||
// 类和样式处理
|
||||
$layout_content_obj.attr('class', $offcanvas_layout_config.attr('data-ent')+' '+ent);
|
||||
$layout_content_obj.attr('style', style);
|
||||
$layout_content_obj.attr('style', temp_style);
|
||||
|
||||
// 数据加入配置
|
||||
data['frontend_config'] = {
|
||||
|
|
@ -2212,6 +2235,40 @@ function FormBackModulePopupGoodsSearchHandle(data)
|
|||
$popup_goods_search.modal('close');
|
||||
}
|
||||
|
||||
/**
|
||||
* 模块-基础布局处理
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2021-05-18
|
||||
* @desc description
|
||||
* @param {[object]} data [表单数据]
|
||||
*/
|
||||
function ModuleConfigBaseContentHandle(data)
|
||||
{
|
||||
// 默认值处理
|
||||
data.style_width_max_limit_value = data.style_width_max_limit_value || '';
|
||||
data.style_background_images_no_repeat = data.style_background_images_no_repeat || '';
|
||||
data.style_background_images_size_cover = data.style_background_images_size_cover || '';
|
||||
data.style_background_images_position_center = data.style_background_images_position_center || '';
|
||||
|
||||
// 图片处理
|
||||
var $ul = $offcanvas_layout_config.find('ul.layout-style-background-images-view');
|
||||
if((data.style_background_images || null) == null)
|
||||
{
|
||||
$ul.find('li').remove();
|
||||
} else {
|
||||
var html = `<li>
|
||||
<input type="text" name="style_background_images" value="`+data.style_background_images+`">
|
||||
<img src="`+data.style_background_images+`" />
|
||||
<i>×</i>
|
||||
</li>`;
|
||||
$ul.html(html);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 模块-图片链接地址生成
|
||||
* @author Devil
|
||||
|
|
@ -3029,8 +3086,15 @@ $(function()
|
|||
json[i] = '';
|
||||
}
|
||||
}
|
||||
// 节点数据处理
|
||||
json = ModuleConfigBaseContentHandle(json);
|
||||
|
||||
// 表单赋值
|
||||
FormDataFill(json, config_doc);
|
||||
|
||||
// 单选框初始化
|
||||
$offcanvas_layout_config.find('input[type="checkbox"], input[type="radio"]').uCheck();
|
||||
|
||||
// 背景色组件处理
|
||||
ModuleColorpickerHandle($offcanvas_layout_config);
|
||||
|
||||
|
|
@ -3085,7 +3149,13 @@ $(function()
|
|||
json[i] = '';
|
||||
}
|
||||
}
|
||||
// 节点数据处理
|
||||
json = ModuleConfigBaseContentHandle(json);
|
||||
|
||||
// 表单赋值
|
||||
FormDataFill(json, config_doc);
|
||||
// 单选框初始化
|
||||
$offcanvas_layout_config.find('input[type="checkbox"], input[type="radio"]').uCheck();
|
||||
|
||||
// 背景色组件处理
|
||||
ModuleColorpickerHandle($offcanvas_layout_config);
|
||||
|
|
|
|||
|
|
@ -110,8 +110,8 @@
|
|||
colorTable='<table width=232 border="0" cellspacing="0" cellpadding="0" style="border:1px solid #333;height: 24px;line-height: 21px;">'
|
||||
+'<tr><td colspan=21 bgcolor=#cccccc>'
|
||||
+'<table cellpadding="0" cellspacing="1" border="0" style="border-collapse: collapse">'
|
||||
+'<tr><td width="3"><td><input type="text" id="DisColor'+index+'" size="3" disabled style="border:solid 1px #000000;background-color:#000000;padding:0;"></td>'
|
||||
+'<td width="3"><td><input type="text" id="HexColor'+index+'" style="border:inset 1px;font-family:Arial;width:58px;" value="#000000"><a href="javascript:void(0);" id="_determine'+index+'">'+lang_data.confirm+'</a> | <a href="javascript:void(0);" id="_cclose'+index+'">'+lang_data.close+'</a> | <a href="javascript:void(0);" id="_creset'+index+'">'+lang_data.clear+'</a></td></tr></table></td></table>'
|
||||
+'<tr><td width="3"><td><input type="text" data-is-clearout="0" id="DisColor'+index+'" size="3" disabled style="border:solid 1px #000000;background-color:#000000;padding:0;"></td>'
|
||||
+'<td width="3"><td><input type="text" data-is-clearout="0" id="HexColor'+index+'" style="border:inset 1px;font-family:Arial;width:58px;" value="#000000"><a href="javascript:void(0);" id="_determine'+index+'">'+lang_data.confirm+'</a> | <a href="javascript:void(0);" id="_cclose'+index+'">'+lang_data.close+'</a> | <a href="javascript:void(0);" id="_creset'+index+'">'+lang_data.clear+'</a></td></tr></table></td></table>'
|
||||
+'<table id="CT'+index+'" border="1" cellspacing="0" cellpadding="0" style="border-collapse: collapse;border-color:#333;border-width:0 1px 1px 1px;border-style:solid;">'
|
||||
+colorTable+'</table>';
|
||||
$('#colorpanel'+index).html(colorTable);
|
||||
|
|
|
|||
Loading…
Reference in New Issue