2021-06-22 21:45:29 +08:00
// 公共列表 form 搜索条件
FromInit ( 'form.form-validation-layout-config' ) ;
FromInit ( 'form.form-validation-module-offcanvas-images' ) ;
FromInit ( 'form.form-validation-module-offcanvas-many-images' ) ;
2022-11-24 21:03:39 +08:00
FromInit ( 'form.form-validation-module-offcanvas-images-text' ) ;
2022-11-27 21:49:10 +08:00
FromInit ( 'form.form-validation-module-offcanvas-images-magic-cube' ) ;
2021-06-22 21:45:29 +08:00
FromInit ( 'form.form-validation-module-offcanvas-video' ) ;
FromInit ( 'form.form-validation-module-offcanvas-goods' ) ;
FromInit ( 'form.form-validation-module-offcanvas-title' ) ;
2022-11-24 21:03:39 +08:00
FromInit ( 'form.form-validation-module-offcanvas-custom' ) ;
2021-06-22 21:45:29 +08:00
FromInit ( 'form.form-validation-module-offcanvas-border' ) ;
FromInit ( 'form.form-validation-module-offcanvas-height' ) ;
FromInit ( 'form.form-validation-module-modal-title-keywords' ) ;
FromInit ( 'form.form-validation-module-modal-rolling-config' ) ;
FromInit ( 'form.form-validation-module-modal-list-config' ) ;
FromInit ( 'form.form-validation-module-popup-goods-search' ) ;
// 弹窗容器
var $layout _content _obj = null ;
var $page _parent _obj = null ;
var $base _show _style _value _obj = null ;
var $base _title _keywords _obj = null ;
2022-08-21 17:11:09 +08:00
var $layout = $ ( '.layout-container' ) ;
2021-06-22 21:45:29 +08:00
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' ) ;
2022-11-24 21:03:39 +08:00
var $offcanvas _config _images _text = $ ( '#offcanvas-module-config-images-text' ) ;
2022-11-27 21:49:10 +08:00
var $offcanvas _config _images _magic _cube = $ ( '#offcanvas-module-config-images-magic-cube' ) ;
2021-06-22 21:45:29 +08:00
var $offcanvas _config _video = $ ( '#offcanvas-module-config-video' ) ;
var $offcanvas _config _goods = $ ( '#offcanvas-module-config-goods' ) ;
var $offcanvas _config _title = $ ( '#offcanvas-module-config-title' ) ;
2022-11-24 21:03:39 +08:00
var $offcanvas _config _custom = $ ( '#offcanvas-module-config-custom' ) ;
2021-06-22 21:45:29 +08:00
var $offcanvas _config _border = $ ( '#offcanvas-module-config-border' ) ;
var $offcanvas _config _height = $ ( '#offcanvas-module-config-height' ) ;
var $modal _pages _select = $ ( '#modal-module-pages-select' ) ;
var $modal _rolling _config = $ ( '#modal-module-rolling-config' ) ;
var $modal _list _config = $ ( '#modal-module-list-config' ) ;
var $modal _title _keywords = $ ( '#modal-module-title-keywords' ) ;
var $popup _goods _select = $ ( '#popup-module-goods-select' ) ;
var $popup _goods _search = $ ( '#popup-module-goods-search' ) ;
var $popup _goods _category = $ ( '#popup-module-goods-category' ) ;
// 布局模块类型信息
2022-08-21 17:11:09 +08:00
var layout _module _type _arr = { } ;
2024-01-19 14:49:32 +08:00
$ ( '#renovation-tabs-module button' ) . each ( function ( k , v ) {
2022-08-21 17:11:09 +08:00
layout _module _type _arr [ $ ( this ) . data ( 'value' ) ] = $ ( this ) . text ( ) ;
} ) ;
2021-06-22 21:45:29 +08:00
/ * *
* 模块拖拽初始化
* @ author Devil
* @ blog http : //gong.gg/
* @ version 1.0 . 0
* @ date 2021 - 05 - 13
* @ desc description
* @ param { [ object ] } event [ 初始化容器 ]
* /
2024-01-19 14:49:32 +08:00
function ModuleDragSortInit ( event ) {
2021-06-22 21:45:29 +08:00
// 是否指定初始化容器
2024-01-19 14:49:32 +08:00
if ( ( event || null ) == null ) {
2021-06-22 21:45:29 +08:00
event = $ ( '.layout-content' ) ;
}
// 模块拖拽
event . dragsort ( {
dragSelector : '.module-view-submit-drag' ,
placeHolderTemplate : '<div class="drag-sort-dotted"></div>'
} ) ;
}
/ * *
* 布局生成
* @ author Devil
* @ blog http : //gong.gg/
* @ version 1.0 . 0
* @ date 2021 - 05 - 10
* @ desc description
* @ param { [ string ] } value [ 布局比例值 ]
* /
2024-01-19 14:49:32 +08:00
function StructureDragHtmlCreate ( value ) {
2021-06-22 21:45:29 +08:00
// 基础
2022-08-21 17:11:09 +08:00
var switch _on = $layout . data ( 'switch-on-text' ) || '开启' ;
var switch _off = $layout . data ( 'switch-off-text' ) || '关闭' ;
var set _title = $layout . data ( 'layout-set-title' ) || '布局设置' ;
var del _title = $layout . data ( 'layout-del-title' ) || '布局移除' ;
var content _tips = $layout . data ( 'layout-content-tips' ) || '模块内容区域' ;
2024-01-19 14:49:32 +08:00
var html = '<div class="layout-view" data-value="' + value + '">' ;
html += '<i class="layout-view-dragenter-icon am-icon-sort-asc am-icon-lg am-hide"></i>' ;
html += '<div class="layout-content-submit drag-submit">' ;
html += '<input type="checkbox" data-am-switch class="switch-checkbox am-switch-mini" checked="true" data-size="xs" data-on-color="success" data-off-color="warning" data-off-text="' + switch _off + '" data-on-text="' + switch _on + '" />' ;
html += ' <button type="button" class="am-btn am-btn-secondary am-radius am-btn-xs am-icon-square-o layout-submit layout-submit-set"> ' + set _title + '</button>' ;
html += ' <button type="button" class="am-btn am-btn-danger am-radius am-btn-xs am-icon-trash-o layout-submit layout-submit-del"> ' + del _title + '</button>' ;
html += '</div>' ;
2021-06-22 21:45:29 +08:00
// 容器设置
var content _submit = '<div class="layout-content-submit-container">' ;
2024-01-19 14:49:32 +08:00
content _submit += '<button type="button" class="am-btn am-btn-secondary am-radius am-btn-xs am-icon-gear layout-submit layout-content-submit-set"></button>' ;
content _submit += '</div>' ;
2021-06-22 21:45:29 +08:00
// 默认内容提示信息
2024-01-19 14:49:32 +08:00
var content _tips = '<div class="layout-content-tips">' + content _tips + '</div>' ;
2021-06-22 21:45:29 +08:00
// 根据布局类型处理
var arr = value . toString ( ) . split ( ':' ) ;
var length = arr . length ;
2024-01-19 14:49:32 +08:00
if ( length <= 1 ) {
2021-06-22 21:45:29 +08:00
// 100%
html += '<div class="layout-content-children">' ;
html += '<div class="layout-content-container">' ;
html += content _submit ;
html += '<div class="layout-content">' ;
html += content _tips ;
html += '</div>' ;
html += '</div>' ;
html += '</div>' ;
} else {
// 多个格子
html += '<div class="layout-content-children">' ;
2024-01-19 14:49:32 +08:00
for ( var i in arr ) {
html += '<div class="am-u-md-' + arr [ i ] + '">' ;
2021-06-22 21:45:29 +08:00
html += '<div class="layout-content-container">' ;
html += content _submit ;
html += '<div class="layout-content">' ;
html += content _tips ;
html += '</div>' ;
html += '</div>' ;
html += '</div>' ;
}
html += '</div>' ;
}
html += '</div>' ;
return html ;
}
/ * *
* 模块生成
* @ author Devil
* @ blog http : //gong.gg/
* @ version 1.0 . 0
* @ date 2021 - 05 - 13
* @ desc description
* @ param { [ string ] } value [ 模块类型 ]
* /
2024-01-19 14:49:32 +08:00
function RenovationModuleDragHtmlCreate ( value ) {
2021-06-22 21:45:29 +08:00
// 根据模块类型处理
2024-01-19 14:49:32 +08:00
if ( ( layout _module _type _arr [ value ] || null ) == null ) {
Prompt ( ( $layout . data ( 'module-not-exist-tips' ) || '模块未定义' ) + '[' + value + ']' ) ;
2021-06-22 21:45:29 +08:00
return false ;
}
// 基础
2022-08-21 17:11:09 +08:00
var config _first _tips = $layout . data ( 'config-first-tips' ) || '请配置' ;
2024-01-19 14:49:32 +08:00
var index = parseInt ( Math . random ( ) * 1000001 ) ;
var doc = 'module-content-index-' + value + '-' + index ;
2021-06-22 21:45:29 +08:00
var html = '<div class="module-view">' ;
2024-01-19 14:49:32 +08:00
html += '<div class="module-view-submit-container" data-value="' + value + '" data-index="' + index + '" data-doc=".' + doc + '">' ;
html += '<button type="button" class="am-btn am-btn-secondary am-radius am-btn-xs am-icon-reorder layout-submit module-view-submit-drag"></button>' ;
html += ' <button type="button" class="am-btn am-btn-secondary am-radius am-btn-xs am-icon-folder-open-o layout-submit module-view-submit-set"></button>' ;
html += ' <button type="button" class="am-btn am-btn-danger am-radius am-btn-xs am-icon-trash-o layout-submit module-view-submit-del"></button>' ;
html += '</div>' ;
html += '<div class="module-content module-content-type-' + value + ' ' + doc + '">' ;
html += '<div class="am-text-center am-padding-vertical-sm am-text-primary">' + config _first _tips + layout _module _type _arr [ value ] + '</div>' ;
html += '</div>' ;
html += '</div>' ;
2021-06-22 21:45:29 +08:00
return html ;
}
/ * *
* 模块 - 链接提示信息
* @ author Devil
* @ blog http : //gong.gg/
* @ version 1.0 . 0
* @ date 2021 - 06 - 04
* @ desc description
* @ param { [ string ] } to _name [ 链接地址名称 ]
* /
2024-01-19 14:49:32 +08:00
function ModuleToPrompt ( to _name ) {
2022-08-21 17:11:09 +08:00
Prompt ( to _name || ( $layout . data ( 'url-not-set-tips' ) || '未设置链接地址' ) , 'warning' ) ;
2021-06-22 21:45:29 +08:00
}
/ * *
* 基础样式处理
* @ author Devil
* @ blog http : //gong.gg/
* @ version 1.0 . 0
* @ date 2021 - 06 - 09
* @ desc description
* @ param { [ object ] } data [ 数据 ]
* @ param { [ string ] } key [ key ]
* @ param { [ array ] } replace _rules [ 替换规则 ]
2022-11-27 21:49:10 +08:00
* @ param { [ array ] } exclude [ 排除css ]
2021-06-22 21:45:29 +08:00
* /
2024-01-19 14:49:32 +08:00
function StyleBaseHandle ( data , key , replace _rules , exclude ) {
2021-06-22 21:45:29 +08:00
// 样式容器
var style = '' ;
// 上下左右处理
// 边线类型、边线、外边距、内边距
var arr = [
{
"type" : "border_style" ,
"css" : "border-style" ,
"unit" : "" ,
"value" : ""
} ,
{
"type" : "border_width" ,
"css" : "border-width" ,
"unit" : "px" ,
"value" : 0
} ,
{
"type" : "margin" ,
"css" : "margin" ,
"unit" : "px" ,
"value" : 0
} ,
{
"type" : "padding" ,
"css" : "padding" ,
"unit" : "px" ,
"value" : 0
}
] ;
2024-01-19 14:49:32 +08:00
for ( var i in arr ) {
2021-06-22 21:45:29 +08:00
var type = arr [ i ] [ 'type' ] ;
var value = arr [ i ] [ 'value' ] ;
var unit = arr [ i ] [ 'unit' ] ;
2024-01-19 14:49:32 +08:00
var t = data [ key + type + '_top' ] || value ;
var r = data [ key + type + '_right' ] || value ;
var b = data [ key + type + '_bottom' ] || value ;
var l = data [ key + type + '_left' ] || value ;
if ( ( t != 0 || r != 0 || b != 0 || l != 0 ) || ( t != '' || r != '' || b != '' || l != '' ) ) {
if ( ( exclude || null ) != null ) {
if ( exclude . indexOf ( arr [ i ] [ t ] ) != - 1 ) {
2022-11-27 21:49:10 +08:00
t = 0 ;
}
2024-01-19 14:49:32 +08:00
if ( exclude . indexOf ( arr [ i ] [ r ] ) != - 1 ) {
2022-11-27 21:49:10 +08:00
r = 0 ;
}
2024-01-19 14:49:32 +08:00
if ( exclude . indexOf ( arr [ i ] [ b ] ) != - 1 ) {
2022-11-27 21:49:10 +08:00
b = 0 ;
}
2024-01-19 14:49:32 +08:00
if ( exclude . indexOf ( arr [ i ] [ l ] ) != - 1 ) {
2022-11-27 21:49:10 +08:00
l = 0 ;
}
2022-11-24 21:03:39 +08:00
}
2024-01-19 14:49:32 +08:00
style += arr [ i ] [ 'css' ] + ':' + t + unit + ' ' + r + unit + ' ' + b + unit + ' ' + l + unit + ';' ;
2021-06-22 21:45:29 +08:00
}
}
// 单个处理
var arr2 = [
2023-03-24 16:22:20 +08:00
{ type : "border_style" , css : "border-style" , unit : "" } ,
{ type : "border_width" , css : "border-width" , unit : "px" } ,
{ type : "border_color" , css : "border-color" , unit : "" } ,
{ type : "border_radius" , css : "border-radius" , unit : "px" } ,
{ type : "background_color" , css : "background-color" , unit : "" } ,
{ type : "color" , css : "color" , unit : "" } ,
{ type : "align" , css : "text-align" , unit : "" } ,
{ type : "font_size" , css : "font-size" , unit : "px" } ,
{ type : "margin" , css : "margin" , unit : "px" } ,
{ type : "padding" , css : "padding" , unit : "px" } ,
{ type : "height" , css : "height" , unit : "px" } ,
2023-08-27 16:10:21 +08:00
{ type : "width" , css : "width" , unit : "px" } ,
{ type : "max_height" , css : "max-height" , unit : "px" } ,
{ type : "max_width" , css : "max-width" , unit : "px" }
2021-06-22 21:45:29 +08:00
] ;
2024-01-19 14:49:32 +08:00
for ( var i in arr2 ) {
if ( ( data [ key + arr2 [ i ] [ 'type' ] ] || null ) != null ) {
if ( ( exclude || null ) == null || exclude . indexOf ( arr2 [ i ] [ 'css' ] ) == - 1 ) {
2022-11-24 21:03:39 +08:00
// 样式值
2024-01-19 14:49:32 +08:00
var v = data [ key + arr2 [ i ] [ 'type' ] ] + arr2 [ i ] [ 'unit' ] ;
2021-06-22 21:45:29 +08:00
2022-11-24 21:03:39 +08:00
// 替换规则
// rules {"field":{"value":"hello","var":"var"}}
2024-01-19 14:49:32 +08:00
if ( ( replace _rules || null ) != null && ( replace _rules [ arr2 [ i ] [ 'type' ] ] || null ) != null ) {
2022-11-24 21:03:39 +08:00
var rules = replace _rules [ arr2 [ i ] [ 'type' ] ] ;
var reg = new RegExp ( rules [ 'var' ] , 'g' ) ;
2024-01-19 14:49:32 +08:00
v = rules [ 'value' ] . replace ( reg , data [ key + arr2 [ i ] [ 'type' ] ] ) ;
2022-11-24 21:03:39 +08:00
}
2024-01-19 14:49:32 +08:00
style += arr2 [ i ] [ 'css' ] + ':' + v + ';' ;
2022-11-24 21:03:39 +08:00
}
2021-06-22 21:45:29 +08:00
}
}
return style ;
}
2022-11-27 21:49:10 +08:00
/ * *
* 表单回调数据列表处理
* @ author Devil
* @ blog http : //gong.gg/
* @ version 1.0 . 0
* @ date 2022 - 11 - 25
* @ desc description
* @ param { [ object ] } data [ 表单数据 ]
* @ param { [ object ] } fields [ 处理字段 ]
* /
2024-01-19 14:49:32 +08:00
function FormBackDataListHandle ( data , fields ) {
2022-11-27 21:49:10 +08:00
var key _temp = [ ] ;
var data _list = [ ] ;
2024-01-19 14:49:32 +08:00
for ( var i in data ) {
2022-11-27 21:49:10 +08:00
var loc = i . lastIndexOf ( '_' ) ;
2024-01-19 14:49:32 +08:00
if ( loc != - 1 ) {
var key = i . substr ( 0 , loc + 1 ) ;
var last = i . substr ( loc + 1 ) ;
for ( var f in fields ) {
if ( key == f ) {
2022-11-27 21:49:10 +08:00
// 临时索引记录
var index = key _temp . indexOf ( last ) ;
2024-01-19 14:49:32 +08:00
if ( index == - 1 ) {
2022-11-27 21:49:10 +08:00
key _temp . push ( last ) ;
2024-01-19 14:49:32 +08:00
index = key _temp . length - 1 ;
2022-11-27 21:49:10 +08:00
}
// 数据组合
2024-01-19 14:49:32 +08:00
if ( data _list [ index ] == undefined ) {
2022-11-27 21:49:10 +08:00
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
}
}
2021-06-22 21:45:29 +08:00
/ * *
* 元素固定处理
* @ author Devil
* @ blog http : //gong.gg/
* @ version 1.0 . 0
* @ date 2021 - 06 - 09
* @ desc description
* @ param { [ object ] } data [ 数据 ]
* /
2024-01-19 14:49:32 +08:00
function MediaFixedHandle ( data ) {
2021-06-22 21:45:29 +08:00
// 文件容器
var media _container _ent = '' ;
2023-08-27 16:10:21 +08:00
// 文件容器样式
2021-06-22 21:45:29 +08:00
var media _container _style = StyleBaseHandle ( data , 'style_media_fixed_' ) ;
2024-01-19 14:49:32 +08:00
if ( ( media _container _style || null ) != null ) {
2021-06-22 21:45:29 +08:00
media _container _ent += 'module-fixed-doc ' ;
}
2023-08-27 16:10:21 +08:00
// 文件容器加上居中、避免容器没居中导致内容居中无效
2024-01-19 14:49:32 +08:00
if ( ( data [ 'style_media_fixed_is_auto' ] || 0 ) == 1 ) {
2023-08-27 16:10:21 +08:00
media _container _ent += 'module-fixed-doc-ent-auto ' ;
}
2021-06-22 21:45:29 +08:00
// 文件
var media _ent = '' ;
var arr = [ 'width' , 'height' , 'auto' , 'cover' ] ;
2024-01-19 14:49:32 +08:00
for ( var i in arr ) {
var key = 'style_media_fixed_is_' + arr [ i ] ;
if ( ( data [ key ] || 0 ) == 1 ) {
media _ent += 'module-fixed-doc-ent-' + arr [ i ] + ' ' ;
2021-06-22 21:45:29 +08:00
}
}
2023-03-23 11:06:13 +08:00
// 鼠标悬停在图片上方放大
2024-01-19 14:49:32 +08:00
if ( parseInt ( data . style _mouse _hover _images _amplify _value || 0 ) == 1 ) {
2023-03-23 11:06:13 +08:00
media _ent += 'module-mouse-hover-images-amplify ' ;
}
2021-06-22 21:45:29 +08:00
return {
"media_container_ent" : media _container _ent ,
"media_container_style" : media _container _style ,
"media_ent" : media _ent
}
}
/ * *
2022-11-29 14:13:31 +08:00
* 布局 - 容器设置处理
2021-06-22 21:45:29 +08:00
* @ author Devil
* @ blog http : //gong.gg/
* @ version 1.0 . 0
* @ date 2021 - 05 - 18
* @ desc description
* @ param { [ object ] } data [ 表单数据 ]
* /
2024-01-19 14:49:32 +08:00
function FormBackLayoutConfigHandle ( data ) {
2021-06-22 21:45:29 +08:00
// 基础信息
2024-01-19 14:49:32 +08:00
if ( $layout _content _obj == null ) {
2021-06-22 21:45:29 +08:00
Prompt ( '操作标记有误' ) ;
return false ;
}
// 标签类定义
var ent = '' ;
// 边线大小、外边距、内边距
var size _arr = [ 'sm' , 'md' , 'lg' ] ;
var angle _arr = [ 'top' , 'right' , 'bottom' , 'left' ] ;
var type _arr = {
"style_{var}_border_width" : "layout-{var}-border" ,
"style_{var}_margin" : "layout-{var}-margin" ,
"style_{var}_padding" : "layout-{var}-padding" ,
} ;
2024-01-19 14:49:32 +08:00
for ( var a in size _arr ) {
for ( var b in type _arr ) {
for ( var c in angle _arr ) {
var key = b . replace ( '{var}' , size _arr [ a ] ) + '_' + angle _arr [ c ] ;
if ( ( data [ key ] || 0 ) > 0 ) {
ent += type _arr [ b ] . replace ( '{var}' , size _arr [ a ] ) + '-' + angle _arr [ c ] + '-' + data [ key ] + ' ' ;
2021-06-22 21:45:29 +08:00
}
}
}
}
// 边线类型
2024-01-19 14:49:32 +08:00
for ( var a in size _arr ) {
for ( var b in angle _arr ) {
var key = 'style_' + size _arr [ a ] + '_border_style_' + angle _arr [ b ] ;
if ( ( data [ key ] || null ) != null ) {
ent += 'layout-' + size _arr [ a ] + '-border-' + angle _arr [ b ] + '-' + data [ key ] + ' ' ;
2021-06-22 21:45:29 +08:00
}
}
}
// 圆角
2024-01-19 14:49:32 +08:00
for ( var i in size _arr ) {
var key = 'style_' + size _arr [ i ] + '_border_radius' ;
if ( ( data [ key ] || 0 ) > 0 ) {
ent += 'layout-' + size _arr [ i ] + '-border-radius-' + data [ key ] + ' ' ;
2021-06-22 21:45:29 +08:00
}
}
2022-12-01 21:47:06 +08:00
// 系统标准限宽、兼容老版本的参数
2024-01-19 14:49:32 +08:00
if ( ( data [ 'style_width_max_limit_value' ] || null ) != null || ( data [ 'width_max_limit_value' ] || null ) != null ) {
2022-11-29 14:13:31 +08:00
ent += 'am-container ' ;
}
2021-06-22 21:45:29 +08:00
// 样式处理
var style = '' ;
// 背景色
2024-01-19 14:49:32 +08:00
if ( ( data [ 'style_background_color' ] || null ) != null ) {
style += 'background-color:' + data [ 'style_background_color' ] + ';' ;
2021-06-22 21:45:29 +08:00
}
// 边线颜色
2024-01-19 14:49:32 +08:00
if ( ( data [ 'style_border_color' ] || null ) != null ) {
style += 'border-color:' + data [ 'style_border_color' ] + ';' ;
2021-06-22 21:45:29 +08:00
}
2022-12-01 21:47:06 +08:00
// 背景样式
// 是否不允许重复
2024-01-19 14:49:32 +08:00
if ( parseInt ( data . style _background _images _no _repeat || 0 ) == 1 ) {
2022-12-01 21:47:06 +08:00
style += 'background-repeat:no-repeat;' ;
}
// 是否铺满
2024-01-19 14:49:32 +08:00
if ( parseInt ( data . style _background _images _size _cover || 0 ) == 1 ) {
2022-12-01 21:47:06 +08:00
style += 'background-size:cover;' ;
}
// 是否居中
2024-01-19 14:49:32 +08:00
if ( parseInt ( data . style _background _images _position _center || 0 ) == 1 ) {
2022-12-01 21:47:06 +08:00
style += 'background-position:center;' ;
}
// 背景图片
var temp _style = style ;
2024-01-19 14:49:32 +08:00
if ( ( data . style _background _images || null ) != null ) {
temp _style += 'background-image:url(' + data . style _background _images + ');' ;
2022-12-01 21:47:06 +08:00
}
2021-06-22 21:45:29 +08:00
// 类和样式处理
2024-01-19 14:49:32 +08:00
$layout _content _obj . attr ( 'class' , $offcanvas _layout _config . attr ( 'data-ent' ) + ' ' + ent ) ;
2022-12-01 21:47:06 +08:00
$layout _content _obj . attr ( 'style' , temp _style ) ;
2021-06-22 21:45:29 +08:00
// 数据加入配置
data [ 'frontend_config' ] = {
2023-03-23 11:06:13 +08:00
style : style ,
ent : ent
2021-06-22 21:45:29 +08:00
}
2022-11-27 21:49:10 +08:00
$layout _content _obj . attr ( 'data-json' , encodeURIComponent ( CryptoJS . enc . Base64 . stringify ( CryptoJS . enc . Utf8 . parse ( JSON . stringify ( data ) ) ) ) ) ;
2021-06-22 21:45:29 +08:00
$offcanvas _layout _config . offCanvas ( 'close' ) ;
}
/ * *
* 模块 - 图片处理
* @ author Devil
* @ blog http : //gong.gg/
* @ version 1.0 . 0
* @ date 2021 - 05 - 18
* @ desc description
* @ param { [ object ] } data [ 表单数据 ]
* /
2024-01-19 14:49:32 +08:00
function FormBackModuleConfigImagesHandle ( data ) {
2021-06-22 21:45:29 +08:00
// 基础信息
var doc = $offcanvas _config _images . attr ( 'data-doc' ) || null ;
2024-01-19 14:49:32 +08:00
if ( doc == null ) {
2022-08-21 17:11:09 +08:00
Prompt ( $layout . data ( 'module-tab-tips' ) || '模块标记有误' ) ;
2021-06-22 21:45:29 +08:00
return false ;
}
// 图片必须
2024-01-19 14:49:32 +08:00
if ( ( data . content _images || null ) == null ) {
2022-08-21 17:11:09 +08:00
Prompt ( $layout . data ( 'upload-images-tips' ) || '请上传图片' ) ;
2021-06-22 21:45:29 +08:00
return false ;
}
// 样式处理
var style = StyleBaseHandle ( data , 'style_' ) ;
2023-03-23 11:06:13 +08:00
// 图片样式
2021-06-22 21:45:29 +08:00
var media _fixed = MediaFixedHandle ( data ) ;
// html拼接
2024-01-19 14:49:32 +08:00
var html = '<div class="module-images-container" style="' + style + '">' ;
html += '<a href="javascript:ModuleToPrompt(\'' + ( data . content _to _name || '' ) + '\');" class="' + media _fixed . media _container _ent + '" style="' + media _fixed . media _container _style + '">' ;
html += '<img src="' + data [ 'content_images' ] + '" class="' + media _fixed . media _ent + '" style="' + media _fixed . media _container _style + '" />' ;
html += '</a>' ;
html += '</div>' ;
2021-06-22 21:45:29 +08:00
var $doc = $ ( doc ) ;
$doc . html ( html ) ;
// 数据加入配置
data [ 'frontend_config' ] = {
2023-03-23 11:06:13 +08:00
style : style ,
media _fixed : media _fixed
2021-06-22 21:45:29 +08:00
}
2022-11-27 21:49:10 +08:00
$doc . attr ( 'data-json' , encodeURIComponent ( CryptoJS . enc . Base64 . stringify ( CryptoJS . enc . Utf8 . parse ( JSON . stringify ( data ) ) ) ) ) ;
2021-06-22 21:45:29 +08:00
$offcanvas _config _images . offCanvas ( 'close' ) ;
}
/ * *
* 模块 - 多图处理
* @ author Devil
* @ blog http : //gong.gg/
* @ version 1.0 . 0
* @ date 2021 - 05 - 18
* @ desc description
* @ param { [ object ] } data [ 表单数据 ]
* /
2024-01-19 14:49:32 +08:00
function FormBackModuleConfigManyImagesHandle ( data ) {
2021-06-22 21:45:29 +08:00
// 基础信息
var doc = $offcanvas _config _many _images . attr ( 'data-doc' ) || null ;
2024-01-19 14:49:32 +08:00
if ( doc == null ) {
2022-08-21 17:11:09 +08:00
Prompt ( $layout . data ( 'module-tab-tips' ) || '模块标记有误' ) ;
2021-06-22 21:45:29 +08:00
return false ;
}
2022-11-24 21:03:39 +08:00
// 数据字段
2021-06-22 21:45:29 +08:00
var fields = {
2023-03-24 16:22:20 +08:00
content _images _ : "images" ,
content _to _name _ : "name" ,
content _to _type _ : "type" ,
content _to _value _ : "value"
2021-06-22 21:45:29 +08:00
} ;
2022-11-27 21:49:10 +08:00
var res = FormBackDataListHandle ( data , fields ) ;
data = res . data ;
var data _list = res . data _list ;
2024-01-19 14:49:32 +08:00
if ( data _list . length <= 0 ) {
2022-08-21 17:11:09 +08:00
Prompt ( $layout . data ( 'config-images-tips' ) || '请先添加图片并配置' ) ;
2021-06-22 21:45:29 +08:00
return false ;
}
2024-01-19 14:49:32 +08:00
for ( var i in data _list ) {
if ( ( data _list [ i ] [ 'images' ] || null ) == null ) {
2022-08-21 17:11:09 +08:00
Prompt ( $layout . data ( 'upload-images-tips' ) || '请上传图片' ) ;
2021-06-22 21:45:29 +08:00
return false ;
}
}
// 样式处理
var style = StyleBaseHandle ( data , 'style_' ) ;
// 展示模式
var show _style = data . view _list _show _style || 'routine' ;
2023-03-23 11:06:13 +08:00
// 图片样式
2021-06-22 21:45:29 +08:00
var media _fixed = MediaFixedHandle ( data ) ;
// 数据项html
var item _html = '' ;
2024-01-19 14:49:32 +08:00
if ( show _style != 'list' ) {
for ( var i in data _list ) {
2021-06-22 21:45:29 +08:00
item _html += '<li>' ;
2024-01-19 14:49:32 +08:00
item _html += '<a href="javascript:ModuleToPrompt(\'' + ( data _list [ i ] [ 'name' ] || '' ) + '\');" class="' + media _fixed . media _container _ent + '" style="' + media _fixed . media _container _style + '">'
item _html += '<img src="' + data _list [ i ] [ 'images' ] + '" class="' + media _fixed . media _ent + '" style="' + media _fixed . media _container _style + '" />' ;
2021-06-22 21:45:29 +08:00
item _html += '</a>' ;
item _html += '</li>' ;
}
}
// html拼接
2024-01-19 14:49:32 +08:00
var html = '<div class="module-slider-container" style="' + style + '">' ;
2021-06-22 21:45:29 +08:00
// 初始化参数
var option = { } ;
// 展示模式处理
var nav _dot _ent = '' ;
var list _ent = '' ;
2024-01-19 14:49:32 +08:00
switch ( show _style ) {
2021-06-22 21:45:29 +08:00
// 滚动
2024-01-19 14:49:32 +08:00
case 'rolling' :
2021-06-22 21:45:29 +08:00
// 参数处理
var show _style _value = ViewRollingShowStyleValueHandle ( data . view _list _show _style _value ) ;
// 是否展示导航点
nav _dot _ent = show _style _value . is _nav _dot ? '' : 'slides-rolling-not-dot' ;
// html拼接
2024-01-19 14:49:32 +08:00
html += '<div class="am-slider am-slider-default am-slider-carousel ' + nav _dot _ent + '">' ;
2021-06-22 21:45:29 +08:00
html += '<ul class="am-slides">' ;
html += item _html ;
html += '</ul>' ;
html += '</div>' ;
// 组件参数
option = {
itemWidth : show _style _value . item _width ,
itemMargin : show _style _value . item _margin ,
slideshow : show _style _value . is _auto _play ,
controlNav : show _style _value . is _nav _dot
} ;
break ;
// 列表
2024-01-19 14:49:32 +08:00
case 'list' :
2021-06-22 21:45:29 +08:00
// 参数处理
var show _style _value = ViewListShowStyleValueHandle ( data . view _list _show _style _value ) ;
// 列表展示数量
var sm = show _style _value . view _list _number _sm || 2 ;
var md = show _style _value . view _list _number _md || 5 ;
var lg = show _style _value . view _list _number _lg || 5 ;
// 外边距
2022-11-24 21:03:39 +08:00
var item _margin = parseInt ( show _style _value . style _margin || 0 ) ;
2021-06-22 21:45:29 +08:00
// 数据项样式处理
2024-01-19 14:49:32 +08:00
var item _style = ( item _margin > 0 ) ? 'margin:' + item _margin + 'px 0 0 ' + item _margin + 'px;' : '' ;
2021-06-22 21:45:29 +08:00
// 设置了外边距,则计算平均移动值
2024-01-19 14:49:32 +08:00
var avg = ( item _margin > 0 ) ? 'module-list-content-avg-' + item _margin : '' ;
2021-06-22 21:45:29 +08:00
// 列表class
2024-01-19 14:49:32 +08:00
list _ent = avg + ' module-list-sm-' + sm + ' module-list-md-' + md + ' module-list-lg-' + md + ' ' ;
2021-06-22 21:45:29 +08:00
2024-01-19 14:49:32 +08:00
html += '<ul class="module-list-content ' + list _ent + '">' ;
for ( var i in data _list ) {
2021-06-22 21:45:29 +08:00
html += '<li>' ;
2024-01-19 14:49:32 +08:00
html += '<div class="module-item" style="' + item _style + '">' ;
html += '<a href="javascript:ModuleToPrompt(\'' + ( data _list [ i ] [ 'name' ] || '' ) + '\');" class="' + media _fixed . media _container _ent + '" style="' + media _fixed . media _container _style + '">'
html += '<img src="' + data _list [ i ] [ 'images' ] + '" class="' + media _fixed . media _ent + '" style="' + media _fixed . media _container _style + '" />' ;
2021-06-22 21:45:29 +08:00
html += '</a>' ;
html += '</div>' ;
html += '</li>' ;
}
html += '</ul>' ;
break ;
// 常规、默认
2024-01-19 14:49:32 +08:00
default :
2021-06-22 21:45:29 +08:00
// html拼接
html += '<div data-am-widget="slider" class="am-slider am-slider-a1" data-am-slider=\'{"directionNav":false}\'>' ;
html += '<ul class="am-slides">' ;
html += item _html ;
html += '</ul>' ;
html += '</div>' ;
break ;
}
html += '</div>' ;
// 模块容器设置
var $doc = $ ( doc ) ;
$doc . html ( html ) ;
// 数据加入配置
data [ 'frontend_config' ] = {
2023-03-23 11:06:13 +08:00
style : style ,
item _style : item _style ,
nav _dot _ent : nav _dot _ent ,
list _ent : list _ent ,
media _fixed : media _fixed
2021-06-22 21:45:29 +08:00
}
data [ 'data_list' ] = data _list ;
2022-11-27 21:49:10 +08:00
$doc . attr ( 'data-json' , encodeURIComponent ( CryptoJS . enc . Base64 . stringify ( CryptoJS . enc . Utf8 . parse ( JSON . stringify ( data ) ) ) ) ) ;
2021-06-22 21:45:29 +08:00
// 滚动初始化
2024-01-19 14:49:32 +08:00
if ( show _style != 'list' ) {
2021-06-22 21:45:29 +08:00
$doc . find ( '.am-slider' ) . flexslider ( option ) ;
}
$offcanvas _config _many _images . offCanvas ( 'close' ) ;
}
2022-11-24 21:03:39 +08:00
/ * *
* 模块 - 图文处理
* @ author Devil
* @ blog http : //gong.gg/
* @ version 1.0 . 0
* @ date 2021 - 05 - 18
* @ desc description
* @ param { [ object ] } data [ 表单数据 ]
* /
2024-01-19 14:49:32 +08:00
function FormBackModuleConfigImagesTextHandle ( data ) {
2022-11-24 21:03:39 +08:00
// 基础信息
var doc = $offcanvas _config _images _text . attr ( 'data-doc' ) || null ;
2024-01-19 14:49:32 +08:00
if ( doc == null ) {
2022-11-24 21:03:39 +08:00
Prompt ( $layout . data ( 'module-tab-tips' ) || '模块标记有误' ) ;
return false ;
}
// 数据字段
var fields = {
2023-03-24 16:22:20 +08:00
content _images _ : "images" ,
content _title _ : "title" ,
content _title _style _color _ : "title_style_color" ,
content _title _style _font _size _ : "title_style_font_size" ,
content _title _style _align _ : "title_style_align" ,
content _title _style _margin _top _ : "title_style_margin_top" ,
content _title _style _margin _right _ : "title_style_margin_right" ,
content _title _style _margin _bottom _ : "title_style_margin_bottom" ,
content _title _style _margin _left _ : "title_style_margin_left" ,
content _desc _ : "desc" ,
content _desc _style _color _ : "desc_style_color" ,
content _desc _style _font _size _ : "desc_style_font_size" ,
content _desc _style _align _ : "desc_style_align" ,
content _desc _style _margin _top _ : "desc_style_margin_top" ,
content _desc _style _margin _right _ : "desc_style_margin_right" ,
content _desc _style _margin _bottom _ : "desc_style_margin_bottom" ,
content _desc _style _margin _left _ : "desc_style_margin_left" ,
content _to _name _ : "name" ,
content _to _type _ : "type" ,
content _to _value _ : "value"
2022-11-24 21:03:39 +08:00
} ;
2022-11-27 21:49:10 +08:00
var res = FormBackDataListHandle ( data , fields ) ;
data = res . data ;
var data _list = res . data _list ;
2024-01-19 14:49:32 +08:00
if ( data _list . length <= 0 ) {
2022-11-24 21:03:39 +08:00
Prompt ( $layout . data ( 'config-images-text-tips' ) || '请先添加图文并配置' ) ;
return false ;
}
2024-01-19 14:49:32 +08:00
for ( var i in data _list ) {
if ( ( data _list [ i ] [ 'images' ] || null ) == null && ( data _list [ i ] [ 'title' ] || null ) == null ) {
2022-11-24 21:03:39 +08:00
Prompt ( $layout . data ( 'upload-images-or-title-tips' ) || '图片和标题必填一项' ) ;
return false ;
}
}
// 展示模式
var show _style = data . view _list _show _style || null ;
2024-01-19 14:49:32 +08:00
if ( show _style == null ) {
2022-11-24 21:03:39 +08:00
Prompt ( $layout . data ( 'data-show-modal-tips' ) || '请选择数据展示模式' ) ;
2022-11-27 21:49:10 +08:00
return false ;
2022-11-24 21:03:39 +08:00
}
// 样式处理
var style = StyleBaseHandle ( data , 'style_' ) ;
2023-03-23 11:06:13 +08:00
// 图片样式
2022-11-24 21:03:39 +08:00
var media _fixed = MediaFixedHandle ( data ) ;
// html拼接
2024-01-19 14:49:32 +08:00
var html = '<div class="module-slider-container" style="' + style + '">' ;
2022-11-24 21:03:39 +08:00
// 初始化参数
var option = { } ;
// 参数处理
var show _style _value = ViewListShowStyleValueHandle ( data . view _list _show _style _value ) ;
// 外边距
var item _margin = parseInt ( show _style _value . style _margin || 0 ) ;
// 数据项样式处理
2024-01-19 14:49:32 +08:00
var item _style = ( item _margin > 0 && show _style != 'rolling' ) ? 'margin:' + item _margin + 'px 0 0 ' + item _margin + 'px;' : '' ;
2022-11-24 21:03:39 +08:00
// 内容处理
var item _html = '' ;
var item _right _style = '' ;
var item _field _style = [ ] ;
2024-01-19 14:49:32 +08:00
for ( var i in data _list ) {
2022-11-24 21:03:39 +08:00
// 字段样式
2024-01-19 14:49:32 +08:00
if ( item _field _style [ i ] == undefined ) {
2022-11-24 21:03:39 +08:00
item _field _style [ i ] = { } ;
}
item _field _style [ i ] [ 'title' ] = StyleBaseHandle ( data _list [ i ] , 'title_style_' ) ;
item _field _style [ i ] [ 'desc' ] = StyleBaseHandle ( data _list [ i ] , 'desc_style_' ) ;
// 拼接html
item _html += '<li>' ;
2024-01-19 14:49:32 +08:00
item _html += '<div class="module-item" style="' + item _style + '">' ;
switch ( show _style ) {
2022-11-24 21:03:39 +08:00
// 左右
2024-01-19 14:49:32 +08:00
case 'leftright' :
2022-11-24 21:03:39 +08:00
var style _media _fixed _width = parseInt ( data . style _media _fixed _width || 0 ) ;
2024-01-19 14:49:32 +08:00
item _right _style = 'margin-left:10px;' + ( ( style _media _fixed _width > 0 ) ? 'width: calc(100% - ' + ( style _media _fixed _width + 10 ) + 'px);' : '' ) ;
if ( ( data _list [ i ] [ 'images' ] || null ) != null ) {
item _html += '<a href="javascript:ModuleToPrompt(\'' + ( data _list [ i ] [ 'name' ] || '' ) + '\');" class="am-fl ' + media _fixed . media _container _ent + '" style="' + media _fixed . media _container _style + '">' ;
item _html += '<img src="' + data _list [ i ] [ 'images' ] + '" class="' + media _fixed . media _ent + '" style="' + media _fixed . media _container _style + '" />' ;
2022-11-28 11:06:15 +08:00
item _html += '</a>' ;
}
2024-01-19 14:49:32 +08:00
item _html += '<div class="am-fl" style="' + item _right _style + '">' ;
if ( ( data _list [ i ] [ 'title' ] || null ) != null ) {
item _html += '<a href="javascript:ModuleToPrompt(\'' + ( data _list [ i ] [ 'name' ] || '' ) + '\');">' ;
item _html += '<p style="' + item _field _style [ i ] [ 'title' ] + '">' + data _list [ i ] [ 'title' ] + '</p>' ;
2022-11-25 11:58:27 +08:00
item _html += '</a>' ;
2022-11-24 21:03:39 +08:00
}
2024-01-19 14:49:32 +08:00
if ( ( data _list [ i ] [ 'desc' ] || null ) != null ) {
item _html += '<p style="' + item _field _style [ i ] [ 'desc' ] + '">' + data _list [ i ] [ 'desc' ] + '</p>' ;
2022-11-24 21:03:39 +08:00
}
item _html += '</div>' ;
break ;
// 默认 上下、滚动
2024-01-19 14:49:32 +08:00
case 'updown' :
default :
if ( ( data _list [ i ] [ 'images' ] || null ) != null ) {
item _html += '<a href="javascript:ModuleToPrompt(\'' + ( data _list [ i ] [ 'name' ] || '' ) + '\');" class="' + media _fixed . media _container _ent + '" style="' + media _fixed . media _container _style + '">'
item _html += '<img src="' + data _list [ i ] [ 'images' ] + '" class="' + media _fixed . media _ent + '" style="' + media _fixed . media _container _style + '" />' ;
2022-11-28 11:06:15 +08:00
item _html += '</a>' ;
}
2024-01-19 14:49:32 +08:00
if ( ( data _list [ i ] [ 'title' ] || null ) != null ) {
item _html += '<a href="javascript:ModuleToPrompt(\'' + ( data _list [ i ] [ 'name' ] || '' ) + '\');">' ;
item _html += '<p style="' + item _field _style [ i ] [ 'title' ] + '">' + data _list [ i ] [ 'title' ] + '</p>' ;
2022-11-25 11:58:27 +08:00
item _html += '</a>' ;
2022-11-24 21:03:39 +08:00
}
2024-01-19 14:49:32 +08:00
if ( ( data _list [ i ] [ 'desc' ] || null ) != null ) {
item _html += '<p style="' + item _field _style [ i ] [ 'desc' ] + '">' + data _list [ i ] [ 'desc' ] + '</p>' ;
2022-11-24 21:03:39 +08:00
}
break ;
}
item _html += '</div>' ;
item _html += '</li>' ;
}
// 滚动
var nav _dot _ent = '' ;
var list _ent = '' ;
2024-01-19 14:49:32 +08:00
if ( show _style == 'rolling' ) {
2022-11-24 21:03:39 +08:00
// 参数处理
var show _style _value = ViewRollingShowStyleValueHandle ( data . view _list _show _style _value ) ;
// 是否展示导航点
nav _dot _ent = show _style _value . is _nav _dot ? '' : 'slides-rolling-not-dot' ;
// html拼接
2024-01-19 14:49:32 +08:00
html += '<div class="am-slider am-slider-default am-slider-carousel ' + nav _dot _ent + '">' ;
2022-11-24 21:03:39 +08:00
html += '<ul class="am-slides">' ;
html += item _html ;
html += '</ul>' ;
html += '</div>' ;
// 组件参数
option = {
itemWidth : show _style _value . item _width ,
itemMargin : show _style _value . item _margin ,
slideshow : show _style _value . is _auto _play ,
controlNav : show _style _value . is _nav _dot
} ;
} else {
// 列表展示数量
var sm = show _style _value . view _list _number _sm || 2 ;
var md = show _style _value . view _list _number _md || 5 ;
var lg = show _style _value . view _list _number _lg || 5 ;
// 设置了外边距,则计算平均移动值
2024-01-19 14:49:32 +08:00
var avg = ( item _margin > 0 ) ? 'module-list-content-avg-' + item _margin : '' ;
2022-11-24 21:03:39 +08:00
// 列表class
2024-01-19 14:49:32 +08:00
list _ent = avg + ' module-list-sm-' + sm + ' module-list-md-' + md + ' module-list-lg-' + md + ' ' ;
html += '<ul class="module-list-content ' + list _ent + '">' ;
2022-11-24 21:03:39 +08:00
html += item _html ;
html += '</ul>' ;
}
html += '</div>' ;
// 模块容器设置
var $doc = $ ( doc ) ;
$doc . html ( html ) ;
// 数据加入配置
data [ 'frontend_config' ] = {
2023-03-23 11:06:13 +08:00
style : style ,
item _style : item _style ,
item _right _style : item _right _style ,
item _field _style : item _field _style ,
nav _dot _ent : nav _dot _ent ,
list _ent : list _ent ,
media _fixed : media _fixed
2022-11-24 21:03:39 +08:00
}
data [ 'data_list' ] = data _list ;
2022-11-27 21:49:10 +08:00
$doc . attr ( 'data-json' , encodeURIComponent ( CryptoJS . enc . Base64 . stringify ( CryptoJS . enc . Utf8 . parse ( JSON . stringify ( data ) ) ) ) ) ;
2022-11-24 21:03:39 +08:00
// 滚动初始化
2024-01-19 14:49:32 +08:00
if ( show _style == 'rolling' ) {
2022-11-24 21:03:39 +08:00
$doc . find ( '.am-slider' ) . flexslider ( option ) ;
}
$offcanvas _config _images _text . offCanvas ( 'close' ) ;
}
2022-11-27 21:49:10 +08:00
/ * *
* 模块 - 图片魔方处理
* @ author Devil
* @ blog http : //gong.gg/
* @ version 1.0 . 0
* @ date 2021 - 05 - 18
* @ desc description
* @ param { [ object ] } data [ 表单数据 ]
* /
2024-01-19 14:49:32 +08:00
function FormBackModuleConfigImagesMagicCubeHandle ( data ) {
2022-11-27 21:49:10 +08:00
// 基础信息
var doc = $offcanvas _config _images _magic _cube . attr ( 'data-doc' ) || null ;
2024-01-19 14:49:32 +08:00
if ( doc == null ) {
2022-11-27 21:49:10 +08:00
Prompt ( $layout . data ( 'module-tab-tips' ) || '模块标记有误' ) ;
return false ;
}
// 数据字段
var fields = {
2023-03-24 16:22:20 +08:00
content _images _ : "images" ,
content _to _name _ : "name" ,
content _to _type _ : "type" ,
content _to _value _ : "value"
2022-11-27 21:49:10 +08:00
} ;
var res = FormBackDataListHandle ( data , fields ) ;
data = res . data ;
var data _list = res . data _list ;
2024-01-19 14:49:32 +08:00
for ( var i in data _list ) {
if ( ( data _list [ i ] [ 'images' ] || null ) == null ) {
2022-11-27 21:49:10 +08:00
Prompt ( $layout . data ( 'upload-images-tips' ) || '请上传图片' ) ;
return false ;
}
}
// 展示模式
var show _style = data . view _list _show _style || null ;
2024-01-19 14:49:32 +08:00
if ( show _style == null ) {
2022-11-27 21:49:10 +08:00
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_' ) ;
// 设置了外边距,则计算平均移动值
2024-01-19 14:49:32 +08:00
var list _ent = ( margin > 0 ) ? 'module-list-content-avg-' + margin : '' ;
2022-11-27 21:49:10 +08:00
2023-03-23 11:06:13 +08:00
// 图片样式
var media _fixed = MediaFixedHandle ( data ) ;
2022-11-27 21:49:10 +08:00
// 数据处理
var html = '' ;
var item _style = [ ] ;
2024-01-19 14:49:32 +08:00
switch ( show _style ) {
2022-11-27 21:49:10 +08:00
// 1图
2024-01-19 14:49:32 +08:00
case 'g1' :
2022-11-27 21:49:10 +08:00
item _style [ 0 ] = 'width:100%;' ;
2024-01-19 14:49:32 +08:00
html += ` <div class="am-nbfc layout-module-images-magic-cube layout-module-images-magic-cube- ` + show _style + ` ` + list _ent + ` ">
< div class = "item-module-magic-cube" style = "`+ item_style[0] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[0]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[0]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
< / d i v > ` ;
break ;
// 2竖图
2024-01-19 14:49:32 +08:00
case 'v2' :
2022-11-27 21:49:10 +08:00
item _style [ 0 ] = 'width:50%;' ;
item _style [ 1 ] = 'width:50%;' ;
2024-01-19 14:49:32 +08:00
html += ` <div class="am-nbfc layout-module-images-magic-cube layout-module-images-magic-cube- ` + show _style + ` ` + list _ent + ` ">
< div class = "am-fl item-module-magic-cube" style = "`+ item_style[0] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[0]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[0]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
2024-01-19 14:49:32 +08:00
< div class = "am-fr item-module-magic-cube" style = "`+ item_style[1] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[1]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[1]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
< / d i v > ` ;
break ;
// 3竖图
2024-01-19 14:49:32 +08:00
case 'v3' :
2022-11-27 21:49:10 +08:00
item _style [ 0 ] = 'width:33.33%;' ;
item _style [ 1 ] = 'width:33.33%;' ;
item _style [ 2 ] = 'width:33.33%;' ;
2024-01-19 14:49:32 +08:00
html += ` <div class="am-nbfc layout-module-images-magic-cube layout-module-images-magic-cube- ` + show _style + ` ` + list _ent + ` ">
< div class = "am-fl item-module-magic-cube" style = "`+ item_style[0] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[0]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[0]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
2024-01-19 14:49:32 +08:00
< div class = "am-fl item-module-magic-cube" style = "`+ item_style[1] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[1]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[1]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
2024-01-19 14:49:32 +08:00
< div class = "am-fr item-module-magic-cube" style = "`+ item_style[2] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[2]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[2]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
< / d i v > ` ;
break ;
// 4竖图
2024-01-19 14:49:32 +08:00
case 'v4' :
2022-11-27 21:49:10 +08:00
item _style [ 0 ] = 'width:25%;' ;
item _style [ 1 ] = 'width:25%;' ;
item _style [ 2 ] = 'width:25%;' ;
item _style [ 3 ] = 'width:25%;' ;
2024-01-19 14:49:32 +08:00
html += ` <div class="am-nbfc layout-module-images-magic-cube layout-module-images-magic-cube- ` + show _style + ` ` + list _ent + ` ">
< div class = "am-fl item-module-magic-cube" style = "`+ item_style[0] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[0]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[0]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
2024-01-19 14:49:32 +08:00
< div class = "am-fl item-module-magic-cube" style = "`+ item_style[1] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[1]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[1]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
2024-01-19 14:49:32 +08:00
< div class = "am-fl item-module-magic-cube" style = "`+ item_style[2] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[2]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[2]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
2024-01-19 14:49:32 +08:00
< div class = "am-fr item-module-magic-cube" style = "`+ item_style[3] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[3]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[3]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
< / d i v > ` ;
break ;
// 2横图
2024-01-19 14:49:32 +08:00
case 'h2' :
2022-11-27 21:49:10 +08:00
item _style [ 0 ] = 'width:100%;' ;
item _style [ 1 ] = 'width:100%;' ;
2024-01-19 14:49:32 +08:00
html += ` <div class="am-nbfc layout-module-images-magic-cube layout-module-images-magic-cube- ` + show _style + ` ` + list _ent + ` ">
< div class = "item-module-magic-cube" style = "`+ item_style[0] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[0]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[0]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
2024-01-19 14:49:32 +08:00
< div class = "item-module-magic-cube" style = "`+ item_style[1] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[1]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[1]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
< / d i v > ` ;
break ;
// 3横图
2024-01-19 14:49:32 +08:00
case 'h3' :
2022-11-27 21:49:10 +08:00
item _style [ 0 ] = 'width:100%;' ;
item _style [ 1 ] = 'width:100%;' ;
item _style [ 2 ] = 'width:100%;' ;
2024-01-19 14:49:32 +08:00
html += ` <div class="am-nbfc layout-module-images-magic-cube layout-module-images-magic-cube- ` + show _style + ` ` + list _ent + ` ">
< div class = "item-module-magic-cube" style = "`+ item_style[0] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[0]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[0]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
2024-01-19 14:49:32 +08:00
< div class = "item-module-magic-cube" style = "`+ item_style[1] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[1]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[1]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
2024-01-19 14:49:32 +08:00
< div class = "item-module-magic-cube" style = "`+ item_style[2] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[2]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[2]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
< / d i v > ` ;
break ;
// 4横图
2024-01-19 14:49:32 +08:00
case 'h4' :
2022-11-27 21:49:10 +08:00
item _style [ 0 ] = 'width:100%;' ;
item _style [ 1 ] = 'width:100%;' ;
item _style [ 2 ] = 'width:100%;' ;
item _style [ 3 ] = 'width:100%;' ;
2024-01-19 14:49:32 +08:00
html += ` <div class="am-nbfc layout-module-images-magic-cube layout-module-images-magic-cube- ` + show _style + ` ` + list _ent + ` ">
< div class = "item-module-magic-cube" style = "`+ item_style[0] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[0]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[0]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
2024-01-19 14:49:32 +08:00
< div class = "item-module-magic-cube" style = "`+ item_style[1] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[1]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[1]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
2024-01-19 14:49:32 +08:00
< div class = "item-module-magic-cube" style = "`+ item_style[2] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[2]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[2]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
2024-01-19 14:49:32 +08:00
< div class = "item-module-magic-cube" style = "`+ item_style[3] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[3]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[3]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
< / d i v > ` ;
break ;
// 1左右2
2024-01-19 14:49:32 +08:00
case 'lr12' :
if ( margin > 0 ) {
item _style [ 0 ] = 'width:calc(50% + ' + ( margin / 2 ) + 'px);' ;
item _style [ 1 ] = 'width:calc(50% - ' + ( margin / 2 ) + 'px);' ;
2022-11-27 21:49:10 +08:00
} else {
item _style [ 0 ] = 'width:50%;' ;
item _style [ 1 ] = 'width:50%;' ;
}
2024-01-19 14:49:32 +08:00
html += ` <div class="am-nbfc layout-module-images-magic-cube layout-module-images-magic-cube- ` + show _style + ` ` + list _ent + ` ">
< div class = "am-fl item-module-magic-cube" style = "`+ item_style[0] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[0]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[0]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
2024-01-19 14:49:32 +08:00
< div class = "am-fr item-module-magic-cube" style = "`+ item_style[1] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[1]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[1]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
2024-01-19 14:49:32 +08:00
< a href = "javascript:ModuleToPrompt('`+ (data_list[2]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[2]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
< / d i v > ` ;
break ;
// 1左右3
2024-01-19 14:49:32 +08:00
case 'lr13' :
if ( margin > 0 ) {
item _style [ 0 ] = 'width:calc(50% + ' + margin + 'px);' ;
item _style [ 1 ] = 'width:calc(50% - ' + margin + 'px);' ;
2022-11-27 21:49:10 +08:00
} else {
item _style [ 0 ] = 'width:50%;' ;
item _style [ 1 ] = 'width:50%;' ;
}
2024-01-19 14:49:32 +08:00
html += ` <div class="am-nbfc layout-module-images-magic-cube layout-module-images-magic-cube- ` + show _style + ` ` + list _ent + ` ">
< div class = "am-fl item-module-magic-cube" style = "`+ item_style[0] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[0]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[0]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
2024-01-19 14:49:32 +08:00
< div class = "am-fr item-module-magic-cube" style = "`+ item_style[1] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[1]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[1]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
2024-01-19 14:49:32 +08:00
< a href = "javascript:ModuleToPrompt('`+ (data_list[2]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[2]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
2024-01-19 14:49:32 +08:00
< a href = "javascript:ModuleToPrompt('`+ (data_list[3]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[3]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
< / d i v > ` ;
break ;
// 2左右1
2024-01-19 14:49:32 +08:00
case 'lr21' :
if ( margin > 0 ) {
item _style [ 0 ] = 'width:calc(50% - ' + ( margin / 2 ) + 'px);' ;
item _style [ 1 ] = 'width:calc(50% + ' + ( margin / 2 ) + 'px);' ;
2022-11-27 21:49:10 +08:00
} else {
item _style [ 0 ] = 'width:50%;' ;
item _style [ 1 ] = 'width:50%;' ;
}
2024-01-19 14:49:32 +08:00
html += ` <div class="am-nbfc layout-module-images-magic-cube layout-module-images-magic-cube- ` + show _style + ` ` + list _ent + ` ">
< div class = "am-fl item-module-magic-cube" style = "`+ item_style[0] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[0]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[0]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
2024-01-19 14:49:32 +08:00
< a href = "javascript:ModuleToPrompt('`+ (data_list[1]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[1]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
2024-01-19 14:49:32 +08:00
< div class = "am-fr item-module-magic-cube" style = "`+ item_style[1] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[2]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[2]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
< / d i v > ` ;
break ;
// 3左右1
2024-01-19 14:49:32 +08:00
case 'lr31' :
if ( margin > 0 ) {
item _style [ 0 ] = 'width:calc(50% - ' + margin + 'px);' ;
item _style [ 1 ] = 'width:calc(50% + ' + margin + 'px);' ;
2022-11-27 21:49:10 +08:00
} else {
item _style [ 0 ] = 'width:50%;' ;
item _style [ 1 ] = 'width:50%;' ;
}
2024-01-19 14:49:32 +08:00
html += ` <div class="am-nbfc layout-module-images-magic-cube layout-module-images-magic-cube- ` + show _style + ` ` + list _ent + ` ">
< div class = "am-fl item-module-magic-cube" style = "`+ item_style[0] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[0]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[0]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
2024-01-19 14:49:32 +08:00
< a href = "javascript:ModuleToPrompt('`+ (data_list[1]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[1]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
2024-01-19 14:49:32 +08:00
< a href = "javascript:ModuleToPrompt('`+ (data_list[2]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[2]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
2024-01-19 14:49:32 +08:00
< div class = "am-fr item-module-magic-cube" style = "`+ item_style[1] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[3]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[3]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
< / d i v > ` ;
break ;
// 1上下2
2024-01-19 14:49:32 +08:00
case 'tb12' :
2022-11-27 21:49:10 +08:00
item _style [ 0 ] = 'width:100%;' ;
item _style [ 1 ] = 'width:50%;' ;
item _style [ 2 ] = 'width:50%;' ;
2024-01-19 14:49:32 +08:00
html += ` <div class="am-nbfc layout-module-images-magic-cube layout-module-images-magic-cube- ` + show _style + ` ` + list _ent + ` ">
< div class = "item-module-magic-cube" style = "`+ item_style[0] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[0]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[0]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
< div class = "am-nbfc" >
2024-01-19 14:49:32 +08:00
< div class = "am-fl item-module-magic-cube" style = "`+ item_style[1] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[1]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[1]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
2024-01-19 14:49:32 +08:00
< div class = "am-fr item-module-magic-cube" style = "`+ item_style[2] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[2]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[2]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
< / d i v >
< / d i v > ` ;
break ;
// 1上下3
2024-01-19 14:49:32 +08:00
case 'tb13' :
2022-11-27 21:49:10 +08:00
item _style [ 0 ] = 'width:100%;' ;
item _style [ 1 ] = 'width:33.33%;' ;
item _style [ 2 ] = 'width:33.33%;' ;
item _style [ 3 ] = 'width:33.33%;' ;
2024-01-19 14:49:32 +08:00
html += ` <div class="am-nbfc layout-module-images-magic-cube layout-module-images-magic-cube- ` + show _style + ` ` + list _ent + ` ">
< div class = "item-module-magic-cube" style = "`+ item_style[0] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[0]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[0]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
< div class = "am-nbfc" >
2024-01-19 14:49:32 +08:00
< div class = "am-fl item-module-magic-cube" style = "`+ item_style[1] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[1]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[1]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
2024-01-19 14:49:32 +08:00
< div class = "am-fl item-module-magic-cube" style = "`+ item_style[2] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[2]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[2]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
2024-01-19 14:49:32 +08:00
< div class = "am-fr item-module-magic-cube" style = "`+ item_style[3] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[3]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[3]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
< / d i v >
< / d i v > ` ;
break ;
// 2上下1
2024-01-19 14:49:32 +08:00
case 'tb21' :
2022-11-27 21:49:10 +08:00
item _style [ 0 ] = 'width:50%;' ;
item _style [ 1 ] = 'width:50%;' ;
item _style [ 2 ] = 'width:100%;' ;
2024-01-19 14:49:32 +08:00
html += ` <div class="am-nbfc layout-module-images-magic-cube layout-module-images-magic-cube- ` + show _style + ` ` + list _ent + ` ">
2022-11-27 21:49:10 +08:00
< div class = "am-nbfc" >
2024-01-19 14:49:32 +08:00
< div class = "am-fl item-module-magic-cube" style = "`+ item_style[0] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[0]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[0]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
2024-01-19 14:49:32 +08:00
< div class = "am-fr item-module-magic-cube" style = "`+ item_style[1] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[1]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[1]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
< / d i v >
2024-01-19 14:49:32 +08:00
< div class = "item-module-magic-cube" style = "`+ item_style[2] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[2]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[2]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
< / d i v > ` ;
break ;
// 3上下1
2024-01-19 14:49:32 +08:00
case 'tb31' :
2022-11-27 21:49:10 +08:00
item _style [ 0 ] = 'width:33.33%;' ;
item _style [ 1 ] = 'width:33.33%;' ;
item _style [ 2 ] = 'width:33.33%;' ;
item _style [ 3 ] = 'width:100%;' ;
2024-01-19 14:49:32 +08:00
html += ` <div class="am-nbfc layout-module-images-magic-cube layout-module-images-magic-cube- ` + show _style + ` ` + list _ent + ` ">
2022-11-27 21:49:10 +08:00
< div class = "am-nbfc" >
2024-01-19 14:49:32 +08:00
< div class = "am-fl item-module-magic-cube" style = "`+ item_style[0] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[0]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[0]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
2024-01-19 14:49:32 +08:00
< div class = "am-fl item-module-magic-cube" style = "`+ item_style[1] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[1]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[1]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
2024-01-19 14:49:32 +08:00
< div class = "am-fr item-module-magic-cube" style = "`+ item_style[2] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[2]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[2]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
< / d i v >
2024-01-19 14:49:32 +08:00
< div class = "item-module-magic-cube" style = "`+ item_style[3] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[3]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[3]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
< / d i v > ` ;
break ;
// 2竖左右横2
2024-01-19 14:49:32 +08:00
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);' ;
2022-11-27 21:49:10 +08:00
} else {
item _style [ 0 ] = 'width:25%;' ;
item _style [ 1 ] = 'width:25%;' ;
item _style [ 2 ] = 'width:50%;' ;
}
2024-01-19 14:49:32 +08:00
html += ` <div class="am-nbfc layout-module-images-magic-cube layout-module-images-magic-cube- ` + show _style + ` ` + list _ent + ` ">
< div class = "am-fl item-module-magic-cube" style = "`+ item_style[0] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[0]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[0]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
2024-01-19 14:49:32 +08:00
< div class = "am-fl item-module-magic-cube" style = "`+ item_style[1] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[1]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[1]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
2024-01-19 14:49:32 +08:00
< div class = "am-fr item-module-magic-cube" style = "`+ item_style[2] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[2]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[2]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
2024-01-19 14:49:32 +08:00
< a href = "javascript:ModuleToPrompt('`+ (data_list[3]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[3]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
< / d i v > ` ;
break ;
// 2横左右竖2
2024-01-19 14:49:32 +08:00
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);' ;
2022-11-27 21:49:10 +08:00
} else {
item _style [ 0 ] = 'width:50%;' ;
item _style [ 1 ] = 'width:25%;' ;
item _style [ 2 ] = 'width:25%;' ;
}
2024-01-19 14:49:32 +08:00
html += ` <div class="am-nbfc layout-module-images-magic-cube layout-module-images-magic-cube- ` + show _style + ` ` + list _ent + ` ">
< div class = "am-fl item-module-magic-cube" style = "`+ item_style[0] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[0]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[0]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
2024-01-19 14:49:32 +08:00
< a href = "javascript:ModuleToPrompt('`+ (data_list[1]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[1]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
2024-01-19 14:49:32 +08:00
< div class = "am-fl item-module-magic-cube" style = "`+ item_style[1] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[2]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[2]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
2024-01-19 14:49:32 +08:00
< div class = "am-fr item-module-magic-cube" style = "`+ item_style[2] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[3]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[3]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
< / d i v > ` ;
break ;
2024-01-19 14:49:32 +08:00
// 4图
case 'g4' :
2022-11-27 21:49:10 +08:00
item _style [ 0 ] = 'width:50%;' ;
item _style [ 1 ] = 'width:50%;' ;
item _style [ 2 ] = 'width:50%;' ;
item _style [ 3 ] = 'width:50%;' ;
2024-01-19 14:49:32 +08:00
html += ` <div class="am-nbfc layout-module-images-magic-cube layout-module-images-magic-cube- ` + show _style + ` ` + list _ent + ` ">
2022-11-27 21:49:10 +08:00
< div class = "am-nbfc" >
2024-01-19 14:49:32 +08:00
< div class = "am-fl item-module-magic-cube" style = "`+ item_style[0] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[0]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[0]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
2024-01-19 14:49:32 +08:00
< div class = "am-fr item-module-magic-cube" style = "`+ item_style[1] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[1]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[1]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
< / d i v >
< div class = "am-nbfc" >
2024-01-19 14:49:32 +08:00
< div class = "am-fl item-module-magic-cube" style = "`+ item_style[2] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[2]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[2]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
2024-01-19 14:49:32 +08:00
< div class = "am-fr item-module-magic-cube" style = "`+ item_style[3] + `" >
< a href = "javascript:ModuleToPrompt('`+ (data_list[3]['name'] || '') + `');" class = "am-block am-nbfc" style = "` + images_style + `" >
< img src = "`+ data_list[3]['images'] + `" class = "am-block ` + media_fixed.media_ent + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< / d i v >
< / d i v >
< / d i v > ` ;
break ;
}
// 模块容器设置
var $doc = $ ( doc ) ;
$doc . html ( html ) ;
// 数据加入配置
data [ 'frontend_config' ] = {
list _ent : list _ent ,
item _style : item _style ,
2023-03-23 11:06:13 +08:00
images _style : images _style ,
media _fixed : media _fixed
2022-11-27 21:49:10 +08:00
}
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' ) ;
}
2021-06-22 21:45:29 +08:00
/ * *
* 模块 - 视频处理
* @ author Devil
* @ blog http : //gong.gg/
* @ version 1.0 . 0
* @ date 2021 - 05 - 18
* @ desc description
* @ param { [ object ] } data [ 表单数据 ]
* /
2024-01-19 14:49:32 +08:00
function FormBackModuleConfigVideoHandle ( data ) {
2021-06-22 21:45:29 +08:00
// 基础信息
var doc = $offcanvas _config _video . attr ( 'data-doc' ) || null ;
2024-01-19 14:49:32 +08:00
if ( doc == null ) {
2022-08-21 17:11:09 +08:00
Prompt ( $layout . data ( 'module-tab-tips' ) || '模块标记有误' ) ;
2021-06-22 21:45:29 +08:00
return false ;
}
// 视频
2024-01-19 14:49:32 +08:00
if ( ( data . content _video || null ) == null ) {
2022-08-21 17:11:09 +08:00
Prompt ( $layout . data ( 'upload-video-tips' ) || '请上传视频' ) ;
2021-06-22 21:45:29 +08:00
return false ;
}
// 样式处理
var style = StyleBaseHandle ( data , 'style_' ) ;
// 视频固定
var media _fixed = MediaFixedHandle ( data ) ;
// html拼接
2024-01-19 14:49:32 +08:00
var html = '<div class="module-video-container" style="' + style + '">' ;
html += '<div class="module-video-content ' + media _fixed . media _container _ent + '" style="' + media _fixed . media _container _style + '">' ;
html += '<video src="' + data . content _video + '" poster="' + ( data . content _images || '' ) + '" controls class="' + media _fixed . media _ent + '" style="' + media _fixed . media _container _style + '">your browser does not support the video tag</video>' ;
html += '</div>' ;
html += '</div>' ;
2021-06-22 21:45:29 +08:00
var $doc = $ ( doc ) ;
$doc . html ( html ) ;
// 数据加入配置
data [ 'frontend_config' ] = {
2023-03-23 11:06:13 +08:00
style : style ,
media _fixed : media _fixed
2021-06-22 21:45:29 +08:00
}
2022-11-27 21:49:10 +08:00
$doc . attr ( 'data-json' , encodeURIComponent ( CryptoJS . enc . Base64 . stringify ( CryptoJS . enc . Utf8 . parse ( JSON . stringify ( data ) ) ) ) ) ;
2021-06-22 21:45:29 +08:00
$offcanvas _config _video . offCanvas ( 'close' ) ;
}
/ * *
* 模块 - 商品处理
* @ author Devil
* @ blog http : //gong.gg/
* @ version 1.0 . 0
* @ date 2021 - 06 - 04
* @ desc description
* @ param { [ object ] } data [ 表单数据 ]
* /
2024-01-19 14:49:32 +08:00
function FormBackModuleConfigGoodsHandle ( data ) {
2021-06-22 21:45:29 +08:00
// 基础信息
var doc = $offcanvas _config _goods . attr ( 'data-doc' ) || null ;
2024-01-19 14:49:32 +08:00
if ( doc == null ) {
2022-08-21 17:11:09 +08:00
Prompt ( $layout . data ( 'module-tab-tips' ) || '模块标记有误' ) ;
2021-06-22 21:45:29 +08:00
return false ;
}
// 数据类型
var goods _ids = '' ;
var category _id = 0 ;
2024-01-19 14:49:32 +08:00
switch ( data . goods _data _type ) {
2021-06-22 21:45:29 +08:00
// 商品
2024-01-19 14:49:32 +08:00
case 'goods' :
if ( ( data . goods _ids || null ) == null ) {
2022-08-21 17:11:09 +08:00
Prompt ( $layout . data ( 'choice-goods-tips' ) || '请选择商品' ) ;
2021-06-22 21:45:29 +08:00
return false ;
}
goods _ids = data . goods _ids ;
break ;
// 商品分类
2024-01-19 14:49:32 +08:00
case 'category' :
if ( ( data . goods _category _value || null ) == null ) {
2022-08-21 17:11:09 +08:00
Prompt ( $layout . data ( 'choice-goods-category-tips' ) || '请选择商品分类' ) ;
2021-06-22 21:45:29 +08:00
return false ;
}
var category = JSON . parse ( decodeURIComponent ( data . goods _category _value ) ) || null ;
2024-01-19 14:49:32 +08:00
category _id = category [ category . length - 1 ] [ 'id' ] ;
2021-06-22 21:45:29 +08:00
break ;
2024-01-19 14:49:32 +08:00
default :
Prompt ( ( $layout . data ( 'data-type-tips' ) || '数据类型有误' ) + '[' + data . goods _data _type + ']' ) ;
2021-06-22 21:45:29 +08:00
return false ;
}
// 获取商品
var $this = $offcanvas _config _goods . find ( 'button[type="submit"]' ) ;
var url = $offcanvas _config _goods . data ( 'data-url' ) ;
$this . button ( 'loading' ) ;
$ . ajax ( {
2022-05-14 15:37:28 +08:00
url : RequestUrlHandle ( url ) ,
2021-06-22 21:45:29 +08:00
type : 'post' ,
data : {
"data_type" : data . goods _data _type ,
"goods_ids" : goods _ids ,
"category_id" : category _id ,
"order_by_type" : data . goods _order _by _type || 0 ,
"order_by_rule" : data . goods _order _by _rule || 0 ,
"order_limit_number" : data . goods _order _limit _number || 10
} ,
dataType : 'json' ,
2024-01-19 14:49:32 +08:00
success : function ( res ) {
2021-06-22 21:45:29 +08:00
$this . button ( 'reset' ) ;
2024-01-19 14:49:32 +08:00
if ( res [ 'code' ] == 0 ) {
if ( ( res . data || null ) != null && res . data . length > 0 ) {
2021-06-22 21:45:29 +08:00
// 列表数据
var list = res . data ;
// 列表展示数量
var sm = data . view _list _number _sm || 2 ;
var md = data . view _list _number _md || 5 ;
var lg = data . view _list _number _lg || 5 ;
// 外边距
var margin = data . style _margin || 0 ;
// 内容样式处理
var style = StyleBaseHandle ( data , 'style_module_' ) ;
// 商品样式处理
var rules = {
2023-03-24 16:22:20 +08:00
margin : {
value : "{var}px 0 0 {var}px" ,
var : "{var}"
2021-06-22 21:45:29 +08:00
}
} ;
var item _style = StyleBaseHandle ( data , 'style_' , rules ) ;
2023-03-23 11:06:13 +08:00
// 图片样式
2021-06-22 21:45:29 +08:00
var media _fixed = MediaFixedHandle ( data ) ;
// 模块容器设置
var $doc = $ ( doc ) ;
// 数据项html
var item _html = '' ;
2024-01-19 14:49:32 +08:00
for ( var i in list ) {
2022-11-30 11:29:04 +08:00
item _html += ` <li>
2024-01-19 14:49:32 +08:00
< div class = "module-item" style = "`+ item_style + `" >
< a href = "`+ list[i]['goods_url'] + `" target = "_blank" class = "` + media_fixed.media_container_ent + `" style = "` + media_fixed.media_container_style + `" >
< img src = "`+ list[i]['images'] + `" alt = "` + list[i]['title'] + `" class = "` + media_fixed.media_ent + `" style = "` + media_fixed.media_container_style + `" / >
2022-11-27 21:49:10 +08:00
< / a >
< div class = "item-bottom" >
< div class = "module-title" >
2024-01-19 14:49:32 +08:00
< a href = "`+ list[i]['goods_url'] + `" target = "_blank" > ` + list[i]['title'] + ` < / a >
2022-11-27 21:49:10 +08:00
< / d i v >
2024-01-19 14:49:32 +08:00
< p class = "module-price" > ` + __currency_symbol__ + list[i]['price'] + ` < / p >
2022-11-27 21:49:10 +08:00
< / d i v >
< / d i v >
< / l i > ` ;
2021-06-22 21:45:29 +08:00
}
// 商品容器
2024-01-19 14:49:32 +08:00
var html = '<div class="module-goods-container" style="' + style + '">' ;
2021-06-22 21:45:29 +08:00
// 初始化参数
var option = { } ;
// 展示模式
var nav _dot _ent = '' ;
var list _ent = '' ;
2022-11-27 21:49:10 +08:00
var item _right _style = '' ;
2021-06-22 21:45:29 +08:00
var show _style = data . view _list _show _style || 'routine' ;
2024-01-19 14:49:32 +08:00
switch ( show _style ) {
2021-06-22 21:45:29 +08:00
// 滚动
2024-01-19 14:49:32 +08:00
case 'rolling' :
2021-06-22 21:45:29 +08:00
// 参数处理
var show _style _value = ViewRollingShowStyleValueHandle ( data . view _list _show _style _value ) ;
// 是否展示导航点
nav _dot _ent = show _style _value . is _nav _dot ? '' : 'slides-rolling-not-dot' ;
// html拼接
2024-01-19 14:49:32 +08:00
html += '<div class="am-slider am-slider-default am-slider-carousel module-goods-content ' + nav _dot _ent + '">' ;
2021-06-22 21:45:29 +08:00
html += '<ul class="am-slides module-list-content">' ;
html += item _html ;
html += '</ul>' ;
html += '</div>' ;
// 配置参数
option = {
itemWidth : show _style _value . item _width ,
itemMargin : show _style _value . item _margin ,
slideshow : show _style _value . is _auto _play ,
controlNav : show _style _value . is _nav _dot
}
break ;
2022-11-27 21:49:10 +08:00
// 左图右文
2024-01-19 14:49:32 +08:00
case 'leftright' :
2022-11-27 21:49:10 +08:00
var style _media _fixed _width = parseInt ( data . style _media _fixed _width || 0 ) ;
2024-01-19 14:49:32 +08:00
item _right _style = 'margin-left:10px;' + ( ( style _media _fixed _width > 0 ) ? 'width: calc(100% - ' + ( style _media _fixed _width + 10 ) + 'px);' : '' ) ;
2022-11-27 21:49:10 +08:00
// 设置了外边距,则计算平均移动值
2024-01-19 14:49:32 +08:00
var avg = ( margin > 0 ) ? 'module-list-content-avg-' + margin : '' ;
2022-11-27 21:49:10 +08:00
// 列表class
2024-01-19 14:49:32 +08:00
list _ent = avg + ' module-list-sm-' + sm + ' module-list-md-' + md + ' module-list-lg-' + md + ' ' ;
html += '<ul class="module-goods-content module-list-content ' + list _ent + '">' ;
for ( var i in list ) {
2022-11-27 21:49:10 +08:00
html += ` <li>
2024-01-19 14:49:32 +08:00
< div class = "module-item" style = "`+ item_style + `" >
< a href = "`+ list[i]['goods_url'] + `" target = "_blank" class = "am-fl ` + media_fixed.media_container_ent + `" style = "` + media_fixed.media_container_style + `" >
< img src = "`+ list[i]['images'] + `" class = "` + media_fixed.media_ent + `" style = "` + media_fixed.media_container_style + `" / >
2022-11-27 21:49:10 +08:00
< / a >
2024-01-19 14:49:32 +08:00
< div class = "am-fl" style = "`+ item_right_style + `" >
2022-11-27 21:49:10 +08:00
< div class = "module-title" >
2024-01-19 14:49:32 +08:00
< a href = "`+ list[i]['goods_url'] + `" target = "_blank" > ` + list[i]['title'] + ` < / a >
2022-11-27 21:49:10 +08:00
< / d i v >
2024-01-19 14:49:32 +08:00
< p class = "module-price" > ` + __currency_symbol__ + list[i]['price'] + ` < / p >
2022-11-27 21:49:10 +08:00
< / d i v >
< / d i v >
< / l i > ` ;
}
html += '</ul>' ;
break ;
2021-06-22 21:45:29 +08:00
// 常规、默认
2024-01-19 14:49:32 +08:00
default :
2021-06-22 21:45:29 +08:00
// 设置了外边距,则计算平均移动值
2024-01-19 14:49:32 +08:00
var avg = ( margin > 0 ) ? 'module-list-content-avg-' + margin : '' ;
2021-06-22 21:45:29 +08:00
// 列表class
2024-01-19 14:49:32 +08:00
list _ent = avg + ' module-list-sm-' + sm + ' module-list-md-' + md + ' module-list-lg-' + md + ' ' ;
2021-06-22 21:45:29 +08:00
2024-01-19 14:49:32 +08:00
html += '<ul class="module-goods-content module-list-content ' + list _ent + '">' ;
2021-06-22 21:45:29 +08:00
html += item _html ;
html += '</ul>' ;
break ;
}
html += '</div>' ;
// 固定商品则加入数据中,方便使用
2024-01-19 14:49:32 +08:00
if ( data . goods _data _type == 'goods' ) {
2021-06-22 21:45:29 +08:00
data [ 'data_list' ] = list ;
}
// 模块容器设置
$doc . html ( html ) ;
// 数据加入配置
data [ 'frontend_config' ] = {
2023-03-23 11:06:13 +08:00
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
2021-06-22 21:45:29 +08:00
}
2022-11-27 21:49:10 +08:00
$doc . attr ( 'data-json' , encodeURIComponent ( CryptoJS . enc . Base64 . stringify ( CryptoJS . enc . Utf8 . parse ( JSON . stringify ( data ) ) ) ) ) ;
2021-06-22 21:45:29 +08:00
// 组件参数
2024-01-19 14:49:32 +08:00
if ( JSON . stringify ( option ) !== '{}' ) {
2021-06-22 21:45:29 +08:00
$doc . find ( '.am-slider' ) . flexslider ( option ) ;
}
// 关闭商品窗口
$offcanvas _config _goods . offCanvas ( 'close' ) ;
} else {
2022-08-21 17:11:09 +08:00
Prompt ( $layout . data ( 'goods-data-empty-tips' ) || '商品信息为空' ) ;
2021-06-22 21:45:29 +08:00
}
} else {
Prompt ( res . msg ) ;
2024-01-19 14:49:32 +08:00
}
2021-06-22 21:45:29 +08:00
} ,
2024-01-19 14:49:32 +08:00
error : function ( res ) {
2021-06-22 21:45:29 +08:00
$this . button ( 'reset' ) ;
2022-08-22 15:42:40 +08:00
var msg = HtmlToString ( xhr . responseText ) || ( window [ 'lang_error_text' ] || '异常错误' ) ;
2021-06-22 21:45:29 +08:00
Prompt ( msg , null , 30 ) ;
}
} ) ;
}
/ * *
* 模块 - 标题处理
* @ author Devil
* @ blog http : //gong.gg/
* @ version 1.0 . 0
* @ date 2021 - 06 - 04
* @ desc description
* @ param { [ object ] } data [ 表单数据 ]
* /
2024-01-19 14:49:32 +08:00
function FormBackModuleConfigTitleHandle ( data ) {
2021-06-22 21:45:29 +08:00
// 基础信息
var doc = $offcanvas _config _title . attr ( 'data-doc' ) || null ;
2024-01-19 14:49:32 +08:00
if ( doc == null ) {
2022-08-21 17:11:09 +08:00
Prompt ( $layout . data ( 'module-tab-tips' ) || '模块标记有误' ) ;
2021-06-22 21:45:29 +08:00
return false ;
}
// 视频
2024-01-19 14:49:32 +08:00
if ( ( data . content _title || null ) == null ) {
2022-08-21 17:11:09 +08:00
Prompt ( $layout . data ( 'main-title-tips' ) || '请填写主标题' ) ;
2021-06-22 21:45:29 +08:00
return false ;
}
// 样式处理
var style = StyleBaseHandle ( data , 'style_' ) ;
// 主标题样式
var style _title _main = StyleBaseHandle ( data , 'style_title_' ) ;
// 副标题样式
var style _title _vice = StyleBaseHandle ( data , 'style_title_vice_' ) ;
// 右侧按钮样式
var style _title _more = StyleBaseHandle ( data , 'style_title_more_' ) ;
// html拼接
2024-01-19 14:49:32 +08:00
var html = '<div class="module-title-container" style="' + style + '">' ;
html += '<div class="module-title-content">' ;
html += '<span class="title-main" style="' + style _title _main + '">' + data . content _title + '</span>' ;
2021-06-22 21:45:29 +08:00
// 副标题
2024-01-19 14:49:32 +08:00
if ( ( data . content _title _vice || null ) != null ) {
html += '<span class="title-vice" style="' + style _title _vice + '">' + data . content _title _vice + '</span>' ;
2021-06-22 21:45:29 +08:00
}
2024-01-19 14:49:32 +08:00
2021-06-22 21:45:29 +08:00
// 关键字
var field _first = 'content_item_keywords_' ;
var field _first _length = field _first . length ;
var key _temp = [ ] ;
var keywords _list = [ ] ;
2024-01-19 14:49:32 +08:00
for ( var i in data ) {
if ( i . substr ( 0 , field _first _length ) == field _first ) {
2021-06-22 21:45:29 +08:00
keywords _list . push ( JSON . parse ( decodeURIComponent ( data [ i ] ) ) ) ;
delete data [ i ] ;
}
}
2024-01-19 14:49:32 +08:00
if ( keywords _list . length > 0 ) {
2021-06-22 21:45:29 +08:00
html += '<div class="keywords-content">' ;
2024-01-19 14:49:32 +08:00
for ( var i in keywords _list ) {
var kt _item _style = ( ( keywords _list [ i ] [ 'style_keywords_color' ] || null ) == null ) ? '' : 'color:' + keywords _list [ i ] [ 'style_keywords_color' ] + ';' ;
html += '<a href="javascript:ModuleToPrompt(\'' + keywords _list [ i ] [ 'content_to_name' ] + '\');" style="' + kt _item _style + '">' + keywords _list [ i ] [ 'content_keywords' ] + '</a>' ;
2021-06-22 21:45:29 +08:00
}
2024-01-19 14:49:32 +08:00
html += '</div>' ;
2021-06-22 21:45:29 +08:00
}
data [ 'keywords_list' ] = keywords _list ;
// 右侧按钮
2024-01-19 14:49:32 +08:00
if ( ( data . content _title _more || null ) != null ) {
2021-06-22 21:45:29 +08:00
html += '<div class="more-content">' ;
2024-01-19 14:49:32 +08:00
html += '<a href="javascript:ModuleToPrompt(\'' + ( data . content _to _name || '' ) + '\');" style="' + style _title _more + '">' ;
html += '<span>' + data . content _title _more + '</span> ' ;
2024-07-03 22:46:04 +08:00
html += '<i class="iconfont icon-angle-right"></i>' ;
2021-06-22 21:45:29 +08:00
html += '</a>' ;
html += '</div>' ;
}
html += '</div>' ;
html += '</div>' ;
// 模块容器设置
var $doc = $ ( doc ) ;
$doc . html ( html ) ;
// 数据加入配置
data [ 'frontend_config' ] = {
2023-03-23 11:06:13 +08:00
style : style ,
style _title _main : style _title _main ,
style _title _vice : style _title _vice ,
style _title _more : style _title _more
2021-06-22 21:45:29 +08:00
}
2022-11-27 21:49:10 +08:00
$doc . attr ( 'data-json' , encodeURIComponent ( CryptoJS . enc . Base64 . stringify ( CryptoJS . enc . Utf8 . parse ( JSON . stringify ( data ) ) ) ) ) ;
2021-06-22 21:45:29 +08:00
$offcanvas _config _title . offCanvas ( 'close' ) ;
}
2022-11-24 21:03:39 +08:00
/ * *
* 模块 - 自定义html处理
* @ author Devil
* @ blog http : //gong.gg/
* @ version 1.0 . 0
* @ date 2021 - 06 - 04
* @ desc description
* @ param { [ object ] } data [ 表单数据 ]
* /
2024-01-19 14:49:32 +08:00
function FormBackModuleConfigCustomHandle ( data ) {
2022-11-24 21:03:39 +08:00
// 基础信息
var doc = $offcanvas _config _custom . attr ( 'data-doc' ) || null ;
2024-01-19 14:49:32 +08:00
if ( doc == null ) {
2022-11-24 21:03:39 +08:00
Prompt ( $layout . data ( 'module-tab-tips' ) || '模块标记有误' ) ;
return false ;
}
// 模块容器设置
var $doc = $ ( doc ) ;
$doc . html ( data . custom || '' ) ;
// 数据加入配置
2022-11-27 21:49:10 +08:00
$doc . attr ( 'data-json' , encodeURIComponent ( CryptoJS . enc . Base64 . stringify ( CryptoJS . enc . Utf8 . parse ( JSON . stringify ( data ) ) ) ) ) ;
2022-11-24 21:03:39 +08:00
$offcanvas _config _custom . offCanvas ( 'close' ) ;
}
2021-06-22 21:45:29 +08:00
/ * *
* 模块 - 辅助线处理
* @ author Devil
* @ blog http : //gong.gg/
* @ version 1.0 . 0
* @ date 2021 - 06 - 04
* @ desc description
* @ param { [ object ] } data [ 表单数据 ]
* /
2024-01-19 14:49:32 +08:00
function FormBackModuleConfigBorderHandle ( data ) {
2021-06-22 21:45:29 +08:00
// 基础信息
var doc = $offcanvas _config _border . attr ( 'data-doc' ) || null ;
2024-01-19 14:49:32 +08:00
if ( doc == null ) {
2022-08-21 17:11:09 +08:00
Prompt ( $layout . data ( 'module-tab-tips' ) || '模块标记有误' ) ;
2021-06-22 21:45:29 +08:00
return false ;
}
// 边线类型、和大小
2024-01-19 14:49:32 +08:00
if ( ( data . style _border _style || null ) == null ) {
2022-08-21 17:11:09 +08:00
Prompt ( $layout . data ( 'border-style-tips' ) || '请选择边线类型' ) ;
2021-06-22 21:45:29 +08:00
return false ;
}
2024-01-19 14:49:32 +08:00
if ( ( data . style _border _width || null ) == null ) {
2022-08-21 17:11:09 +08:00
Prompt ( $layout . data ( 'border-style-max-tips' ) || '请输入边线、最大10的数字' ) ;
2021-06-22 21:45:29 +08:00
return false ;
}
// 样式处理
var style = StyleBaseHandle ( data , 'style_' ) ;
// html拼接
2024-01-19 14:49:32 +08:00
var html = '<div class="module-border-container" style="' + style + '"></div>' ;
2021-06-22 21:45:29 +08:00
// 模块容器设置
var $doc = $ ( doc ) ;
$doc . html ( html ) ;
// 数据加入配置
data [ 'frontend_config' ] = {
2023-03-23 11:06:13 +08:00
style : style
2021-06-22 21:45:29 +08:00
}
2022-11-27 21:49:10 +08:00
$doc . attr ( 'data-json' , encodeURIComponent ( CryptoJS . enc . Base64 . stringify ( CryptoJS . enc . Utf8 . parse ( JSON . stringify ( data ) ) ) ) ) ;
2021-06-22 21:45:29 +08:00
$offcanvas _config _border . offCanvas ( 'close' ) ;
}
/ * *
* 模块 - 辅助空白处理
* @ author Devil
* @ blog http : //gong.gg/
* @ version 1.0 . 0
* @ date 2021 - 06 - 04
* @ desc description
* @ param { [ object ] } data [ 表单数据 ]
* /
2024-01-19 14:49:32 +08:00
function FormBackModuleConfigHeightHandle ( data ) {
2021-06-22 21:45:29 +08:00
// 基础信息
var doc = $offcanvas _config _height . attr ( 'data-doc' ) || null ;
2024-01-19 14:49:32 +08:00
if ( doc == null ) {
2022-08-21 17:11:09 +08:00
Prompt ( $layout . data ( 'module-tab-tips' ) || '模块标记有误' ) ;
2021-06-22 21:45:29 +08:00
return false ;
}
// 高度
2024-01-19 14:49:32 +08:00
if ( ( data . style _height || null ) == null ) {
2022-08-21 17:11:09 +08:00
Prompt ( $layout . data ( 'height-max-tips' ) || '请输入高度、最大100的数字' ) ;
2021-06-22 21:45:29 +08:00
return false ;
}
// 样式处理
var style = StyleBaseHandle ( data , 'style_' ) ;
// html拼接
2024-01-19 14:49:32 +08:00
var html = '<div class="module-height-container" style="' + style + '"></div>' ;
2021-06-22 21:45:29 +08:00
// 模块容器设置
var $doc = $ ( doc ) ;
$doc . html ( html ) ;
// 数据加入配置
data [ 'frontend_config' ] = {
2023-03-23 11:06:13 +08:00
style : style
2021-06-22 21:45:29 +08:00
}
2022-11-27 21:49:10 +08:00
$doc . attr ( 'data-json' , encodeURIComponent ( CryptoJS . enc . Base64 . stringify ( CryptoJS . enc . Utf8 . parse ( JSON . stringify ( data ) ) ) ) ) ;
2021-06-22 21:45:29 +08:00
$offcanvas _config _height . offCanvas ( 'close' ) ;
}
/ * *
* 模块 - 滚动配置处理
* @ author Devil
* @ blog http : //gong.gg/
* @ version 1.0 . 0
* @ date 2021 - 06 - 04
* @ desc description
* @ param { [ object ] } data [ 表单数据 ]
* /
2024-01-19 14:49:32 +08:00
function FormBackModuleModalRollingConfigHandle ( data ) {
2021-06-22 21:45:29 +08:00
$base _show _style _value _obj . val ( encodeURIComponent ( JSON . stringify ( data ) ) ) ;
$modal _rolling _config . modal ( 'close' ) ;
}
/ * *
* 模块 - 列表配置处理
* @ author Devil
* @ blog http : //gong.gg/
* @ version 1.0 . 0
* @ date 2021 - 06 - 04
* @ desc description
* @ param { [ object ] } data [ 表单数据 ]
* /
2024-01-19 14:49:32 +08:00
function FormBackModuleModalListConfigHandle ( data ) {
2021-06-22 21:45:29 +08:00
$base _show _style _value _obj . val ( encodeURIComponent ( JSON . stringify ( data ) ) ) ;
$modal _list _config . modal ( 'close' ) ;
}
/ * *
* 模块 - 标题 - 关键字处理
* @ author Devil
* @ blog http : //gong.gg/
* @ version 1.0 . 0
* @ date 2021 - 06 - 04
* @ desc description
* @ param { [ object ] } data [ 表单数据 ]
* /
2024-01-19 14:49:32 +08:00
function FormBackModuleModalTitleKeywordsHandle ( data ) {
2021-06-22 21:45:29 +08:00
// 操作类型
var type = parseInt ( $modal _title _keywords . attr ( 'data-opt-type' ) || 0 ) ;
// 获取设置的数据、关键字名称必填
2024-01-19 14:49:32 +08:00
if ( ( data . content _keywords || null ) == null ) {
2021-06-22 21:45:29 +08:00
$modal _title _keywords . find ( 'input[name="content_keywords"]' ) . focus ( ) ;
2022-08-21 17:11:09 +08:00
Prompt ( $layout . data ( 'keywords-tips' ) || '请填写关键字' ) ;
2021-06-22 21:45:29 +08:00
return false ;
}
// 生成数据项
var params = {
"content_keywords" : data . content _keywords ,
"style_keywords_color" : data . style _keywords _color || '' ,
"content_to_type" : data . content _to _type || '' ,
"content_to_name" : data . content _to _name || '' ,
"content_to_value" : data . content _to _value || ''
} ;
var html = ModuleConfigTitleKeywordsContentHtml ( params ) ;
// 0添加、1编辑
2024-01-19 14:49:32 +08:00
if ( type == 0 ) {
2021-06-22 21:45:29 +08:00
$offcanvas _config _title . find ( '.config-title-container' ) . append ( html ) ;
} else {
$base _title _keywords _obj . prop ( 'outerHTML' , html ) ;
}
$modal _title _keywords . modal ( 'close' ) ;
}
/ * *
* 模块 - 弹窗搜索选择回调处理
* @ author Devil
* @ blog http : //gong.gg/
* @ version 1.0 . 0
* @ date 2021 - 06 - 04
* @ desc description
* @ param { [ object ] } data [ 表单数据 ]
* /
2024-01-19 14:49:32 +08:00
function FormBackModulePopupGoodsSearchHandle ( data ) {
2021-06-22 21:45:29 +08:00
// 参数配置
var type = $popup _goods _search . find ( '.am-tabs-nav li.am-active a' ) . data ( 'value' ) ;
2024-01-19 14:49:32 +08:00
var $vb = $popup _goods _search . find ( '.form-container-' + type ) ;
2021-06-22 21:45:29 +08:00
var params = {
"type" : type ,
"value" : ""
} ;
2024-01-19 14:49:32 +08:00
switch ( type ) {
2021-06-22 21:45:29 +08:00
// 商品分类
2024-01-19 14:49:32 +08:00
case 'category' :
2021-06-22 21:45:29 +08:00
var json = $vb . find ( '.already-select-tips' ) . attr ( 'data-value' ) || null ;
2024-01-19 14:49:32 +08:00
if ( json != null ) {
2021-06-22 21:45:29 +08:00
json = JSON . parse ( decodeURIComponent ( json ) ) || null ;
}
2024-01-19 14:49:32 +08:00
if ( json == null ) {
2022-08-21 17:11:09 +08:00
Prompt ( $layout . data ( 'before-choice-goods-category-tips' ) || '请先选择商品分类' ) ;
2021-06-22 21:45:29 +08:00
return false ;
}
params [ 'value' ] = json ;
break ;
// 品牌
2024-01-19 14:49:32 +08:00
case 'brand' :
2021-06-22 21:45:29 +08:00
var $vbs = $vb . find ( 'ul li.active a' ) ;
2024-01-19 14:49:32 +08:00
if ( $vbs . length <= 0 ) {
2022-08-21 17:11:09 +08:00
Prompt ( $layout . data ( 'before-choice-brand-tips' ) || '请先选择品牌' ) ;
2021-06-22 21:45:29 +08:00
return false ;
}
params [ 'value' ] = {
"id" : $vbs . data ( 'value' ) ,
"name" : $vbs . find ( 'span' ) . text ( )
} ;
break ;
// 关键字
2024-01-19 14:49:32 +08:00
case 'keywords' :
2021-06-22 21:45:29 +08:00
var value = $vb . find ( 'input' ) . val ( ) || '' ;
2024-01-19 14:49:32 +08:00
if ( value == '' ) {
2021-06-22 21:45:29 +08:00
$vb . find ( 'input' ) . focus ( ) ;
2022-08-21 17:11:09 +08:00
Prompt ( $layout . data ( 'before-input-keywords-tips' ) || '请先输入关键字1~30个字符' ) ;
2021-06-22 21:45:29 +08:00
return false ;
}
// 输入关键字去除引号
params [ 'value' ] = value . replace ( new RegExp ( '"' , 'g' ) , '' ) . replace ( new RegExp ( "'" , 'g' ) , '' ) ;
break ;
}
// 数据赋值并关闭弹窗
var show _name = ModuleConfigGoodsSearchPageShowName ( params ) ;
var $page = $modal _pages _select . find ( '.am-tabs-bd ul li.page-goods_search a' ) ;
2024-01-19 14:49:32 +08:00
$page . find ( 'span' ) . text ( $page . data ( 'name' ) + show _name ) ;
$page . attr ( 'data-json' , encodeURIComponent ( JSON . stringify ( params ) ) ) ;
$popup _goods _search . modal ( 'close' ) ;
2021-06-22 21:45:29 +08:00
}
2022-12-01 21:47:06 +08:00
/ * *
* 模块 - 基础布局处理
* @ author Devil
* @ blog http : //gong.gg/
* @ version 1.0 . 0
* @ date 2021 - 05 - 18
* @ desc description
* @ param { [ object ] } data [ 表单数据 ]
* /
2024-01-19 14:49:32 +08:00
function ModuleConfigBaseContentHandle ( data ) {
2022-12-01 21:47:06 +08:00
// 默认值处理
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' ) ;
2024-01-19 14:49:32 +08:00
if ( ( data . style _background _images || null ) == null ) {
2022-12-01 21:47:06 +08:00
$ul . find ( 'li' ) . remove ( ) ;
} else {
var html = ` <li>
2024-01-19 14:49:32 +08:00
< input type = "text" name = "style_background_images" value = "`+ data.style_background_images + `" >
< img src = "`+ data.style_background_images + `" / >
2024-04-15 10:25:01 +08:00
< i class = "iconfont icon-close" > < / i >
2022-12-01 21:47:06 +08:00
< / l i > ` ;
$ul . html ( html ) ;
}
return data ;
}
2021-06-22 21:45:29 +08:00
/ * *
* 模块 - 图片链接地址生成
* @ author Devil
* @ blog http : //gong.gg/
* @ version 1.0 . 0
* @ date 2021 - 05 - 18
* @ desc description
* @ param { [ string ] } name [ 显示名称 ]
* /
2024-01-19 14:49:32 +08:00
function ModuleConfigImagesToContentHtml ( name ) {
2021-06-22 21:45:29 +08:00
// 无数据
2024-01-19 14:49:32 +08:00
if ( ( name || null ) == null ) {
return '<a href="javascript:;" class="form-view-choice-container-submit">' + ( $layout . data ( 'choice-url-tips' ) || '请选择跳转链接' ) + '</a>' ;
2021-06-22 21:45:29 +08:00
}
// 有数据
var html = '<span class="form-view-choice-container-submit form-view-choice-container-active am-radius">' ;
2024-01-19 14:49:32 +08:00
html += '<span class="am-text-truncate">' + name + '</span>' ;
html += '<i class="am-icon-close am-margin-left-xs"></i>' ;
html += '</span>' ;
html += '<a href="javascript:;" class="form-view-choice-container-submit am-margin-left-sm">' + ( $layout . data ( 'edit-name' ) || '修改' ) + '</a>' ;
2021-06-22 21:45:29 +08:00
return html ;
}
/ * *
* 模块 - 商品分类地址生成
* @ author Devil
* @ blog http : //gong.gg/
* @ version 1.0 . 0
* @ date 2021 - 05 - 18
* @ desc description
* @ param { [ string ] } name [ 显示名称 ]
* /
2024-01-19 14:49:32 +08:00
function ModuleConfigGoodsCategoryContentHtml ( name ) {
2021-06-22 21:45:29 +08:00
// 无数据
2024-01-19 14:49:32 +08:00
if ( ( name || null ) == null ) {
return '<a href="javascript:;" class="form-view-choice-container-submit">' + ( $layout . data ( 'choice-goods-category-tips' ) || '请选择商品分类' ) + '</a>' ;
2021-06-22 21:45:29 +08:00
}
// 设置数据
var html = '<span class="form-view-choice-container-submit form-view-choice-container-active am-radius">' ;
2024-01-19 14:49:32 +08:00
html += '<span class="am-text-truncate">' + name + '</span>' ;
html += '<i class="am-icon-close am-margin-left-xs"></i>' ;
html += '</span>' ;
html += '<a href="javascript:;" class="form-view-choice-container-submit am-margin-left-sm">' + ( $layout . data ( 'edit-name' ) || '修改' ) + '</a>' ;
2021-06-22 21:45:29 +08:00
return html ;
}
/ * *
* 模块 - 商品信息生成
* @ author Devil
* @ blog http : //gong.gg/
* @ version 1.0 . 0
* @ date 2021 - 05 - 18
* @ desc description
* @ param { [ object ] } data [ 商品列表 ]
* /
2024-01-19 14:49:32 +08:00
function ModuleConfigGoodsItemContentHtml ( data ) {
2021-06-22 21:45:29 +08:00
var html = '' ;
2024-01-19 14:49:32 +08:00
if ( ( data || null ) != null && data . length > 0 ) {
for ( var i in data ) {
html += '<li data-gid="' + data [ i ] [ 'id' ] + '">' ;
2021-06-22 21:45:29 +08:00
html += '<a href="javascript:;" class="am-close am-close-alt am-icon-times"></a>' ;
2024-01-19 14:49:32 +08:00
html += '<a href="' + data [ i ] [ 'goods_url' ] + '" title="' + data [ i ] [ 'title' ] + '" target="_blank" class="am-block am-padding-xs">' ;
html += '<img src="' + data [ i ] [ 'images' ] + '" alt="' + data [ i ] [ 'title' ] + '" />' ;
2021-06-22 21:45:29 +08:00
html += '</a>' ;
html += '</li>' ;
}
}
return html ;
}
/ * *
* 模块 - 多图信息生成
* @ author Devil
* @ blog http : //gong.gg/
* @ version 1.0 . 0
* @ date 2021 - 05 - 18
* @ desc description
* @ param { [ string ] } images [ 图片地址 ]
* @ param { [ string ] } type [ 类型 ]
* @ param { [ string ] } name [ 名称 ]
* @ param { [ string ] } value [ 数据值 ]
* /
2024-01-19 14:49:32 +08:00
function ModuleConfigManyImagesItemContentHtml ( images , type , name , value ) {
var index = parseInt ( Math . random ( ) * 1000001 ) ;
2022-11-27 21:49:10 +08:00
var html = ` <div class="am-panel am-panel-default am-padding-sm">
< a href = "javascript:;" class = "am-close am-close-alt am-icon-times" > < / a >
< div class = "am-form-group am-form-file am-form-group-refreshing" >
2024-01-19 14:49:32 +08:00
< ul class = "plug-file-upload-view am-cf module-slider-type-images-view module-slider-type-images-view-`+ index + `" data - form - name = "content_images_` + index + `" data - max - number = "1" data - delete = "0" data - dialog - type = "images" >
2022-11-27 21:49:10 +08:00
< li >
2024-01-19 14:49:32 +08:00
< input type = "text" name = "content_images_`+ index + `" data - validation - message = "` + ($layout.data('upload-images-tips') || '请上传图片') + `" value = "` + (images || '') + `" required / >
< img src = "`+ (images || $offcanvas_config_many_images.data('default-images')) + `" / >
2022-11-27 21:49:10 +08:00
< / l i >
< / u l >
2024-01-19 14:49:32 +08:00
< div class = "plug-file-upload-submit" data - view - tag = "ul.module-slider-type-images-view-`+ index + `" > + ` + ( $ layout.data('upload-images-name') || '上传图片') + ` < / d i v >
2022-11-27 21:49:10 +08:00
< / d i v >
< div class = "am-form-group am-form-group-refreshing" >
2024-01-19 14:49:32 +08:00
< div class = "form-view-choice-container am-margin-top-xs" data - key = "`+ index + `" >
< input type = "hidden" name = "content_to_type_`+ index + `" value = "` + (type || '') + `" / >
< input type = "hidden" name = "content_to_name_`+ index + `" value = "` + (name || '') + `" / >
< input type = "hidden" name = "content_to_value_`+ index + `" value = "` + ((value || null) == null ? '' : encodeURIComponent(JSON.stringify(value))) + `" / >
2022-11-27 21:49:10 +08:00
< div class = "form-view-choice-container-content" >
2024-01-19 14:49:32 +08:00
` + ModuleConfigImagesToContentHtml(name) + `
2022-11-27 21:49:10 +08:00
< / d i v >
< / d i v >
< / d i v >
< / d i v > ` ;
2021-06-22 21:45:29 +08:00
return html ;
}
2022-11-24 21:03:39 +08:00
/ * *
* 模块 - 图文信息生成
* @ author Devil
* @ blog http : //gong.gg/
* @ version 1.0 . 0
* @ date 2021 - 05 - 18
* @ desc description
* @ param { [ object ] } data [ 配置数据 ]
* /
2024-01-19 14:49:32 +08:00
function ModuleConfigImagesTextItemContentHtml ( data ) {
if ( ( data || null ) == null ) {
2022-11-24 21:03:39 +08:00
data = { } ;
}
2024-01-19 14:49:32 +08:00
if ( ( data . title _style _align || null ) == null ) {
2022-11-24 21:03:39 +08:00
data . title _style _align = 'left' ;
}
2024-01-19 14:49:32 +08:00
if ( ( data . desc _style _align || null ) == null ) {
2022-11-24 21:03:39 +08:00
data . desc _style _align = 'left' ;
}
2024-01-19 14:49:32 +08:00
var index = parseInt ( Math . random ( ) * 1000001 ) ;
2023-03-24 16:22:20 +08:00
var font _size = $layout . data ( 'images-text-font-size' ) || '大小' ;
var title _message = $layout . data ( 'images-text-margin-title-message' ) || '标题外边距最大1000' ;
var desc _message = $layout . data ( 'images-text-margin-desc-message' ) || '描述外边距最大1000' ;
var margin _top = $layout . data ( 'images-text-margin-top' ) || '外上' ;
2024-04-15 10:25:01 +08:00
var margin _right = $layout . data ( 'images-text-margin-right' ) || '外右' ;
var margin _bottom = $layout . data ( 'images-text-margin-bottom' ) || '外下' ;
var margin _left = $layout . data ( 'images-text-margin-left' ) || '外左' ;
2023-03-24 16:22:20 +08:00
var position _left = $layout . data ( 'images-text-position-left' ) || '外左' ;
var position _center = $layout . data ( 'images-text-position-center' ) || '外中' ;
var position _right = $layout . data ( 'images-text-position-right' ) || '外右' ;
2022-11-24 21:03:39 +08:00
var html = ` <div class="am-panel am-panel-default am-padding-sm">
< a href = "javascript:;" class = "am-close am-close-alt am-icon-times" > < / a >
< div class = "am-form-group am-form-file am-form-group-refreshing" >
2024-01-19 14:49:32 +08:00
< ul class = "plug-file-upload-view am-cf module-slider-type-images-view module-slider-type-images-view-`+ index + `" data - form - name = "content_images_` + index + `" data - max - number = "1" data - delete = "0" data - dialog - type = "images" >
2022-11-24 21:03:39 +08:00
< li >
2024-01-19 14:49:32 +08:00
< input type = "text" name = "content_images_`+ index + `" value = "` + (data.images || '') + `" / >
< img src = "`+ (data.images || $offcanvas_config_many_images.data('default-images')) + `" / >
2022-11-24 21:03:39 +08:00
< / l i >
< / u l >
2024-01-19 14:49:32 +08:00
< div class = "plug-file-upload-submit" data - view - tag = "ul.module-slider-type-images-view-`+ index + `" > + ` + ( $ layout.data('upload-images-name') || '上传图片') + ` < / d i v >
2022-11-24 21:03:39 +08:00
< / d i v >
< div class = "am-form-group am-form-group-refreshing" >
2024-01-19 14:49:32 +08:00
< div class = "form-view-choice-container am-margin-top-xs" data - key = "`+ index + `" >
< input type = "hidden" name = "content_to_type_`+ index + `" value = "` + (data.type || '') + `" / >
< input type = "hidden" name = "content_to_name_`+ index + `" value = "` + (data.name || '') + `" / >
< input type = "hidden" name = "content_to_value_`+ index + `" value = "` + ((data.value || null) == null ? '' : encodeURIComponent(JSON.stringify(data.value))) + `" / >
2022-11-24 21:03:39 +08:00
< div class = "form-view-choice-container-content" >
2024-01-21 00:00:51 +08:00
` + ModuleConfigImagesToContentHtml(data.name) + `
2022-11-24 21:03:39 +08:00
< / d i v >
< / d i v >
< / d i v > ` ;
2024-01-19 14:49:32 +08:00
// 标题
var title _style _color = ( data . title _style _color || null ) == null ? '' : 'background-color:' + data . title _style _color + ';border-color:' + data . title _style _color + ';' ;
var title = $layout . data ( 'images-text-title' ) || '标题' ;
html += ` <div class="am-form-group am-form-group-refreshing">
< label > ` + title + ` < / l a b e l >
2022-11-24 21:03:39 +08:00
< div class = "am-input-group am-input-group-sm" >
2024-01-19 14:49:32 +08:00
< input type = "text" placeholder = "`+ title + `" name = "content_title_` + index + `" value = "` + (data.title || '') + `" class = "am-form-field" / >
< input type = "hidden" name = "content_title_style_color_`+ index + `" value = "` + (data.title_style_color || '') + `" / >
2024-04-15 10:25:01 +08:00
< a href = "javascript:;" class = "am-input-group-label am-padding-0 am-border-0" >
< div class = "colorpicker-container colorpicker-simple" >
< div class = "colorpicker-submit module-style-color-images-text-content-title-style-color-`+ index + `" data - position = "fixed" data - input - tag = ".module-style-color-images-text-content-title-style-color-` + index + `" data - color - tag = "input[name='content_title_style_color_` + index + `']" data - color - style = "background-color|border-color" style = "` + title_style_color + `" data - color = "` + (data.title_style_color || '') + `" >
< / d i v >
< img class = "imitate-colorpicker-submit" src = "`+ __attachment_host__ + `/static/common/images/colorpicker.png" / >
< / d i v >
2022-11-24 21:03:39 +08:00
< / a >
< / d i v > ` ;
2024-01-19 14:49:32 +08:00
// 外边距
html += ` <div class="am-input-group am-input-group-sm group-border-width am-margin-top-xs">
< input type = "number" data - is - clearout = "0" placeholder = "`+ margin_top + `" name = "content_title_style_margin_top_` + index + `" min = "0" max = "1000" data - validation - message = "` + title_message + `" value = "` + (data.title_style_margin_top || '') + `" class = "am-form-field" / >
< input type = "number" data - is - clearout = "0" placeholder = "`+ margin_right + `" name = "content_title_style_margin_right_` + index + `" min = "0" max = "1000" data - validation - message = "` + title_message + `" value = "` + (data.title_style_margin_right || '') + `" class = "am-form-field" / >
< input type = "number" data - is - clearout = "0" placeholder = "`+ margin_bottom + `" name = "content_title_style_margin_bottom_` + index + `" min = "0" max = "1000" data - validation - message = "` + title_message + `" value = "` + (data.title_style_margin_bottom || '') + `" class = "am-form-field" / >
< input type = "number" data - is - clearout = "0" placeholder = "`+ margin_left + `" name = "content_title_style_margin_left_` + index + `" min = "0" max = "1000" data - validation - message = "` + title_message + `" value = "` + (data.title_style_margin_left || '') + `" class = "am-form-field" / >
2022-11-24 21:03:39 +08:00
< span class = "am-input-group-label" > px < / s p a n >
< / d i v > ` ;
2024-01-19 14:49:32 +08:00
// 字体大小和左右居中
html += ` <div class="am-margin-top-xs am-nbfc">
2022-11-24 21:03:39 +08:00
< div class = "am-input-group am-input-group-sm am-fl group-input-font-size" >
2024-01-19 14:49:32 +08:00
< input type = "number" data - is - clearout = "0" placeholder = "`+ font_size + `" name = "content_title_style_font_size_` + index + `" min = "0" max = "1000" data - validation - message = "` + ($layout.data('images-text-font-size-title-message') || '标题字体最大1000') + `" value = "` + (data.title_style_font_size || '') + `" class = "am-form-field" / >
2022-11-24 21:03:39 +08:00
< span class = "am-input-group-label" > px < / s p a n >
< / d i v >
2024-01-19 14:49:32 +08:00
< div class = "am-fr group-text-align-style" > < label class = "am-checkbox-inline" > < input type = "radio" name = "content_title_style_align_`+ index + `" value = "left" data - am - ucheck ` + (data.title_style_align == 'left' ? 'checked' : '') + ` / > ` + position_left + ` < /label><label class="am-checkbox-inline"><input type="radio" name="content_title_style_align_` + index + `" value="center" data-am-ucheck ` + (data.title_style_align == 'center' ? 'checked' : '') + ` / > ` + position_center + ` < /label><label class="am-checkbox-inline"><input type="radio" name="content_title_style_align_` + index + `" value="right" data-am-ucheck ` + (data.title_style_align == 'right' ? 'checked' : '') + ` / > ` + position_right + ` < / l a b e l > < / d i v >
2022-11-24 21:03:39 +08:00
< / d i v > ` ;
2024-01-19 14:49:32 +08:00
html += ` </div> ` ;
2022-11-24 21:03:39 +08:00
2024-01-19 14:49:32 +08:00
// 描述
var desc = $layout . data ( 'images-text-desc' ) || '描述' ;
var desc _style _color = ( data . desc _style _color || null ) == null ? '' : 'background-color:' + data . desc _style _color + ';border-color:' + data . desc _style _color + ';' ;
html += ` <div class="am-form-group am-form-group-refreshing">
< label > ` + desc + ` < / l a b e l >
2022-11-24 21:03:39 +08:00
< div class = "am-input-group am-input-group-sm" >
2024-01-19 14:49:32 +08:00
< input type = "text" placeholder = "`+ desc + `" name = "content_desc_` + index + `" value = "` + (data.desc || '') + `" class = "am-form-field" / >
< input type = "hidden" name = "content_desc_style_color_`+ index + `" value = "` + (data.desc_style_color || '') + `" / >
2024-04-15 10:25:01 +08:00
< a href = "javascript:;" class = "am-input-group-label am-padding-0 am-border-0" >
< div class = "colorpicker-container colorpicker-simple" >
< div class = "colorpicker-submit module-style-color-images-text-content-desc-style-color-`+ index + `" data - position = "fixed" data - input - tag = ".module-style-color-images-text-content-desc-style-color-` + index + `" data - color - tag = "input[name='content_desc_style_color_` + index + `']" data - color - style = "background-color|border-color" style = "` + desc_style_color + `" data - color = "` + (data.desc_style_color || '') + `" >
< / d i v >
< img class = "imitate-colorpicker-submit" src = "`+ __attachment_host__ + `/static/common/images/colorpicker.png" / >
< / d i v >
2022-11-24 21:03:39 +08:00
< / a >
< / d i v > ` ;
2024-01-19 14:49:32 +08:00
// 外边距
html += ` <div class="am-input-group am-input-group-sm group-border-width am-margin-top-xs">
< input type = "number" data - is - clearout = "0" placeholder = "`+ margin_top + `" name = "content_desc_style_margin_top_` + index + `" min = "0" max = "1000" data - validation - message = "` + desc_message + `" value = "` + (data.desc_style_margin_top || '') + `" class = "am-form-field" / >
< input type = "number" data - is - clearout = "0" placeholder = "`+ margin_right + `" name = "content_desc_style_margin_right_` + index + `" min = "0" max = "1000" data - validation - message = "` + desc_message + `" value = "` + (data.desc_style_margin_right || '') + `" class = "am-form-field" / >
< input type = "number" data - is - clearout = "0" placeholder = "`+ margin_bottom + `" name = "content_desc_style_margin_bottom_` + index + `" min = "0" max = "1000" data - validation - message = "` + desc_message + `" value = "` + (data.desc_style_margin_bottom || '') + `" class = "am-form-field" / >
< input type = "number" data - is - clearout = "0" placeholder = "`+ margin_left + `" name = "content_desc_style_margin_left_` + index + `" min = "0" max = "1000" data - validation - message = "` + desc_message + `" value = "` + (data.desc_style_margin_left || '') + `" class = "am-form-field" / >
2022-11-24 21:03:39 +08:00
< span class = "am-input-group-label" > px < / s p a n >
< / d i v > ` ;
2024-01-19 14:49:32 +08:00
// 字体大小和左右居中
html += ` <div class="am-margin-top-xs am-nbfc">
2022-11-24 21:03:39 +08:00
< div class = "am-input-group am-input-group-sm am-fl group-input-font-size" >
2024-01-19 14:49:32 +08:00
< input type = "number" data - is - clearout = "0" placeholder = "`+ font_size + `" name = "content_desc_style_font_size_` + index + `" min = "0" max = "1000" data - validation - message = "` + ($layout.data('images-text-font-size-desc-message') || '描述字体最大1000') + `" value = "` + (data.desc_style_font_size || '') + `" class = "am-form-field" / >
2022-11-24 21:03:39 +08:00
< span class = "am-input-group-label" > px < / s p a n >
< / d i v >
2024-01-19 14:49:32 +08:00
< div class = "am-fr group-text-align-style" > < label class = "am-checkbox-inline" > < input type = "radio" name = "content_desc_style_align_`+ index + `" value = "left" data - am - ucheck ` + (data.desc_style_align == 'left' ? 'checked' : '') + ` / > ` + position_left + ` < /label><label class="am-checkbox-inline"><input type="radio" name="content_desc_style_align_` + index + `" value="center" data-am-ucheck ` + (data.desc_style_align == 'center' ? 'checked' : '') + ` / > ` + position_center + ` < /label><label class="am-checkbox-inline"><input type="radio" name="content_desc_style_align_` + index + `" value="right" data-am-ucheck ` + (data.desc_style_align == 'right' ? 'checked' : '') + ` / > ` + position_right + ` < / l a b e l > < / d i v >
2022-11-24 21:03:39 +08:00
< / d i v >
< / d i v > ` ;
2024-01-19 14:49:32 +08:00
html += ` </div> ` ;
2022-11-24 21:03:39 +08:00
return html ;
}
2022-11-27 21:49:10 +08:00
/ * *
* 模块 - 图片魔方信息生成
* @ author Devil
* @ blog http : //gong.gg/
* @ version 1.0 . 0
* @ date 2021 - 05 - 18
* @ desc description
* @ param { [ object ] } data [ 配置数据 ]
* /
2024-01-19 14:49:32 +08:00
function ModuleConfigImagesMagicCubeItemContentHtml ( data ) {
2022-11-27 21:49:10 +08:00
// 基础处理
2024-01-19 14:49:32 +08:00
if ( ( data || null ) == null ) {
2022-11-27 21:49:10 +08:00
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 ;
2024-01-19 14:49:32 +08:00
if ( value == null ) {
2022-11-27 21:49:10 +08:00
Prompt ( $layout . data ( 'data-show-modal-tips' ) || '请选择数据展示模式' ) ;
return false ;
}
2024-01-19 14:49:32 +08:00
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 + ')' ) ;
2022-11-27 21:49:10 +08:00
return false ;
}
// 编辑则重新添加
var count = 0 ;
2024-01-19 14:49:32 +08:00
if ( JSON . stringify ( data ) == '{}' ) {
2022-11-27 21:49:10 +08:00
// 已有数据条数、满足数量则不增加,多余则移除
count = $offcanvas _config _images _magic _cube . find ( '.config-images-magic-cube-container > .am-panel' ) . length ;
2024-01-19 14:49:32 +08:00
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 ( ) ;
2022-11-27 21:49:10 +08:00
}
}
2024-01-19 14:49:32 +08:00
if ( max <= 0 ) {
2022-11-27 21:49:10 +08:00
return false ;
}
}
// 生成数据
var html = '' ;
var data _list = data . data _list || [ ] ;
2024-01-19 14:49:32 +08:00
for ( var i = count ; i < modal _arr [ value ] ; i ++ ) {
2022-11-27 21:49:10 +08:00
var item = data _list [ i ] || { } ;
html += ` <div class="am-panel am-panel-default am-padding-sm">
< div class = "am-form-group am-form-file am-form-group-refreshing" >
2024-01-19 14:49:32 +08:00
< ul class = "plug-file-upload-view am-cf module-slider-type-images-view module-slider-type-images-view-`+ i + `" data - form - name = "content_images_` + i + `" data - max - number = "1" data - delete = "0" data - dialog - type = "images" >
2022-11-27 21:49:10 +08:00
< li >
2024-01-19 14:49:32 +08:00
< input type = "text" name = "content_images_`+ i + `" data - validation - message = "` + ($layout.data('upload-images-tips') || '请上传图片') + `" value = "` + (item.images || '') + `" required / >
< img src = "`+ (item.images || $offcanvas_config_many_images.data('default-images')) + `" / >
2022-11-27 21:49:10 +08:00
< / l i >
< / u l >
2024-01-19 14:49:32 +08:00
< div class = "plug-file-upload-submit" data - view - tag = "ul.module-slider-type-images-view-`+ i + `" > + ` + ( $ layout.data('upload-images-name') || '上传图片') + ` < / d i v >
2022-11-27 21:49:10 +08:00
< / d i v >
< div class = "am-form-group am-form-group-refreshing" >
2024-01-19 14:49:32 +08:00
< div class = "form-view-choice-container am-margin-top-xs" data - key = "`+ i + `" >
< input type = "hidden" name = "content_to_type_`+ i + `" value = "` + (item.type || '') + `" / >
< input type = "hidden" name = "content_to_name_`+ i + `" value = "` + (item.name || '') + `" / >
< input type = "hidden" name = "content_to_value_`+ i + `" value = "` + ((item.value || null) == null ? '' : encodeURIComponent(JSON.stringify(item.value))) + `" / >
2022-11-27 21:49:10 +08:00
< div class = "form-view-choice-container-content" >
2024-01-19 14:49:32 +08:00
` + ModuleConfigImagesToContentHtml(item.name) + `
2022-11-27 21:49:10 +08:00
< / d i v >
< / d i v >
< / d i v >
< / d i v > ` ;
}
return html ;
}
2021-06-22 21:45:29 +08:00
/ * *
* 模块 - 标题关键字
* @ author Devil
* @ blog http : //gong.gg/
* @ version 1.0 . 0
* @ date 2021 - 06 - 12
* @ desc description
* @ param { [ object ] } data [ 关键字数据项配置 ]
* /
2024-01-19 14:49:32 +08:00
function ModuleConfigTitleKeywordsContentHtml ( data ) {
var index = parseInt ( Math . random ( ) * 1000001 ) ;
2021-06-22 21:45:29 +08:00
var html = '<li>' ;
2024-01-19 14:49:32 +08:00
html += '<input type="hidden" name="content_item_keywords_' + index + '" value="' + ( ( ( data || null ) == null ) ? '' : encodeURIComponent ( JSON . stringify ( data ) ) ) + '" />' ;
html += '<span class="am-text-truncate am-block">' + ( data . content _keywords || '' ) + '</span>' ;
html += '<a href="javascript:;" class="am-icon-edit"></a>' ;
html += '<a href="javascript:;" class="am-icon-remove"></a>' ;
html += '</li>' ;
2021-06-22 21:45:29 +08:00
return html ;
}
/ * *
* 模块 - 标题关键字打开弹窗
* @ author Devil
* @ blog http : //gong.gg/
* @ version 1.0 . 0
* @ date 2021 - 06 - 12
* @ desc description
* @ param { [ int ] } type [ 操作类型 ( 0 添加 、 1 编辑 ) ]
* @ param { [ object ] } data [ 关键字数据项配置 ]
* /
2024-01-19 14:49:32 +08:00
function ModuleConfigTitleKeywordsOpen ( type , data ) {
2021-06-22 21:45:29 +08:00
// 数据处理
2024-01-19 14:49:32 +08:00
if ( ( data || null ) != null ) {
2021-06-22 21:45:29 +08:00
data = JSON . parse ( decodeURIComponent ( data ) ) || null ;
}
2024-01-19 14:49:32 +08:00
if ( ( data || null ) == null ) {
2021-06-22 21:45:29 +08:00
data = {
2024-01-19 14:49:32 +08:00
"content_keywords" : "" ,
"style_keywords_color" : "" ,
"content_to_name" : "" ,
"content_to_type" : "" ,
"content_to_value" : ""
2021-06-22 21:45:29 +08:00
} ;
}
// 表单数据赋值
FormDataFill ( data , '#modal-module-title-keywords' ) ;
// 链接地址
$modal _title _keywords . find ( '.form-view-choice-container-content' ) . html ( ModuleConfigImagesToContentHtml ( data . content _to _name ) ) ;
// 关键字颜色
var color = data . style _keywords _color || '' ;
2024-01-19 14:49:32 +08:00
$modal _title _keywords . find ( '.module-style-color_keywords' ) . css ( { "background-color" : color , "border-color" : color , "color" : color } ) ;
2021-06-22 21:45:29 +08:00
// 开启标题关键字配置弹窗
$modal _title _keywords . modal ( {
width : 260 ,
height : 210 ,
closeViaDimmer : false
} ) ;
$modal _title _keywords . attr ( 'data-opt-type' , type || 0 ) ;
}
/ * *
* 模块商品搜索 - 页面展示名称
* @ author Devil
* @ blog http : //gong.gg/
* @ version 1.0 . 0
* @ date 2021 - 05 - 20
* @ desc description
* @ param { [ string ] } data - > type [ 类型 ]
* @ param { [ string | object ] } data - > value [ 选择的数据值 ]
* /
2024-01-19 14:49:32 +08:00
function ModuleConfigGoodsSearchPageShowName ( data ) {
2021-06-22 21:45:29 +08:00
var name = '' ;
2024-01-19 14:49:32 +08:00
if ( ( data || null ) != null && ( data . type || null ) != null && ( data . value || null ) != null ) {
2021-06-22 21:45:29 +08:00
var value = data [ 'value' ] ;
2024-01-19 14:49:32 +08:00
switch ( data . type ) {
2021-06-22 21:45:29 +08:00
// 商品分类
2024-01-19 14:49:32 +08:00
case 'category' :
name = ( $layout . data ( 'goods-category-name' ) || '商品分类' ) + '-' + value [ value . length - 1 ] [ 'name' ] ;
2021-06-22 21:45:29 +08:00
break ;
// 品牌
2024-01-19 14:49:32 +08:00
case 'brand' :
name = ( $layout . data ( 'brand-name' ) || '品牌' ) + '-' + value [ 'name' ] ;
2021-06-22 21:45:29 +08:00
break ;
// 关键字
2024-01-19 14:49:32 +08:00
case 'keywords' :
name = ( $layout . data ( 'keywords-name' ) || '关键字' ) + '-' + value ;
2021-06-22 21:45:29 +08:00
break ;
}
}
2024-01-19 14:49:32 +08:00
return ( name || null ) == null ? '' : '( ' + name + ') ' ;
2021-06-22 21:45:29 +08:00
}
/ * *
* 左侧商品配置商品id
* @ author Devil
* @ blog http : //gong.gg/
* @ version 1.0 . 0
* @ date 2021 - 06 - 06
* @ desc description
* /
2024-01-19 14:49:32 +08:00
function OffcanvasModuleConfigGoodsIds ( ) {
2021-06-22 21:45:29 +08:00
return $ ( '#offcanvas-module-config-goods input[name="goods_ids"]' ) . val ( ) || '' ;
}
/ * *
* 滚动数据参数处理
* @ author Devil
* @ blog http : //gong.gg/
* @ version 1.0 . 0
* @ date 2021 - 06 - 12
* @ desc description
* @ param { [ object ] } data [ 配置数据 ]
* /
2024-01-19 14:49:32 +08:00
function ViewRollingShowStyleValueHandle ( data ) {
2021-06-22 21:45:29 +08:00
// 数据处理
var value = ( ( data || null ) == null ) ? { } : ( JSON . parse ( decodeURIComponent ( data ) ) || { } ) ;
// 宽度
value [ 'item_width' ] = parseInt ( value [ 'item_width' ] || 200 ) ;
// 外边距
value [ 'item_margin' ] = parseInt ( value [ 'item_margin' ] || 0 ) ;
// 是否自动播放
value [ 'is_auto_play' ] = ( ( value . is _auto _play || 0 ) == 0 ) ? false : true ;
// 是否展示导航点
value [ 'is_nav_dot' ] = ( ( value . is _nav _dot || 0 ) == 0 ) ? false : true ;
return value ;
}
/ * *
* 列表数据参数处理
* @ author Devil
* @ blog http : //gong.gg/
* @ version 1.0 . 0
* @ date 2021 - 06 - 12
* @ desc description
* @ param { [ object ] } data [ 配置数据 ]
* /
2024-01-19 14:49:32 +08:00
function ViewListShowStyleValueHandle ( data ) {
2021-06-22 21:45:29 +08:00
// 数据处理
var value = ( ( data || null ) == null ) ? { } : ( JSON . parse ( decodeURIComponent ( data ) ) || { } ) ;
// 小屏
value [ 'view_list_number_sm' ] = parseInt ( value [ 'view_list_number_sm' ] || 2 ) ;
// 中屏
value [ 'view_list_number_md' ] = parseInt ( value [ 'view_list_number_md' ] || 5 ) ;
// 大屏
value [ 'view_list_number_lg' ] = parseInt ( value [ 'view_list_number_lg' ] || 5 ) ;
// 外边距
value [ 'style_margin' ] = parseInt ( value [ 'style_margin' ] || 0 ) ;
return value ;
}
/ * *
* 左侧配置 - 页面选择
* @ author Devil
* @ blog http : //gong.gg/
* @ version 1.0 . 0
* @ date 2021 - 06 - 10
* @ desc description
* @ param { [ object ] } obj [ 当前对象 ]
* @ param { [ object ] } event [ 事件 ]
* /
2024-01-19 14:49:32 +08:00
function OffcanvasConfigPagesChoice ( obj , event ) {
2021-06-22 21:45:29 +08:00
// 当前选择页面的链接位置对象
$page _parent _obj = obj . parent ( ) ;
// 获取已选择的数据
var $parent = $page _parent _obj . parents ( '.form-view-choice-container' ) ;
2024-01-19 14:49:32 +08:00
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 ;
2021-06-22 21:45:29 +08:00
// 所有处理
2024-01-19 14:49:32 +08:00
$modal _pages _select . find ( '.am-tabs-bd ul li' ) . each ( function ( k , v ) {
2021-06-22 21:45:29 +08:00
$ ( this ) . removeClass ( 'active' ) ;
2024-01-19 14:49:32 +08:00
$ ( this ) . find ( 'a span' ) . text ( $ ( this ) . find ( 'a' ) . data ( 'name' ) ) ;
2021-06-22 21:45:29 +08:00
} ) ;
$modal _pages _select . find ( '.am-tabs-bd ul li' ) . removeClass ( 'active' ) ;
$modal _pages _select . find ( '.am-tabs-bd ul li a' ) . attr ( 'data-json' , '' ) ;
2021-07-01 18:00:26 +08:00
// 自定义链接地址
2024-01-19 14:49:32 +08:00
if ( to _type == 'pages-custom-url' ) {
2021-07-01 18:00:26 +08:00
var form _doc = '.pages-custom-url-container' ;
2024-01-19 14:49:32 +08:00
if ( ( to _value || null ) == null ) {
2021-07-01 18:00:26 +08:00
to _value = GetFormVal ( form _doc , true ) ;
} else {
to _value = JSON . parse ( decodeURIComponent ( to _value ) ) ;
}
FormDataFill ( to _value , form _doc ) ;
var index = 2 ;
2024-01-19 14:49:32 +08:00
// 常规页面选择
2021-07-01 18:00:26 +08:00
} else {
// 当前选中的数据
2024-01-19 14:49:32 +08:00
var $active _obj = $modal _pages _select . find ( '.am-tabs-bd ul li.page-' + to _type ) ;
2021-07-01 18:00:26 +08:00
$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 ( ) ;
2024-01-19 14:49:32 +08:00
if ( index == - 1 ) {
2021-07-01 18:00:26 +08:00
index = 0 ;
}
2021-06-22 21:45:29 +08:00
}
2021-07-01 18:00:26 +08:00
// tab切换
2021-06-22 21:45:29 +08:00
$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' ) ;
$modal _pages _select . find ( '.am-tabs-bd .am-tab-panel' ) . eq ( index ) . addClass ( 'am-active' ) ;
// 开启页面选择弹窗
$modal _pages _select . modal ( {
2023-03-24 16:22:20 +08:00
width : 380 ,
2024-07-03 22:46:04 +08:00
height : 475 ,
2021-06-22 21:45:29 +08:00
closeViaDimmer : false
} ) ;
}
/ * *
* 左侧配置 - 页面移除
* @ author Devil
* @ blog http : //gong.gg/
* @ version 1.0 . 0
* @ date 2021 - 06 - 10
* @ desc description
* @ param { [ object ] } obj [ 当前对象 ]
* @ param { [ object ] } event [ 事件 ]
* /
2024-01-19 14:49:32 +08:00
function OffcanvasConfigPagesRemove ( obj , event ) {
2021-06-22 21:45:29 +08:00
var $parent = obj . parents ( '.form-view-choice-container' ) ;
var $content = $parent . find ( '.form-view-choice-container-content' ) ;
2022-11-27 21:49:10 +08:00
var key = $parent . data ( 'key' ) ;
2024-01-19 14:49:32 +08:00
var index = ( key == undefined ) ? '' : '_' + key ;
2021-06-22 21:45:29 +08:00
$content . html ( ModuleConfigImagesToContentHtml ( ) ) ;
2024-01-19 14:49:32 +08:00
$parent . find ( 'input[name="content_to_type' + index + '"]' ) . val ( '' ) ;
$parent . find ( 'input[name="content_to_name' + index + '"]' ) . val ( '' ) ;
$parent . find ( 'input[name="content_to_value' + index + '"]' ) . val ( '' ) ;
2021-06-22 21:45:29 +08:00
event . stopPropagation ( ) ;
}
/ * *
* 模块背景色组件处理
* @ author Devil
* @ blog http : //gong.gg/
* @ version 1.0 . 0
* @ date 2021 - 06 - 09
* @ desc description
* @ param { [ object ] } e [ 模块对象 ]
* /
2024-01-19 14:49:32 +08:00
function ModuleColorpickerHandle ( e ) {
e . find ( '.colorpicker-submit' ) . each ( function ( k , v ) {
2021-06-22 21:45:29 +08:00
var color = $ ( this ) . prev ( ) . val ( ) || '' ;
var style = $ ( this ) . data ( 'color-style' ) || null ;
2024-01-19 14:49:32 +08:00
if ( style != null ) {
2021-06-22 21:45:29 +08:00
var arr = style . split ( '|' ) ;
2024-01-19 14:49:32 +08:00
for ( var i in arr ) {
2021-06-22 21:45:29 +08:00
$ ( this ) . css ( arr [ i ] , color ) ;
2024-01-19 14:49:32 +08:00
$ ( this ) . find ( '.fcolorpicker-curbox' ) . css ( arr [ i ] , color ) ;
2021-06-22 21:45:29 +08:00
}
}
} ) ;
}
/ * *
* 布局页面配置获取
* @ author Devil
* @ blog http : //gong.gg/
* @ version 1.0 . 0
* @ date 2021 - 06 - 16
* @ desc description
* /
2024-01-19 14:49:32 +08:00
function LayoutViewConfig ( ) {
2021-06-22 21:45:29 +08:00
// 循环读取布局
var data = [ ] ;
2024-01-19 14:49:32 +08:00
$ ( '.layout-container .layout-view' ) . each ( function ( k , v ) {
2021-06-22 21:45:29 +08:00
// 布局数据
var json = $ ( this ) . find ( '.layout-content-children' ) . attr ( 'data-json' ) || null ;
var layout _temp = {
2023-03-24 16:22:20 +08:00
value : $ ( this ) . data ( 'value' ) . toString ( ) ,
status : ( $ ( this ) . find ( '.layout-content-submit input[type="checkbox"]:checked' ) . val ( ) == 'on' ) ? 1 : 0 ,
config : ( json == null ) ? { } : JSON . parse ( CryptoJS . enc . Base64 . parse ( decodeURIComponent ( json ) ) . toString ( CryptoJS . enc . Utf8 ) ) ,
children : [ ]
2021-06-22 21:45:29 +08:00
} ;
// 模块容器
2024-01-19 14:49:32 +08:00
$ ( this ) . find ( '.layout-content-container' ) . each ( function ( ks , vs ) {
2021-06-22 21:45:29 +08:00
// 容器数据
var json = $ ( this ) . attr ( 'data-json' ) || null ;
var content _temp = {
2023-03-24 16:22:20 +08:00
config : ( json == null ) ? { } : JSON . parse ( CryptoJS . enc . Base64 . parse ( decodeURIComponent ( json ) ) . toString ( CryptoJS . enc . Utf8 ) ) ,
children : [ ]
2021-06-22 21:45:29 +08:00
} ;
// 模块
2024-01-19 14:49:32 +08:00
$ ( this ) . find ( '.layout-content .module-view' ) . each ( function ( kss , vss ) {
2021-06-22 21:45:29 +08:00
// 模块数据
var json = $ ( this ) . find ( '.module-content' ) . attr ( 'data-json' ) || null ;
var value = $ ( this ) . find ( '.module-view-submit-container' ) . data ( 'value' ) ;
var module _config = {
2023-03-24 16:22:20 +08:00
value : value ,
name : layout _module _type _arr [ value ] ,
config : ( json == null ) ? { } : JSON . parse ( CryptoJS . enc . Base64 . parse ( decodeURIComponent ( json ) ) . toString ( CryptoJS . enc . Utf8 ) )
2021-06-22 21:45:29 +08:00
} ;
// 商品模块移除商品列表
2024-01-19 14:49:32 +08:00
if ( value == 'goods' ) {
2021-06-22 21:45:29 +08:00
delete module _config . config . data _list ;
}
content _temp . children . push ( module _config ) ;
} ) ;
// 容器加入布局
layout _temp . children . push ( content _temp ) ;
} ) ;
// 加入数据列表
data . push ( layout _temp ) ;
} ) ;
return data ;
}
/ * *
* 状态切换组件初始化
* @ author Devil
* @ blog http : //gong.gg/
* @ version 1.0 . 0
* @ date 2021 - 06 - 18
* @ desc description
* /
2024-01-19 14:49:32 +08:00
function LayoutSwitchInit ( ) {
SwitchInit ( ) ;
2021-06-22 21:45:29 +08:00
}
2024-01-19 14:49:32 +08:00
$ ( function ( ) {
// 开关变化
$ ( document ) . on ( 'click' , '.layout-view .switch-checkbox' , function ( ) {
var state = $ ( this ) . find ( 'input' ) . is ( ':checked' ) ? true : false ;
if ( state === true ) {
$ ( this ) . parents ( '.layout-view' ) . removeClass ( 'layout-view-hidden' ) ;
} else {
$ ( this ) . parents ( '.layout-view' ) . addClass ( 'layout-view-hidden' ) ;
}
} )
2021-06-22 21:45:29 +08:00
// 布局拖拽
2022-08-21 17:11:09 +08:00
$layout . dragsort ( {
2021-06-22 21:45:29 +08:00
dragSelector : '.drag-submit' ,
placeHolderTemplate : '<div class="drag-sort-dotted"></div>'
} ) ;
// 模块拖拽
ModuleDragSortInit ( ) ;
// 开关初始化
LayoutSwitchInit ( ) ;
// 布局/模块切换事件
2024-01-19 14:49:32 +08:00
$ ( '.renovation-tabs .am-tabs-nav a' ) . on ( 'click' , function ( ) {
2021-06-22 21:45:29 +08:00
$ ( this ) . parent ( 'li' ) . addClass ( 'am-active' ) . siblings ( 'li' ) . removeClass ( 'am-active' ) ;
$ ( '.renovation-tabs .am-tabs-bd .renovation-panel' ) . addClass ( 'am-hide' ) ;
$ ( $ ( this ) . attr ( 'href' ) ) . removeClass ( 'am-hide' ) ;
} ) ;
// 布局拖放
2024-01-19 14:49:32 +08:00
$ ( document ) . on ( 'dragstart' , '.structure-drag button' , function ( e ) {
2021-06-22 21:45:29 +08:00
// 布局配置
var drag _value = $ ( this ) . data ( 'value' ) ;
// 拖拽过程中经过的元素
2024-01-19 14:49:32 +08:00
$ ( document ) . on ( 'dragenter' , '.layout-view, .layout-container-tips' , function ( e ) {
2021-06-22 21:45:29 +08:00
// 当前是否在布局模式下操作
2024-01-19 14:49:32 +08:00
if ( $ ( '.renovation-tabs .am-tabs-nav li.am-active' ) . data ( 'value' ) == 'structure' ) {
2021-06-22 21:45:29 +08:00
$ ( '.layout-view, .layout-container-tips' ) . removeClass ( 'layout-view-dragenter' ) ;
$ ( this ) . addClass ( 'layout-view-dragenter' ) ;
}
} ) ;
// 拖拽离开元素移除过程中添加的样式
2024-01-19 14:49:32 +08:00
$ ( document ) . on ( 'dragleave' , '.structure-drag button' , function ( e ) {
2021-06-22 21:45:29 +08:00
$ ( '.layout-view,.layout-container-tips' ) . removeClass ( 'layout-view-dragenter' ) ;
} ) ;
// 拖拽结束
2024-01-19 14:49:32 +08:00
$ ( document ) . on ( 'dragend' , '.structure-drag button' , function ( e ) {
2021-06-22 21:45:29 +08:00
// 移除过程中添加的样式
$ ( '.layout-view,.layout-container-tips' ) . removeClass ( 'layout-view-dragenter' ) ;
// 关闭事件
$ ( '.layout-view, .layout-container-tips' ) . off ( 'dragover' ) ;
$ ( '.layout-view, .layout-container-tips' ) . off ( 'dragenter' ) ;
$ ( '.layout-view, .layout-container-tips' ) . off ( 'drop' ) ;
} ) ;
// 拖拽过程中一直在元素内、并阻止默认事件
2024-01-19 14:49:32 +08:00
$ ( document ) . on ( 'dragover' , '.layout-container' , function ( e ) {
2021-06-22 21:45:29 +08:00
e . preventDefault ( ) ;
e . stopPropagation ( ) ;
} ) ;
// 拖放接收事件
2024-01-19 14:49:32 +08:00
$ ( '.layout-view, .layout-container-tips' ) . on ( 'drop' , function ( e ) {
2021-06-22 21:45:29 +08:00
// 添加布局
$ ( this ) . before ( StructureDragHtmlCreate ( drag _value ) ) ;
// 容器设置弹出框提示初始化
$ ( '.layout-content-submit-set' ) . popover ( {
2022-08-21 17:11:09 +08:00
content : $layout . data ( 'layout-content-set-tips' ) || '容器设置' ,
2021-06-22 21:45:29 +08:00
trigger : 'hover focus' ,
theme : 'sm'
} ) ;
// 新的元素新增样式
var $new = $ ( this ) . prev ( ) ;
$new . addClass ( 'layout-view-new' ) ;
2024-01-19 14:49:32 +08:00
setTimeout ( function ( ) {
2021-06-22 21:45:29 +08:00
$new . removeClass ( 'layout-view-new' ) ;
} , 1500 ) ;
// 模块拖拽
ModuleDragSortInit ( $new . find ( '.layout-content' ) ) ;
// 关闭事件
$ ( '.layout-view, .layout-container-tips' ) . off ( 'dragover' ) ;
$ ( '.layout-view, .layout-container-tips' ) . off ( 'dragenter' ) ;
$ ( '.layout-view, .layout-container-tips' ) . off ( 'drop' ) ;
// 开关初始化
LayoutSwitchInit ( ) ;
// 移除布局提示
$ ( '.layout-container-tips' ) . remove ( ) ;
} ) ;
} ) ;
// 布局设置
2024-01-19 14:49:32 +08:00
$ ( document ) . on ( 'click' , '.layout-submit-set' , function ( ) {
2021-06-22 21:45:29 +08:00
// 布局对象
$layout _content _obj = $ ( this ) . parents ( '.layout-content-submit' ) . next ( ) ;
// 配置数据
var config _doc = '#offcanvas-layout-config' ;
var json = $layout _content _obj . attr ( 'data-json' ) || null ;
2024-01-19 14:49:32 +08:00
if ( json != null ) {
2021-06-22 21:45:29 +08:00
// 数据解析
2022-11-27 21:49:10 +08:00
json = JSON . parse ( CryptoJS . enc . Base64 . parse ( decodeURIComponent ( json ) ) . toString ( CryptoJS . enc . Utf8 ) ) || null ;
2021-06-22 21:45:29 +08:00
}
// 获取表单字段并赋空值
2024-01-19 14:49:32 +08:00
if ( ( json || null ) == null ) {
2021-06-22 21:45:29 +08:00
json = GetFormVal ( config _doc , true ) ;
2024-01-19 14:49:32 +08:00
for ( var i in json ) {
2021-06-22 21:45:29 +08:00
json [ i ] = '' ;
}
}
2022-12-01 21:47:06 +08:00
// 节点数据处理
json = ModuleConfigBaseContentHandle ( json ) ;
// 表单赋值
2021-06-22 21:45:29 +08:00
FormDataFill ( json , config _doc ) ;
2022-12-01 21:47:06 +08:00
// 单选框初始化
$offcanvas _layout _config . find ( 'input[type="checkbox"], input[type="radio"]' ) . uCheck ( ) ;
2021-06-22 21:45:29 +08:00
// 背景色组件处理
ModuleColorpickerHandle ( $offcanvas _layout _config ) ;
// 指定操作类型
$offcanvas _layout _config . attr ( 'data-ent' , 'layout-content-children' ) ;
// 打开配置
$offcanvas _layout _config . offCanvas ( 'open' ) ;
} ) ;
// 布局移除
2024-01-19 14:49:32 +08:00
$ ( document ) . on ( 'click' , '.layout-submit-del' , function ( ) {
2021-06-22 21:45:29 +08:00
var $this = $ ( this ) ;
AMUI . dialog . confirm ( {
2022-08-21 17:11:09 +08:00
title : $layout . data ( 'layout-reminder-title' ) || '温馨提示' ,
content : $layout . data ( 'layout-reminder-msg' ) || '移除后不可恢复、确定继续吗?' ,
2024-01-19 14:49:32 +08:00
onConfirm : function ( e ) {
2021-06-22 21:45:29 +08:00
// 移除布局
$this . parents ( '.layout-view' ) . remove ( ) ;
// 无布局则添加提示信息
2024-01-19 14:49:32 +08:00
if ( $ ( '.layout-container .layout-view' ) . length <= 0 ) {
$layout . html ( '<div class="layout-container-tips">' + ( $layout . data ( 'layout-container-tips' ) || '布局拖放到该区域松开鼠标即可' ) + '</div>' ) ;
2021-06-22 21:45:29 +08:00
}
}
} ) ;
} ) ;
2022-11-29 14:13:31 +08:00
// 布局容器设置
2024-01-19 14:49:32 +08:00
$ ( document ) . on ( 'click' , '.layout-content-submit-set' , function ( ) {
2021-06-22 21:45:29 +08:00
// 容器内容对象
$layout _content _obj = $ ( this ) . parents ( '.layout-content-container' ) ;
// 配置数据
2022-12-01 14:49:41 +08:00
var config _doc = '#offcanvas-layout-config' ;
2021-06-22 21:45:29 +08:00
var json = $layout _content _obj . attr ( 'data-json' ) || null ;
2024-01-19 14:49:32 +08:00
if ( json != null ) {
2021-06-22 21:45:29 +08:00
// 数据解析
2022-11-27 21:49:10 +08:00
json = JSON . parse ( CryptoJS . enc . Base64 . parse ( decodeURIComponent ( json ) ) . toString ( CryptoJS . enc . Utf8 ) ) || null ;
2021-06-22 21:45:29 +08:00
}
// 获取表单字段并赋空值
2024-01-19 14:49:32 +08:00
if ( ( json || null ) == null ) {
2021-06-22 21:45:29 +08:00
json = GetFormVal ( config _doc , true ) ;
2024-01-19 14:49:32 +08:00
for ( var i in json ) {
2021-06-22 21:45:29 +08:00
json [ i ] = '' ;
}
}
2022-12-01 21:47:06 +08:00
// 节点数据处理
json = ModuleConfigBaseContentHandle ( json ) ;
// 表单赋值
2021-06-22 21:45:29 +08:00
FormDataFill ( json , config _doc ) ;
2022-12-01 21:47:06 +08:00
// 单选框初始化
$offcanvas _layout _config . find ( 'input[type="checkbox"], input[type="radio"]' ) . uCheck ( ) ;
2021-06-22 21:45:29 +08:00
// 背景色组件处理
2022-12-01 14:49:41 +08:00
ModuleColorpickerHandle ( $offcanvas _layout _config ) ;
2021-06-22 21:45:29 +08:00
// 指定操作类型
2022-12-01 14:49:41 +08:00
$offcanvas _layout _config . attr ( 'data-ent' , 'layout-content-container' ) ;
2021-06-22 21:45:29 +08:00
// 打开配置
2022-12-01 14:49:41 +08:00
$offcanvas _layout _config . offCanvas ( 'open' ) ;
2021-06-22 21:45:29 +08:00
} ) ;
// 模块拖放
2024-01-19 14:49:32 +08:00
$ ( document ) . on ( 'dragstart' , '.renovation-drag button' , function ( e ) {
2021-06-22 21:45:29 +08:00
// 布局配置
var drag _value = $ ( this ) . data ( 'value' ) ;
// 拖拽过程中经过的元素
2024-01-19 14:49:32 +08:00
$ ( document ) . on ( 'dragenter' , '.layout-content' , function ( e ) {
2021-06-22 21:45:29 +08:00
// 当前是否在布局模式下操作
2024-01-19 14:49:32 +08:00
if ( $ ( '.renovation-tabs .am-tabs-nav li.am-active' ) . data ( 'value' ) == 'module' ) {
2021-06-22 21:45:29 +08:00
$ ( '.layout-content' ) . removeClass ( 'layout-content-dragenter' ) ;
2024-01-19 14:49:32 +08:00
if ( ! $ ( this ) . hasClass ( '.layout-content-tips' ) ) {
2021-06-22 21:45:29 +08:00
$ ( this ) . addClass ( 'layout-content-dragenter' ) ;
}
}
} ) ;
// 拖拽离开元素移除过程中添加的样式
2024-01-19 14:49:32 +08:00
$ ( document ) . on ( 'dragleave' , '.renovation-drag button' , function ( e ) {
2021-06-22 21:45:29 +08:00
$ ( '.layout-content' ) . removeClass ( 'layout-content-dragenter' ) ;
} ) ;
// 拖拽结束
2024-01-19 14:49:32 +08:00
$ ( document ) . on ( 'dragend' , '.renovation-drag button' , function ( e ) {
2021-06-22 21:45:29 +08:00
// 移除过程中添加的样式
$ ( '.layout-content' ) . removeClass ( 'layout-content-dragenter' ) ;
// 关闭事件
$ ( '.layout-content' ) . off ( 'dragover' ) ;
$ ( '.layout-content' ) . off ( 'dragenter' ) ;
$ ( '.layout-content' ) . off ( 'drop' ) ;
} ) ;
// 拖拽过程中一直在元素内、并阻止默认事件
2024-01-19 14:49:32 +08:00
$ ( document ) . on ( 'dragover' , '.layout-content' , function ( event ) {
event . preventDefault ( ) ;
event . stopPropagation ( ) ;
2021-06-22 21:45:29 +08:00
} ) ;
// 拖放接收事件
2024-01-19 14:49:32 +08:00
$ ( '.layout-content' ) . on ( 'drop' , function ( e ) {
2021-06-22 21:45:29 +08:00
// 生成模块html
var html = RenovationModuleDragHtmlCreate ( drag _value ) ;
2024-01-19 14:49:32 +08:00
if ( html != false ) {
2021-06-22 21:45:29 +08:00
// 添加模块
$ ( this ) . find ( '.layout-content-tips' ) . remove ( ) ;
$ ( this ) . append ( html ) ;
// 模块弹出框提示初始化
$ ( '.module-view-submit-drag' ) . popover ( {
2022-08-21 17:11:09 +08:00
content : $layout . data ( 'module-drag-title' ) || '拖拽排序' ,
2021-06-22 21:45:29 +08:00
trigger : 'hover focus' ,
theme : 'sm'
} ) ;
$ ( '.module-view-submit-set' ) . popover ( {
2022-08-21 17:11:09 +08:00
content : $layout . data ( 'module-set-title' ) || '模块设置' ,
2021-06-22 21:45:29 +08:00
trigger : 'hover focus' ,
theme : 'sm'
} ) ;
$ ( '.module-view-submit-del' ) . popover ( {
2022-08-21 17:11:09 +08:00
content : $layout . data ( 'module-del-title' ) || '模块移除' ,
2021-06-22 21:45:29 +08:00
trigger : 'hover focus' ,
theme : 'sm'
} ) ;
}
// 关闭事件
$ ( '.layout-content' ) . off ( 'dragover' ) ;
$ ( '.layout-content' ) . off ( 'dragenter' ) ;
$ ( '.layout-content' ) . off ( 'drop' ) ;
} ) ;
} ) ;
// 模块移除
2024-01-19 14:49:32 +08:00
$ ( document ) . on ( 'click' , '.module-view-submit-del' , function ( ) {
2021-06-22 21:45:29 +08:00
var $this = $ ( this ) ;
AMUI . dialog . confirm ( {
2022-08-21 17:11:09 +08:00
title : $layout . data ( 'layout-reminder-title' ) || '温馨提示' ,
content : $layout . data ( 'layout-reminder-msg' ) || '移除后不可恢复、确定继续吗?' ,
2024-01-19 14:49:32 +08:00
onConfirm : function ( e ) {
2021-06-22 21:45:29 +08:00
// 模块容器
var $module _view = $this . parents ( '.layout-content' ) ;
// 移除模块
$this . parents ( '.module-view' ) . remove ( ) ;
// 无模块则添加提示信息
2024-01-19 14:49:32 +08:00
if ( $module _view . find ( '.module-view' ) . length <= 0 ) {
$module _view . html ( '<div class="layout-content-tips">' + ( $layout . data ( 'layout-content-tips' ) || '模块内容区域' ) + '</div>' ) ;
2021-06-22 21:45:29 +08:00
}
}
} ) ;
} ) ;
// 模块设置
2024-01-19 14:49:32 +08:00
$ ( document ) . on ( 'click' , '.module-view-submit-set' , function ( ) {
2021-06-22 21:45:29 +08:00
// 基础
var $parent = $ ( this ) . parents ( '.module-view-submit-container' ) ;
var value = $parent . data ( 'value' ) || null ;
var index = $parent . data ( 'index' ) || null ;
var doc = $parent . data ( 'doc' ) || null ;
2024-01-19 14:49:32 +08:00
if ( value == null || index == null || doc == null ) {
2022-08-21 17:11:09 +08:00
Prompt ( $layout . data ( 'module-attr-tips' ) || '模块属性有误' ) ;
2021-06-22 21:45:29 +08:00
return false ;
}
// 公共数据
var json = $ ( doc ) . attr ( 'data-json' ) || null ;
2024-01-19 14:49:32 +08:00
if ( json != null ) {
2021-06-22 21:45:29 +08:00
// 数据解析
2022-11-27 21:49:10 +08:00
json = JSON . parse ( CryptoJS . enc . Base64 . parse ( decodeURIComponent ( json ) ) . toString ( CryptoJS . enc . Utf8 ) ) || null ;
2021-06-22 21:45:29 +08:00
}
// 配置模块
2024-01-19 14:49:32 +08:00
var config _doc = '#offcanvas-module-config-' + value ;
2021-06-22 21:45:29 +08:00
var $config = $ ( config _doc ) ;
$config . attr ( 'data-value' , value ) ;
$config . attr ( 'data-index' , index ) ;
$config . attr ( 'data-doc' , doc ) ;
// 获取表单字段并赋空值
2024-01-19 14:49:32 +08:00
if ( ( json || null ) == null ) {
2021-06-22 21:45:29 +08:00
var fields _dv = {
2023-03-24 16:22:20 +08:00
goods _order _by _type : 0 ,
goods _order _by _rule : 0 ,
view _list _show _style : 'routine' ,
view _list _number _sm : 2 ,
view _list _number _md : 5 ,
view _list _number _lg : 5 ,
goods _data _type : "goods"
2021-06-22 21:45:29 +08:00
} ;
json = GetFormVal ( config _doc , true ) ;
2024-01-19 14:49:32 +08:00
for ( var i in json ) {
2021-06-22 21:45:29 +08:00
json [ i ] = ( fields _dv [ i ] == undefined ) ? '' : fields _dv [ i ] ;
}
}
// 展示模式默认值处理、默认常规模式
2024-01-19 14:49:32 +08:00
if ( ( json . view _list _show _style || null ) == null ) {
2021-06-22 21:45:29 +08:00
json [ 'view_list_show_style' ] = 'routine' ;
}
// 根据模块类型处理
2024-01-19 14:49:32 +08:00
switch ( value ) {
2021-06-22 21:45:29 +08:00
// 图片模块
2024-01-19 14:49:32 +08:00
case 'images' :
2021-06-22 21:45:29 +08:00
var default _images = $config . data ( 'default-images' ) ;
var html = '<li>' ;
2024-01-19 14:49:32 +08:00
html += '<input type="text" name="content_images" value="' + ( json . content _images || '' ) + '" data-validation-message="' + ( $layout . data ( 'upload-images-tips' ) || '请上传图片' ) + '" value="" required />' ;
html += '<img src="' + ( json . content _images || default _images ) + '" />' ;
html += '</li>' ;
2021-06-22 21:45:29 +08:00
$config . find ( 'ul.module-images-type-images-view' ) . html ( html ) ;
// 链接地址处理
$config . find ( '.form-view-choice-container-content' ) . html ( ModuleConfigImagesToContentHtml ( json . content _to _name || '' ) ) ;
break ;
// 多图
2024-01-19 14:49:32 +08:00
case 'many-images' :
2021-06-22 21:45:29 +08:00
var html = '' ;
2024-01-19 14:49:32 +08:00
if ( ( json . data _list || null ) != null && json . data _list . length > 0 ) {
for ( var i in json . data _list ) {
2021-06-22 21:45:29 +08:00
html += ModuleConfigManyImagesItemContentHtml ( json . data _list [ i ] [ 'images' ] , json . data _list [ i ] [ 'type' ] , json . data _list [ i ] [ 'name' ] , json . data _list [ i ] [ 'value' ] ) ;
}
}
$config . find ( '.config-many-images-container' ) . html ( html ) ;
break ;
2022-11-24 21:03:39 +08:00
// 图文
2024-01-19 14:49:32 +08:00
case 'images-text' :
2022-11-24 21:03:39 +08:00
var html = '' ;
2024-01-19 14:49:32 +08:00
if ( ( json . data _list || null ) != null && json . data _list . length > 0 ) {
for ( var i in json . data _list ) {
2022-11-24 21:03:39 +08:00
html += ModuleConfigImagesTextItemContentHtml ( json . data _list [ i ] ) ;
}
}
$config . find ( '.config-images-text-container' ) . html ( html ) ;
// 展示模式默认空,必须要选择
2024-01-19 14:49:32 +08:00
if ( ( json . view _list _show _style || null ) == null ) {
2022-11-27 21:49:10 +08:00
json [ 'view_list_show_style' ] = '' ;
}
break ;
// 图片魔方
2024-01-19 14:49:32 +08:00
case 'images-magic-cube' :
2022-11-27 21:49:10 +08:00
var html = '' ;
2024-01-19 14:49:32 +08:00
if ( ( json . data _list || null ) != null && json . data _list . length > 0 ) {
2022-11-27 21:49:10 +08:00
html += ModuleConfigImagesMagicCubeItemContentHtml ( json ) ;
}
$config . find ( '.config-images-magic-cube-container' ) . html ( html ) ;
var $tips _msg = $offcanvas _config _images _magic _cube . find ( '.tips-msg' ) ;
2024-01-19 14:49:32 +08:00
if ( ( html || null ) == null ) {
2022-11-27 21:49:10 +08:00
$tips _msg . removeClass ( 'am-hide' ) ;
} else {
$tips _msg . addClass ( 'am-hide' ) ;
}
// 展示模式默认空,必须要选择
2024-01-19 14:49:32 +08:00
if ( ( json . view _list _show _style || null ) == null ) {
2022-11-24 21:03:39 +08:00
json [ 'view_list_show_style' ] = '' ;
}
break ;
2021-06-22 21:45:29 +08:00
// 视频
2024-01-19 14:49:32 +08:00
case 'video' :
2021-06-22 21:45:29 +08:00
// 视频地址
$config . find ( '.module-video-type-view-video video' ) . attr ( 'src' , json . content _video || '' ) ;
// 封面图片
var html = '' ;
2024-01-19 14:49:32 +08:00
if ( ( json . content _images || null ) != null ) {
2021-06-22 21:45:29 +08:00
html += '<li>' ;
2024-01-19 14:49:32 +08:00
html += '<input type="text" name="content_images" value="' + json . content _images + '" /><img src="' + json . content _images + '" />' ;
2024-04-15 10:25:01 +08:00
html += '<i class="iconfont icon-close"></i>' ;
2021-06-22 21:45:29 +08:00
html += '</li>' ;
}
$config . find ( '.module-video-type-view-images' ) . html ( html ) ;
break ;
// 商品模块
2024-01-19 14:49:32 +08:00
case 'goods' :
2021-06-22 21:45:29 +08:00
var goods _data _type = json . goods _data _type || 'goods' ;
2024-01-19 14:49:32 +08:00
switch ( goods _data _type ) {
2021-06-22 21:45:29 +08:00
// 商品
2024-01-19 14:49:32 +08:00
case 'goods' :
2021-06-22 21:45:29 +08:00
$config . find ( '.config-goods-list' ) . html ( ModuleConfigGoodsItemContentHtml ( json . data _list ) ) ;
// 清空分类选择
$config . find ( '.offcanvas-config-goods-category-container .form-view-choice-container-content' ) . html ( ModuleConfigGoodsCategoryContentHtml ( ) ) ;
$config . find ( 'input[name="goods_category_value"]' ) . val ( '' ) ;
break ;
// 商品分类
2024-01-19 14:49:32 +08:00
case 'category' :
2021-06-22 21:45:29 +08:00
var category = ( ( json . goods _category _value || null ) == null ) ? null : JSON . parse ( decodeURIComponent ( json . goods _category _value ) ) || null ;
2024-01-19 14:49:32 +08:00
var name = ( category == null || category . length <= 0 ) ? '' : category [ category . length - 1 ] [ 'name' ] ;
2021-06-22 21:45:29 +08:00
var html = ModuleConfigGoodsCategoryContentHtml ( name ) ;
$config . find ( '.offcanvas-config-goods-category-container .form-view-choice-container-content' ) . html ( html ) ;
// 清空商品列表
$config . find ( '.config-goods-list' ) . html ( '' ) ;
$config . find ( 'input[name="goods_ids"]' ) . val ( '' ) ;
break ;
// 未定义
2024-01-19 14:49:32 +08:00
default :
console . info ( ( $layout . data ( 'module-assembly-not-exist-tips' ) || '模块组件未定义' ) + '[' + goods _data _type + ']' )
2021-06-22 21:45:29 +08:00
}
2024-01-19 14:49:32 +08:00
2021-06-22 21:45:29 +08:00
// tab处理
var index = 0 ;
2024-01-19 14:49:32 +08:00
$config . find ( '.am-tabs-nav li' ) . each ( function ( k , v ) {
if ( $ ( this ) . find ( 'a' ) . data ( 'value' ) == goods _data _type ) {
2021-06-22 21:45:29 +08:00
index = k ;
}
} ) ;
$config . find ( '.am-tabs-nav li' ) . removeClass ( 'am-active' ) ;
$config . find ( '.am-tabs-nav li' ) . eq ( index ) . addClass ( 'am-active' ) ;
$config . find ( '.am-tabs-bd .am-tab-panel' ) . removeClass ( 'am-active' ) ;
$config . find ( '.am-tabs-bd .am-tab-panel' ) . eq ( index ) . addClass ( 'am-active' ) ;
break ;
// 标题
2024-01-19 14:49:32 +08:00
case 'title' :
2021-06-22 21:45:29 +08:00
// 关键字
var html = '' ;
2024-01-19 14:49:32 +08:00
if ( ( json . keywords _list || null ) != null && json . keywords _list . length > 0 ) {
for ( var i in json . keywords _list ) {
2021-06-22 21:45:29 +08:00
html += ModuleConfigTitleKeywordsContentHtml ( json . keywords _list [ i ] ) ;
}
}
$config . find ( '.config-title-container' ) . html ( html ) ;
// 链接地址处理
$config . find ( '.form-view-choice-container-content' ) . html ( ModuleConfigImagesToContentHtml ( json . content _to _name || '' ) ) ;
break ;
2022-11-24 21:03:39 +08:00
2024-01-19 14:49:32 +08:00
default :
if ( $config . length == 0 ) {
Prompt ( ( $layout . data ( 'base-module-not-config-tips' ) || '模块未配置' ) + '(' + value + ')' ) ;
2022-11-24 21:03:39 +08:00
return false ;
}
2021-06-22 21:45:29 +08:00
}
2022-11-24 21:03:39 +08:00
2021-06-22 21:45:29 +08:00
// 表单数据赋值
FormDataFill ( json , config _doc ) ;
// 背景色组件处理
ModuleColorpickerHandle ( $config ) ;
2024-04-15 10:25:01 +08:00
// 颜色选择器初始化
ColorPickerInit ( ) ;
2022-11-24 21:03:39 +08:00
// 单选框初始化
$config . find ( 'input[type="checkbox"], input[type="radio"]' ) . uCheck ( ) ;
2021-06-22 21:45:29 +08:00
// 更新选择组件
$config . find ( '.chosen-select' ) . trigger ( 'chosen:updated' ) ;
// 打开弹窗
$config . offCanvas ( 'open' ) ;
} ) ;
// 配置图片 - 选择页面事件
2024-01-19 14:49:32 +08:00
$offcanvas _config _images . on ( 'click' , '.form-view-choice-container-submit' , function ( e ) {
2021-06-22 21:45:29 +08:00
OffcanvasConfigPagesChoice ( $ ( this ) , e ) ;
} ) ;
// 配置图片 - 选择页面 - 移除
2024-01-19 14:49:32 +08:00
$offcanvas _config _images . on ( 'click' , '.form-view-choice-container-active i.am-icon-close' , function ( e ) {
2021-06-22 21:45:29 +08:00
OffcanvasConfigPagesRemove ( $ ( this ) , e ) ;
} ) ;
// 页面选择 tab 切换事件
2024-01-19 14:49:32 +08:00
$modal _pages _select . on ( 'click' , '.am-tabs-nav a' , function ( ) {
2021-06-22 21:45:29 +08:00
// 所有处理
$modal _pages _select . find ( '.am-tabs-bd ul li' ) . removeClass ( 'active' ) ;
$modal _pages _select . find ( '.am-tabs-bd ul li a' ) . attr ( 'data-json' , '' ) ;
// 名称还原
2024-01-19 14:49:32 +08:00
$modal _pages _select . find ( '.am-tabs-bd ul li' ) . each ( function ( k , v ) {
2021-06-22 21:45:29 +08:00
var $o = $ ( this ) . find ( 'a' ) ;
$o . attr ( 'data-json' , '' ) ;
$o . find ( 'span' ) . text ( $o . data ( 'name' ) ) ;
} ) ;
2021-07-01 18:00:26 +08:00
// 自定义链接清空
$ ( '.pages-custom-url-container input' ) . val ( '' ) ;
2021-06-22 21:45:29 +08:00
} ) ;
// 页面选择切换
2024-01-19 14:49:32 +08:00
$modal _pages _select . on ( 'click' , '.am-tabs-bd ul li a' , function ( ) {
2021-06-22 21:45:29 +08:00
// 选中状态
2021-07-01 18:00:26 +08:00
var $parent = $ ( this ) . parents ( '.am-tab-panel' ) ;
$parent . find ( 'li' ) . removeClass ( 'active' ) ;
$ ( this ) . parent ( ) . addClass ( 'active' ) ;
2021-06-22 21:45:29 +08:00
// 参数值
var value = $ ( this ) . data ( 'value' ) || null ;
var name = $ ( this ) . data ( 'name' ) || null ;
var json = $ ( this ) . attr ( 'data-json' ) || null ;
2024-01-19 14:49:32 +08:00
if ( value == null || name == null ) {
2022-08-21 17:11:09 +08:00
Prompt ( $layout . data ( 'params-tips' ) || '参数值有误' ) ;
2021-06-22 21:45:29 +08:00
return false ;
}
2024-01-19 14:49:32 +08:00
if ( json != null ) {
2021-06-22 21:45:29 +08:00
json = JSON . parse ( decodeURIComponent ( json ) ) || null ;
}
// 根据类型处理
2024-01-19 14:49:32 +08:00
switch ( value ) {
2021-06-22 21:45:29 +08:00
// 单一商品
2024-01-19 14:49:32 +08:00
case 'goods' :
2021-06-22 21:45:29 +08:00
// 弹窗数据设置并打开
var goods _ids = ( json == null || ( json . id || null ) == null ) ? '' : json . id ;
$popup _goods _select . attr ( 'data-goods-ids' , goods _ids ) ;
$popup _goods _select . attr ( 'data-type' , 'single-goods' ) ;
$popup _goods _select . attr ( 'data-is-single-choice' , 1 ) ;
2024-01-19 14:49:32 +08:00
$popup _goods _select . modal ( { closeViaDimmer : false } ) ;
2024-07-03 22:46:04 +08:00
// 弹窗没有商品内容则触发搜索
if ( $popup _goods _select . find ( '.goods-list-container ul li' ) . length == 0 )
{
$popup _goods _select . find ( '.forth-selection-container .search-submit' ) . trigger ( 'click' ) ;
}
2021-06-22 21:45:29 +08:00
break ;
// 搜索页面
2024-01-19 14:49:32 +08:00
case 'goods_search' :
2021-06-22 21:45:29 +08:00
var index = 0 ;
var type = 'category' ;
var value = null ;
2024-01-19 14:49:32 +08:00
if ( json != null && ( json . type || null ) != null ) {
2021-06-22 21:45:29 +08:00
// 基础参数
2021-06-22 23:54:54 +08:00
var arr = [ 'category' , 'brand' , 'keywords' , 'other' ] ;
2021-06-22 21:45:29 +08:00
index = arr . indexOf ( json . type ) ;
type = json . type ;
value = json . value || null ;
}
// tab导航和容器
$popup _goods _search . find ( '.am-tabs-nav li' ) . removeClass ( 'am-active' ) ;
$popup _goods _search . find ( '.am-tabs-nav li' ) . eq ( index ) . addClass ( 'am-active' ) ;
$popup _goods _search . find ( '.am-tabs-bd .am-tab-panel' ) . removeClass ( 'am-active' ) ;
$popup _goods _search . find ( '.am-tabs-bd .am-tab-panel' ) . eq ( index ) . addClass ( 'am-active' ) ;
// 数据处理
$popup _goods _search . find ( '.form-container-category' ) . find ( '.goods-category-select-2, .goods-category-select-3' ) . html ( '' ) . addClass ( 'am-hide' ) ;
$popup _goods _search . find ( '.form-container-category .already-select-tips' ) . attr ( 'data-value' , '' ) . addClass ( 'am-hide' ) . find ( 'strong' ) . text ( '' ) ;
$popup _goods _search . find ( '.goods-category-choice-content ul li.active' ) . removeClass ( 'active' ) ;
$popup _goods _search . find ( '.form-container-keywords input' ) . val ( '' ) ;
// 数据选中
2024-01-19 14:49:32 +08:00
if ( value != null ) {
switch ( type ) {
2021-06-22 21:45:29 +08:00
// 商品分类
2024-01-19 14:49:32 +08:00
case 'category' :
for ( var i in value ) {
var $gcs = $popup _goods _search . find ( '.form-container-category .goods-category-select-' + ( parseInt ( i ) + 1 ) ) ;
if ( $gcs . length > 0 && $gcs . find ( 'li' ) . length > 0 ) {
$gcs . find ( 'li' ) . each ( function ( k , v ) {
if ( $ ( this ) . find ( 'a' ) . data ( 'value' ) == value [ i ] [ 'id' ] ) {
2021-06-22 21:45:29 +08:00
$ ( this ) . find ( 'a' ) . trigger ( 'click' ) ;
}
} ) ;
}
}
break ;
// 品牌
2024-01-19 14:49:32 +08:00
case 'brand' :
$popup _goods _search . find ( '.form-container-brand ul li' ) . each ( function ( k , v ) {
if ( $ ( this ) . find ( 'a' ) . data ( 'value' ) == value . id ) {
2021-06-22 21:45:29 +08:00
$ ( this ) . addClass ( 'active' ) ;
}
} ) ;
break ;
// 关键字
2024-01-19 14:49:32 +08:00
case 'keywords' :
2021-06-22 21:45:29 +08:00
$popup _goods _search . find ( '.form-container-keywords input' ) . val ( value ) ;
break ;
}
}
2024-01-19 14:49:32 +08:00
$popup _goods _search . modal ( { closeViaDimmer : false } ) ;
2021-06-22 21:45:29 +08:00
break ;
}
} ) ;
// 页面选择确认事件
2024-01-19 14:49:32 +08:00
$modal _pages _select . on ( 'click' , '.pages-confirm-submit' , function ( ) {
2021-07-01 18:00:26 +08:00
// 选中tab
var index = $modal _pages _select . find ( '.am-tabs-nav li.am-active' ) . index ( ) ;
2021-06-22 21:45:29 +08:00
2021-07-01 18:00:26 +08:00
// 参数值、自定义链接、常规页面选择
2024-01-19 14:49:32 +08:00
if ( index == 2 ) {
2021-07-01 18:00:26 +08:00
var to _type = 'pages-custom-url' ;
2022-08-21 17:11:09 +08:00
var to _name = $layout . data ( 'custom-url-name' ) || '自定义链接' ;
2021-07-01 18:00:26 +08:00
var to _value = GetFormVal ( '.pages-custom-url-container' , true ) ;
var count = 0 ;
2024-01-19 14:49:32 +08:00
for ( var i in to _value ) {
if ( ( to _value [ i ] || null ) == null ) {
2021-07-01 18:00:26 +08:00
count ++ ;
2021-06-22 21:45:29 +08:00
}
2021-07-01 18:00:26 +08:00
}
2024-01-19 14:49:32 +08:00
if ( count >= Object . keys ( to _value ) . length ) {
2022-08-21 17:11:09 +08:00
Prompt ( $layout . data ( 'custom-url-tips' ) || '请至少填写一个地址' ) ;
2021-07-01 18:00:26 +08:00
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 ;
2024-01-19 14:49:32 +08:00
if ( to _value != '' ) {
2021-07-01 18:00:26 +08:00
json = JSON . parse ( decodeURIComponent ( to _value ) ) || null ;
}
2024-01-19 14:49:32 +08:00
if ( to _type == '' || to _name == '' ) {
2022-08-21 17:11:09 +08:00
Prompt ( $layout . data ( 'before-choice-page-tips' ) || '请先选择页面' ) ;
2021-07-01 18:00:26 +08:00
return false ;
}
2021-06-22 21:45:29 +08:00
2021-07-01 18:00:26 +08:00
// 根据类型处理
2024-01-19 14:49:32 +08:00
switch ( to _type ) {
2021-07-01 18:00:26 +08:00
// 单一商品
2024-01-19 14:49:32 +08:00
case 'goods' :
if ( json == null ) {
2022-08-21 17:11:09 +08:00
Prompt ( $layout . data ( 'choice-goods-tips' ) || '请选择商品' ) ;
2021-07-01 18:00:26 +08:00
return false ;
}
2021-06-22 21:45:29 +08:00
2021-07-01 18:00:26 +08:00
// 选择位置是否存在
2024-01-19 14:49:32 +08:00
if ( $page _parent _obj == null ) {
2022-08-21 17:11:09 +08:00
Prompt ( $layout . data ( 'before-choice-url-position-tips' ) || '请先选择链接位置' ) ;
2021-07-01 18:00:26 +08:00
return false ;
}
2021-06-22 21:45:29 +08:00
2021-07-01 18:00:26 +08:00
// 显示名称
2024-01-19 14:49:32 +08:00
to _name += '( ' + json [ 'title' ] + ') ' ;
2021-07-01 18:00:26 +08:00
break ;
2021-06-22 21:45:29 +08:00
2021-07-01 18:00:26 +08:00
// 搜索页面
2024-01-19 14:49:32 +08:00
case 'goods_search' :
if ( json == null ) {
2022-08-21 17:11:09 +08:00
Prompt ( $layout . data ( 'before-config-goods-search-tips' ) || '请先配置商品搜索' ) ;
2021-07-01 18:00:26 +08:00
return false ;
}
// 显示名称
to _name += ModuleConfigGoodsSearchPageShowName ( json ) ;
break ;
}
2021-06-22 21:45:29 +08:00
}
// 设置数据
var $parent = $page _parent _obj . parents ( '.form-view-choice-container' ) ;
2022-11-27 21:49:10 +08:00
var key = $parent . data ( 'key' ) ;
2024-01-19 14:49:32 +08:00
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 ) ;
2021-06-22 21:45:29 +08:00
$page _parent _obj . html ( ModuleConfigImagesToContentHtml ( to _name ) ) ;
$modal _pages _select . modal ( 'close' ) ;
} ) ;
// 商品配置-选择商品和分类
2024-01-19 14:49:32 +08:00
$offcanvas _config _goods . on ( 'click' , '.form-view-choice-container-submit' , function ( ) {
2021-06-22 21:45:29 +08:00
var value = $ ( this ) . parents ( '.form-view-choice-container' ) . data ( 'value' ) ;
2024-01-19 14:49:32 +08:00
switch ( value ) {
2021-06-22 21:45:29 +08:00
// 商品
2024-01-19 14:49:32 +08:00
case 'goods' :
2021-06-22 21:45:29 +08:00
// 弹窗数据设置并打开
var goods _ids = OffcanvasModuleConfigGoodsIds ( ) ;
$popup _goods _select . attr ( 'data-goods-ids' , goods _ids ) ;
$popup _goods _select . attr ( 'data-type' , 'list-goods' ) ;
$popup _goods _select . attr ( 'data-is-single-choice' , 0 ) ;
2024-01-19 14:49:32 +08:00
$popup _goods _select . modal ( { closeViaDimmer : false } ) ;
2024-07-03 22:46:04 +08:00
// 弹窗没有商品内容则触发搜索
if ( $popup _goods _select . find ( '.goods-list-container ul li' ) . length == 0 )
{
$popup _goods _select . find ( '.forth-selection-container .search-submit' ) . trigger ( 'click' ) ;
}
2021-06-22 21:45:29 +08:00
break ;
// 商品分类
2024-01-19 14:49:32 +08:00
case 'category' :
2021-06-22 21:45:29 +08:00
// 分类数据
var json = $offcanvas _config _goods . find ( '.offcanvas-config-goods-category-container input[name="goods_category_value"]' ) . val ( ) || null ;
2024-01-19 14:49:32 +08:00
if ( json != null ) {
2021-06-22 21:45:29 +08:00
json = JSON . parse ( decodeURIComponent ( json ) ) || null ;
}
2024-01-19 14:49:32 +08:00
if ( json == null ) {
2021-06-22 21:45:29 +08:00
// 数据清空
$popup _goods _category . find ( '.form-container-category' ) . find ( '.goods-category-select-2, .goods-category-select-3' ) . html ( '' ) . addClass ( 'am-hide' ) ;
$popup _goods _category . find ( '.form-container-category .already-select-tips' ) . attr ( 'data-value' , '' ) . addClass ( 'am-hide' ) . find ( 'strong' ) . text ( '' ) ;
$popup _goods _category . find ( '.goods-category-choice-content ul li.active' ) . removeClass ( 'active' ) ;
} else {
// 生成选择的数据
2024-01-19 14:49:32 +08:00
for ( var i in json ) {
var $gcs = $popup _goods _category . find ( '.form-container-category .goods-category-select-' + ( parseInt ( i ) + 1 ) ) ;
if ( $gcs . length > 0 && $gcs . find ( 'li' ) . length > 0 ) {
$gcs . find ( 'li' ) . each ( function ( k , v ) {
if ( $ ( this ) . find ( 'a' ) . data ( 'value' ) == json [ i ] [ 'id' ] ) {
2021-06-22 21:45:29 +08:00
$ ( this ) . find ( 'a' ) . trigger ( 'click' ) ;
}
} ) ;
}
}
}
2024-01-19 14:49:32 +08:00
$popup _goods _category . modal ( { closeViaDimmer : false } ) ;
2021-06-22 21:45:29 +08:00
break ;
2024-01-19 14:49:32 +08:00
default :
Prompt ( ( $layout . data ( 'type-event-not-exist-tips' ) || '类型事件未定义' ) + '[' + value + ']' )
2021-06-22 21:45:29 +08:00
}
} ) ;
// 商品配置-商品选择-移除
2024-01-19 14:49:32 +08:00
$ ( document ) . on ( 'click' , '#offcanvas-module-config-goods .config-goods-list li a.am-close' , function ( ) {
2021-06-22 21:45:29 +08:00
// 商品id处理
var value = $ ( this ) . parent ( ) . data ( 'gid' ) ;
var goods _ids = $offcanvas _config _goods . find ( 'input[name="goods_ids"]' ) . val ( ) || null ;
2024-01-19 14:49:32 +08:00
if ( goods _ids != null ) {
2021-06-22 21:45:29 +08:00
goods _ids = goods _ids . split ( ',' ) ;
2024-01-19 14:49:32 +08:00
for ( var i in goods _ids ) {
if ( goods _ids [ i ] == value ) {
2021-06-22 21:45:29 +08:00
goods _ids . splice ( i , 1 ) ;
}
}
goods _ids = ( goods _ids . length > 0 ) ? goods _ids . join ( ',' ) : '' ;
}
$offcanvas _config _goods . find ( 'input[name="goods_ids"]' ) . val ( goods _ids || '' ) ;
// 移除元素
$ ( this ) . parent ( ) . remove ( ) ;
} ) ;
// 商品配置-分类选择确认
2024-01-19 14:49:32 +08:00
$popup _goods _category . on ( 'click' , '.confirm-submit' , function ( ) {
2021-06-22 21:45:29 +08:00
// 分类数据
var json = $popup _goods _category . find ( '.already-select-tips' ) . attr ( 'data-value' ) || null ;
2024-01-19 14:49:32 +08:00
if ( json != null ) {
2021-06-22 21:45:29 +08:00
json = JSON . parse ( decodeURIComponent ( json ) ) || null ;
}
2024-01-19 14:49:32 +08:00
if ( json == null ) {
2022-08-21 17:11:09 +08:00
Prompt ( $layout . data ( 'before-choice-goods-category-tips' ) || '请先选择商品分类' ) ;
2021-06-22 21:45:29 +08:00
return false ;
}
// 当前选择的节点
2024-01-19 14:49:32 +08:00
var data = json [ json . length - 1 ] ;
2021-06-22 21:45:29 +08:00
var html = ModuleConfigGoodsCategoryContentHtml ( data . name ) ;
var $offcanvas _category = $offcanvas _config _goods . find ( '.offcanvas-config-goods-category-container' ) ;
$offcanvas _category . find ( '.form-view-choice-container-content' ) . html ( html ) ;
$offcanvas _category . find ( 'input[name="goods_category_value"]' ) . val ( encodeURIComponent ( JSON . stringify ( json ) ) ) ;
$popup _goods _category . modal ( 'close' ) ;
} ) ;
// 商品配置-分类选择确认-移除
2024-01-19 14:49:32 +08:00
$offcanvas _config _goods . on ( 'click' , '.offcanvas-config-goods-category-container .form-view-choice-container-active i.am-icon-close' , function ( ) {
2021-06-22 21:45:29 +08:00
var $parent = $ ( this ) . parents ( '.form-view-choice-container-content' ) ;
2024-01-19 14:49:32 +08:00
$parent . html ( '<a href="javascript:;" class="form-view-choice-container-submit">' + ( $layout . data ( 'choice-goods-category-tips' ) || '请选择商品分类' ) + '</a>' ) ;
2021-06-22 21:45:29 +08:00
$parent . parent ( ) . find ( 'input[name="goods_category_value"]' ) . val ( '' ) ;
return false ;
} ) ;
// 商品配置-tab切换
2024-01-19 14:49:32 +08:00
$offcanvas _config _goods . on ( 'click' , '.am-tabs-nav a' , function ( ) {
2021-06-22 21:45:29 +08:00
$offcanvas _config _goods . find ( 'input[name="goods_data_type"]' ) . val ( $ ( this ) . data ( 'value' ) || 'goods' ) ;
} ) ;
// 商品搜索选择
// 分页
2025-09-23 21:22:38 +08:00
$popup _goods _select . find ( '.goods-page-container' ) . html ( PageLibrary ( ) ) ;
2021-06-22 21:45:29 +08:00
// 搜索商品
2025-09-23 21:22:38 +08:00
$ ( document ) . on ( 'click' , '#popup-module-goods-select .forth-selection-container .search-submit, .pagelibrary li a' , function ( ) {
2021-06-22 21:45:29 +08:00
// 分页处理
var is _active = $ ( this ) . data ( 'is-active' ) || 0 ;
2024-01-19 14:49:32 +08:00
if ( is _active == 1 ) {
2021-06-22 21:45:29 +08:00
return false ;
}
var page = $ ( this ) . data ( 'page' ) || 1 ;
// 请求参数
2025-09-23 21:22:38 +08:00
var url = $popup _goods _select . find ( '.forth-selection-container' ) . data ( 'search-url' ) ;
var category _field = $popup _goods _select . find ( '.forth-selection-container' ) . find ( 'input[name="category_field"]' ) . val ( ) || '' ;
var category _id = $popup _goods _select . find ( '.forth-selection-form-category' ) . val ( ) ;
var keywords = $popup _goods _select . find ( '.forth-selection-form-keywords' ) . val ( ) ;
2021-06-22 21:45:29 +08:00
var goods _ids = $popup _goods _select . attr ( 'data-goods-ids' ) || '' ;
var $this = $ ( this ) ;
2024-07-03 22:46:04 +08:00
if ( $this . hasClass ( 'search-submit' ) ) {
$this . button ( 'loading' ) ;
}
2024-01-19 14:49:32 +08:00
$ ( '.goods-list-container ul.am-gallery' ) . html ( '<div class="table-no"><i class="am-icon-spinner am-icon-pulse"></i> ' + ( $ ( '.goods-list-container' ) . data ( 'loading-msg' ) ) + '</div>' ) ;
2021-06-22 21:45:29 +08:00
$ . ajax ( {
2022-05-14 15:37:28 +08:00
url : RequestUrlHandle ( url ) ,
2021-06-22 21:45:29 +08:00
type : 'post' ,
2024-01-19 14:49:32 +08:00
data : { "page" : page , "category_field" : category _field , "category_id" : category _id , "keywords" : keywords , "goods_ids" : goods _ids } ,
2021-06-22 21:45:29 +08:00
dataType : 'json' ,
2024-01-19 14:49:32 +08:00
success : function ( res ) {
2021-06-22 21:45:29 +08:00
$this . button ( 'reset' ) ;
2024-01-19 14:49:32 +08:00
if ( res . code == 0 ) {
2021-06-22 21:45:29 +08:00
$ ( '.goods-list-container' ) . attr ( 'data-is-init' , 0 ) ;
$ ( '.goods-list-container ul.am-gallery' ) . html ( res . data . data ) ;
$ ( '.goods-page-container' ) . html ( PageLibrary ( res . data . total , res . data . page _size , res . data . page , 4 ) ) ;
} else {
Prompt ( res . msg ) ;
2024-01-19 14:49:32 +08:00
$ ( '.goods-list-container ul.am-gallery' ) . html ( '<div class="table-no"><i class="am-icon-warning"></i> ' + res . msg + '</div>' ) ;
2021-06-22 21:45:29 +08:00
}
} ,
2024-01-19 14:49:32 +08:00
error : function ( res ) {
2021-06-22 21:45:29 +08:00
$this . button ( 'reset' ) ;
2022-08-22 15:42:40 +08:00
var msg = HtmlToString ( xhr . responseText ) || ( window [ 'lang_error_text' ] || '异常错误' ) ;
2021-06-22 21:45:29 +08:00
Prompt ( msg , null , 30 ) ;
2024-01-19 14:49:32 +08:00
$ ( '.goods-list-container ul.am-gallery' ) . html ( '<div class="table-no"><i class="am-icon-warning"></i> ' + msg + '</div>' ) ;
2021-06-22 21:45:29 +08:00
}
} ) ;
} ) ;
// 商品添加/删除
2024-01-19 14:49:32 +08:00
$ ( document ) . on ( 'click' , '.goods-list-container .goods-add-submit, .goods-list-container .goods-del-submit' , function ( ) {
2021-06-22 21:45:29 +08:00
// 基础参数
var is _single _choice = parseInt ( $popup _goods _select . attr ( 'data-is-single-choice' ) ) || 0 ;
var goods _ids = $popup _goods _select . attr ( 'data-goods-ids' ) || null ;
2024-01-19 14:49:32 +08:00
goods _ids = ( goods _ids == null ) ? [ ] : goods _ids . split ( ',' ) ;
2021-06-22 21:45:29 +08:00
// 商品信息
var $this = $ ( this ) ;
var type = $this . data ( 'type' ) ;
var $parent = $this . parents ( 'li' ) ;
var goods _id = $parent . data ( 'gid' ) ;
var goods _title = $parent . data ( 'title' ) ;
var goods _url = $parent . data ( 'url' ) ;
var goods _img = $parent . data ( 'img' ) ;
// 是否单选
2024-01-19 14:49:32 +08:00
if ( is _single _choice == 1 ) {
2021-06-22 21:45:29 +08:00
// 还原选项
2024-01-19 14:49:32 +08:00
$popup _goods _select . find ( '.goods-list-container li' ) . each ( function ( k , v ) {
2021-06-22 21:45:29 +08:00
$ ( this ) . find ( '.icon-submit-container' ) . html ( $ ( this ) . data ( 'add-html' ) ) ;
} ) ;
2024-01-19 14:49:32 +08:00
if ( type == 'add' ) {
2021-06-22 21:45:29 +08:00
goods _ids = [ goods _id ] ;
$parent . find ( '.icon-submit-container' ) . html ( $parent . data ( 'del-html' ) ) ;
} else {
goods _ids = [ ] ;
}
} else {
// 商品是否已经添加
var index = goods _ids . indexOf ( goods _id . toString ( ) ) ;
2024-01-19 14:49:32 +08:00
if ( index == - 1 ) {
2021-06-22 21:45:29 +08:00
goods _ids . push ( goods _id ) ;
} else {
2024-01-19 14:49:32 +08:00
goods _ids . splice ( index , 1 ) ;
2021-06-22 21:45:29 +08:00
}
2024-01-19 14:49:32 +08:00
var icon _html = $parent . data ( ( type == 'add' ? 'del' : 'add' ) + '-html' ) ;
2021-06-22 21:45:29 +08:00
$this . parent ( ) . html ( icon _html ) ;
}
// 选择的商品id赋值
$popup _goods _select . attr ( 'data-goods-ids' , goods _ids . join ( ',' ) ) ;
} ) ;
// 商品选择确认事件
2024-01-19 14:49:32 +08:00
$popup _goods _select . on ( 'click' , '.confirm-submit' , function ( ) {
2021-06-22 21:45:29 +08:00
// 已选商品
var goods _ids = $popup _goods _select . attr ( 'data-goods-ids' ) || null ;
2024-01-19 14:49:32 +08:00
if ( goods _ids == null ) {
2022-08-21 17:11:09 +08:00
Prompt ( $layout . data ( 'before-choice-goods-tips' ) || '请先选择商品' ) ;
2021-06-22 21:45:29 +08:00
return false ;
}
// 基础参数
var $this = $ ( this ) ;
2025-09-23 21:22:38 +08:00
var url = $popup _goods _select . find ( '.forth-selection-container' ) . data ( 'data-url' ) ;
2021-06-22 21:45:29 +08:00
var type = $popup _goods _select . attr ( 'data-type' ) || null ;
var is _single _choice = parseInt ( $popup _goods _select . attr ( 'data-is-single-choice' ) ) || 0 ;
// 获取商品
$this . button ( 'loading' ) ;
$ . ajax ( {
2022-05-14 15:37:28 +08:00
url : RequestUrlHandle ( url ) ,
2021-06-22 21:45:29 +08:00
type : 'post' ,
2024-01-19 14:49:32 +08:00
data : { "goods_ids" : goods _ids } ,
2021-06-22 21:45:29 +08:00
dataType : 'json' ,
2024-01-19 14:49:32 +08:00
success : function ( res ) {
2021-06-22 21:45:29 +08:00
$this . button ( 'reset' ) ;
2024-01-19 14:49:32 +08:00
if ( res [ 'code' ] == 0 ) {
if ( ( res . data || null ) != null && res . data . length > 0 ) {
2021-06-22 21:45:29 +08:00
// 根据类型处理不同业务逻辑
var data = res . data ;
2024-01-19 14:49:32 +08:00
switch ( type ) {
2021-06-22 21:45:29 +08:00
// 单一商品选择
2024-01-19 14:49:32 +08:00
case 'single-goods' :
2021-06-22 21:45:29 +08:00
var $single _goods = $modal _pages _select . find ( '.am-tabs-bd ul li.page-goods a' ) ;
2024-01-19 14:49:32 +08:00
$single _goods . find ( 'span' ) . text ( $single _goods . data ( 'name' ) + '( ' + data [ 0 ] [ 'title' ] + ') ' ) ;
2021-06-22 21:45:29 +08:00
$single _goods . attr ( 'data-json' , encodeURIComponent ( JSON . stringify ( data [ 0 ] ) ) ) ;
break ;
// 列表商品
2024-01-19 14:49:32 +08:00
case 'list-goods' :
2021-06-22 21:45:29 +08:00
// 商品id赋值
2024-01-19 14:49:32 +08:00
var goods _ids = data . map ( function ( e ) { return e . id ; } ) . join ( ',' ) ;
2021-06-22 21:45:29 +08:00
$offcanvas _config _goods . find ( 'input[name="goods_ids"]' ) . val ( goods _ids ) ;
2024-01-19 14:49:32 +08:00
2024-07-03 22:46:04 +08:00
// html 拼接
2021-06-22 21:45:29 +08:00
$offcanvas _config _goods . find ( '.config-goods-list' ) . html ( ModuleConfigGoodsItemContentHtml ( data ) ) ;
break ;
}
// 关闭商品窗口
$popup _goods _select . modal ( 'close' ) ;
// 清空选择的商品id
$popup _goods _select . attr ( 'data-goods-ids' , '' ) ;
} else {
2022-08-21 17:11:09 +08:00
Prompt ( $layout . data ( 'goods-data-empty-tips' ) || '商品信息为空' ) ;
2021-06-22 21:45:29 +08:00
}
} else {
Prompt ( res . msg ) ;
2024-01-19 14:49:32 +08:00
}
2021-06-22 21:45:29 +08:00
} ,
2024-01-19 14:49:32 +08:00
error : function ( res ) {
2021-06-22 21:45:29 +08:00
$this . button ( 'reset' ) ;
2022-08-22 15:42:40 +08:00
var msg = HtmlToString ( xhr . responseText ) || ( window [ 'lang_error_text' ] || '异常错误' ) ;
2021-06-22 21:45:29 +08:00
Prompt ( msg , null , 30 ) ;
}
} ) ;
} ) ;
// 商品搜索tab类型切换事件
2024-01-19 14:49:32 +08:00
$popup _goods _search . on ( 'click' , '.am-tabs-nav a' , function ( ) {
2021-06-22 21:45:29 +08:00
$popup _goods _search . find ( '.form-container-category' ) . find ( '.goods-category-select-2, .goods-category-select-3' ) . html ( '' ) . addClass ( 'am-hide' ) ;
$popup _goods _search . find ( '.form-container-category .already-select-tips' ) . attr ( 'data-value' , '' ) . addClass ( 'am-hide' ) . find ( 'strong' ) . text ( '' ) ;
$popup _goods _search . find ( '.goods-category-choice-content ul li.active' ) . removeClass ( 'active' ) ;
$popup _goods _search . find ( '.form-container-keywords input' ) . val ( '' ) ;
} ) ;
// 分类选择切换
2024-01-19 14:49:32 +08:00
$ ( document ) . on ( 'click' , '.layout-category-choice .goods-category-choice-content ul li a' , function ( ) {
2021-06-22 21:45:29 +08:00
// 父级
var $parents = $ ( this ) . parents ( '.goods-category-choice' ) ;
// 选中
$ ( this ) . parent ( ) . addClass ( 'active' ) . siblings ( ) . removeClass ( 'active' ) ;
// 分类数据
2022-08-21 17:11:09 +08:00
var data = $ ( this ) . find ( 'span.data-json' ) . text ( ) || null ;
2024-01-19 14:49:32 +08:00
if ( data != null ) {
2022-12-13 17:00:45 +08:00
data = JSON . parse ( CryptoJS . enc . Base64 . parse ( decodeURIComponent ( data ) ) . toString ( CryptoJS . enc . Utf8 ) )
2021-06-22 21:45:29 +08:00
}
2024-01-19 14:49:32 +08:00
2021-06-22 21:45:29 +08:00
// 参数
var level = $ ( this ) . parents ( 'ul' ) . data ( 'level' ) || 1 ;
2024-01-19 14:49:32 +08:00
var level _next = level + 1 ;
2021-06-22 21:45:29 +08:00
// 拼接html
2024-01-19 14:49:32 +08:00
if ( data != null && level < 3 ) {
2021-06-22 21:45:29 +08:00
var html = '' ;
2024-01-19 14:49:32 +08:00
for ( var i in data ) {
2022-12-13 17:00:45 +08:00
var json = ( ( data [ i ] [ 'items' ] || null ) == null || data [ i ] [ 'items' ] . length == 0 ) ? '' : encodeURIComponent ( CryptoJS . enc . Base64 . stringify ( CryptoJS . enc . Utf8 . parse ( JSON . stringify ( data [ i ] [ 'items' ] ) ) ) ) ;
2024-01-19 14:49:32 +08:00
html += '<li><a href="javascript:;" data-value="' + data [ i ] [ 'id' ] + '">' ;
html += '<span class="data-name">' + data [ i ] [ 'name' ] + '</span>' ;
html += '<span class="data-json am-hide">' + json + '</span>' ;
if ( ( data [ i ] [ 'items' ] || null ) != null && data [ i ] [ 'items' ] . length > 0 ) {
2024-07-03 22:46:04 +08:00
html += '<i class="iconfont icon-angle-right am-fr"></i>' ;
2021-06-22 21:45:29 +08:00
}
html += '</a></li>' ;
}
2024-01-19 14:49:32 +08:00
$parents . find ( '.goods-category-select-' + level _next ) . html ( html ) . removeClass ( 'am-hide' ) ;
2021-06-22 21:45:29 +08:00
}
// 级别数据处理
2024-01-19 14:49:32 +08:00
if ( data == null ) {
$parents . find ( '.goods-category-select-' + level _next ) . addClass ( 'am-hide' ) . html ( '' ) ;
2021-06-22 21:45:29 +08:00
} else {
2024-01-19 14:49:32 +08:00
$parents . find ( '.goods-category-select-' + level _next ) . removeClass ( 'am-hide' ) ;
2021-06-22 21:45:29 +08:00
}
// 选择第一级的时候隐藏第三级
2024-01-19 14:49:32 +08:00
if ( level == 1 ) {
2021-06-22 21:45:29 +08:00
$parents . find ( '.goods-category-select-3' ) . addClass ( 'am-hide' ) . html ( '' ) ;
}
// 提示信息展示
var text = '' ;
var value = [ ] ;
2024-01-19 14:49:32 +08:00
$parents . find ( 'ul li.active' ) . each ( function ( k , v ) {
if ( k > 0 ) {
2021-06-22 21:45:29 +08:00
text += ' > ' ;
}
2022-08-21 17:11:09 +08:00
var name = $ ( this ) . find ( 'a span.data-name' ) . text ( ) ;
2024-01-19 14:49:32 +08:00
value . push ( { "id" : $ ( this ) . find ( 'a' ) . data ( 'value' ) , "name" : name } ) ;
2021-06-22 21:45:29 +08:00
text += name ;
} ) ;
var $tips = $parents . find ( '.already-select-tips' ) ;
$tips . removeClass ( 'am-hide' ) ;
$tips . find ( 'strong' ) . text ( text ) ;
// 选择数据
$tips . attr ( 'data-value' , encodeURIComponent ( JSON . stringify ( value ) ) ) ;
} ) ;
// 左侧配置 - 多图- 多图添加图片
2024-01-19 14:49:32 +08:00
$offcanvas _config _many _images . on ( 'click' , '.config-many-images-item-add' , function ( ) {
2021-06-22 21:45:29 +08:00
$offcanvas _config _many _images . find ( '.config-many-images-container' ) . append ( ModuleConfigManyImagesItemContentHtml ( ) ) ;
} ) ;
// 配置多图 - 选择页面事件
2024-01-19 14:49:32 +08:00
$offcanvas _config _many _images . on ( 'click' , '.form-view-choice-container-submit' , function ( e ) {
2021-06-22 21:45:29 +08:00
OffcanvasConfigPagesChoice ( $ ( this ) , e ) ;
} ) ;
// 左侧配置 - 配置多图 - 链接地址 - 移除
2024-01-19 14:49:32 +08:00
$offcanvas _config _many _images . on ( 'click' , '.form-view-choice-container-active i.am-icon-close' , function ( e ) {
2021-06-22 21:45:29 +08:00
OffcanvasConfigPagesRemove ( $ ( this ) , e ) ;
} ) ;
// 左侧配置 - 配置多图 - 移除
2024-01-19 14:49:32 +08:00
$ ( document ) . on ( 'click' , '#offcanvas-module-config-many-images .config-many-images-container .am-panel a.am-close' , function ( ) {
2021-06-22 21:45:29 +08:00
$ ( this ) . parent ( ) . remove ( ) ;
} ) ;
2022-11-24 21:03:39 +08:00
// 配置多图 - 展示模式切换
2024-01-19 14:49:32 +08:00
$ ( document ) . on ( 'click' , '#offcanvas-module-config-many-images input[name="view_list_show_style"]' , function ( ) {
2021-06-22 21:45:29 +08:00
$base _show _style _value _obj = $ ( this ) . parents ( '.config-view-show-style' ) . find ( 'input[name="view_list_show_style_value"]' ) ;
2024-01-19 14:49:32 +08:00
switch ( $ ( this ) . val ( ) ) {
2021-06-22 21:45:29 +08:00
// 滚动
2024-01-19 14:49:32 +08:00
case 'rolling' :
2021-06-22 21:45:29 +08:00
// 数据填充
var json = ViewRollingShowStyleValueHandle ( $base _show _style _value _obj . val ( ) ) ;
2024-01-19 14:49:32 +08:00
if ( json [ 'item_margin' ] <= 0 ) {
2021-06-22 21:45:29 +08:00
json [ 'item_margin' ] = '' ;
}
FormDataFill ( json , '#modal-module-rolling-config' ) ;
// 开关状态
2024-01-19 14:49:32 +08:00
$modal _rolling _config . find ( 'input[name="is_auto_play"]' ) . switch ( ) . toggleSwitch ( json . is _auto _play ) ;
$modal _rolling _config . find ( 'input[name="is_nav_dot"]' ) . switch ( ) . toggleSwitch ( json . is _nav _dot ) ;
2021-06-22 21:45:29 +08:00
// 开启弹窗
$modal _rolling _config . modal ( {
width : 260 ,
height : 370 ,
closeViaDimmer : false
} ) ;
break ;
// 列表
2024-01-19 14:49:32 +08:00
case 'list' :
2021-06-22 21:45:29 +08:00
// 数据填充
var json = ViewListShowStyleValueHandle ( $base _show _style _value _obj . val ( ) ) ;
2024-01-19 14:49:32 +08:00
if ( json [ 'style_margin' ] <= 0 ) {
2021-06-22 21:45:29 +08:00
json [ 'style_margin' ] = '' ;
}
FormDataFill ( json , '#modal-module-list-config' ) ;
// 开启弹窗
$modal _list _config . modal ( {
width : 260 ,
height : 225 ,
closeViaDimmer : false
} ) ;
break ;
2024-01-19 14:49:32 +08:00
default :
2021-06-22 21:45:29 +08:00
$base _show _style _value _obj . val ( '' ) ;
}
} ) ;
2022-11-24 21:03:39 +08:00
// 左侧配置 - 图文- 图文添加
2024-01-19 14:49:32 +08:00
$offcanvas _config _images _text . on ( 'click' , '.config-images-text-item-add' , function ( ) {
2022-11-24 21:03:39 +08:00
$offcanvas _config _images _text . find ( '.config-images-text-container' ) . append ( ModuleConfigImagesTextItemContentHtml ( ) ) ;
// 单选框初始化
$offcanvas _config _images _text . find ( 'input[type="checkbox"], input[type="radio"]' ) . uCheck ( ) ;
// 颜色选择器初始化
ColorPickerInit ( ) ;
} ) ;
// 配置图文 - 选择页面事件
2024-01-19 14:49:32 +08:00
$offcanvas _config _images _text . on ( 'click' , '.form-view-choice-container-submit' , function ( e ) {
2022-11-24 21:03:39 +08:00
OffcanvasConfigPagesChoice ( $ ( this ) , e ) ;
} ) ;
// 左侧配置 - 配置图文 - 链接地址 - 移除
2024-01-19 14:49:32 +08:00
$offcanvas _config _images _text . on ( 'click' , '.form-view-choice-container-active i.am-icon-close' , function ( e ) {
2022-11-24 21:03:39 +08:00
OffcanvasConfigPagesRemove ( $ ( this ) , e ) ;
} ) ;
// 左侧配置 - 配置图文 - 移除
2024-01-19 14:49:32 +08:00
$ ( document ) . on ( 'click' , '#offcanvas-module-config-images-text .config-images-text-container .am-panel a.am-close' , function ( ) {
2022-11-24 21:03:39 +08:00
$ ( this ) . parent ( ) . remove ( ) ;
} ) ;
// 配置图文 - 展示模式切换
2024-01-19 14:49:32 +08:00
$ ( document ) . on ( 'click' , '#offcanvas-module-config-images-text input[name="view_list_show_style"]' , function ( ) {
2022-11-24 21:03:39 +08:00
$base _show _style _value _obj = $ ( this ) . parents ( '.config-view-show-style' ) . find ( 'input[name="view_list_show_style_value"]' ) ;
2024-01-19 14:49:32 +08:00
switch ( $ ( this ) . val ( ) ) {
2022-11-24 21:03:39 +08:00
// 滚动
2024-01-19 14:49:32 +08:00
case 'rolling' :
2022-11-24 21:03:39 +08:00
// 数据填充
var json = ViewRollingShowStyleValueHandle ( $base _show _style _value _obj . val ( ) ) ;
2024-01-19 14:49:32 +08:00
if ( json [ 'item_margin' ] <= 0 ) {
2022-11-24 21:03:39 +08:00
json [ 'item_margin' ] = '' ;
}
FormDataFill ( json , '#modal-module-rolling-config' ) ;
// 开关状态
2024-01-19 14:49:32 +08:00
$modal _rolling _config . find ( 'input[name="is_auto_play"]' ) . switch ( ) . toggleSwitch ( json . is _auto _play ) ;
$modal _rolling _config . find ( 'input[name="is_nav_dot"]' ) . switch ( ) . toggleSwitch ( json . is _nav _dot ) ;
2022-11-24 21:03:39 +08:00
// 开启弹窗
$modal _rolling _config . modal ( {
width : 260 ,
height : 370 ,
closeViaDimmer : false
} ) ;
break ;
// 默认
2024-01-19 14:49:32 +08:00
default :
2022-11-24 21:03:39 +08:00
// 数据填充
var json = ViewListShowStyleValueHandle ( $base _show _style _value _obj . val ( ) ) ;
2024-01-19 14:49:32 +08:00
if ( json [ 'style_margin' ] <= 0 ) {
2022-11-24 21:03:39 +08:00
json [ 'style_margin' ] = '' ;
}
FormDataFill ( json , '#modal-module-list-config' ) ;
// 开启弹窗
$modal _list _config . modal ( {
width : 260 ,
height : 225 ,
closeViaDimmer : false
} ) ;
}
} ) ;
2022-11-27 21:49:10 +08:00
// 配置图片魔方 - 选择页面事件
2024-01-19 14:49:32 +08:00
$offcanvas _config _images _magic _cube . on ( 'click' , '.form-view-choice-container-submit' , function ( e ) {
2022-11-27 21:49:10 +08:00
OffcanvasConfigPagesChoice ( $ ( this ) , e ) ;
} ) ;
// 左侧配置 - 配置图片魔方 - 链接地址 - 移除
2024-01-19 14:49:32 +08:00
$offcanvas _config _images _magic _cube . on ( 'click' , '.form-view-choice-container-active i.am-icon-close' , function ( e ) {
2022-11-27 21:49:10 +08:00
OffcanvasConfigPagesRemove ( $ ( this ) , e ) ;
} ) ;
// 配置图片魔方 - 展示模式切换
2024-01-19 14:49:32 +08:00
$ ( document ) . on ( 'click' , '#offcanvas-module-config-images-magic-cube input[name="view_list_show_style"]' , function ( ) {
2022-11-27 21:49:10 +08:00
var html = ModuleConfigImagesMagicCubeItemContentHtml ( ) ;
2024-01-19 14:49:32 +08:00
if ( html !== false ) {
2022-11-27 21:49:10 +08:00
$offcanvas _config _images _magic _cube . find ( '.config-images-magic-cube-container' ) . append ( html ) ;
}
} ) ;
// 配置商品 - 展示模式切换
2024-01-19 14:49:32 +08:00
$ ( document ) . on ( 'click' , '#offcanvas-module-config-goods input[name="view_list_show_style"]' , function ( ) {
2022-11-27 21:49:10 +08:00
$base _show _style _value _obj = $ ( this ) . parents ( '.config-view-show-style' ) . find ( 'input[name="view_list_show_style_value"]' ) ;
2024-01-19 14:49:32 +08:00
switch ( $ ( this ) . val ( ) ) {
2022-11-27 21:49:10 +08:00
// 滚动
2024-01-19 14:49:32 +08:00
case 'rolling' :
2022-11-27 21:49:10 +08:00
// 数据填充
var json = ViewRollingShowStyleValueHandle ( $base _show _style _value _obj . val ( ) ) ;
2024-01-19 14:49:32 +08:00
if ( json [ 'item_margin' ] <= 0 ) {
2022-11-27 21:49:10 +08:00
json [ 'item_margin' ] = '' ;
}
FormDataFill ( json , '#modal-module-rolling-config' ) ;
// 开关状态
2024-01-19 14:49:32 +08:00
$modal _rolling _config . find ( 'input[name="is_auto_play"]' ) . switch ( ) . toggleSwitch ( json . is _auto _play ) ;
$modal _rolling _config . find ( 'input[name="is_nav_dot"]' ) . switch ( ) . toggleSwitch ( json . is _nav _dot ) ;
2022-11-27 21:49:10 +08:00
// 开启弹窗
$modal _rolling _config . modal ( {
width : 260 ,
height : 370 ,
closeViaDimmer : false
} ) ;
break ;
}
} ) ;
2021-06-22 21:45:29 +08:00
// 左侧配置 - 标题 - 右侧按钮 - 选择页面事件
2024-01-19 14:49:32 +08:00
$offcanvas _config _title . on ( 'click' , '.form-view-choice-container-submit' , function ( e ) {
2021-06-22 21:45:29 +08:00
OffcanvasConfigPagesChoice ( $ ( this ) , e ) ;
} ) ;
// 左侧配置 - 标题 - 右侧按钮 - 移除
2024-01-19 14:49:32 +08:00
$offcanvas _config _title . on ( 'click' , '.form-view-choice-container-active i.am-icon-close' , function ( e ) {
2021-06-22 21:45:29 +08:00
OffcanvasConfigPagesRemove ( $ ( this ) , e ) ;
} ) ;
// 左侧配置 - 标题 - 添加关键字
2024-01-19 14:49:32 +08:00
$offcanvas _config _title . on ( 'click' , '.config-title-item-add' , function ( ) {
2021-06-22 21:45:29 +08:00
ModuleConfigTitleKeywordsOpen ( ) ;
} ) ;
// 左侧配置 - 标题 - 关键字 - 编辑
2024-01-19 14:49:32 +08:00
$ ( document ) . on ( 'click' , '#offcanvas-module-config-title .config-title-container li a.am-icon-edit' , function ( ) {
2021-06-22 21:45:29 +08:00
var $parent = $ ( this ) . parent ( ) ;
$base _title _keywords _obj = $parent ;
ModuleConfigTitleKeywordsOpen ( 1 , $parent . find ( 'input' ) . val ( ) || null ) ;
} ) ;
// 左侧配置 - 标题 - 关键字 - 移除
2024-01-19 14:49:32 +08:00
$ ( document ) . on ( 'click' , '#offcanvas-module-config-title .config-title-container li a.am-icon-remove' , function ( ) {
2021-06-22 21:45:29 +08:00
$ ( this ) . parents ( 'li' ) . remove ( ) ;
} ) ;
// 左侧配置 - 标题 - 关键字 - 选择页面事件
2024-01-19 14:49:32 +08:00
$modal _title _keywords . on ( 'click' , '.form-view-choice-container-submit' , function ( e ) {
2021-06-22 21:45:29 +08:00
OffcanvasConfigPagesChoice ( $ ( this ) , e ) ;
} ) ;
// 左侧配置 - 标题 - 关键字 - 移除
2024-01-19 14:49:32 +08:00
$modal _title _keywords . on ( 'click' , '.form-view-choice-container-active i.am-icon-close' , function ( e ) {
2021-06-22 21:45:29 +08:00
OffcanvasConfigPagesRemove ( $ ( this ) , e ) ;
} ) ;
2021-06-24 22:47:40 +08:00
// 页面布局数据保存
var $layout _operate _container = $ ( '.layout-operate-container' ) ;
2024-01-19 14:49:32 +08:00
$layout _operate _container . on ( 'click' , 'button' , function ( ) {
2021-06-24 22:47:40 +08:00
// 基础配置
var data = $layout _operate _container . attr ( 'data-json' ) || null ;
2024-01-19 14:49:32 +08:00
if ( data != null ) {
2021-06-24 22:47:40 +08:00
data = JSON . parse ( decodeURIComponent ( data ) ) || null ;
}
2024-01-19 14:49:32 +08:00
if ( data == null ) {
2021-06-24 22:47:40 +08:00
data = { } ;
}
// 设计配置
data [ 'config' ] = JSON . stringify ( LayoutViewConfig ( ) ) ;
// 保存数据
var $this = $ ( this ) ;
$this . button ( 'loading' ) ;
$ . ajax ( {
2022-05-14 15:37:28 +08:00
url : RequestUrlHandle ( $layout _operate _container . data ( 'save-url' ) ) ,
2021-06-24 22:47:40 +08:00
type : 'post' ,
data : data ,
dataType : 'json' ,
2024-01-19 14:49:32 +08:00
success : function ( res ) {
if ( res [ 'code' ] == 0 ) {
2021-06-24 22:47:40 +08:00
Prompt ( res . msg , 'success' ) ;
2024-01-19 14:49:32 +08:00
setTimeout ( function ( ) {
2021-06-24 22:47:40 +08:00
var url = $layout _operate _container . find ( 'a' ) . attr ( 'href' ) || null ;
2024-01-19 14:49:32 +08:00
if ( url == null || url == 'javascript:;' ) {
2021-06-24 22:47:40 +08:00
window . location . reload ( ) ;
} else {
window . location . href = url ;
}
} , 1500 ) ;
} else {
$this . button ( 'reset' ) ;
Prompt ( res . msg ) ;
2024-01-19 14:49:32 +08:00
}
2021-06-24 22:47:40 +08:00
} ,
2024-01-19 14:49:32 +08:00
error : function ( xhr , type ) {
2021-06-24 22:47:40 +08:00
$this . button ( 'reset' ) ;
2022-08-22 15:42:40 +08:00
var msg = HtmlToString ( xhr . responseText ) || ( window [ 'lang_error_text' ] || '异常错误' ) ;
2021-06-24 22:47:40 +08:00
Prompt ( msg , null , 30 ) ;
}
} ) ;
} ) ;
2021-06-22 21:45:29 +08:00
} ) ;