indexpad1.js 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. ////发布的时候,全部置为空
  2. var userid = ""//"10876168-b21d-481e-9a02-1edb5af9853f";
  3. var username = ""//"蔺雪峰";
  4. var oatoken = ""//"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDg3NjE2OC1iMjFkLTQ4MWUtOWEwMi0xZWRiNWFmOTg1M2YiLCJjbGllbnRpZCI6ImFuZHJvaWRjbGllbnQiLCJncmFudF90eXBlIjoicGFzc3dvcmQiLCJzY29wZSI6Im9wZW5pZCBwcm9maWxlIGVtYWlsIFJlZmluZUFQSSIsImV4cCI6MTcwMzk2MDAxMiwiY29uZmlnIjoiMjAyMC0yMDk5In0.9z4RMfCPldMBXaaBuLB_1FEy5VQX2hQt1smTI86nqAM";
  5. var avatar = ""//"http://192.168.3.101:8088/fs/avatar/show/2a7cbdee-9391-cd8b-cd8d-7cc78e88e9bf";
  6. var maintoken = ""//"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI4YTY5OTY2NDg4ODUyMmFhMDE4OGEwMGNjNjA3NjY1MyIsImFwcE5hbWUiOiJPQeWKnuWFrOeuoeeQhiIsImFwcENvZGUiOiJvYWJnZ2wiLCJ0eXBlIjoiVVNFUl9QQVNTV09SRCIsInVzZXJOYW1lIjoi6JS66Zuq5bOwIiwidXNlcklkIjoiOGE2OTk2NjQ4ODg1MjJhYTAxODhhMDBjYzYwNzY2NTMiLCJzZWNyZXRMZXZlbCI6MCwicmFuZG9tIjoiZkJYOGwzIiwibG9naW5OYW1lIjoibGlueHVlZmVuZyIsImFwcElkIjoiOGE1MDJjOGU4NWY2MWQ2YjAxODYyYWJkNzg3MjI1M2EiLCJEc3BUb2tlbiI6Ijc3N2U3YWJiNjUxMmIyZjExZjlkMjBiMWRjZTMwOWQwMTIyYjNkN2IzNmFjNjAxMTExN2Y2OWNlNjcxMDAxMGU1YzNhMWY2NWM3NjgwN2EwIiwiZXhwIjoxNzAwMzYzNjk3LCJpYXQiOjE3MDAzNjAwOTd9.8SIbHoBe-7hiwhzJVWbjTJ9ecEJmWYh9igrjXIVgfTo"
  7. window.addEventListener("flutterInAppWebViewPlatformReady", function () {
  8. window.flutter_inappwebview
  9. .callHandler("getuserinfo", "")
  10. .then(function (res) {
  11. userid = res.username;
  12. username = res.name;
  13. oatoken = res.oatoken;
  14. avatar = res.avatar;
  15. //console.log(JSON.stringify(res));
  16. })
  17. });
  18. function jumpPageParent(id, title, src) {
  19. var setID = "indexpad_page_" + id;
  20. if ($("#iframePart").find("#" + setID).length < 1) {
  21. //$(".sp-wrapper-tabs-box-col").hide();
  22. $("#iframePart .indexpad-page").removeClass("indexpad-current");
  23. $("#iframePart").append("<div class=\"indexpad-page indexpad-current\" id=\"" + setID + "\"><iframe id=\"iframe_" + setID + "\" src=\"" + src + "\" width=\"100%\" height=\"100%\" frameborder=\"0\" scrolling=\"auto\"></iframe></div>");
  24. //$("#" + setID).show();
  25. sp.fitHeight("#iframe_" + setID + "", 0); //设置iframe的高度
  26. } else {
  27. //$(".sp-wrapper-tabs-box-current").hide();
  28. $(".indexpad-page").removeClass("indexpad-current");
  29. var get_oldurl = $("#iframe_" + setID + "").attr("src");
  30. if (get_oldurl != src) {
  31. $("#" + setID).addClass("indexpad-current");
  32. //$("#" + setID).show();
  33. $("#" + setID + " iframe").attr("src", src); ////然后让里面的iframe重新加载点击后的页面
  34. } else {
  35. $("#" + setID).addClass("indexpad-current");
  36. }
  37. sp.fitHeight("#iframe_" + setID + "", 0); //设置iframe的高度
  38. }
  39. //setTimeout(function () {
  40. // var WindowHeight = $(window).height();
  41. // var WindownWidth = $(window).width();
  42. // alert("得到屏幕宽度:" + WindownWidth + ", 屏幕高度:" + WindowHeight);
  43. //}, 1000);
  44. }
  45. setTimeout(function () {
  46. postCfg = {
  47. headers: {
  48. 'Content-Type': 'application/json',
  49. 'Authorization': "Bearer " + self.get_AccessToken
  50. }
  51. };
  52. $.cookie("GlWorkPlatform-userid", userid, { path: '/', expires: 1 });
  53. $.cookie("GlWorkPlatform-chineseName", username, { path: '/', expires: 1 });
  54. $.cookie("GlWorkPlatform-photo", "AFrontEnd/css/icons/photo/02.jpg", { path: '/', expires: 1 });
  55. localStorage.setItem("GlWorkPlatform-AccessToken", oatoken);
  56. //localStorage.setItem("main-token", maintoken);
  57. jumpPageParent("FZ0", "桌面", "tpl/_indexgmtpad/index_2.html");
  58. }, 200);
  59. ///增加设备标识
  60. localStorage.setItem("tjJxtGoldenlinkWork-deviceType", "pad");
  61. //左侧的动态新动态菜单采用angularJS的方式渲染
  62. var app = angular.module('app', []);
  63. app.controller("leftPartCtrl", ["$scope", "$http", "$interval", "$timeout", function ($scope, $http, $interval, $timeout) {
  64. var self = this;
  65. var s4 = new SM4Util();
  66. self.userId = $.cookie("GlWorkPlatform-userid")//userid;
  67. self.userCName = $.cookie("GlWorkPlatform-chineseName")//username;
  68. self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken")//oatoken;
  69. //self.outToken = maintoken;
  70. var postCfg = {
  71. headers: {
  72. 'Content-Type': 'application/json',
  73. 'Authorization': "Bearer " + self.get_AccessToken
  74. }
  75. };
  76. self.goBackHome = function () {
  77. jumpPageParent("FZ0", "桌面", "tpl/_indexgmtpad/index_2.html");
  78. }
  79. //获取上传附件文件格式限制----20230517
  80. uploadformat = [];
  81. function getUploadFormat() {
  82. var data = { tablename: "CODE_UPLOADFORMAT" }
  83. $http.post(apiurljs.login + "g2app/DangAn/queryCodeData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  84. .success(function (obj) {
  85. var res = strToJson(s4.decryptData_CBC(obj.data));
  86. uploadformat = res.data;
  87. })
  88. };
  89. getUploadFormat()
  90. //获取大平台token
  91. self.getMainToken = function () {
  92. $http.post(apiurljs.login + "g2app/usercertification/querySSOToken", { data: s4.encryptData_CBC(JSON.stringify({ userid: self.userId })) }, postCfg)
  93. .success(function (obj) {
  94. var res = strToJson(s4.decryptData_CBC(obj.data))
  95. localStorage.setItem("main-token", res.data);
  96. self.outToken = res.data;
  97. })
  98. }
  99. self.getMainToken()
  100. $interval(function () {
  101. var data = {
  102. token: self.outToken
  103. }
  104. $http.post(apiurljs.login + "g2app/usercertification/loginToken", JSON.stringify(data), postCfg)
  105. .success(function (obj) {
  106. var res = strToJson(s4.decryptData_CBC(obj.data));
  107. if (res.success == true) {
  108. localStorage.setItem("main-token", res.data);
  109. self.outToken = res.data;
  110. }
  111. })
  112. }, 21600000)
  113. }]);