index.html 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <!DOCTYPE html>
  2. <html lang="en" >
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
  6. <script type="text/javascript" src="__VENDOR__/cordova/index.js"></script>
  7. <script type="text/javascript" src="__VENDOR__/cordova/android/cordova_plugins.js"></script>
  8. <script type="text/javascript" src="__VENDOR__/cordova/android/cordova.js"></script>
  9. <script type="text/javascript" src="__VENDOR__/cordova/android/plugins/cordova-plugin-device/www/device.js"></script>
  10. <script type="text/javascript" src="__VENDOR__/cordova/android/plugins/cordova-plugin-splashscreen/www/splashscreen.js"></script>
  11. <script type="text/javascript" src="__VENDOR__/cordova/android/plugins/cordova-plugin-statusbar/www/statusbar.js"></script>
  12. <script type="text/javascript" src="__VENDOR__/cordova/android/plugins/jpush-phonegap-plugin/www/JPushPlugin.js"></script>
  13. <title>test jpush</title>
  14. </head>
  15. <body>
  16. <h3>welcome to usky tech2...</h3>
  17. </body>
  18. <script>
  19. // const Storage = {};
  20. // Storage.get = function (name) {
  21. // return JSON.parse(localStorage.getItem(name));
  22. // }
  23. // Storage.set = function (name, val) {
  24. // localStorage.setItem(name, JSON.stringify(val))
  25. // }
  26. // Storage.add = function (name, addVal) {
  27. // let oldVal = Storage.get(name);
  28. // let newVal = oldVal.concat(addVal);
  29. // Storage.set(name, newVal);
  30. // }
  31. // export default Storage;
  32. // localStorage.lastname="Smith";
  33. alert("=2="+localStorage.getItem('tagPhone'));
  34. document.addEventListener('deviceready', function(){
  35. var jpush = window.plugins && window.plugins.jPushPlugin;
  36. // console.log(4444);
  37. //
  38. // http://www.jd-ioe.com/jdxf/wxapp/Home/View/Public/cordova/android/test.appcache
  39. // http://www.jd-ioe.com/jdxf/wxapp/Home/View/Public/cordova/android/test.appcache
  40. // function getExtras(event) { // manifest="test.appcache"
  41. // let extras = event.extras || {};
  42. // if (/iPhone/i.test(navigator.userAgent)) {
  43. // extras.sound = event.sound;
  44. // }
  45. // return extras;
  46. // }
  47. // function setTags() {
  48. // if (jpush) {
  49. // let tags = ['13900000000'];
  50. // jpush.setTags(tags, function (errorcode) {
  51. // console.log(`设置${tags} 标签, errorcode 值${errorcode}`)
  52. // }, function (e) {
  53. // console.log('设置标签错误:' + e);
  54. // });
  55. // }
  56. // setTags();
  57. document.removeEventListener("jpush.openNotification");
  58. document.removeEventListener("jpush.receiveNotification");
  59. // document.addEventListener("jpush.openNotification",function(event){
  60. // console.log(111);
  61. // }, false);
  62. document.addEventListener("jpush.openNotification",function(event){
  63. // console.log(1111);
  64. window.location.href = "http://www.baidu.com";
  65. }, false);
  66. // document.addEventListener("jpush.openNotification",function(event){
  67. // let extras = getExtras(event);
  68. //...do something
  69. // var msgBody = JSON.parse(event.alert);
  70. // if(msgBody.evt=='U44'){
  71. // window.location.href = "http://www.jd-ioe.com/jdxf/wxapp.php/Home/Index/index";
  72. // window.location.href = "http://www.jd-ioe.com/jdxf/wxapp.php/Home/Semi/index";
  73. // }
  74. // alert(event.title);
  75. // alert(event.extras.sound);
  76. // }, false);
  77. document.addEventListener("jpush.receiveNotification",function(event){
  78. // console.log(333);
  79. // let extras = getExtras(event);
  80. // window.location.href = "http://www.jd-ioe.com/jdxf/wxapp.php/Home/Index/index";
  81. // window.location.href = "http://www.jd-ioe.com/jdxf/wxapp.php/Home/Semi/index";
  82. window.location.href = "http://www.163.com";
  83. // console.log(222);
  84. // console.log(event);
  85. //...do something
  86. }, false);
  87. // document.addEventListener("jpush.receiveMessage", function (event) {
  88. // console.log(222);
  89. // var message;
  90. // if(device.platform == "Android") {
  91. // message = event.message;
  92. // window.location.href = "http://www.jd-ioe.com/jdxf/wxapp.php/Home/Index/index";
  93. // window.location.href = "http://www.jd.com";
  94. // } else {
  95. // message = event.content;
  96. // }
  97. // }, false);
  98. }, false);
  99. </script>
  100. </html>