diff --git a/application/admin/command/Crud.php b/application/admin/command/Crud.php index db3b2ce223df62d815e0155f4db8cdc2f1ffc87c..31cbed9c4c905cd9e4eee480f18ac61567a1cd03 100755 --- a/application/admin/command/Crud.php +++ b/application/admin/command/Crud.php @@ -1327,6 +1327,9 @@ EOD; if (in_array($datatype, ['set'])) { $html .= ", operate:'FIND_IN_SET'"; } + if (in_array($formatter, ['image','images'])) { + $html .= ", events: Table.api.events.image"; + } if ($itemArr && !$formatter) { $formatter = 'normal'; } diff --git a/public/assets/js/require-table.js b/public/assets/js/require-table.js index c4630558cabd6be5d73fca67e56e6772747d5c78..c5ee67bfd29905ac717e8e6de69d588a28070535 100644 --- a/public/assets/js/require-table.js +++ b/public/assets/js/require-table.js @@ -366,6 +366,23 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table } ); } + },//单元格图片预览 + image: { + 'click .img-center': function (e, value, row, index) { + data = []; + value= value.split(","); + $.each(value, function (index, value) { + data.push({ + src: Fast.api.cdnurl(value), + }); + }); + layer.photos({ + photos: { + "data": data + }, + anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数) + }); + }, } }, // 单元格数据格式化 @@ -381,7 +398,7 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table image: function (value, row, index) { value = value ? value : '/assets/img/blank.gif'; var classname = typeof this.classname !== 'undefined' ? this.classname : 'img-sm img-center'; - return ''; + return ''; }, images: function (value, row, index) { value = value === null ? '' : value.toString(); @@ -390,7 +407,7 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table var html = []; $.each(arr, function (i, value) { value = value ? value : '/assets/img/blank.gif'; - html.push(''); + html.push(''); }); return html.join(' '); },