style:图片上传
Showing
4 changed files
with
77 additions
and
25 deletions
... | @@ -436,7 +436,48 @@ input[type='file'] { | ... | @@ -436,7 +436,48 @@ input[type='file'] { |
436 | border-radius: 2px; | 436 | border-radius: 2px; |
437 | box-sizing: border-box; | 437 | box-sizing: border-box; |
438 | } | 438 | } |
439 | .conImageUpdate { | ||
440 | width: 100%; | ||
441 | min-height: 290px; | ||
442 | } | ||
439 | .itemImageUpdate { | 443 | .itemImageUpdate { |
440 | position: relative; | ||
441 | margin-right: 15px; | 444 | margin-right: 15px; |
445 | position: relative; | ||
446 | } | ||
447 | .mask { | ||
448 | width: 100%; | ||
449 | height: 240px; | ||
450 | background: rgba(0, 0, 0, 0.3); | ||
451 | position: relative; | ||
452 | position: absolute; | ||
453 | left: 0; | ||
454 | top: 0; | ||
455 | display: none; | ||
456 | opacity: 0; | ||
457 | } | ||
458 | .mask:hover { | ||
459 | opacity: 1; | ||
460 | } | ||
461 | .mask p { | ||
462 | width: 100%; | ||
463 | height: 30px; | ||
464 | text-align: center; | ||
465 | position: absolute; | ||
466 | left: 0; | ||
467 | bottom: 0; | ||
468 | background: rgba(0, 0, 0, 0.3); | ||
469 | padding-top: 5px; | ||
470 | } | ||
471 | .mask p img { | ||
472 | width: 20px; | ||
473 | height: 20px; | ||
474 | cursor: pointer; | ||
475 | margin: 0 10px; | ||
476 | } | ||
477 | .imageUpdateTitle { | ||
478 | float: left; | ||
479 | margin-right: 10px; | ||
480 | height: 240px; | ||
481 | width: 70px; | ||
482 | line-height: 240px; | ||
442 | } | 483 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
staticImages/fangda.png
0 → 100644
6.82 KB
staticImages/shanchu.png
0 → 100644
3.71 KB
... | @@ -41,7 +41,7 @@ $(function () { | ... | @@ -41,7 +41,7 @@ $(function () { |
41 | }); | 41 | }); |
42 | 42 | ||
43 | //读取受理信息 | 43 | //读取受理信息 |
44 | function loadAcceptDetail(){ | 44 | function loadAcceptDetail() { |
45 | $('#wwsqbh p').text(slsqxx.wwsqbh); | 45 | $('#wwsqbh p').text(slsqxx.wwsqbh); |
46 | $('#sqrq p').text(slsqxx.sqrq); | 46 | $('#sqrq p').text(slsqxx.sqrq); |
47 | //$('#sqrmc p').text(slsqxx.sqrmc); | 47 | //$('#sqrmc p').text(slsqxx.sqrmc); |
... | @@ -294,14 +294,15 @@ function LoadClxxDiv() { | ... | @@ -294,14 +294,15 @@ function LoadClxxDiv() { |
294 | let clxxDic = $("#clxx"); | 294 | let clxxDic = $("#clxx"); |
295 | let clxxContent; | 295 | let clxxContent; |
296 | $.each(slsqxx.slclList, function (index, item) { | 296 | $.each(slsqxx.slclList, function (index, item) { |
297 | clxxContent = '<div id="' + item.bsmCl + '">'; | 297 | clxxContent = '<div id="' + item.bsmCl + '" class="conImageUpdate">'; |
298 | clxxContent += '<h5 class="imageUpdateTitle">' + slsqxx.slclList[index].clmc + '</h5>'; | ||
298 | for (i = 0; i < item.fs; i++) { | 299 | for (i = 0; i < item.fs; i++) { |
299 | clxxContent += '<div style="float: left;" class="itemImageUpdate">'; | 300 | clxxContent += '<div style="float: left;" class="itemImageUpdate">'; |
300 | clxxContent += '<img class="pic" src="../../staticImages/update.png">'; | 301 | clxxContent += '<img class="pic" src="../../staticImages/update.png">'; |
301 | clxxContent += '<input name="file" accept="image/*" type="file" style="display: none" />'; | 302 | clxxContent += '<input name="file" accept="image/*" type="file" style="display: none" />'; |
303 | clxxContent += '<div class="mask"><p><img class="enlarge" src="../../staticImages/fangda.png"> <img class="delete" src="../../staticImages/shanchu.png"></p></div>'; | ||
302 | clxxContent += '<div class="certificate">'; | 304 | clxxContent += '<div class="certificate">'; |
303 | clxxContent += '<span>' + slsqxx.slclList[index].clmc + '【' + slsqxx.slclList[index].wjlxmc + '】(' + slsqxx.slclList[index].fs + '-' + (i + 1) + ')</span>'; | 305 | clxxContent += '<span>' + slsqxx.slclList[index].clmc + '【' + slsqxx.slclList[index].wjlxmc + '】(' + slsqxx.slclList[index].fs + '-' + (i + 1) + ')</span>'; |
304 | clxxContent += '<a class="ddd">删除</a>'; | ||
305 | clxxContent += '</div>'; | 306 | clxxContent += '</div>'; |
306 | clxxContent += '</div>'; | 307 | clxxContent += '</div>'; |
307 | } | 308 | } |
... | @@ -318,24 +319,28 @@ function AddCLxxClick() { | ... | @@ -318,24 +319,28 @@ function AddCLxxClick() { |
318 | $(this).next().click(); //隐藏了input:file样式后,点击头像就可以本地上传 | 319 | $(this).next().click(); //隐藏了input:file样式后,点击头像就可以本地上传 |
319 | $(this).next().on("change", function () { | 320 | $(this).next().on("change", function () { |
320 | var objUrl = getObjectURL(this.files[0]); //获取图片的路径,该路径不是图片在本地的路径 | 321 | var objUrl = getObjectURL(this.files[0]); //获取图片的路径,该路径不是图片在本地的路径 |
321 | console.log(999, objUrl) | ||
322 | if (objUrl) { | 322 | if (objUrl) { |
323 | let bsm_slclmx = UploadPicture(this.files[0], $(this).parent().parent().prop("id")); | 323 | let bsm_slclmx = UploadPicture(this.files[0], $(this).parent().parent().prop("id")); |
324 | if (bsm_slclmx == "") { | 324 | if (bsm_slclmx == "") { |
325 | alert("图片上传失败,请稍后上传!"); | 325 | layer.msg('图片上传失败,请稍后上传!'); |
326 | } | 326 | } |
327 | else { | 327 | else { |
328 | layer.msg('图片上传成功'); | ||
328 | $(this).prev().attr("src", objUrl);//将图片路径存入src中,显示出图片 | 329 | $(this).prev().attr("src", objUrl);//将图片路径存入src中,显示出图片 |
329 | $(this).parent().attr("id", bsm_slclmx); | 330 | $(this).parent().attr("id", bsm_slclmx); |
331 | $(this).parent().find('.mask').show(); | ||
330 | } | 332 | } |
331 | } | 333 | } |
332 | }); | 334 | }); |
333 | }); | 335 | }); |
334 | //删除事件 | 336 | //del |
335 | $(".ddd").click(function () { | 337 | $(document).on("click", ".delete", function (e) { |
336 | let imgObj = $(this).parent().siblings(".pic"); | 338 | let imgObj = $(this).parent().parent().siblings(".pic"); |
337 | let file = $(this).parent().siblings("input[type='file']"); | 339 | let file = $(this).parent().parent().siblings("input[type='file']"); |
338 | let slclmxObj = $(this).parent().parent(); | 340 | let slclmxObj = $(this).parent().parent().parent(); |
341 | layer.confirm('此操作将删除图片是否继续', { | ||
342 | btn: ['是', '否'] //按钮 | ||
343 | }, function () { | ||
339 | $.ajax({ | 344 | $.ajax({ |
340 | type: "post", //提交方式 | 345 | type: "post", //提交方式 |
341 | url: portal.api_url + "/portal/FillInformation/deleteSlcl",//路径 | 346 | url: portal.api_url + "/portal/FillInformation/deleteSlcl",//路径 |
... | @@ -346,17 +351,34 @@ function AddCLxxClick() { | ... | @@ -346,17 +351,34 @@ function AddCLxxClick() { |
346 | //数据,这里使用的是Json格式进行传输 | 351 | //数据,这里使用的是Json格式进行传输 |
347 | success: function (result) {//返回数据根据结果进行相应的处理 | 352 | success: function (result) {//返回数据根据结果进行相应的处理 |
348 | if (result.code == 200) { | 353 | if (result.code == 200) { |
349 | imgObj.attr("src", ""); | 354 | layer.msg(result.message); |
355 | imgObj.attr("src", "../../staticImages/update.png"); | ||
350 | file.after(file.clone().val("")); | 356 | file.after(file.clone().val("")); |
351 | file.remove(); | 357 | file.remove(); |
352 | slclmxObj.attr("id", ""); | 358 | slclmxObj.attr("id", ""); |
353 | } else { | 359 | } else { |
354 | alert('删除失败!'); | 360 | layer.msg('删除失败!'); |
361 | |||
355 | } | 362 | } |
356 | } | 363 | } |
357 | }); | 364 | }); |
365 | }, function () { | ||
366 | layer.msg('已取消删除'); | ||
358 | }); | 367 | }); |
359 | 368 | }) | |
369 | // 放大 | ||
370 | $(document).on("click", ".enlarge", function (e) { | ||
371 | var imgHtml = "<img src='../../staticImages/update.png' />"; | ||
372 | layer.open({ | ||
373 | type: 1, | ||
374 | title: false, | ||
375 | closeBtn: 0, | ||
376 | area: ['auto'], | ||
377 | skin: 'layui-layer-nobg', //没有背景色 | ||
378 | shadeClose: true, | ||
379 | content: imgHtml | ||
380 | }); | ||
381 | }) | ||
360 | } | 382 | } |
361 | 383 | ||
362 | // 图片上传 | 384 | // 图片上传 |
... | @@ -378,17 +400,6 @@ function UploadPicture(flie, bsmCl) { | ... | @@ -378,17 +400,6 @@ function UploadPicture(flie, bsmCl) { |
378 | success: function (result) {//返回数据根据结果进行相应的处理 | 400 | success: function (result) {//返回数据根据结果进行相应的处理 |
379 | if (result.code == 200) { | 401 | if (result.code == 200) { |
380 | bsm_slclmx = result.data[0].bsmSlclmx; | 402 | bsm_slclmx = result.data[0].bsmSlclmx; |
381 | //layer.msg('上传成功!'); | ||
382 | // fileul.parent().find('.fileListName .fileName').eq(fileul.find("li").length - 1).find('.operation').attr('bsmSlclmx', result.data[0].bsmSlclmx) | ||
383 | // if (fileul.find('.fileName').length === sizeNum) { | ||
384 | // fileul.parent().find('.pictureUpload').show() | ||
385 | // layer.msg('上传成功,并且以上传最大限度!'); | ||
386 | // fileul.parent().find('.file_name').css("z-index", "15"); | ||
387 | // fileul.parent().find('.updatetext').hide() | ||
388 | // fileul.parent().find('.update').attr('src', '../../staticImages/Yes.png') | ||
389 | // } else { | ||
390 | // layer.msg('上传成功!'); | ||
391 | // | ||
392 | } | 403 | } |
393 | } | 404 | } |
394 | }); | 405 | }); | ... | ... |
-
Please register or sign in to post a comment