123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- <!DOCTYPE html>
- <html lang="en" >
- <head>
- <meta charset="UTF-8">
- <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
-
- <script type="text/javascript" src="__VENDOR__/cordova/index.js"></script>
- <script type="text/javascript" src="__VENDOR__/cordova/android/cordova_plugins.js"></script>
- <script type="text/javascript" src="__VENDOR__/cordova/android/cordova.js"></script>
- <script type="text/javascript" src="__VENDOR__/cordova/android/plugins/cordova-plugin-device/www/device.js"></script>
- <script type="text/javascript" src="__VENDOR__/cordova/android/plugins/cordova-plugin-splashscreen/www/splashscreen.js"></script>
- <script type="text/javascript" src="__VENDOR__/cordova/android/plugins/cordova-plugin-statusbar/www/statusbar.js"></script>
- <script type="text/javascript" src="__VENDOR__/cordova/android/plugins/jpush-phonegap-plugin/www/JPushPlugin.js"></script>
- <title>test jpush</title>
- </head>
- <body>
- <h3>welcome to usky tech2...</h3>
- </body>
- <script>
- // const Storage = {};
- // Storage.get = function (name) {
- // return JSON.parse(localStorage.getItem(name));
- // }
- // Storage.set = function (name, val) {
- // localStorage.setItem(name, JSON.stringify(val))
- // }
- // Storage.add = function (name, addVal) {
- // let oldVal = Storage.get(name);
- // let newVal = oldVal.concat(addVal);
- // Storage.set(name, newVal);
- // }
- // export default Storage;
- // localStorage.lastname="Smith";
- alert("=2="+localStorage.getItem('tagPhone'));
- document.addEventListener('deviceready', function(){
- var jpush = window.plugins && window.plugins.jPushPlugin;
- // console.log(4444);
- //
- // http://www.jd-ioe.com/jdxf/wxapp/Home/View/Public/cordova/android/test.appcache
- // http://www.jd-ioe.com/jdxf/wxapp/Home/View/Public/cordova/android/test.appcache
- // function getExtras(event) { // manifest="test.appcache"
- // let extras = event.extras || {};
- // if (/iPhone/i.test(navigator.userAgent)) {
- // extras.sound = event.sound;
- // }
- // return extras;
- // }
- // function setTags() {
- // if (jpush) {
- // let tags = ['13900000000'];
- // jpush.setTags(tags, function (errorcode) {
- // console.log(`设置${tags} 标签, errorcode 值${errorcode}`)
- // }, function (e) {
- // console.log('设置标签错误:' + e);
- // });
- // }
- // setTags();
- document.removeEventListener("jpush.openNotification");
- document.removeEventListener("jpush.receiveNotification");
- // document.addEventListener("jpush.openNotification",function(event){
- // console.log(111);
- // }, false);
- document.addEventListener("jpush.openNotification",function(event){
- // console.log(1111);
- window.location.href = "http://www.baidu.com";
- }, false);
- // document.addEventListener("jpush.openNotification",function(event){
- // let extras = getExtras(event);
- //...do something
- // var msgBody = JSON.parse(event.alert);
- // if(msgBody.evt=='U44'){
- // window.location.href = "http://www.jd-ioe.com/jdxf/wxapp.php/Home/Index/index";
- // window.location.href = "http://www.jd-ioe.com/jdxf/wxapp.php/Home/Semi/index";
- // }
- // alert(event.title);
- // alert(event.extras.sound);
- // }, false);
- document.addEventListener("jpush.receiveNotification",function(event){
- // console.log(333);
- // let extras = getExtras(event);
- // window.location.href = "http://www.jd-ioe.com/jdxf/wxapp.php/Home/Index/index";
- // window.location.href = "http://www.jd-ioe.com/jdxf/wxapp.php/Home/Semi/index";
- window.location.href = "http://www.163.com";
- // console.log(222);
- // console.log(event);
- //...do something
- }, false);
- // document.addEventListener("jpush.receiveMessage", function (event) {
- // console.log(222);
- // var message;
- // if(device.platform == "Android") {
- // message = event.message;
- // window.location.href = "http://www.jd-ioe.com/jdxf/wxapp.php/Home/Index/index";
- // window.location.href = "http://www.jd.com";
- // } else {
- // message = event.content;
- // }
- // }, false);
- }, false);
- </script>
- </html>
|