base.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572
  1. layout = window.layout || {};
  2. layout.desktop = layout;
  3. layout.desktop.type = "app";
  4. var locate = window.location;
  5. layout.protocol = locate.protocol;
  6. layout.inBrowser = true;
  7. layout.session = layout.session || {};
  8. layout.debugger = (locate.href.toString().indexOf("debugger") !== -1);
  9. layout.anonymous = (locate.href.toString().indexOf("anonymous") !== -1);
  10. o2.xApplication = o2.xApplication || {};
  11. o2.xDesktop = o2.xDesktop || {};
  12. o2.xDesktop.requireApp = function (module, clazz, callback, async) {
  13. o2.requireApp(module, clazz, callback, async);
  14. };
  15. (function (layout) {
  16. layout.readys = [];
  17. layout.addReady = function () {
  18. for (var i = 0; i < arguments.length; i++) {
  19. if (o2.typeOf(arguments[i]) === "function") layout.readys.push(arguments[i]);
  20. }
  21. };
  22. var _requireApp = function (appNames, callback, clazzName) {
  23. var appPath = appNames.split(".");
  24. var baseObject = o2.xApplication;
  25. appPath.each(function (path, i) {
  26. if (i < (appPath.length - 1)) {
  27. baseObject[path] = baseObject[path] || {};
  28. } else {
  29. baseObject[path] = baseObject[path] || { "options": Object.clone(o2.xApplication.Common.options) };
  30. }
  31. baseObject = baseObject[path];
  32. }.bind(this));
  33. if (!baseObject.options) baseObject.options = Object.clone(o2.xApplication.Common.options);
  34. var _lpLoaded = false;
  35. o2.xDesktop.requireApp(appNames, "lp." + o2.language, {
  36. "failure": function () {
  37. o2.xDesktop.requireApp(appNames, "lp.zh-cn", null, false);
  38. }.bind(this)
  39. }, false);
  40. o2.xDesktop.requireApp(appNames, clazzName, function () {
  41. if (callback) callback(baseObject);
  42. });
  43. };
  44. var _createNewApplication = function (e, appNamespace, appName, options, statusObj, inBrowser, taskitem, notCurrent) {
  45. if (options) { options.event = e; } else { options = { "event": e }; }
  46. var app = new appNamespace["Main"](layout.desktop, options);
  47. app.desktop = layout.desktop;
  48. app.status = statusObj;
  49. app.inBrowser = !!(inBrowser || layout.inBrowser);
  50. if (layout.desktop.type === "layout") {
  51. app.appId = (options.appId) ? options.appId : ((appNamespace.options.multitask) ? appName + "-" + (new o2.widget.UUID()) : appName);
  52. app.options.appId = app.appId;
  53. if (!taskitem) taskitem = layout.desktop.createTaskItem(app);
  54. app.taskitem = taskitem;
  55. app.taskitem.app = app;
  56. app.isLoadApplication = true;
  57. app.load(!notCurrent);
  58. if (!layout.desktop.apps) layout.desktop.apps = {};
  59. if (layout.desktop.apps[app.appId]) {
  60. var tmpApp = layout.desktop.apps[app.appId];
  61. } else {
  62. layout.desktop.apps[app.appId] = app;
  63. }
  64. layout.desktop.appArr.push(app);
  65. layout.desktop.appCurrentList.push(app);
  66. if (!notCurrent) layout.desktop.currentApp = app;
  67. //app.taskitem = new MWF.xDesktop.Layout.Taskitem(app, this);
  68. } else {
  69. app.load(true);
  70. layout.app = app;
  71. }
  72. var mask = document.getElementById("appContentMask");
  73. if (mask) mask.destroy();
  74. };
  75. var _openWorkAndroid = function (options) {
  76. if (window.o2android && window.o2android.openO2Work) {
  77. if (options.workId) {
  78. window.o2android.openO2Work(options.workId, "", options.title || "");
  79. } else if (options.workCompletedId) {
  80. window.o2android.openO2Work("", options.workCompletedId, options.title || "");
  81. }
  82. return true;
  83. }
  84. return false;
  85. };
  86. var _openWorkIOS = function (options) {
  87. if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.openO2Work) {
  88. if (options.workId) {
  89. window.webkit.messageHandlers.openO2Work.postMessage({
  90. "work": options.workId,
  91. "workCompleted": "",
  92. "title": options.title || ""
  93. });
  94. } else if (options.workCompletedId) {
  95. window.webkit.messageHandlers.openO2Work.postMessage({
  96. "work": "",
  97. "workCompleted": options.workCompletedId,
  98. "title": options.title || ""
  99. });
  100. }
  101. return true;
  102. }
  103. return false;
  104. };
  105. var _openWorkHTML = function (options) {
  106. var uri = new URI(window.location.href);
  107. var redirectlink = uri.getData("redirectlink");
  108. if (!redirectlink) {
  109. redirectlink = encodeURIComponent(locate.pathname + locate.search);
  110. } else {
  111. redirectlink = encodeURIComponent(redirectlink);
  112. }
  113. if (options.workId) {
  114. o2.
  115. window.location = o2.filterUrl("../x_desktop/workmobilewithaction.html?workid=" + options.workId + ((layout.debugger) ? "&debugger" : "") + "&redirectlink=" + redirectlink);
  116. } else if (options.workCompletedId) {
  117. window.location = o2.filterUrl("../x_desktop/workmobilewithaction.html?workcompletedid=" + options.workCompletedId + ((layout.debugger) ? "&debugger" : "") + "&redirectlink=" + redirectlink);
  118. }
  119. };
  120. var _openWork = function (options) {
  121. if (!_openWorkAndroid(options)) if (!_openWorkIOS(options)) _openWorkHTML(options);
  122. };
  123. var _openDocument = function (appNames, options, statusObj) {
  124. var title = typeOf(options) === "object" ? (options.docTitle || options.title) : "";
  125. title = title || "";
  126. var par = "app=" + encodeURIComponent(appNames) + "&status=" + encodeURIComponent((statusObj) ? JSON.encode(statusObj) : "") + "&option=" + encodeURIComponent((options) ? JSON.encode(options) : "");
  127. if (window.o2android && window.o2android.openO2CmsDocument) {
  128. window.o2android.openO2CmsDocument(options.documentId, title);
  129. } else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.openO2CmsDocument) {
  130. window.webkit.messageHandlers.openO2CmsDocument.postMessage({ "docId": options.documentId, "docTitle": title });
  131. } else {
  132. window.location = o2.filterUrl("../x_desktop/appMobile.html?" + par + ((layout.debugger) ? "&debugger" : ""));
  133. }
  134. };
  135. var _openCms = function (appNames, options, statusObj) {
  136. var par = "app=" + encodeURIComponent(appNames) + "&status=" + encodeURIComponent((statusObj) ? JSON.encode(statusObj) : "") + "&option=" + encodeURIComponent((options) ? JSON.encode(options) : "");
  137. if (window.o2android && window.o2android.openO2CmsApplication) {
  138. window.o2android.openO2CmsApplication(options.columnId, options.title || "");
  139. } else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.openO2CmsApplication) {
  140. window.webkit.messageHandlers.openO2CmsApplication.postMessage(options.columnId);
  141. } else {
  142. window.location = o2.filterUrl("../x_desktop/appMobile.html?" + par + ((layout.debugger) ? "&debugger" : ""));
  143. }
  144. };
  145. var _openMeeting = function (appNames, options, statusObj) {
  146. var par = "app=" + encodeURIComponent(appNames) + "&status=" + encodeURIComponent((statusObj) ? JSON.encode(statusObj) : "") + "&option=" + encodeURIComponent((options) ? JSON.encode(options) : "");
  147. if (window.o2android && window.o2android.openO2Meeting) {
  148. window.o2android.openO2Meeting("");
  149. } else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.openO2Meeting) {
  150. window.webkit.messageHandlers.openO2Meeting.postMessage("");
  151. } else {
  152. window.location = o2.filterUrl("../x_desktop/appMobile.html?" + par + ((layout.debugger) ? "&debugger" : ""));
  153. }
  154. };
  155. var _openCalendar = function (appNames, options, statusObj) {
  156. var par = "app=" + encodeURIComponent(appNames) + "&status=" + encodeURIComponent((statusObj) ? JSON.encode(statusObj) : "") + "&option=" + encodeURIComponent((options) ? JSON.encode(options) : "");
  157. if (window.o2android && window.o2android.openO2Calendar) {
  158. window.o2android.openO2Calendar("");
  159. } else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.openO2Calendar) {
  160. window.webkit.messageHandlers.openO2Calendar.postMessage("");
  161. } else {
  162. window.location = o2.filterUrl("../x_desktop/appMobile.html?" + par + ((layout.debugger) ? "&debugger" : ""));
  163. }
  164. };
  165. var _openTaskCenter = function (appNames, options, statusObj) {
  166. var par = "app=" + encodeURIComponent(appNames) + "&status=" + encodeURIComponent((statusObj) ? JSON.encode(statusObj) : "") + "&option=" + encodeURIComponent((options) ? JSON.encode(options) : "");
  167. var tab = ((options && options.navi) ? options.navi : "task").toLowerCase();
  168. if (tab === "done") tab = "taskCompleted";
  169. if (tab === "readed") tab = "readCompleted";
  170. if (window.o2android && window.o2android.openO2WorkSpace) {
  171. window.o2android.openO2WorkSpace(tab);
  172. } else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.openO2WorkSpace) {
  173. window.webkit.messageHandlers.openO2WorkSpace.postMessage(tab);
  174. } else {
  175. window.location = o2.filterUrl("../x_desktop/appMobile.html?" + par + ((layout.debugger) ? "&debugger" : ""));
  176. }
  177. };
  178. var _openApplicationMobile = function (appNames, options, statusObj) {
  179. switch (appNames) {
  180. case "process.Work":
  181. _openWork(options);
  182. break;
  183. case "cms.Document":
  184. _openDocument(appNames, options, statusObj);
  185. break;
  186. case "cms.Module":
  187. _openCms(appNames, options, statusObj);
  188. break;
  189. case "Meeting":
  190. _openMeeting(appNames, options, statusObj);
  191. break;
  192. case "Calendar":
  193. _openCalendar(appNames, options, statusObj);
  194. break;
  195. case "process.TaskCenter":
  196. _openTaskCenter(appNames, options, statusObj);
  197. break;
  198. default:
  199. var uri = new URI(window.location.href);
  200. var optionsStr = uri.getData("option");
  201. var statusStr = uri.getData("status");
  202. window.location = o2.filterUrl("../x_desktop/appMobile.html?app=" + appNames + "&option=" + (optionsStr || "") + "&status=" + (statusStr || "") + ((layout.debugger) ? "&debugger" : ""));
  203. }
  204. };
  205. layout.openApplication = function (e, appNames, options, statusObj, inBrowser, taskitem, notCurrent) {
  206. if (appNames.substring(0, 4) === "@url") {
  207. var url = appNames.replace(/\@url\:/i, "");
  208. var a = new Element("a", { "href": url, "target": "_blank" });
  209. a.click();
  210. a.destroy();
  211. a = null;
  212. return true;
  213. }
  214. if (layout.app) {
  215. if (layout.mobile) {
  216. _openApplicationMobile(appNames, options, statusObj);
  217. } else {
  218. var par = "app=" + encodeURIComponent(appNames) + "&status=" + encodeURIComponent((statusObj) ? JSON.encode(statusObj) : "") + "&option=" + encodeURIComponent((options) ? JSON.encode(options) : "");
  219. if (layout.app.$openWithSelf) {
  220. return window.location = o2.filterUrl("../x_desktop/app.html?" + par + ((layout.debugger) ? "&debugger" : ""));
  221. } else {
  222. return window.open(o2.filterUrl("../x_desktop/app.html?" + par + ((layout.debugger) ? "&debugger" : "")), par);
  223. }
  224. }
  225. } else {
  226. var appPath = appNames.split(".");
  227. var appName = appPath[appPath.length - 1];
  228. _requireApp(appNames, function (appNamespace) {
  229. var appId = (options && options.appId) ? options.appId : ((appNamespace.options.multitask) ? "" : appName);
  230. //if (appId && layout.desktop.apps && layout.desktop.apps[appId] && layout.desktop.apps[appId].window){
  231. if (appId && layout.desktop.apps && layout.desktop.apps[appId]) {
  232. layout.desktop.apps[appId].setCurrent();
  233. } else {
  234. if (options) options.appId = appId;
  235. _createNewApplication(e, appNamespace, appName, (options || { "appId": appId }), statusObj, inBrowser, taskitem, notCurrent);
  236. }
  237. }.bind(this));
  238. }
  239. };
  240. layout.refreshApp = function (app) {
  241. var status = app.recordStatus();
  242. var uri = new URI(window.location.href);
  243. var appNames = uri.getData("app");
  244. var optionsStr = uri.getData("option");
  245. var statusStr = uri.getData("status");
  246. if (status) statusStr = JSON.encode(status);
  247. var port = uri.get("port");
  248. window.location = o2.filterUrl(uri.get("scheme") + "://" + uri.get("host") + ((port) ? ":" + port + "/" : "") + uri.get("directory ") + "?app=" + encodeURIComponent(appNames) + "&status=" + encodeURIComponent(statusStr) + "&option=" + encodeURIComponent((options) ? JSON.encode(options) : "") + ((layout.debugger) ? "&debugger" : ""));
  249. };
  250. layout.load = function (appNames, options, statusObj) {
  251. // layout.message = new o2.xDesktop.MessageMobile();
  252. // layout.message.load();
  253. layout.apps = [];
  254. layout.node = $("layout");
  255. var appName = appNames, m_status = statusObj, option = options;
  256. var topWindow = window.opener;
  257. if (topWindow) {
  258. try {
  259. if (!appName) appName = topWindow.layout.desktop.openBrowserApp;
  260. if (!m_status) m_status = topWindow.layout.desktop.openBrowserStatus;
  261. if (!option) option = topWindow.layout.desktop.openBrowserOption;
  262. } catch (e) { }
  263. }
  264. layout.openApplication(null, appName, option || {}, m_status);
  265. };
  266. // layout.getAppUrlMapping = function(url){
  267. // return this.getUrlMapping(url, "app");
  268. // };
  269. // layout.getCenterUrlMapping = function(url){
  270. // return this.getUrlMapping(url,"center");
  271. // };
  272. // layout.getWebUrlMapping = function(url){
  273. // return this.getUrlMapping(url, "web");
  274. // };
  275. // layout.getUrlMapping = function(url, type){
  276. // var urlContextMapping = layout.config.urlMapping;
  277. // if (urlContextMapping && urlContextMapping.app){
  278. // var href = url || window.location.href.toString();
  279. //
  280. // for (var k in urlContextMapping[type]){
  281. // var regex = new RegExp(k);
  282. // if (regex.test(href)){
  283. // return urlContextMapping[type][k];
  284. // }
  285. // }
  286. // }
  287. // return "";
  288. // };
  289. })(layout);
  290. o2.addReady(function () {
  291. // layout.desktop = new (new Class({Implements: [Options, Events]}))();
  292. // layout.desktop.openApplication = layout.openApplication;
  293. // layout.desktop.refreshApp = layout.refreshApp;
  294. // layout.desktop.load = layout.load;
  295. //兼容方法
  296. Element.implement({
  297. "makeLnk": function (options) { }
  298. });
  299. layout.desktop.addEvent = function (type, e, d) {
  300. window.addEvent(type, e, d);
  301. };
  302. layout.desktop.addEvents = function (e) {
  303. window.addEvents(e);
  304. };
  305. var loadingNode = $("loaddingArea");
  306. var loadeds = 0;
  307. var loadCount = 4;
  308. var size = document.body.getSize();
  309. var _closeLoadingNode = function () {
  310. if (loadingNode) {
  311. loadingNode.destroy();
  312. loadingNode = null;
  313. }
  314. };
  315. var _loadProgressBar = function (complete) {
  316. if (loadingNode) {
  317. if (complete) {
  318. loadingNode.setStyles({ "width": "" + size.x + "px" });
  319. //loadingNode.set('morph', {duration: 100}).morph({"width": ""+size.x+"px"});
  320. window.setTimeout(_closeLoadingNode, 500);
  321. } else {
  322. loadeds++;
  323. var p = (loadeds / loadCount) * size.x;
  324. loadingNode.setStyles({ "width": "" + p + "px" });
  325. //loadingNode.set('morph', {duration: 100}).morph({"width": ""+p+"px"});
  326. if (loadeds >= loadCount) window.setTimeout(_closeLoadingNode, 500);
  327. }
  328. }
  329. };
  330. //异步载入必要模块
  331. layout.config = null;
  332. var configLoaded = false;
  333. var lpLoaded = false;
  334. var commonLoaded = false;
  335. var lp = o2.session.path + "/lp/" + o2.language + ".js";
  336. if (o2.session.isDebugger && (o2.session.isMobile || layout.mobile)) o2.load("../o2_lib/eruda/eruda.js");
  337. o2.load(lp, function () {
  338. _loadProgressBar();
  339. lpLoaded = true;
  340. var modules = ["o2.xDesktop.$all"];
  341. o2.require(modules, {
  342. "onSuccess": function () {
  343. commonLoaded = true;
  344. if (configLoaded && commonLoaded && lpLoaded) _getDistribute(function () { _load(); });
  345. },
  346. "onEvery": function () {
  347. _loadProgressBar();
  348. }
  349. });
  350. //if (configLoaded && lpLoaded && commonLoaded) _getDistribute(function () { _load(); });
  351. });
  352. o2.getJSON("../x_desktop/res/config/config.json", function (config) {
  353. _loadProgressBar();
  354. layout.config = config;
  355. configLoaded = true;
  356. if (configLoaded && commonLoaded && lpLoaded) _getDistribute(function () { _load(); });
  357. });
  358. var _getDistribute = function (callback) {
  359. if (layout.config.app_protocol === "auto") {
  360. layout.config.app_protocol = window.location.protocol;
  361. }
  362. o2.xDesktop.getServiceAddress(layout.config, function (service, center) {
  363. layout.serviceAddressList = service;
  364. layout.centerServer = center;
  365. layout.desktop.serviceAddressList = service;
  366. layout.desktop.centerServer = center;
  367. _loadProgressBar();
  368. if (callback) callback();
  369. }.bind(this));
  370. };
  371. var _load = function () {
  372. var _loadApp = function (json) {
  373. //用户已经登录
  374. layout.user = json.data;
  375. //layout.session = {};
  376. layout.session.user = json.data;
  377. layout.session.token = json.data.token;
  378. layout.desktop.session = layout.session;
  379. //(function (layout) {
  380. // var _loadResource = function (callback) {
  381. // // var isLoadedA = false;
  382. // // var isLoadedB = false;
  383. // //var isLoadedC = false;
  384. //
  385. // var modules = [
  386. // "o2.widget._base",
  387. // "o2.xDesktop._base"
  388. // ];
  389. // //o2.xDesktop.requireApp("Common", "", null, false);
  390. // //var _check = function () { if (isLoadedA && isLoadedB) if (callback) callback(); };
  391. //
  392. // //o2.load(["../o2_lib/mootools/plugin/mBox.min.js"], function () { _loadProgressBar(); isLoadedA = true; _check(); });
  393. // // o2.require("o2.widget.Common", function () {
  394. // // _loadProgressBar();
  395. // o2.require(modules, {
  396. // "onSuccess": function () {
  397. // _loadProgressBar();
  398. // if (callback) callback();
  399. // //o2.requireApp("Common", "", function () { _loadProgressBar(); isLoadedB = true; _check(); })
  400. // },
  401. // "onEvery": function () {
  402. // _loadProgressBar();
  403. // }
  404. // });
  405. // // });
  406. // };
  407. // var _loadContent = function () {
  408. //_loadResource(function () {
  409. _loadProgressBar(true);
  410. while (layout.readys && layout.readys.length) {
  411. layout.readys.shift().apply(window);
  412. }
  413. //});
  414. // };
  415. // _loadContent();
  416. //})(layout);
  417. };
  418. //修改支持x-token
  419. var uri = new URI(window.location.href);
  420. var options = uri.get("data");
  421. if (options["x-token"]) {
  422. Cookie.write("x-token", options["x-token"]);
  423. }
  424. //先判断用户是否登录
  425. o2.Actions.get("x_organization_assemble_authentication").getAuthentication(function (json) {
  426. //已经登录
  427. _loadProgressBar();
  428. _loadApp(json);
  429. }.bind(this), function (json) {
  430. _loadProgressBar();
  431. //允许匿名访问
  432. if (layout.anonymous) {
  433. _loadProgressBar(true);
  434. _loadApp({
  435. user: "anonymous",
  436. session: {
  437. user: {
  438. name: "anonymous",
  439. roleList: []
  440. }
  441. }
  442. });
  443. } else {
  444. //用户未经登录
  445. //打开登录页面
  446. // var _loadResource = function (callback) {
  447. // var isLoadedA = false;
  448. // var isLoadedB = false;
  449. // //var isLoadedC = false;
  450. //
  451. // //var lp = o2.session.path+"/lp/"+o2.language+".js";
  452. // var modules = [
  453. // "o2.xDesktop.desktopInit"
  454. // ];
  455. // //o2.xDesktop.requireApp("Common", "", null, false);
  456. // var _check = function () { if (isLoadedA && isLoadedB) if (callback) callback(); };
  457. //
  458. // o2.load(["../o2_lib/mootools/plugin/mBox.min.js"], function () { _loadProgressBar(); isLoadedA = true; _check(); });
  459. // o2.require("o2.widget.Common", function () {
  460. // _loadProgressBar();
  461. // o2.require(modules, {
  462. // "onSuccess": function () {
  463. // o2.requireApp("Common", "", function () { isLoadedB = true; _check(); })
  464. // },
  465. // "onEvery": function () {
  466. // _loadProgressBar();
  467. // }
  468. // });
  469. // });
  470. // };
  471. //_loadResource(function () {
  472. _loadProgressBar(true);
  473. if (layout.yqwx) {
  474. layout.openLoginQywx();
  475. } else {
  476. layout.openLogin();
  477. }
  478. //});
  479. }
  480. });
  481. layout.openLogin = function () {
  482. // o2.require("o2.widget.Common", null, false);
  483. // o2.require("o2.xDesktop.Authentication", function () {
  484. layout.authentication = new o2.xDesktop.Authentication({
  485. "style": "flat",
  486. "onLogin": _load.bind(layout)
  487. });
  488. layout.authentication.loadLogin(document.body);
  489. var loadingNode = $("browser_loading");
  490. if (loadingNode) loadingNode.fade("out");
  491. // });
  492. };
  493. layout.openLoginQywx = function () {
  494. console.log("开始login。。。。。。。。。。。。。");
  495. var uri = locate.href.toURI();
  496. // MWF.require("MWF.xDesktop.Actions.RestActions", function () {
  497. console.log("执行单点。。。。。。。。。。");
  498. var action = new MWF.xDesktop.Actions.RestActions("", "x_organization_assemble_authentication", "");
  499. action.getActions = function (actionCallback) {
  500. this.actions = { "sso": { "uri": "/jaxrs/qiyeweixin/code/{code}", "method": "GET" } };
  501. if (actionCallback) actionCallback();
  502. };
  503. action.invoke({
  504. "name": "sso", "async": true, "parameter": { "code": uri.getData("code") }, "success": function (json) {
  505. console.log("单点成功。");
  506. console.log(json);
  507. //基础数据。。。。
  508. layout.session.user = json.data;
  509. //
  510. _load();
  511. }.bind(this), "failure": function (xhr, text, error) {
  512. var n = document.getElementById("loaddingArea");
  513. if (n) { n.destroy(); }
  514. document.id("layout").set("html", "<div>企业微信单点异常!</div>")
  515. }.bind(this)
  516. });
  517. // });
  518. };
  519. };
  520. });