SettingCloud.js 4.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. MWF.xDesktop.requireApp("Setting", "Document", null, false);
  2. MWF.xApplication.Setting.CloudConnectDocument = new Class({
  3. Extends: MWF.xApplication.Setting.Document,
  4. load: function(){
  5. this.node = new Element("div", {"styles": {"overflow": "hidden", "padding-bottom": "80px"}}).inject(this.contentAreaNode);
  6. // 第一步 O2云连接检查
  7. this.firstStepTitleName = new Element("div", {"styles": this.explorer.css.explorerContentTitleNode}).inject(this.node);
  8. this.firstStepTitleName.set("text", this.lp.mobile_connect_first_cloud_check);
  9. // 查询是否已经连接登录到O2云
  10. var o2CloudConnected = false;
  11. this.actions.collectValidate(function(json){
  12. o2CloudConnected = json.data.value;
  13. }.bind(this), function(json){
  14. o2CloudConnected = false;
  15. }.bind(this), false);
  16. this.firstStepSubTitle = new Element("div", {"styles": this.explorer.css.explorerContentTitleSubNode}).inject(this.node);
  17. this.firstStepSubTitle.set("html", o2CloudConnected ? this.lp.mobile_connect_first_cloud_check_connected : this.lp.mobile_connect_first_cloud_check_disconnected);
  18. // 第二步 外网连接配置
  19. this.titleName = new Element("div", {"styles": this.explorer.css.explorerContentTitleNode}).inject(this.node);
  20. this.titleName.set("text", this.lp.mobile_connect_connectSetting);
  21. this.mobileHttpProtocolInput = new MWF.xApplication.Setting.Document.Select(this.explorer, this.node, {
  22. "lp": {"title": this.lp.mobile_httpProtocol, "infor": this.lp.mobile_httpProtocol_infor},
  23. "data": {"key": "proxyData", "valueKey": "httpProtocol"},
  24. "value": this.explorer.proxyData.httpProtocol,
  25. "options": [{"value": "http", "text": "http"}, {"value": "https", "text": "https"}]
  26. });
  27. this.mobileCenterInput = new MWF.xApplication.Setting.Document.List(this.explorer, this.node, {
  28. "lp": {"title": this.lp.mobile_center, "infor": this.lp.mobile_center_infor, "editAction": this.lp.mobile_center_action},
  29. "data": {"key": "proxyData", "valueKey": "center", "notEmpty": false},
  30. "value": this.explorer.proxyData.center,
  31. "itemTitle": "{proxyHost}:{proxyPort}",
  32. "icon": "center.png"
  33. });
  34. this.mobileWebInput = new MWF.xApplication.Setting.Document.List(this.explorer, this.node, {
  35. "lp": {"title": this.lp.mobile_web, "infor": this.lp.mobile_web_infor, "editAction": this.lp.mobile_web_action},
  36. "data": {"key": "proxyData", "valueKey": "web", "notEmpty": false},
  37. "value": this.explorer.proxyData.web,
  38. "itemTitle": "{proxyHost}:{proxyPort}",
  39. "icon": "webserver.png"
  40. });
  41. this.mobileApplicationInput = new MWF.xApplication.Setting.Document.List(this.explorer, this.node, {
  42. "lp": {"title": this.lp.mobile_application, "infor": this.lp.mobile_application_infor, "editAction": this.lp.mobile_application_action},
  43. "data": {"key": "proxyData", "valueKey": "applicationList", "notEmpty": false},
  44. "value": this.explorer.proxyData.applicationList,
  45. "itemTitle": "{proxyHost}:{proxyPort}",
  46. "readonly": ["node"],
  47. "icon": "server.png"
  48. });
  49. // 第三步 检查连接用的二维码
  50. this.thirdStepTitleName = new Element("div", {"styles": this.explorer.css.explorerContentTitleNode}).inject(this.node);
  51. this.thirdStepTitleName.set("text", this.lp.mobile_connect_third_mobile_connect_check);
  52. this.thirdStepSubTitle = new Element("div", {"styles": this.explorer.css.explorerContentTitleSubNode}).inject(this.node);
  53. this.thirdStepSubTitle.set("html", this.lp.mobile_connect_third_mobile_connect_check_info);
  54. // 生成二维码按钮
  55. this.thirdStepQrcodeNode = new Element("div", {"styles": this.css.explorerContentItemQrcodeNode}).inject(this.node);
  56. this.thirdStepQrcodeGenerateButton = new Element("div", {"styles": this.css.explorerContentItemButton, "html": this.lp.mobile_connect_third_mobile_connect_check_generate_button}).inject(this.thirdStepQrcodeNode);
  57. this.thirdStepQrcodeGenerateButton.addEvent("click", this.showQrcode.bind(this));
  58. },
  59. showQrcode: function() {
  60. o2.Actions.load("x_program_center").CollectAction.mobileCheckConnect(function(json){
  61. this.thirdStepQrcodeNode.empty();
  62. // 生成二维码
  63. new Element("img", {
  64. src: "data:image/png;base64," + json.data.qrcode
  65. }).inject(this.thirdStepQrcodeNode);
  66. }.bind(this));
  67. }
  68. });