浏览代码

添加自定义相机按钮

Mac 6 年之前
父节点
当前提交
cb874899a7

+ 2 - 0
show-server/src/main/resources/server-page.xml

@ -9,6 +9,8 @@
9 9
    <action name="Map" 		template="template/webapp/plugins/map.html"></action>
10 10
    <action name="Photo" 	template="template/webapp/plugins/photo.html"></action>
11 11
    <action name="CustomCamera" template="template/webapp/plugins/customCamera.html"></action>
12
    <!-- 自定义拍照插件可根据参数旋转图片 -->
13
    <action name="CustomCameraOrientation" template="template/webapp/plugins/customCameraOrientation.html"></action>
12 14
    <action name="File" 	template="template/webapp/plugins/file/file.html"></action>
13 15
    <action name="FileDetail" template="template/webapp/plugins/file/fileDetail.html"></action>
14 16
    <action name="Storage" 	template="template/webapp/plugins/storage.html"></action>

+ 49 - 0
show-server/src/main/webapp/biz/js/plugins/customCameraOrientation.js

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

+ 4 - 3
show-server/src/main/webapp/biz/js/plugins/pageHandler/pageHandler.js

@ -24,16 +24,17 @@ require([ "wadeMobile", "mobile", "jcl" ], function(WadeMobile, Mobile, $) {
24 24
		// 可选按钮:isShare,isSearch,isCoppLink;分享、 搜索、复制链接。
25 25
		// color1,color2,color3:顶部背景色、图标颜色、字体颜色。
26 26
		$("#openUrl").click(function() {
27
			var url = "https://www.baidu.com";
27
//			var url = "https://www.baidu.com";
28
			var url = "https://hs.zxpt.vsens.com/mobile/homepage";
28 29
			var title = "自定义主题";
29 30
			var style = [ "#8BCBE4", "#FFFFFF", "#FFFFFF" ];
30
			var buttons = [ true, false, false ];
31
			var buttons = [ true, true, true ];
31 32
			WadeMobile.openUrl(url, function(result) {
32 33
33 34
			}, title, buttons, style);
34 35
		});
35 36
		$("#openUrlNoStyle").click(function() {
36
			var url = "https://www.baidu.com";
37
			var url = "https://hs.zxpt.vsens.com/mobile/homepage";
37 38
			WadeMobile.openUrl(url, function(result) {
38 39
			});
39 40
		});

+ 8 - 2
show-server/src/main/webapp/ipu/frame/mobile/expand-mobile.js

@ -43,10 +43,16 @@ define(["require","jcl"],function(require,Wade) {
43 43
				}
44 44
				storageCallback("getPhoto",callback);
45 45
				execute("getPhoto", [type],err);
46
			},getIdentifyPhoto:function(callback,frameType,resultType,err){//获取照片
46
			},
47
			getIdentifyPhoto:function(callback,frameType,resultType,err){//获取照片
47 48
				storageCallback("getIdentifyPhoto",callback);
48 49
				execute("getIdentifyPhoto", [frameType,resultType],err);
49
			},getPicture:function(callback,type,err){//获取照片
50
			},
51
			getIdentifyPhotoWithOrientation:function(callback,frameType,resultType,orientationType,err){//获取照片可根据参数旋转
52
				storageCallback("getIdentifyPhotoWithOrientation",callback);
53
				execute("getIdentifyPhotoWithOrientation", [frameType,resultType,orientationType],err);
54
			},
55
			getPicture:function(callback,type,err){//获取照片
50 56
				if(type==undefined){
51 57
					type = 1;//0-Base64编码的字符串 1- 文件路径
52 58
				}

+ 73 - 0
show-server/src/main/webapp/template/webapp/plugins/customCameraOrientation.html

@ -0,0 +1,73 @@
1
<!DOCTYPE HTML>
2
<html>
3
<head>
4
	<title>图片/自定义相机带图片旋转</title>
5
	{%>template/common/Head.html%}
6
	<script type="text/javascript" src="biz/js/plugins/customCameraOrientation.js"></script>
7
</head>
8
<body>
9
10
<div class="ipu-row-flex ipu-row-flex-ver">
11
		<div class="ipu-col ipu-col-auto">
12
			<header class="ipu-toolbar">
13
				<span class="ipu-icon fa fa-chevron-left ipu-fn-left" id="left-btn"></span> 
14
				<span class="ipu-icon fa fa-home  ipu-fn-right" id="right-btn"></span>
15
				<h1 class="ipu-toolbar-title">带头像框的拍照</h1>
16
			</header>
17
		</div>
18
		
19
		<div id="scroll-container" class="ipu-col">
20
21
			<div>
22
				<div class="demo-desc">拍照</div>
23
				<div class="ipu-card ">
24
					<div class="ipu-content ipu-border-b">
25
						<div class="label">人脸拍照</div>
26
						<div class="fn" id="face_picture"><span class="fa fa-camera"></span></div>
27
					</div>
28
					<div class="ipu-content ipu-content-vertical">
29
						<div class="label">返回结果</div>
30
						<div class="value">
31
							<span class="fa fa-image ipu-image-holder" id="pic" ></span>
32
						</div>
33
						<div class="info" id="path">路径:</div>
34
					</div>
35
					
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>
67
			</div>
68
69
		</div>
70
</div>
71
72
</body>
73
</html>

+ 10 - 0
show-server/src/main/webapp/template/webapp/plugins/pluginIndex.html

@ -20,6 +20,16 @@
20 20
	        <p>相机</p>
21 21
	    </li>
22 22
	    
23
	    <li class="ipu-col-33 ipu-text-center" data-action="CustomCamera">
24
	        <span class="ipu-icon fa fa-camera"></span>
25
	        <p>自定义相机</p>
26
	    </li>
27
	    
28
	    <li class="ipu-col-33 ipu-text-center" data-action="CustomCameraOrientation">
29
	        <span class="ipu-icon fa fa-camera"></span>
30
	        <p>自定义相机带图片旋转</p>
31
	    </li>
32
	    
23 33
	    <li class="ipu-col-33 ipu-text-center" data-action="File">
24 34
	        <span class="ipu-icon fa fa-folder-open"></span>
25 35
	        <p>文件</p>