Pārlūkot izejas kodu

身份证点击放大

linwu 2 gadi atpakaļ
vecāks
revīzija
e3f43c38f1
1 mainītis faili ar 21 papildinājumiem un 4 dzēšanām
  1. 21 4
      app/admin/view/user/userform.html

+ 21 - 4
app/admin/view/user/userform.html

@@ -156,7 +156,7 @@
 										{notempty name="user.idcardzpic"}
 										<div>
 											<input type="hidden" name="idcardzpic" value="{$user.idcardzpic}">
-											<img src="{$user.idcardzpic}">
+											<img src="{$user.idcardzpic}" class="idcard">
 										</div>
 										{/notempty}
 									</div>
@@ -172,7 +172,7 @@
 										{notempty name="user.idcardfpic"}
 										<div>
 											<input type="hidden" name="idcardfpic" value="{$user.idcardfpic}">
-											<img src="{$user.idcardfpic}">
+											<img src="{$user.idcardfpic}" class="idcard">
 										</div>
 										{/notempty}
 									</div>
@@ -337,6 +337,24 @@
 			});
 		});
 
+		$('.echo-attachment-image-list').on('click', '.idcard', function() {
+			var src = $(this).attr('src');
+			layer.photos({
+				photos: {
+					"title": "", //相册标题
+					"id": 1, //相册id
+					"start": 0, //初始显示的图片序号,默认0
+					"data": [   //相册包含的图片,数组格式
+						{
+							"alt": "身份证",
+							"pid": 1, //图片id
+							"src": src, //原图地址
+							"thumb": src //缩略图地址
+						}
+					]
+				}
+			});
+		});
 
 		$('.echo-attachment-image-list').on('click', '.attachmentdel', function() {
 			$(this).parent().remove();
@@ -361,7 +379,7 @@
 				var html = "";
 				if (upload_amount == 1) {
 					html += '<div> <input type="hidden" name="' + upload_input + '" value="' + res.data.src + '"> ';
-					html += '<img src="' + res.data.src + '"></div>';
+					html += '<img src="' + res.data.src + '" class="idcard"></div>';
 					$("#" + upload_input).html(html);
 				} else {
 					html += '<div> <input type="hidden" name="' + upload_input + '[]" value="' + res.data.src + '"> ';
@@ -374,7 +392,6 @@
 				layer.closeAll('loading');
 			}
 		});
-
 	});
 </script>
 </body>