From de11e26aa3247e8e5ff5f4bd9962cea8c1ade62e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=85=B5?= Date: Fri, 18 Jan 2019 02:11:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8D=95=E5=85=83=E6=A0=BC?= =?UTF-8?q?=E5=9B=BE=E7=89=87/=E7=BB=84=E4=B8=BAlayer=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/command/Crud.php | 3 +++ public/assets/js/require-table.js | 21 +++++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/application/admin/command/Crud.php b/application/admin/command/Crud.php index db3b2ce22..31cbed9c4 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 c4630558c..c5ee67bfd 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(' '); }, -- Gitee