browser.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. function browserGenPage() {
  2. var page = '<div id="browser_page" style="display: block;">\
  3. <div class="maintitle">\
  4. <div>业务浏览器设置</div>\
  5. <div class="page_description_text">业务浏览器是基于Chromium内核自主定制开发。\
  6. </div>\
  7. </div>\
  8. <div id="browserContent">\
  9. <div id="browser_all_content">\
  10. <div id="browser_prompt" class="page_prompt_info page_scenes_info_text hide" style="display: none;"></div>\
  11. <div class="clearboth" id="browser_cache_btn_save_div" style="padding-top:50px">\
  12. <div class="control-label" style="margin-top: 8px;">&nbsp;</div>\
  13. <div class="controls"><button class="btn_normal_long"\
  14. id="browser_btn_save">浏览器缓存清理</button></div>\
  15. </div>\
  16. <div class="clearboth" id="browser_sogou_btn_save_div" style="padding-top:50px">\
  17. <div class="control-label" style="margin-top: 8px;">&nbsp;</div>\
  18. <div class="controls"><button class="btn_normal_long"\
  19. id="browser_sogou_btn_restart">重启搜狗输入法服务(针对异常情况)</button></div>\
  20. </div>\
  21. <div class="clearboth" id="browser_sogou_btn_fetch_div" style="padding-top:50px">\
  22. <div class="control-label" style="margin-top: 8px;">&nbsp;</div>\
  23. <div class="controls"><button class="btn_normal_long"\
  24. id="browser_sogou_btn_fetch">搜狗输入法信息快照</button></div>\
  25. </div>\
  26. <div class="clearboth" style="padding-top:70px"></div>\
  27. </div>\
  28. </div>\
  29. <div id="browser_activation_content" class="page_prompt_info page_scenes_info_text hide">\
  30. </div>\
  31. </div></div>';
  32. $("#rightpagearea").prepend(page);
  33. if (typeof browserRenderPage == "function") {
  34. beforeRenderPage("browser");
  35. browserRenderPage();
  36. afterRenderPage("browser");
  37. }
  38. }
  39. var browserController = (function() {
  40. function updateBrowserCacheClearFlag() {
  41. let req = new Request();
  42. req.configType = 3; //RunConfig
  43. req.section = 'Browser';
  44. req.option = true; //Write
  45. req.key = 'CacheClear';
  46. req.reserved1 = 0;
  47. req.reserved2 = 0;
  48. req.reserved3 = 'true';
  49. req.reserved4 = '';
  50. utilStartSubmitDialog();
  51. RVC.DeviceControlEntityCtrl.ReadConfigValue(req, function(ret) {
  52. utilStopSubmitDialog();
  53. if (ret.errorCode === 0) {
  54. utilStartAlertDialog("清理指令已下发,请重启应用以进行浏览器缓存清理。");
  55. } else {
  56. RVC.DeviceControlEntityCtrl.commErrorCallback(ret);
  57. }
  58. });
  59. }
  60. function restartSogouSrvRestartFlag() {
  61. let req = new Request();
  62. req.configType = 3; //RunConfig
  63. req.section = 'Browser';
  64. req.option = true; //Write
  65. req.key = 'SogouRestart';
  66. req.reserved1 = 0;
  67. req.reserved2 = 0;
  68. req.reserved3 = 'true';
  69. req.reserved4 = '';
  70. utilStartSubmitDialog();
  71. RVC.DeviceControlEntityCtrl.ReadConfigValue(req, function(ret) {
  72. utilStopSubmitDialog();
  73. if (ret.errorCode === 0) {
  74. utilStartAlertDialog("重启指令已下发,请重启应用以执行该操作。");
  75. } else {
  76. RVC.DeviceControlEntityCtrl.commErrorCallback(ret);
  77. }
  78. });
  79. }
  80. function FetchSogouInputInfo() {
  81. let req = new Request();
  82. req.configType = 0;
  83. req.section = 'SougouInput';
  84. req.option = false;
  85. req.key = 'Snapshot';
  86. req.reserved1 = 0;
  87. req.reserved2 = 0;
  88. req.reserved3 = '';
  89. req.reserved4 = '';
  90. utilStartSubmitDialog();
  91. RVC.DeviceControlEntityCtrl.ReadConfigValue(req, function(ret) {
  92. utilStopSubmitDialog();
  93. if (ret.errorCode === 0) {
  94. let result = JSON.parse(ret[RVC.EntityController.sigResponseUUID])
  95. if(result.reserved3 === '') {
  96. utilStartAlertDialog("操作成功!");
  97. } else {
  98. utilStartAlertDialog(result.reserved3);
  99. }
  100. } else {
  101. RVC.DeviceControlEntityCtrl.commErrorCallback(ret);
  102. }
  103. });
  104. }
  105. function saveButtonHandle() {
  106. updateBrowserCacheClearFlag();
  107. }
  108. function initPage() {
  109. $(document).on('click', '#browser_btn_save', saveButtonHandle);
  110. $(document).on('click', '#browser_sogou_btn_restart', restartSogouSrvRestartFlag);
  111. $(document).on('click', '#browser_sogou_btn_fetch', FetchSogouInputInfo);
  112. }
  113. var fistTime = true;
  114. function init() {
  115. if (fistTime) {
  116. fistTime = false;
  117. }
  118. initPage();
  119. }
  120. return { init: init };
  121. }());
  122. window.browserRenderPage = function () {
  123. browserController.init();
  124. };