Selaa lähdekoodia

自定义拍照插件增加相框选择参数

zhanglong7 6 vuotta sitten
vanhempi
commit
b4ef53fa64

+ 30 - 4
show-server/src/main/webapp/biz/js/plugins/customcamera.js

@ -2,20 +2,46 @@ require(["domReady!","wadeMobile","jcl","iScroll","tap"], function(doc,WadeMobil
2 2
	var iscroll = new iScroll("scroll-container");
3 3
4 4
	// 调用手机的照相功能,返回相片的路径或相片的Base64编码
5
	$("#tack_a_picture").tap(function() {
5
	$("#face_picture").tap(function() {
6 6
		var width = $("#pic").width();
7 7
		var height = $("#pic").height();
8 8
		
9 9
		// 默认1;1:返回相片的路径,0:返回相片的Base64编码
10
		var type=1;
11
		WadeMobile.takeCustomPhoto(function(path) {
10
		var resultType=1;
11
		// 相框类型,0(默认):头像;1:身份证正面;2:身份证反面
12
		var frameType=0;
13
		WadeMobile.getIdentifyPhoto(function(path) {
12 14
			$("#path").html("路径:" + path);
13 15
//			$("#pic").removeClass("e_imagePlaceHolder");
14 16
			$("#pic").removeClass("fa").removeClass("fa-image");
15 17
			$("#pic").attr("class","");
16 18
			$("#pic").html("<img height='" + height + "' width='" + width + "' src='" + path + "'/>");
17 19
			iscroll.refresh();
18
		},type);
20
		},frameType,resultType);
21
	});
22
	
23
	$("#take_id_picture_front").tap(function() {
24
		var width = $("#pic_id_front").width();
25
26
		WadeMobile.getIdentifyPhoto(function(path) {
27
			$("#path_front").html("路径:" + path);
28
			$("#pic_id_front").removeClass("fa").removeClass("fa-image");
29
			$("#pic_id_front").attr("class","");
30
			$("#pic_id_front").html("<img width='" + width + "' src='" + path + "'/>");
31
			iscroll.refresh();
32
		},1);
33
	});
34
	
35
	$("#take_id_picture_back").tap(function() {
36
		var width = $("#pic_id_back").width();
37
38
		WadeMobile.getIdentifyPhoto(function(path) {
39
			$("#path_back").html("路径:" + path);
40
			$("#pic_id_back").removeClass("fa").removeClass("fa-image");
41
			$("#pic_id_back").attr("class","");
42
			$("#pic_id_back").html("<img width='" + width + "' src='" + path + "'/>");
43
			iscroll.refresh();
44
		},2);
19 45
	});
20 46
21 47
});

+ 5 - 5
show-server/src/main/webapp/ipu/js/mobile/expand-mobile.js

@ -43,12 +43,12 @@ define(["require","jcl"],function(require,Wade) {
43 43
				}
44 44
				storageCallback("getPhoto",callback);
45 45
				execute("getPhoto", [type],err);
46
			},takeCustomPhoto:function(callback,type,err){//获取照片
47
				if(type==undefined){
48
					type = 1;//0-Base64编码的字符串 1- 文件路径
46
			},getIdentifyPhoto:function(callback,frameType,resultType,err){//获取照片
47
				if(resultType==undefined){
48
					resultType = 1;//0-Base64编码的字符串 1- 文件路径
49 49
				}
50
				storageCallback("takeCustomPhoto",callback);
51
				execute("takeCustomPhoto", [type],err);
50
				storageCallback("getIdentifyPhoto",callback);
51
				execute("getIdentifyPhoto", [frameType,resultType],err);
52 52
			},getPicture:function(callback,type,err){//获取照片
53 53
				if(type==undefined){
54 54
					type = 1;//0-Base64编码的字符串 1- 文件路径

+ 32 - 2
show-server/src/main/webapp/template/webapp/plugins/customCamera.html

@ -22,8 +22,8 @@
22 22
				<div class="demo-desc">拍照</div>
23 23
				<div class="ipu-card ">
24 24
					<div class="ipu-content ipu-border-b">
25
						<div class="label">调用自定义相机拍照</div>
26
						<div class="fn" id="tack_a_picture"><span class="fa fa-camera"></span></div>
25
						<div class="label">人脸拍照</div>
26
						<div class="fn" id="face_picture"><span class="fa fa-camera"></span></div>
27 27
					</div>
28 28
					<div class="ipu-content ipu-content-vertical">
29 29
						<div class="label">返回结果</div>
@ -34,6 +34,36 @@
34 34
					</div>
35 35
					
36 36
				</div>
37
				
38
				<div class="ipu-card ">
39
					<div class="ipu-content ipu-border-b">
40
						<div class="label">身份证正面拍照</div>
41
						<div class="fn" id="take_id_picture_front"><span class="fa fa-camera"></span></div>
42
					</div>
43
					<div class="ipu-content ipu-content-vertical">
44
						<div class="label">返回结果</div>
45
						<div class="value">
46
							<span class="fa fa-image ipu-image-holder" id="pic_id_front" ></span>
47
						</div>
48
						<div class="info" id="path_front">路径:</div>
49
					</div>
50
					
51
				</div>
52
				
53
				<div class="ipu-card ">
54
					<div class="ipu-content ipu-border-b">
55
						<div class="label">身份证反面拍照</div>
56
						<div class="fn" id="take_id_picture_back"><span class="fa fa-camera"></span></div>
57
					</div>
58
					<div class="ipu-content ipu-content-vertical">
59
						<div class="label">返回结果</div>
60
						<div class="value">
61
							<span class="fa fa-image ipu-image-holder" id="pic_id_back" ></span>
62
						</div>
63
						<div class="info" id="path_back">路径:</div>
64
					</div>
65
					
66
				</div>
37 67
			</div>
38 68
39 69
		</div>