拖拽优化
parent
c5ec7a5cb3
commit
d416ef9963
|
|
@ -46,6 +46,75 @@ class BaseLayout
|
|||
'list' => '列表模式',
|
||||
];
|
||||
|
||||
/**
|
||||
* 配置处理-保存
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2021-06-17
|
||||
* @desc description
|
||||
* @param [array] $config [配置信息]
|
||||
* @param [array] $params [输入参数]
|
||||
*/
|
||||
public static function ConfigSaveHandle($config, $params = [])
|
||||
{
|
||||
$config = empty($config) ? [] : (is_array($config) ? $config : json_decode(htmlspecialchars_decode($config), true));
|
||||
if(!empty($config) && is_array($config))
|
||||
{
|
||||
foreach($config as &$v)
|
||||
{
|
||||
// 布局
|
||||
if(!empty($v['children']) && is_array($v['children']))
|
||||
{
|
||||
foreach($v['children'] as &$vs)
|
||||
{
|
||||
// 容器
|
||||
if(!empty($vs['children']) && is_array($vs['children']))
|
||||
{
|
||||
// 模块
|
||||
foreach($vs['children'] as &$vss)
|
||||
{
|
||||
if(!empty($vss['value']) && !empty($vss['config']))
|
||||
{
|
||||
// 根据模块类型处理
|
||||
switch($vss['value'])
|
||||
{
|
||||
// 视频 video
|
||||
case 'video' :
|
||||
$vss['config']['content_video'] = ResourcesService::AttachmentPathHandle($vss['config']['content_video']);
|
||||
break;
|
||||
|
||||
// 单图 images
|
||||
case 'images' :
|
||||
$vss['config']['content_images'] = ResourcesService::AttachmentPathHandle($vss['config']['content_images']);
|
||||
break;
|
||||
|
||||
// 多图 many-images
|
||||
case 'many-images' :
|
||||
foreach($vss['config']['data_list'] as &$mil)
|
||||
{
|
||||
$mil['images'] = ResourcesService::AttachmentPathHandle($mil['images']);
|
||||
}
|
||||
$key = 'content_images_';
|
||||
foreach($vss['config'] as $mik=>$miv)
|
||||
{
|
||||
if(substr($mik, 0, strlen($key)) == $key)
|
||||
{
|
||||
$vss['config'][$mik] = ResourcesService::AttachmentPathHandle($miv);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return empty($config) ? '' : json_encode($config, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置处理-管理
|
||||
* @author Devil
|
||||
|
|
@ -167,8 +236,6 @@ class BaseLayout
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
//print_r($config);die;
|
||||
return $config;
|
||||
}
|
||||
|
||||
|
|
@ -316,8 +383,6 @@ class BaseLayout
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
//print_r($config);die;
|
||||
return $config;
|
||||
}
|
||||
|
||||
|
|
@ -381,6 +446,12 @@ class BaseLayout
|
|||
*/
|
||||
public static function LayoutUrlValueHandle($type, $value)
|
||||
{
|
||||
// 扩展参数处理
|
||||
if(!empty($value) && !is_array($value))
|
||||
{
|
||||
$value = json_decode(urldecode($value), true);
|
||||
}
|
||||
|
||||
// 当前客户端类型
|
||||
$client_type = APPLICATION_CLIENT_TYPE;
|
||||
|
||||
|
|
@ -389,34 +460,98 @@ class BaseLayout
|
|||
|
||||
// 静态地址定义-web端
|
||||
$static_url_web_arr = [
|
||||
'home' => __MY_URL__,
|
||||
'goods_category' => MyUrl('index/category/index'),
|
||||
'cart' => MyUrl('index/cart/index'),
|
||||
'user_center' => MyUrl('index/user/index'),
|
||||
'user_order_list' => MyUrl('index/order/index'),
|
||||
'user_order_aftersale_list' => MyUrl('index/orderaftersale/index'),
|
||||
'user_goods_favor_list' => MyUrl('index/usergoodsfavor/index'),
|
||||
'user_address_list' => MyUrl('index/useraddress/index'),
|
||||
'user_goods_browse_list' => MyUrl('index/usergoodsbrowse/index'),
|
||||
'user_integral_list' => MyUrl('index/userintegral/index'),
|
||||
'user_answer_list' => MyUrl('index/answer/index'),
|
||||
'user_message_list' => MyUrl('index/message/index'),
|
||||
'home' => __MY_URL__,
|
||||
'goods_category' => MyUrl('index/category/index'),
|
||||
'cart' => MyUrl('index/cart/index'),
|
||||
'user_center' => MyUrl('index/user/index'),
|
||||
'user_order_list' => MyUrl('index/order/index'),
|
||||
'user_order_aftersale_list' => MyUrl('index/orderaftersale/index'),
|
||||
'user_goods_favor_list' => MyUrl('index/usergoodsfavor/index'),
|
||||
'user_address_list' => MyUrl('index/useraddress/index'),
|
||||
'user_goods_browse_list' => MyUrl('index/usergoodsbrowse/index'),
|
||||
'user_integral_list' => MyUrl('index/userintegral/index'),
|
||||
'user_answer_list' => MyUrl('index/answer/index'),
|
||||
'user_message_list' => MyUrl('index/message/index'),
|
||||
|
||||
// 多商户
|
||||
'plugins-shop-home' => PluginsHomeUrl('shop', 'index', 'index'),
|
||||
|
||||
// 品牌
|
||||
'plugins-brand-home' => PluginsHomeUrl('brand', 'index', 'index'),
|
||||
|
||||
// 优惠券
|
||||
'plugins-coupon-home' => PluginsHomeUrl('coupon', 'index', 'index'),
|
||||
'plugins-coupon-user' => PluginsHomeUrl('coupon', 'coupon', 'index'),
|
||||
|
||||
// 会员等级
|
||||
'plugins-membershiplevelvip-home' => PluginsHomeUrl('membershiplevelvip', 'index', 'index'),
|
||||
'plugins-membershiplevelvip-user-center' => PluginsHomeUrl('membershiplevelvip', 'vip', 'index'),
|
||||
'plugins-membershiplevelvip-user-poster' => PluginsHomeUrl('membershiplevelvip', 'poster', 'index'),
|
||||
|
||||
// 分销
|
||||
'plugins-distribution-user-center' => PluginsHomeUrl('distribution', 'index', 'index'),
|
||||
'plugins-distribution-user-poster' => PluginsHomeUrl('distribution', 'poster', 'index'),
|
||||
|
||||
// 发票
|
||||
'plugins-invoice-user' => PluginsHomeUrl('invoice', 'user', 'index'),
|
||||
'plugins-invoice-order' => PluginsHomeUrl('invoice', 'order', 'index'),
|
||||
|
||||
// 积分商城
|
||||
'plugins-points-home' => PluginsHomeUrl('points', 'index', 'index'),
|
||||
|
||||
// 钱包
|
||||
'plugins-wallet-user' => PluginsHomeUrl('wallet', 'wallet', 'index'),
|
||||
|
||||
// 签到
|
||||
'plugins-signin-user' => PluginsHomeUrl('signin', 'userqrcode', 'index'),
|
||||
];
|
||||
|
||||
// 静态地址定义-手机端
|
||||
$static_url_app_arr = [
|
||||
'home' => '/pages/index/index',
|
||||
'goods_category' => '/pages/goods-category/goods-category',
|
||||
'cart' => '/pages/cart/cart',
|
||||
'user_center' => '/pages/user/user',
|
||||
'user_order_list' => '/pages/user-order/user-order',
|
||||
'user_order_aftersale_list' => '/pages/user-orderaftersale/user-orderaftersale',
|
||||
'user_goods_favor_list' => '/pages/user-faovr/user-faovr',
|
||||
'user_address_list' => '/pages/user-address/user-address',
|
||||
'user_goods_browse_list' => '/pages/user-goods-browse/user-goods-browse',
|
||||
'user_integral_list' => '/pages/user-integral/user-integral',
|
||||
'user_answer_list' => '/pages/user-answer-list/user-answer-list',
|
||||
'user_message_list' => '/pages/message/message',
|
||||
'home' => '/pages/index/index',
|
||||
'goods_category' => '/pages/goods-category/goods-category',
|
||||
'cart' => '/pages/cart/cart',
|
||||
'user_center' => '/pages/user/user',
|
||||
'user_order_list' => '/pages/user-order/user-order',
|
||||
'user_order_aftersale_list' => '/pages/user-orderaftersale/user-orderaftersale',
|
||||
'user_goods_favor_list' => '/pages/user-faovr/user-faovr',
|
||||
'user_address_list' => '/pages/user-address/user-address',
|
||||
'user_goods_browse_list' => '/pages/user-goods-browse/user-goods-browse',
|
||||
'user_integral_list' => '/pages/user-integral/user-integral',
|
||||
'user_answer_list' => '/pages/user-answer-list/user-answer-list',
|
||||
'user_message_list' => '/pages/message/message',
|
||||
|
||||
// 多商户
|
||||
'plugins-shop-home' => '/pages/plugins/shop/index/index',
|
||||
|
||||
// 品牌
|
||||
'plugins-brand-home' => '/pages/plugins/brand/index/index',
|
||||
|
||||
// 优惠券
|
||||
'plugins-coupon-home' => '/pages/plugins/coupon/index/index',
|
||||
'plugins-coupon-user' => '/pages/plugins/coupon/user/user',
|
||||
|
||||
// 会员等级
|
||||
'plugins-membershiplevelvip-home' => '/pages/plugins/membershiplevelvip/index/index',
|
||||
'plugins-membershiplevelvip-user-center' => '/pages/plugins/membershiplevelvip/user/user',
|
||||
'plugins-membershiplevelvip-user-poster' => '/pages/plugins/membershiplevelvip/poster/poster',
|
||||
|
||||
// 分销
|
||||
'plugins-distribution-user-center' => '/pages/plugins/distribution/user/user',
|
||||
'plugins-distribution-user-poster' => '/pages/plugins/distribution/poster/poster',
|
||||
|
||||
// 发票
|
||||
'plugins-invoice-user' => '/pages/plugins/invoice/user/user',
|
||||
'plugins-invoice-order' => '/pages/plugins/invoice/order/order',
|
||||
|
||||
// 积分商城
|
||||
'plugins-points-home' => '/pages/plugins/points/index/index',
|
||||
|
||||
// 钱包
|
||||
'plugins-wallet-user' => '/pages/plugins/wallet/user/user',
|
||||
|
||||
// 签到
|
||||
'plugins-signin-user' => '/pages/plugins/signin/user/user',
|
||||
];
|
||||
|
||||
// 静态地址
|
||||
|
|
@ -425,11 +560,6 @@ class BaseLayout
|
|||
{
|
||||
$url = $static_url_arr[$type];
|
||||
} else {
|
||||
// 扩展参数处理
|
||||
if(!empty($value) && !is_array($value))
|
||||
{
|
||||
$value = json_decode(urldecode($value), true);
|
||||
}
|
||||
switch($type)
|
||||
{
|
||||
// 商品
|
||||
|
|
@ -467,8 +597,30 @@ class BaseLayout
|
|||
// 默认搜索页面、无条件
|
||||
$url = ($client_type == 'pc') ? MyUrl('index/search/index', $gsp) : '/pages/goods-search/goods-search'.(empty($gsp) ? '' : $gsp);
|
||||
break;
|
||||
|
||||
// 自定义链接
|
||||
case 'pages-custom-url' :
|
||||
$key = 'pages_custom_url_'.$client_type;
|
||||
if(!empty($value) && is_array($value) && array_key_exists($key, $value) && !empty($value[$key]))
|
||||
{
|
||||
$url = $value[$key];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// url值处理钩子
|
||||
$hook_name = 'plugins_layout_service_url_value_handle';
|
||||
Hook::listen($hook_name, [
|
||||
'hook_name' => $hook_name,
|
||||
'is_backend' => true,
|
||||
'type' => $type,
|
||||
'value' => $value,
|
||||
'client_type' => $client_type,
|
||||
'url' => &$url,
|
||||
]);
|
||||
|
||||
// 返回url
|
||||
return $url;
|
||||
}
|
||||
|
||||
|
|
@ -705,7 +857,8 @@ class BaseLayout
|
|||
*/
|
||||
public static function PagesList($params = [])
|
||||
{
|
||||
return [
|
||||
// 返回页面数据定义
|
||||
$data = [
|
||||
// 公共
|
||||
'common' => [
|
||||
'name' => '系统页面',
|
||||
|
|
@ -777,21 +930,128 @@ class BaseLayout
|
|||
[
|
||||
'name' => '多商户',
|
||||
'value' => 'shop',
|
||||
'tips' => '暂时不支持小程序',
|
||||
'data' => [
|
||||
[
|
||||
'value' => 'home',
|
||||
'name' => '店铺首页',
|
||||
'name' => '首页',
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => '品牌',
|
||||
'value' => 'brand',
|
||||
'data' => [
|
||||
[
|
||||
'value' => 'home',
|
||||
'name' => '首页',
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => '优惠券',
|
||||
'value' => 'coupon',
|
||||
'data' => [
|
||||
[
|
||||
'value' => 'home',
|
||||
'name' => '首页',
|
||||
],
|
||||
[
|
||||
'value' => 'goods_category',
|
||||
'name' => '商品分类',
|
||||
'value' => 'user',
|
||||
'name' => '我的优惠券',
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => '会员等级增强版',
|
||||
'value' => 'membershiplevelvip',
|
||||
'data' => [
|
||||
[
|
||||
'value' => 'home',
|
||||
'name' => '会员首页',
|
||||
],
|
||||
[
|
||||
'value' => 'user-center',
|
||||
'name' => '会员中心',
|
||||
],
|
||||
[
|
||||
'value' => 'user-poster',
|
||||
'name' => '推广返利',
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => '分销',
|
||||
'value' => 'distribution',
|
||||
'data' => [
|
||||
[
|
||||
'value' => 'user-center',
|
||||
'name' => '分销中心',
|
||||
],
|
||||
[
|
||||
'value' => 'user-poster',
|
||||
'name' => '推广返利',
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => '发票',
|
||||
'value' => 'invoice',
|
||||
'data' => [
|
||||
[
|
||||
'value' => 'user',
|
||||
'name' => '我的发票',
|
||||
],
|
||||
[
|
||||
'value' => 'order',
|
||||
'name' => '订单开票',
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => '积分商城',
|
||||
'value' => 'points',
|
||||
'data' => [
|
||||
[
|
||||
'value' => 'home',
|
||||
'name' => '首页',
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => '钱包',
|
||||
'value' => 'wallet',
|
||||
'data' => [
|
||||
[
|
||||
'value' => 'user',
|
||||
'name' => '我的钱包',
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => '签到',
|
||||
'value' => 'signin',
|
||||
'data' => [
|
||||
[
|
||||
'value' => 'user',
|
||||
'name' => '我的签到',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
// 页面列表钩子
|
||||
$hook_name = 'plugins_layout_service_pages_list';
|
||||
Hook::listen($hook_name, [
|
||||
'hook_name' => $hook_name,
|
||||
'is_backend' => true,
|
||||
'params' => $params,
|
||||
'data' => &$data,
|
||||
]);
|
||||
|
||||
// 返回页面数据
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -8,6 +8,7 @@
|
|||
<ul class="am-tabs-nav am-cf">
|
||||
<li class="am-active"><a href="[data-tab-panel-0]">系统页面</a></li>
|
||||
<li><a href="[data-tab-panel-1]">扩展模块</a></li>
|
||||
<li><a href="[data-tab-panel-2]">自定义链接</a></li>
|
||||
</ul>
|
||||
<div class="am-tabs-bd">
|
||||
<div data-tab-panel-0 class="am-tab-panel am-padding-0 am-active">
|
||||
|
|
@ -47,6 +48,40 @@
|
|||
{{/foreach}}
|
||||
</div>
|
||||
</div>
|
||||
<div data-tab-panel-2 class="am-tab-panel am-padding-0">
|
||||
<div class="am-scrollable-vertical">
|
||||
<div class="am-alert am-radius am-margin-top-0 am-text-left am-margin-bottom-0">
|
||||
<div>
|
||||
<p><strong>WEB端</strong></p>
|
||||
<div class="am-padding-left-lg">
|
||||
<p>1. 以http开头</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-margin-top-xs">
|
||||
<p><strong>小程序/APP</strong></p>
|
||||
<div class="am-padding-left-lg">
|
||||
<p>1. 小程序或APP内部地址</p>
|
||||
<p>2. 小程序以/pages开始</p>
|
||||
<p>3. 例如:/pages/user/user</p>
|
||||
<p>4. 支持带参数 ?x=xx</p>
|
||||
<p>
|
||||
<a href="{{if empty($layout_pages_custom_doc_url)}}https://ask.shopxo.net/article/106{{else /}}{{$layout_pages_custom_doc_url}}{{/if}}" target="_blank">小程序页面地址配置说明 <i class="am-icon-external-link"></i></a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pages-custom-url-container am-padding-sm">
|
||||
{{foreach :lang('common_platform_type') as $v}}
|
||||
<div class="am-input-group am-input-group-sm">
|
||||
<span class="am-input-group-btn">
|
||||
<button type="button" class="am-btn am-btn-default am-radius">{{$v.name}}</button>
|
||||
</span>
|
||||
<input type="text" name="pages_custom_url_{{$v.value}}" placeholder="{{$v.name}}" class="am-form-field am-radius" value="" />
|
||||
</div>
|
||||
{{/foreach}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-padding-sm">
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class LayoutService
|
|||
}
|
||||
|
||||
// 保存数据
|
||||
$config = empty($params['config']) ? '' : (is_array($params['config']) ? json_encode($params['config'], JSON_UNESCAPED_UNICODE) : htmlspecialchars_decode($params['config'])) ;
|
||||
$config = empty($params['config']) ? '' : BaseLayout::ConfigSaveHandle($params['config']);
|
||||
$ret = ConfigService::ConfigSave([self::$layout_key[$key]=>$config]);
|
||||
if($ret['code'] == 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -35,6 +35,16 @@
|
|||
padding: 5px;
|
||||
}
|
||||
|
||||
/**
|
||||
* 页面选择自定义url
|
||||
*/
|
||||
.pages-custom-url-container > .am-input-group:not(:first-child) {
|
||||
margin-top: 5px;
|
||||
}
|
||||
.pages-custom-url-container > .am-input-group button {
|
||||
width: 100px;
|
||||
}
|
||||
|
||||
/**
|
||||
* 拖放模块
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1630,18 +1630,36 @@ function OffcanvasConfigPagesChoice(obj, event)
|
|||
$modal_pages_select.find('.am-tabs-bd ul li').removeClass('active');
|
||||
$modal_pages_select.find('.am-tabs-bd ul li a').attr('data-json', '');
|
||||
|
||||
// 当前选中的数据
|
||||
var $active_obj = $modal_pages_select.find('.am-tabs-bd ul li.page-'+to_type);
|
||||
$active_obj.addClass('active');
|
||||
$active_obj.find('a span').text(to_name);
|
||||
$active_obj.find('a').attr('data-json', to_value);
|
||||
// 自定义链接地址
|
||||
if(to_type == 'pages-custom-url')
|
||||
{
|
||||
var form_doc = '.pages-custom-url-container';
|
||||
if((to_value || null) == null)
|
||||
{
|
||||
to_value = GetFormVal(form_doc, true);
|
||||
} else {
|
||||
to_value = JSON.parse(decodeURIComponent(to_value));
|
||||
}
|
||||
FormDataFill(to_value, form_doc);
|
||||
var index = 2;
|
||||
|
||||
// 常规页面选择
|
||||
} else {
|
||||
// 当前选中的数据
|
||||
var $active_obj = $modal_pages_select.find('.am-tabs-bd ul li.page-'+to_type);
|
||||
$active_obj.addClass('active');
|
||||
$active_obj.find('a span').text(to_name);
|
||||
$active_obj.find('a').attr('data-json', to_value);
|
||||
|
||||
// 当前选中的索引值
|
||||
var index = $active_obj.parents('.am-tab-panel').index();
|
||||
if(index == -1)
|
||||
{
|
||||
index = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// tab切换
|
||||
var index = $active_obj.parents('.am-tab-panel').index();
|
||||
if(index == -1)
|
||||
{
|
||||
index = 0;
|
||||
}
|
||||
$modal_pages_select.find('.am-tabs-nav li').removeClass('am-active');
|
||||
$modal_pages_select.find('.am-tabs-nav li').eq(index).addClass('am-active');
|
||||
$modal_pages_select.find('.am-tabs-bd .am-tab-panel').removeClass('am-active');
|
||||
|
|
@ -2286,13 +2304,18 @@ $(function()
|
|||
$o.attr('data-json', '');
|
||||
$o.find('span').text($o.data('name'));
|
||||
});
|
||||
|
||||
// 自定义链接清空
|
||||
$('.pages-custom-url-container input').val('');
|
||||
});
|
||||
|
||||
// 页面选择切换
|
||||
$modal_pages_select.on('click', '.am-tabs-bd ul li a', function()
|
||||
{
|
||||
// 选中状态
|
||||
$(this).parent().addClass('active').siblings().removeClass('active');
|
||||
var $parent = $(this).parents('.am-tab-panel');
|
||||
$parent.find('li').removeClass('active');
|
||||
$(this).parent().addClass('active');
|
||||
|
||||
// 参数值
|
||||
var value = $(this).data('value') || null;
|
||||
|
|
@ -2400,55 +2423,79 @@ $(function()
|
|||
// 页面选择确认事件
|
||||
$modal_pages_select.on('click', '.pages-confirm-submit', function()
|
||||
{
|
||||
// 参数值
|
||||
var $obj = $modal_pages_select.find('.am-tab-panel.am-active ul li.active a');
|
||||
var to_type = $obj.data('value') || '';
|
||||
var to_name = $obj.data('name') || '';
|
||||
var to_value = $obj.attr('data-json') || '';
|
||||
var json = null;
|
||||
if(to_value != '')
|
||||
// 选中tab
|
||||
var index = $modal_pages_select.find('.am-tabs-nav li.am-active').index();
|
||||
|
||||
// 参数值、自定义链接、常规页面选择
|
||||
if(index == 2)
|
||||
{
|
||||
json = JSON.parse(decodeURIComponent(to_value)) || null;
|
||||
}
|
||||
if(to_type == '' || to_name == '')
|
||||
{
|
||||
Prompt('请先选择页面');
|
||||
return false;
|
||||
}
|
||||
|
||||
// 根据类型处理
|
||||
switch(to_type)
|
||||
{
|
||||
// 单一商品
|
||||
case 'goods' :
|
||||
if(json == null)
|
||||
var to_type = 'pages-custom-url';
|
||||
var to_name = '自定义链接';
|
||||
var to_value = GetFormVal('.pages-custom-url-container', true);
|
||||
var count = 0;
|
||||
for(var i in to_value)
|
||||
{
|
||||
if((to_value[i] || null) == null)
|
||||
{
|
||||
Prompt('请选择商品');
|
||||
return false;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if(count >= Object.keys(to_value).length)
|
||||
{
|
||||
Prompt('请至少填写一个地址');
|
||||
return false;
|
||||
}
|
||||
to_value = encodeURIComponent(JSON.stringify(to_value));
|
||||
} else {
|
||||
var $obj = $modal_pages_select.find('.am-tab-panel.am-active ul li.active a');
|
||||
var to_type = $obj.data('value') || '';
|
||||
var to_name = $obj.data('name') || '';
|
||||
var to_value = $obj.attr('data-json') || '';
|
||||
var json = null;
|
||||
if(to_value != '')
|
||||
{
|
||||
json = JSON.parse(decodeURIComponent(to_value)) || null;
|
||||
}
|
||||
if(to_type == '' || to_name == '')
|
||||
{
|
||||
Prompt('请先选择页面');
|
||||
return false;
|
||||
}
|
||||
|
||||
// 选择位置是否存在
|
||||
if($page_parent_obj == null)
|
||||
{
|
||||
Prompt('请先选择链接位置');
|
||||
return false;
|
||||
}
|
||||
// 根据类型处理
|
||||
switch(to_type)
|
||||
{
|
||||
// 单一商品
|
||||
case 'goods' :
|
||||
if(json == null)
|
||||
{
|
||||
Prompt('请选择商品');
|
||||
return false;
|
||||
}
|
||||
|
||||
// 显示名称
|
||||
to_name += '('+json['title']+')';
|
||||
break;
|
||||
// 选择位置是否存在
|
||||
if($page_parent_obj == null)
|
||||
{
|
||||
Prompt('请先选择链接位置');
|
||||
return false;
|
||||
}
|
||||
|
||||
// 搜索页面
|
||||
case 'goods_search' :
|
||||
if(json == null)
|
||||
{
|
||||
Prompt('请先配置商品搜索');
|
||||
return false;
|
||||
}
|
||||
// 显示名称
|
||||
to_name += '('+json['title']+')';
|
||||
break;
|
||||
|
||||
// 显示名称
|
||||
to_name += ModuleConfigGoodsSearchPageShowName(json);
|
||||
break;
|
||||
// 搜索页面
|
||||
case 'goods_search' :
|
||||
if(json == null)
|
||||
{
|
||||
Prompt('请先配置商品搜索');
|
||||
return false;
|
||||
}
|
||||
|
||||
// 显示名称
|
||||
to_name += ModuleConfigGoodsSearchPageShowName(json);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 设置数据
|
||||
|
|
|
|||
Loading…
Reference in New Issue