Browse Source

新增涂鸦插件功能&及对接摇一摇监听案列

leijie 4 years ago
parent
commit
f9cfdd3299

+ 41 - 12
show-server/src/main/webapp/biz/js/plugins/sensor.js

@ -1,16 +1,45 @@
1
require(["ipuMobile","jquery"], function(IpuMobile,$) {
1
require(["ipuMobile","jcl","jquery","ipuUI"], function(IpuMobile,jcl,$,ipuUI) {
2 2
3
    var isApp = true;
3
    $.sizeReady(function(){
4 4
5
    $("#startShakeListener").click(function () {
6
        IpuMobile.startShakeListener(function (result) {
7
            alert(result);
8
        },isApp);
9
    });
5
        var isApp = false;
6
7
        $("#startShakeListener").click(function () {
8
            IpuMobile.startShakingListener(function (result) {
9
                alert(result);
10
            },isApp);
11
        });
12
13
        $("#stopShakeListener").click(function () {
14
            IpuMobile.stopShakingListener(function (result) {
15
                alert(result);
16
            },isApp);
17
        });
18
19
        IpuMobile.listenerEvent("ipuShake",function (result) {
20
            var paintColor = -16711936;
21
            var paintWidth = 15;
22
            var paintData = new jcl.DataMap();
23
            paintData.put("paintColor",paintColor);
24
            paintData.put("paintWidth",paintWidth);
25
            IpuMobile.captureGraffitiPic(function (result) {
26
                var path;
27
                var data = new jcl.DataMap(result);
28
                var type = parseInt(data.get("type",0));
29
                if(type == 0){
30
                    path = data.get("result");
31
                }
32
                $("#screenCapture_path").html("回调结果:" + path);
33
                $("#screenCapture_pic").html("<img src='" + path + "' style='max-width:60%;'/>");
34
            },0,"/sdcard/pic/testPic.png",paintData.toString(),"应用将截取您屏幕上显示的所有内容");
35
            // var type = 0;
36
            // var isSaveToPhoto = 1;
37
            // IpuMobile.noStatusScreenCapture(function(path) {
38
            //     $("#screenCapture_path").html("回调结果:" + path);
39
            //     $("#screenCapture_pic").html("<img src='" + path + "' style='max-width:60%;'/>");
40
            // },type,isSaveToPhoto);
41
        });
10 42
11
    $("#stopShakeListener").click(function () {
12
        IpuMobile.stopShakeListener(function (result) {
13
            alert(result);
14
        },isApp);
15 43
    });
16
})
44
45
});

+ 13 - 1
show-server/src/main/webapp/ipu/frame/mobile/expand-mobile.js

@ -636,7 +636,19 @@ define(["require","jcl"],function(require,Wade) {
636 636
            },stopShakeListener:function (callback,isApp) {
637 637
            	storageCallback("stopShakeListener",callback);
638 638
            	execute("stopShakeListener",[isApp]);
639
        	}
639
        	},startShakingListener:function (callback,isApp) {
640
                storageCallback("startShakingListener",callback);
641
                execute("startShakingListener",[isApp]);
642
            },stopShakingListener:function () {
643
                storageCallback("stopShakingListener",callback);
644
                execute("stopShakingListener",[isApp]);
645
            },captureGraffitiPic:function (callback,type,info,paintData,title) {
646
				storageCallback("captureGraffitiPic",callback);
647
				execute("captureGraffitiPic",[type,info,paintData,title]);
648
            },graffitiPic:function (callback,type,info,paintData) {
649
				storageCallback("graffitiPic",callback);
650
				execute("graffitiPic",[type,info,paintData]);
651
            }
640 652
		};
641 653
	})();
642 654
	

+ 11 - 0
show-server/src/main/webapp/template/webapp/plugins/sensor.html

@ -41,8 +41,19 @@
41 41
                    </div>
42 42
                </div>
43 43
            </div>
44
45
            <div class="ipu-card ipu-card-block">
46
                <div class="ipu-card-content">
47
                    <div class="ipu-card-content-inner">
48
                        <div class="">截屏调用结果信息</div>
49
                        <div id="screenCapture_pic"></div>
50
                        <div id="screenCapture_path"></div>
51
                    </div>
52
                </div>
53
            </div>
44 54
        </div>
45 55
    </div>
56
46 57
</div>
47 58
48 59
</body>