onenethelper.np.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. var oneNetHelper_np=new Object();
  2. oneNetHelper_np.isAvailable = false;
  3. oneNetHelper_np.IsAddonAvailable = function ()
  4. {
  5. if(!oneNetHelper_np.isAvailable)
  6. {
  7. oneNetHelper_np.isAvailable = (plugin) ? true : false;
  8. if(oneNetHelper_np.isAvailable)
  9. {
  10. try
  11. {
  12. //AuthClientCtrl.Test();
  13. }
  14. catch(e)
  15. {
  16. alert("plugin.Test失败!");
  17. }
  18. }
  19. else
  20. {
  21. alert("加载plugin 对象失败!");
  22. }
  23. }
  24. return oneNetHelper_np.isAvailable;
  25. }
  26. oneNetHelper_np.AddonAvailableNotify = function (notify_web)
  27. {
  28. setTimeout(function (){
  29. var resp = {};
  30. resp['addon']=oneNetHelper_np.IsAddonAvailable();
  31. notify_web(resp);
  32. }, 0);
  33. }
  34. oneNetHelper_np.GetUASToken = function (notify_web)
  35. {
  36. alert("GetUASToken np插件未实现");
  37. }
  38. oneNetHelper_np.GetUserInfo = function (notify_web)
  39. {
  40. var msg = {};
  41. msg['logid'] = 'GetUserInfo';
  42. msg['action'] = 'UIGetUserInfo';
  43. msg['data'] = "";
  44. var req = JSON.stringify(msg);
  45. setTimeout(function (){
  46. var resp = {};
  47. var outStr = plugin.HandleJsonReq(req);
  48. resp = JSON.parse(outStr);
  49. notify_web(resp);
  50. }, 0);
  51. }
  52. oneNetHelper_np.GetSignAndToken = function (randomnum, notify_web)
  53. {
  54. /*1.调整np插件获取令牌的anction为GetSignAndToken,保持与非np插件一致;
  55. 2.同时为兼容旧版本客户端,当outStr为空时,需调用action UIGetSignAndToken*/
  56. var msg = {};
  57. var hostname = location.hostname;
  58. msg['logid'] = 'GetSignAndToken';
  59. msg['action'] = 'GetSignAndToken';
  60. msg['data'] = randomnum;
  61. msg['appServerAddr'] = hostname;
  62. var req = JSON.stringify(msg);
  63. setTimeout(function (){
  64. var resp = {};
  65. var outStr = plugin.HandleJsonReq(req);
  66. if(outStr != '{}')
  67. {
  68. resp = JSON.parse(outStr);
  69. notify_web(resp);
  70. }
  71. else
  72. {
  73. msg['action'] = 'UIGetSignAndToken';
  74. req = JSON.stringify(msg);
  75. outStr = plugin.HandleJsonReq(req);
  76. resp = JSON.parse(outStr);
  77. notify_web(resp);
  78. }
  79. }, 0);
  80. }
  81. oneNetHelper_np.GetUserCertInfo = function (notify_web)
  82. {
  83. var msg = {};
  84. msg['logid'] = 'UIGetCertInfo';
  85. msg['action'] = 'UIGetCertInfo';
  86. msg['data'] = "";
  87. var req = JSON.stringify(msg);
  88. setTimeout(function (){
  89. var resp = {};
  90. var outStr = plugin.HandleJsonReq(req);
  91. resp = JSON.parse(outStr);
  92. notify_web(resp);
  93. }, 0);
  94. }
  95. oneNetHelper_np.Login = function (appToken,username,userpwd,authtype,svctype, gw_id, notify_web)
  96. {
  97. alert("Login np插件未实现");
  98. }
  99. oneNetHelper_np.SSLUsbKeyLogin = function (appToken,gw_id,key_pin,notify_web)
  100. {
  101. alert("SSLUsbKeyLogin np插件未实现");
  102. }
  103. oneNetHelper_np.SSLUserPwdLogin = function (appToken,gw_id,username,userpwd,notify_web)
  104. {
  105. alert("SSLUserPwdLogin np插件未实现");
  106. }
  107. oneNetHelper_np.IPSecUsbKeyLogin = function (appToken,gw_id,key_pin,notify_web)
  108. {
  109. alert("IPSecUsbKeyLogin np插件未实现");
  110. }
  111. oneNetHelper_np.Logout = function (appToken,notify_web)
  112. {
  113. alert("Logout np插件未实现");
  114. }
  115. oneNetHelper_np.QuerySecPortalStatus = function (appToken,notify_web)
  116. {
  117. alert("QuerySecPortalStatus np插件未实现");
  118. }
  119. oneNetHelper_np.HeartBeat = function (appToken,notify_web)
  120. {
  121. alert("HeartBeat np插件未实现");
  122. }
  123. oneNetHelper_np.GetWebServiceAddr = function (notify_web)
  124. {
  125. alert("GetWebServiceAddr np插件未实现");
  126. }
  127. oneNetHelper_np.GetGateWayAddrList = function (notify_web)
  128. {
  129. var msg = {};
  130. msg['logid'] = 'GetGateWayAddrList';
  131. msg['action'] = 'GetGateWayAddrList';
  132. msg['data'] = "";
  133. var req = JSON.stringify(msg);
  134. setTimeout(function (){
  135. var resp = {};
  136. var outStr = plugin.HandleJsonReq(req);
  137. resp = JSON.parse(outStr);
  138. notify_web(resp);
  139. }, 0);
  140. }