提交 c4dfeab9 编写于 作者: doc_wei's avatar doc_wei

上传组件修改,解决一张图片时无法查看的问题

上级 436fa031
......@@ -30,7 +30,7 @@ layui.define(["jquery"], function(exports) {
var r = a(this),
w = "<li class='item'></li>",
A = a('<li class="item add"><svg class="icon" viewBox="0 0 1024 1024" version="1" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><defs><style/></defs><path d="M737 436a174 174 0 0 1 172 172 172 172 0 0 1-172 172c-69 1-69 107 0 106 152-2 276-125 278-278S886 332 737 330c-69-1-69 105 0 106zM285 779a174 174 0 0 1-172-172 172 172 0 0 1 172-172c68-1 69-106 0-106A282 282 0 0 0 7 607a281 281 0 0 0 278 278c69 1 68-105 0-106z" fill="#4A5699"/><path d="M340 384a174 174 0 0 1 172-172 172 172 0 0 1 172 172c1 68 106 68 106 0a282 282 0 0 0-278-278 281 281 0 0 0-278 278c-1 68 105 68 106 0z" fill="#C45FA0"/><path d="M545 473c17 17 17 43 0 60L422 656a42 42 0 0 1-60-60l123-123c17-16 43-16 60 0z" fill="#F39A2B"/><path d="M485 473c17-16 44-16 60 0l123 123a42 42 0 0 1-60 60L485 533a42 42 0 0 1 0-60z" fill="#F39A2B"/><path d="M514 634c24 0 43 20 43 43v179a43 43 0 0 1-86 0V677c0-23 19-43 43-43z" fill="#E5594F"/></svg></li>'),
A = a('<li class="item add" style="height:80%"><svg class="icon" viewBox="0 0 1024 1024" version="1" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><defs><style/></defs><path d="M737 436a174 174 0 0 1 172 172 172 172 0 0 1-172 172c-69 1-69 107 0 106 152-2 276-125 278-278S886 332 737 330c-69-1-69 105 0 106zM285 779a174 174 0 0 1-172-172 172 172 0 0 1 172-172c68-1 69-106 0-106A282 282 0 0 0 7 607a281 281 0 0 0 278 278c69 1 68-105 0-106z" fill="#4A5699"/><path d="M340 384a174 174 0 0 1 172-172 172 172 0 0 1 172 172c1 68 106 68 106 0a282 282 0 0 0-278-278 281 281 0 0 0-278 278c-1 68 105 68 106 0z" fill="#C45FA0"/><path d="M545 473c17 17 17 43 0 60L422 656a42 42 0 0 1-60-60l123-123c17-16 43-16 60 0z" fill="#F39A2B"/><path d="M485 473c17-16 44-16 60 0l123 123a42 42 0 0 1-60 60L485 533a42 42 0 0 1 0-60z" fill="#F39A2B"/><path d="M514 634c24 0 43 20 43 43v179a43 43 0 0 1-86 0V677c0-23 19-43 43-43z" fill="#E5594F"/></svg></li>'),
// A = a('<li class="item add"><i class="fa fa-fw fa-plus" style="width:100%;height: 100%;"></i></li>'),
e = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="300" height="300" class="progress"><g fill="rgba(17,89,164,0.1)"><path d="M 0 70 Q 75 39, 150 70 T 300 70 T 450 70 T 600 70 T 750 70 V 320 H 0 V 0"></path><animateTransform attributeName="transform" attributeType="XML" type="translate" from="0" to="-300" dur="1.5s" repeatCount="indefinite"></animateTransform></g><g fill="rgba(17,89,164,0.15)"><path d="M 0 70 Q 87.5 47, 175 70 T 350 70 T 525 70 T 700 70 T 875 70 T 1050 70 V 320 H 0 V 0"></path><animateTransform attributeName="transform" attributeType="XML" type="translate" from="0" to="-350" dur="3s" repeatCount="indefinite"></animateTransform></g></svg><div class="progressnum"></div>',
g = '<svg xmlns="http://www.w3.org/2000/svg" class="delete" version="1" viewBox="0 0 1024 1024"><path fill="#fff" d="M512 70a439 439 0 0 1 442 442 439 439 0 0 1-442 442A439 439 0 0 1 70 512 439 439 0 0 1 512 70m0-40a482 482 0 1 0 0 964 482 482 0 0 0 0-964zm114 253v-1c0-21-17-38-38-38H436c-21 0-38 17-38 38v1H282v74h460v-74H626zM321 396v346c0 21 17 38 38 38h306c21 0 38-17 38-38V396H321zm114 306h-76V474h76v228zm115 0h-76V474h76v228zm115 0h-76V474h76v228z"/></svg>',
......@@ -87,6 +87,7 @@ layui.define(["jquery"], function(exports) {
s = 0,
h = "";
var f = 0;
var completeUrl = ""
b.attr("oldurl", B.value);
for (var x in p) {
if (s < B.num && p[s]) {
......@@ -101,10 +102,14 @@ layui.define(["jquery"], function(exports) {
"</li>").insertBefore(A);
}
r.data("num", ++f).removeClass("empty");
q()
q();
if(options.uploadType == '1'){
completeUrl += fileBasePath + "\\assets\\smpropic\\" + p[s] + ",";
}
}
s++
s++;
}
b.val(completeUrl);
} else {
r.data("num", 0).addClass("empty")
}
......
......@@ -933,4 +933,37 @@ function replaceModelContent(str, ControllerPackageName, ServicePackageName, Ser
return str;
}
function show(id, url) {
var imgSuffix = ["png", "jpg", "jpeg", "gif", "bmp"];
if (imgSuffix.indexOf(url.substring(url.lastIndexOf(".") + 1).toLowerCase()) < 0) {
window.open(url);
return false;
}
var imgs = layui.$(id).find("input[type='hidden'][name='upload']").val().split(",");
var data = [];
layui.$.each(imgs, function (k, v) {
var suffix = v.substring(v.lastIndexOf(".") + 1);
if (imgSuffix.indexOf(suffix.toLowerCase()) > -1) {
var json = {
"alt": "",
"pid": k, //图片id
"src": v, //原图地址
"thumb": "" //缩略图地址
}
data.push(json);
}
})
layer.photos({
photos: {
"title": "", //相册标题
"id": 123, //相册id
"start": 0, //初始显示的图片序号,默认0
"data": data
} //格式见API文档手册页
, anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机
});
}
......@@ -2415,7 +2415,7 @@ body .layer-ext-winconfirm {
margin-top: unset;
}
.upload.one .add{
top: unset;
top: 20%;
}
/*** 上传 end ***/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册