123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291 |
- function browserGenPage() {
- var page = '<div id="browser_page" style="display: block;">\
- <div class="maintitle">\
- <div>业务浏览器设置</div>\
- <div class="page_description_text">业务浏览器基于Chromium内核开发。\
- </div>\
- </div>\
- <div id="browserContent">\
- <div id="browser_all_content">\
- <div id="browser_prompt" class="page_prompt_info page_scenes_info_text hide"\
- style="display: none;"></div>\
- <div class="clearboth" id="browser_btn_save_div" style="padding-top:50px">\
- <div class="control-label" style="margin-top: 8px;"> </div>\
- <div class="controls"><button class="btn_normal_long btn"\
- id="browser_btn_save">浏览器缓存清理</button></div>\
- </div>\
- <div class="clearboth" style="padding-top: 40px;">\
- <div style="width: 170px; margin-right: 10px; margin-top: 8px;" class="control-label"\
- lang-id="IDS_lan_ip_filter_mode">使用浏览器</div>\
- <div class="controls" style="margin-top:7px;">\
- <div class="pull-left">\
- <div onclick="radio(this)" name="browser_provider_radio" id="cefclient_browser"\
- class="radio_btn_off"></div>\
- </div>\
- <div class="pull-left" style="width:100px;">第三方</div>\
- <div class="pull-left">\
- <div onclick="radio(this)" name="browser_provider_radio" id="uos_browser"\
- class="radio_btn_on"></div>\
- </div>\
- <div class="pull-left" style="padding-top:0px;">系统自带\
- </div>\
- </div>\
- </div>\
- <div class="clearboth" style="padding-top:20px"></div>\
- </div>\
- <div id="sogou_management_div" style="margin-top: 40px; padding-bottom: 20px; border-bottom: 1px solid rgb(243, 243, 243);">\
- <div style="margin-top: 30px; font-size: 16px; "><span>Sogou输入法</span></div>\
- </div>\
- <div class="clearboth" id="browser_sogou_info_div" style="padding-top:20px">\
- <div class="control-label" style="margin-top: 8px;"> </div>\
- <div class="controls"><span id="sogou_info_detail">无法获取输入法信息</span>\
- </div>\
- </div>\
- <div class="clearboth" id="browser_sogou_btn_save_div" style="padding-top:50px">\
- <div class="control-label" style="margin-top: 8px;"> </div>\
- <div class="controls"><button class="btn_normal_long"\
- id="browser_sogou_btn_restart">重启搜狗输入法服务V3.0</button></div>\
- </div>\
- <div class="clearboth" id="browser_sogou_btn_fetch_div" style="padding-top:50px">\
- <div class="control-label" style="margin-top: 8px;"> </div>\
- <div class="controls"><button class="btn_normal_long"\
- id="browser_sogou_btn_fetch">搜狗输入法信息快照</button></div>\
- </div>\
- </div>\
- <div id="browser_activation_content" class="page_prompt_info page_scenes_info_text hide">\
- </div>\
- </div>';
- $("#rightpagearea").prepend(page);
- if (typeof browserRenderPage == "function") {
- beforeRenderPage("browser");
- browserRenderPage();
- afterRenderPage("browser");
- }
- }
- var browserController = (function() {
- var gCurrentBrowserMode = '0';
- function updateBrowserCacheClearFlag() {
- let req = new Request();
- req.configType = 7; //GlobalCache
- req.section = 'Browser';
- req.option = true; //Write
- req.key = 'CacheClear';
- req.reserved1 = 0;
- req.reserved2 = 0;
- req.reserved3 = 'true';
- req.reserved4 = '';
- utilStartSubmitDialog();
- RVC.DeviceControlEntityCtrl.ReadConfigValue(req, function(ret) {
- utilStopSubmitDialog();
- if (ret.errorCode === 0) {
- utilStartAlertDialog("清理指令已下发,请重启应用以执行浏览器缓存清理。");
- } else {
- RVC.DeviceControlEntityCtrl.commErrorCallback(ret);
- }
- });
- }
- function restartSogouSrvRestartFlag() {
- let req = new Request();
- req.configType = 3; //RunConfig
- req.section = 'Browser';
- req.option = true; //Write
- req.key = 'SogouRestart';
- req.reserved1 = 0;
- req.reserved2 = 0;
- req.reserved3 = 'true';
- req.reserved4 = '';
- utilStartSubmitDialog();
- RVC.DeviceControlEntityCtrl.ReadConfigValue(req, function(ret) {
- utilStopSubmitDialog();
- if (ret.errorCode === 0) {
- utilStartAlertDialog("重启指令已下发,请重启应用以执行该操作。");
- } else {
- RVC.DeviceControlEntityCtrl.commErrorCallback(ret);
- }
- });
- }
- function restartSogouSrv() {
- let req = new Request();
- req.configType = 0;
- req.timeout = 30000;
- req.section = 'SougouInput';
- req.option = false;
- req.key = 'SogouRestart';
- req.reserved1 = 0;
- req.reserved2 = 0;
- req.reserved3 = '';
- req.reserved4 = '';
- utilStartSubmitDialog();
- RVC.DeviceControlEntityCtrl.ReadConfigValue(req, function(ret) {
- utilStopSubmitDialog();
- if (ret.errorCode === 0) {
- utilStartAlertDialog("输入法重启成功,请退出当前页面,继续业务办理。"
- + "<br><br><span style='color:red'>提示:重启后页面唤起输入法可能会耗时较长,请耐心多次点击内容输入框,如果长时间无响应,请再次进入此页面执行重启。</span>");
- } else {
- RVC.DeviceControlEntityCtrl.commErrorCallback(ret);
- }
- });
- }
- function FetchSogouInputInfo() {
- let req = new Request();
- req.configType = 0;
- req.section = 'SougouInput';
- req.option = false;
- req.key = 'Snapshot';
- req.reserved1 = 0;
- req.reserved2 = 0;
- req.reserved3 = '';
- req.reserved4 = '';
- utilStartSubmitDialog();
- RVC.DeviceControlEntityCtrl.ReadConfigValue(req, function(ret) {
- utilStopSubmitDialog();
- if (ret.errorCode === 0) {
- let result = JSON.parse(ret[RVC.EntityController.sigResponseUUID])
- if(result.reserved3 === '') {
- utilStartAlertDialog("操作成功!");
- } else {
- utilStartAlertDialog(result.reserved3);
- }
- } else {
- RVC.DeviceControlEntityCtrl.commErrorCallback(ret);
- }
- });
- }
- function saveButtonHandle() {
- utilStartConfirmDialog("确认要清理浏览器缓存吗?", function() {
- updateBrowserCacheClearFlag();
- });
- }
- function saveBrowserTypeSelect(usingUOS, failCallback) {
- let req = new Request();
- req.configType = 7; //GlobalCache
- req.section = 'BusinessBrowserType';
- req.option = true;
- req.key = 'FultureEx';
- req.reserved1 = 0;
- req.reserved2 = 0;
- if(!usingUOS) {
- req.reserved3 = '1';
- } else {
- req.reserved3 = '0';
- }
- req.reserved4 = '';
- RVC.DeviceControlEntityCtrl.ReadConfigValue(req, function(ret) {
- if (ret.errorCode === 0) {
- utilShowToast('设置成功!请通过重启应用生效');
- } else {
- utilStartAlertDialog("设置失败! ErrorCode: " + ErrorCodeStringfy(ret.errorCode), function(){
- if(failCallback) {
- failCallback();
- }
- });
- }
- });
- }
- function selectBrowserUseMode() {
- $(document).on('click', "[name='browser_provider_radio']", function () {
- if ($('#cefclient_browser').hasClass('radio_btn_on')) {
- gCurrentBrowserMode = '0';
- console.log("cefclient!");
- saveBrowserTypeSelect(false);
- } else {
- gCurrentBrowserMode = '1';
- console.log("uos!");
- saveBrowserTypeSelect(true);
- }
- });
- }
- function initBrowserTypeSelect() {
- let req = new Request();
- req.configType = 7; //GlobalCache
- req.section = 'BusinessBrowserType';
- req.option = false;
- req.key = 'FultureEx';
- req.reserved1 = 0;
- req.reserved2 = 0;
- req.reserved3 = '';
- req.reserved4 = '';
- RVC.DeviceControlEntityCtrl.ReadConfigValue(req, function(ret) {
- if (ret.errorCode === 0) {
- let result = JSON.parse(ret[RVC.EntityController.sigResponseUUID])
- if(result.value === '1') {
- $('#cefclient_browser').addClass('radio_btn_on').removeClass('radio_btn_off');
- $('#uos_browser').addClass('radio_btn_off').removeClass('radio_btn_on');
- } else {
- $('#uos_browser').addClass('radio_btn_on').removeClass('radio_btn_off');
- $('#cefclient_browser').addClass('radio_btn_off').removeClass('radio_btn_on');
- }
- } else {
- $('#cefclient_browser').addClass('radio_btn_off_disabled').removeClass('radio_btn_on').removeClass('radio_btn_off');
- $('#uos_browser').addClass('radio_btn_off_disabled').removeClass('radio_btn_on').removeClass('radio_btn_off');
- }
- });
- }
- function initSogouVersionInfo()
- {
- let req = new Request();
- req.mode = 1;
- RVC.ResourceWatcherEntity.GetThirdPartyInstallState(req, function(ret) {
- if (ret.errorCode === 0) {
- let result = JSON.parse(ret[RVC.EntityController.sigResponseUUID])
- if(result.status == 1) {
- const version = result.version;
- const path = result.path;
- const installTime = result.reserverd1;
- var value = "当前版本:" + version + "<br/>";
- value += "安装时间:" + installTime + "<br/>";
- console.log(value);
- $('#sogou_info_detail').html(value);
- } else {
- var value = "输入法未安装或未启动!!";
- $('#sogou_info_detail').html(value);
- }
- } else {
- var value = "获取输入法版本失败:" + ErrorCodeStringfy(ret.errorCode);
- $('#sogou_info_detail').html(value);
- }
- });
- }
- function initPage() {
- $(document).on('click', '#browser_btn_save', saveButtonHandle);
- $(document).on('click', '#browser_sogou_btn_restart', restartSogouSrv);
- $(document).on('click', '#browser_sogou_btn_fetch', FetchSogouInputInfo);
-
- selectBrowserUseMode();
-
- initSogouVersionInfo();
- initBrowserTypeSelect();
- }
- var fistTime = true;
- function init() {
- if (fistTime) {
- fistTime = false;
- }
- initPage();
- }
-
- return { init: init };
- }());
- window.browserRenderPage = function () {
- browserController.init();
- };
|