5
This commit is contained in:
@@ -1,5 +1,29 @@
|
||||
define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
var User = {
|
||||
imgpreview:function(e,v,d,index){
|
||||
var that = $(e.currentTarget);
|
||||
var srcs = [];
|
||||
var index = $(that).parents('table').find('.img-center').index($(that))
|
||||
$(that).parents('table').find('.img-center').each(function(v,k){
|
||||
var src = $(that).attr('data-url') || $(that).attr('src');
|
||||
srcs.push({
|
||||
"src": src,
|
||||
"alt": $(that).attr('alt') || $(that).attr('title') || src,
|
||||
"pid":k,
|
||||
"thumb": $(that).attr('data-url') || $(that).attr('src')
|
||||
});
|
||||
});
|
||||
(parent ? parent.layer : layer).photos({
|
||||
zIndex:19891033,
|
||||
photos: { // 图片层的数据源
|
||||
"title": "", // 相册标题
|
||||
"id": 123, // 相册 id
|
||||
"start": index, // 初始显示的图片序号,默认 0
|
||||
"data": srcs
|
||||
}
|
||||
});
|
||||
return false;
|
||||
},
|
||||
//Do setup work hereAction
|
||||
index: function () {
|
||||
|
||||
@@ -31,19 +55,34 @@ define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
title: 'ID',
|
||||
sortable: true // 是否排序
|
||||
},
|
||||
{
|
||||
title: "adapter",
|
||||
field: "adapter",
|
||||
filter: "string",
|
||||
},
|
||||
{
|
||||
title: "名字",
|
||||
field: "title",
|
||||
field: "origin_name",
|
||||
filter: "string",
|
||||
},
|
||||
{
|
||||
title: "文件",
|
||||
field: "path",
|
||||
formatter: function (v,d) {
|
||||
field: "file_name",
|
||||
formatter: function (v,d,index) {
|
||||
if (["jpg", "jpeg", "png", "gif", "bmp", "webp", "svg"].indexOf(d.extension.toLowerCase()) !== -1) {
|
||||
return '<img src="' + Fast.api.cdnurl(v) + '" style="max-width:32px;max-height:32px;" />';
|
||||
var value = d['file_url'] == null || d['file_url'].length === 0 ? '' : d['file_url'].toString();
|
||||
value = value ? value : '/assets/img/blank.gif';
|
||||
var classname = 'img-sm img-center previewitem';
|
||||
var url = Fast.api.cdnurl(value, true);
|
||||
url = url.match(/^(\/|data:image\\)/) ? url : url + Config.upload_thumbstyle;
|
||||
return '<a href="javascript:"><img class="' + classname + '" src="' + url + '" alt="'+d['origin_name']+'" /></a>';
|
||||
}
|
||||
return '<a href="' + d['file_url'] + '" target="_blank" title="'+d['origin_name']+'">' + v + '</a>';
|
||||
},
|
||||
events:{
|
||||
'click .img-center': function(e,v,d,index){
|
||||
User.imgpreview.call(this,e,d['file_url'],d,index);
|
||||
}
|
||||
return '<a href="' + encodeURI(v) + '" target="_blank">' + escape(v) + '</a>';
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -70,11 +109,11 @@ define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
},
|
||||
{
|
||||
title: "图片宽度",
|
||||
field: "width",
|
||||
field: "file_width",
|
||||
},
|
||||
{
|
||||
title: "图片高度",
|
||||
field: "height",
|
||||
field: "file_height",
|
||||
},{
|
||||
title: "扩展名",
|
||||
field: "extension",
|
||||
@@ -170,27 +209,39 @@ define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
totalField: "count",
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID',
|
||||
filter: "number",
|
||||
sortable: true // 是否排序
|
||||
},
|
||||
{
|
||||
title: "adapter",
|
||||
field: "adapter",
|
||||
filter: "string",
|
||||
},
|
||||
{
|
||||
title: "名字",
|
||||
field: "title",
|
||||
field: "origin_name",
|
||||
filter: "string",
|
||||
},
|
||||
{
|
||||
title: "文件",
|
||||
field: "path",
|
||||
filter: "string",
|
||||
formatter: function (v,d) {
|
||||
field: "file_name",
|
||||
formatter: function (v,d,index) {
|
||||
if (["jpg", "jpeg", "png", "gif", "bmp", "webp", "svg"].indexOf(d.extension.toLowerCase()) !== -1) {
|
||||
return '<img src="' + Fast.api.cdnurl(v) + '" style="max-width:32px;max-height:32px;" />';
|
||||
var value = d['file_url'] == null || d['file_url'].length === 0 ? '' : d['file_url'].toString();
|
||||
value = value ? value : '/assets/img/blank.gif';
|
||||
var classname = 'img-sm img-center previewitem';
|
||||
var url = Fast.api.cdnurl(value, true);
|
||||
url = url.match(/^(\/|data:image\\)/) ? url : url + Config.upload_thumbstyle;
|
||||
return '<a href="javascript:"><img class="' + classname + '" src="' + url + '" alt="'+d['origin_name']+'" /></a>';
|
||||
}
|
||||
return '<a href="' + d['file_url'] + '" target="_blank" title="'+d['origin_name']+'">' + v + '</a>';
|
||||
},
|
||||
events:{
|
||||
'click .img-center': function(e,v,d,index){
|
||||
User.imgpreview.call(this,e,d['file_url'],d,index);
|
||||
}
|
||||
return '<a href="' + encodeURI(v) + '" target="_blank">' + escape(v) + '</a>';
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -211,19 +262,17 @@ define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "mime类型",
|
||||
title: "类型",
|
||||
field: "mime_type",
|
||||
hide: true,
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
title: "图片宽度",
|
||||
field: "width",
|
||||
visible: false,
|
||||
field: "file_width",
|
||||
},
|
||||
{
|
||||
title: "图片高度",
|
||||
field: "height",
|
||||
visible: false,
|
||||
field: "file_height",
|
||||
},{
|
||||
title: "扩展名",
|
||||
field: "extension",
|
||||
|
||||
Reference in New Issue
Block a user