indexpad.js 7.2 KB

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