Onload.js 52 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153
  1. //------------------------------------------------------------------------------------用戶桌面和程序數據初始化區域----------------------------------------------------------------------------------------------------------------
  2. Namespace.register("U.MD.D"); //桌面onload和桌面總控的命名空間
  3. /*
  4. window.onload的流程:
  5. 1、自由屬性的設置,例如:頁面識別id。允許瀏覽器多頁面瀏覽www.1473.cn
  6. 2、加載各種事件綁定,如:頁面大小監視,不允許選擇桌面文字,ie7以下瀏覽器頁面提示
  7. 3、加載桌面圖標。
  8. 4、加載跨域設置,如果沒有跨域,首頁數據無法獲取
  9. 4、加載首頁
  10. 5、加載廣告,QQ登錄等外鏈。
  11. UD和UC區別 uc是框架函數 ud為操作系統原殼 這裏的簡化的目標很簡單 只要有人應用ud 就會引用一個web操作系統 提供操作系統的功能應用
  12. 難題 :
  13. 1、命名和用戶沖突 會導致原web系統不可使用
  14. 2、函數沖突 如 用戶自帶window.resize這樣的函數 我們提供了接口 但是這個接口的的暴露性可見性體現出文檔的重要 宣傳文檔也就是文宣的重要性高了
  15. 3、有參數註釋的都為暴露接口類型 其他都為內部使用 更好的體現方式
  16. */
  17. //#region 配置區域,相當於全局變量定義
  18. U.MD.D.IsUseStudio = true;
  19. //本地存儲類
  20. U.MD.D.LocalStorage = null;
  21. //#endregion
  22. //#region onload處理
  23. /**
  24. * 系統初始化處理
  25. *
  26. * @param {function} 在外部項目應用該項目的時候 可以傳入cb這個參數,如果傳入了這個參數在回調跨域main.1473.cn加載成功會就會直接回調
  27. */
  28. window.onload = function () {
  29. U.MD.D.Load();
  30. U.MD.U.L.login();
  31. //U.MD.D.isLogin();
  32. // U.MD.D.fullscreen();
  33. U.MD.D.stopSafari();
  34. // window.addEventListener('resize', () => {
  35. // var realHeight = window.innerHeight
  36. // var realWidth = window.innerWidth
  37. // initViewport(realHeight, realWidth);
  38. // // window.location.reload();
  39. // })
  40. }
  41. US.Config = {
  42. server: '//cloud.api.cocorobo.hk/api/',
  43. api: '//beta.api.cocorobo.cn/',
  44. chat: "//chat.api.cocorobo.cn/",
  45. edu: '//api.edu.cocorobo.cn/edu/',
  46. origin: '//cocorobo.cn',
  47. pbl: "//pbl.cocorobo.cn/api/pbl/",
  48. // bpbl:"//pbl.cocorobo.cn",//正式鏈接
  49. // bpbl:"//beta.pbl.cocorobo.cn",//測試鏈接
  50. bpbl:"//pbl.cocorobo.hk",//hk鏈接
  51. // pbl: "http://localhost:7003/api/pbl/",
  52. basename: '',
  53. type:1,
  54. background:'url("/img/icon/bgImg4.png")'
  55. }
  56. /**
  57. * 供外部調用的window.onload函數雲端系統啟動項
  58. *
  59. * @param {function} 在外部項目應用該項目的時候 可以傳入cb這個參數,如果傳入了這個參數在回調跨域main.1473.cn加載成功會就會直接回調
  60. */
  61. U.MD.D.Load = U.MD.D.FLoad = function (cb) {
  62. //這裏判斷是如果是www.1473.cn 或者 www.boomyun.com項目的時候 或者是 通過ufrom的跨域函數加載成功頁面時候可以執行window.onload, 添加判斷的目的主要是反正 其他項目引用uformd的時候自動執行window.onload報錯。
  63. //當引用雲端硬盤,好友模塊時需要在自己的js文件中添加window.onload入口函數,否則會觸發雲端的window.onload,導致系統報錯,
  64. //初始化桌面,如果是1473主站點那麼初始化桌面系統,否則外部引入1473不加載桌面
  65. //系統初始化、第一個就是加載桌面,然後初始化全局變量、綁定事件、最後加載數據(加載數據需要跨域加載,因為項目分離的原因,我們有disk.1473.cn、user.1473.cn、firend.1473.cn裏面有靜態數據,還有動態的後臺)
  66. if (U.MD.D.IsUseStudio) {
  67. //桌面初始化彈出
  68. U.selectEl("#UD_Dtop")[0].style.display = "block";
  69. //桌面做為一個置底的窗體
  70. new U.UF.UI.form(false, U.selectEl("#UD_Dtop")[0], { onresize: true, style: { "cssText": "width:100%;height:100%;padding:0;border:0;border-radius:0;box-shadow:0;position:static;" }, "className": "" }, { istop: false, isdrag: false, isdrag: false, isstretching: false, isenlarge: false, isnarrow: false, isclose: false }, null, { style: { "padding": "0" } });
  71. }
  72. //這裏加判斷的原因是怕有開發者開發的過程中直接調用uformd.js沒有寫跨域加載,沒有寫window.onload導致再運行的過程中找不到元素報錯
  73. if ($("#U_MD_Home")[0]) {
  74. //設置頁面大小等的全局變量
  75. U.MD.D.settingGlobalVariables();
  76. //瀏覽器事件監視及處理
  77. U.MD.D.addEvents();
  78. //var _browserinfo = U.UF.CI.getBrowser(); //獲取瀏覽器
  79. ////ie7以下的瀏覽器彈出不兼容的處理
  80. //if (_browserinfo["browser"] == "msie" && parseInt(_browserinfo["ver"]) < 7) {
  81. // //彈出不兼容的處理
  82. // U.MD.D.A.browserCompatibleForm();
  83. //}
  84. }
  85. //跨域加載
  86. U.MD.D.crossDomain(cb); //跨域初始化,裏面包含了用戶登錄
  87. }
  88. /**
  89. * 設置當前使用頁面大小
  90. */
  91. U.MD.D.settingGlobalVariables = function () {
  92. //獲取頁面的大小
  93. var _size = U.selectEl("body").getElementInfo();
  94. US.height = _size["CH"]; //獲取高度
  95. US.width = _size["CW"]; //獲取寬度
  96. //1473的登錄識別id
  97. US.systemId = 1;
  98. //頁面識別id 頁面唯一的識別 作為用戶訪問1473的唯一識別碼,在之前用戶獲取聊天室的信息的唯一識別碼
  99. US.pageId = Guid.newGuid();
  100. }
  101. /**
  102. * 系統監視
  103. */
  104. U.MD.D.addEvents = function () {
  105. //頁面活動狀態監視,失焦的時候停止五秒刷新,聚焦的時候開始刷新
  106. U.UF.EV.IsActivity(U.MD.D.focus, U.MD.D.blur);
  107. //監視頁面的點擊 使得窗體點擊為頂部
  108. U.UF.F.clickTopWindow();
  109. //頁面大小變化監視
  110. U.MD.D.reSize();
  111. window.onresize = U.MD.D.reSize;
  112. //如果是雲端1473則屏蔽菜單和錯誤彈框
  113. if (U.MD.D.IsUseStudio) {
  114. if (window.print) { //判斷是否有右鍵菜單
  115. document.oncontextmenu = U.UF.EV.stopDefault; //阻止桌面右鍵默認菜單
  116. }
  117. document.onselectstart = U.UF.C.shieldedSelect; //禁止文本選擇處理
  118. U.UF.EV.addElementEvent("keydown", document, U.UF.C.shieldedBackspace); //禁止瀏覽器回退
  119. //window.onerror = U.MD.D.error; //錯誤提示屏蔽
  120. }
  121. //允許錯誤提示和右鍵菜單
  122. else {
  123. window.onerror = null;
  124. }
  125. //頁面路由事件處理
  126. U.UF.N.route(U.MD.N.urlGuide);
  127. }
  128. /**
  129. * 頁面大小變化時,需要重新排列圖標及任務欄大小的變化.
  130. */
  131. U.MD.D.reSize = function () {
  132. //頁面變化處理
  133. //獲取頁面的大小
  134. // US.height = window.innerHeight > window.innerWidth ? window.innerWidth : window.innerHeight;
  135. // US.width = window.innerHeight > window.innerWidth ? window.innerHeight : window.innerWidth;
  136. var _size = U.selectEl("html").getElementInfo();
  137. if (_size["CH"] > 500) {
  138. //處理窗體區域 隨著頁面大小變化而變化
  139. U.UF.UI.form.windowResize();
  140. // var _size = U.selectEl("body").getElementInfo();
  141. US.height = _size["CH"]; //獲取高度
  142. US.width = _size["CW"]; //獲取寬度;
  143. document.body.style.width = US.width + 'px';
  144. document.body.style.height = US.height + 'px';
  145. //任務欄處理
  146. if ($("#U_MD_D_RW")) {
  147. U.selectEl("#U_MD_D_RW").css("width", US.width - 165 + "px");
  148. U.MD.D.T.taskbar.multitask($("#U_MD_D_RW")[0]);
  149. //桌面圖標處理
  150. if(US.Config.type == '1'){
  151. U.MD.D.iconPostion($("#U_MD_D_K").Child());
  152. }else{
  153. U.MD.D.iconPostion2($("#U_MD_D_K").Child());
  154. }
  155. }
  156. }
  157. }
  158. /**
  159. * 跨域引入1473
  160. * @param {function} 跨域加載成功後的回調函數
  161. */
  162. U.MD.D.crossDomain = function (cb) {
  163. U.MD.D.loadApplication(cb);
  164. ////跨域加載,如果是1473的跨域,那麼則添加跨域的iframe處理
  165. //if (document.domain == "1473.cn") {
  166. // U.UF.CD.loadAjaxCrossDomain(function () {
  167. // U.MD.D.loadApplication(cb);
  168. // });
  169. //}
  170. ////如果是非1473的跨域,添加跨域的iframe
  171. //else {
  172. // U.UF.CD.thirdPartyLoadAjaxCrossDomain(function () {
  173. // U.MD.D.loadApplication(cb);
  174. // });
  175. //}
  176. }
  177. /**
  178. * 加載user 、 friend 、disk的js
  179. */
  180. U.MD.D.loadApplication = function (cb) {
  181. //U.UF.CD.loadApplication(function () {
  182. // U.MD.D.asynCrossDomain(cb);
  183. //});
  184. U.MD.D.asynCrossDomain(cb);
  185. }
  186. /**
  187. * 域名加載成功後異步 此處可正式獲取數據
  188. * @param {function} 跨域加載成功後的回調函數
  189. */
  190. U.MD.D.asynCrossDomain = function (cb) {
  191. ////初始化url的處理
  192. //U.MD.N.urlGuide();
  193. ////通過cookie登錄
  194. //U.MD.U.L.cookieLogin();
  195. ////如果是1473則彈出1473的首頁
  196. //if (U.MD.D.IsUseStudio) {
  197. // U.MD.D.I.openApplication("boomYun");
  198. //}
  199. ////其它模塊加載處理
  200. //U.MD.D.otherModularLoad();
  201. ////添加用戶訪問記錄
  202. //U.UF.CI.getUserLocation(U.MD.D.visitLog);
  203. //桌面開始點,起始函數
  204. if ($("#UD_Dtop")[0]) {
  205. U.MD.D.I.init();
  206. }
  207. //如果其他站點進入1473,這裏是引入成功的回調處理
  208. if (U.UF.C.isFunction(cb)) {
  209. cb(); //回調處理
  210. }
  211. setInterval(function () {
  212. U.MD.D.getuser(); //用戶登錄
  213. }, 2000)
  214. setInterval(function () {
  215. U.MD.D.addLoginTime(); //用戶登錄
  216. }, 600000)
  217. }
  218. /**
  219. * 其它模塊的加載
  220. */
  221. U.MD.D.otherModularLoad = function () {
  222. //計時器消息初始化 每個3秒刷一次消息
  223. U.MD.C.T.onesetInterval();
  224. //加載如廣告 各模塊加載
  225. U.MD.D.thirdPartyLoad(); //頁面插件加載
  226. //html5本地存儲,暫時用來完成本地頁面交互消息 作用共享頁面信息,還未完善。
  227. //U.MD.D.record();
  228. }
  229. /**
  230. * 第三方廣告和登錄加載處理
  231. */
  232. U.MD.D.thirdPartyLoad = function () {
  233. //阿裏巴巴廣告加載
  234. // U.UF.DL.C.AD.alimama([
  235. // { pid: "mm_32325420_3265865_24254681", appkey: "", unid: "" },
  236. // { pid: "mm_32325420_3265865_14752067", appkey: "", unid: "" },
  237. // { pid: "mm_32325420_3265865_24246760", appkey: "", unid: "" },
  238. // { pid: "mm_32325420_3265865_24254681", appkey: "", unid: ""}]);
  239. //qq登錄加載按鈕
  240. // U.MD.U.OT.qqLoadJs({ btnId: "U_MD_U_L_login_O_T_app_QQ", size: "C_S" });
  241. //微博登錄加載按鈕
  242. // U.MD.U.OT.weiboLoadJs({ id: "U_MD_U_L_login_O_T_app_I", type: "3,2", show_head: false, show_name: false, show_cancel: false,
  243. // callback: { login: U.MD.U.OT.weiboLoginCallBack }
  244. // });
  245. //百度統計加載
  246. // U.UF.DL.C.AD.onloadBaiduJs("1fce47ee7e8655ddd108fca7116f0752");
  247. // U.UF.DL.C.AD.onloadBaiduJs("f0ececeb4f687bc4d4ffb7719f4cf6a7");
  248. }
  249. /**
  250. * 寫入訪問用戶信息
  251. */
  252. U.MD.D.visitLog = function () {
  253. U.A.Request(US.USER, ["AddToLoginLog", US.userInfo.UserId || US.EMPTYGUID, US.city.userAllLocation || ""], function () { }); //訪問日誌添加消息
  254. }
  255. //#endregion
  256. //#region 頁面事件處理
  257. //關閉頁面處理 把頁面的活動數-1
  258. window.onunload = function () {
  259. try {
  260. var _userinfo = US.userInfo;
  261. if (U.MD.D.LocalStorage) {
  262. var _count = U.MD.D.LocalStorage.get("ati") || 0;
  263. if (_count > 0) { _count-- };
  264. U.MD.D.LocalStorage.set("ati", _count); //這是活動用戶-1
  265. }
  266. if (_userinfo.UserId && U.A) { //在狀態中讓這個活動用戶下線
  267. U.A.Request(US.USER, ["UserOffline", _userinfo.UserId], function () { }, []);
  268. }
  269. } catch (e) { }
  270. }
  271. //錯誤處理,前端錯誤需要在控製臺輸出,同時提交到錯誤數據庫
  272. //window.onerror = function(sMessage,sUrl,sLine,columnNumber,errorObj){};
  273. //onerror函數的五個參數用於確定錯誤確切的信息,代表的意思依次為:
  274. //* @param {String} errorMessage errorMessage 錯誤信息
  275. //* @param {String} scriptURI 出錯的文件
  276. //* @param {Long} lineNumber 出錯代碼的行號
  277. //* @param {Long} columnNumber 出錯代碼的列號
  278. //* @param {Object} errorObj 錯誤的詳細信息,Anything
  279. U.MD.D.error = function (errorMessage, scripturi, linenumber, columnnumber, errorobj) {
  280. errorobj = errorobj || {}; //屏蔽js錯誤
  281. U.A.Request(US.USER, ["SetError", 0, (event.errorMessage || event || errorMessage), (scripturi || event.filename || event.errorUr) + "。行號:" + (linenumber || event.lineno || event.errorLine)], function () { }, []); //錯誤消息發送到數據庫
  282. U.UF.C.console(event.errorMessage || event || errorobj); //console 輸出錯誤信息
  283. return true; //不讓瀏覽器彈出錯誤報告,瀏覽器會彈出一個comfirm的錯誤。
  284. }
  285. /**
  286. * 用戶登錄處理
  287. */
  288. let LoginState = false
  289. U.MD.D.getuser = function () {
  290. // $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/gif/longhuaBg.gif")'
  291. var userInfo = US.userInfo;
  292. if (Object.keys(userInfo).length === 0 && !U.UF.C.queryString('code') && !U.UF.C.queryString('tycode')) {
  293. var _cookie = U.UF.Cookie.get("cocorobo");
  294. if (Object.keys(userInfo).length === 0 && (_cookie||document.domain!="cocorobo.cn")) {
  295. U.A.Request(US.Config.server + "getcookieuserid", [], function (res) {
  296. if (res.value && res.value[0] && res.value[0][0]) {
  297. var _user = res.value[0][0];
  298. U.A.Request(US.Config.edu + "admin/userinfo/userinfoById/" + _user.userid, [], function (res) {
  299. if (res.value && res.value[0] && res.value[0][0]) {
  300. US.userInfo = res.value[0][0]; //記錄用戶數據
  301. US.userInfo.userid = _user.userid;
  302. if ($("#U_MD_HomeC_Pop")[0]) {
  303. $("#U_MD_HomeC_Pop")[0].close(); //關閉登陸
  304. }
  305. U.A.Request(US.Config.pbl + "selectUser?userid=" + _user.userid, [], function (res) { //US.userInfo.userid
  306. loginSet(res.value[0][0], res)
  307. }, [], { "type": "GET", "withCredentials": true });
  308. }
  309. }, [], { "type": "GET", "withCredentials": true });
  310. }
  311. }, [], { "type": "GET", "withCredentials": true });
  312. }
  313. }else if(!LoginState &&Object.keys(userInfo).length === 0 && U.UF.C.queryString('code').length === 32){
  314. if($("#U_MD_HomeC_Pop")[0]){
  315. $("#U_MD_HomeC_Pop")[0].close()
  316. }
  317. LoginState = true
  318. // console.log('新華跳轉',U.UF.C.queryString('code'))
  319. let url = "https://cloud.cocorobo.cn/api/getTeacherInfoByCode"
  320. var myHeaders = new Headers();
  321. // myHeaders.append("User-Agent", "Apifox/1.0.0 (https://apifox.com)");
  322. myHeaders.append("Content-Type", "application/json");
  323. // myHeaders.append("Access-Control-Allow-Origin","*")
  324. var raw = JSON.stringify({
  325. "code": U.UF.C.queryString('code')
  326. });
  327. var requestOptions = {
  328. method: 'POST',
  329. headers: myHeaders,
  330. body: raw,
  331. redirect: 'follow',
  332. credentials: 'include'
  333. };
  334. fetch(url, requestOptions)
  335. .then(response => response.text())
  336. .then(result => {
  337. // console.log(result)
  338. let data = JSON.parse(result).data
  339. if(JSON.parse(result).code == 200){
  340. let diqu = `${data.province}-${data.city}-${data.county}-${data.street}-${data.schoolName}`
  341. let diquId = data.schoolId
  342. U.A.Request(US.Config.pbl + "batchRegistrationSzdjg3", [data.realName, data.userUniqueId+"@xhly.com", 'a5efd078-20f6-4185-bef9-6d1c688bee70', data.schoolName || "", "", "", 1, data.userUniqueId,diqu,diquId], function (res) {
  343. // console.log(res);
  344. let loginData = JSON.stringify({
  345. openid: data.userUniqueId,
  346. edu: true
  347. })
  348. var requestOptionsLogin = {
  349. method: 'POST',
  350. headers: myHeaders,
  351. body: loginData,
  352. redirect: 'follow',
  353. credentials: 'include'
  354. };
  355. fetch("https://beta.api.cocorobo.cn/api/user", requestOptionsLogin)
  356. .then(response => response.text())
  357. .then(result => {
  358. let a = JSON.parse(result)
  359. if(a.length>0){
  360. let userId = a[0][0].userid
  361. US.userInfo.userid = userId
  362. U.A.Request(US.Config.pbl + "selectUser?userid=" + userId, [], function (res) { //US.userInfo.userid
  363. loginSet(res.value[0][0], res)
  364. }, [], { "type": "GET", "withCredentials": true });
  365. }
  366. })
  367. .catch(error => {
  368. LoginState = false
  369. console.log('error', error)
  370. });
  371. }, [], { "type": "POST", "withCredentials": true })
  372. }else{
  373. U.Alert("用戶登錄已失效,請重新獲取登錄信息!");
  374. }
  375. })
  376. .catch(error => {
  377. LoginState = false
  378. console.log('error', error)
  379. });
  380. }else if(!LoginState &&Object.keys(userInfo).length === 0 && U.UF.C.queryString('code').length < 32 && U.UF.C.queryString('code').length > 9){
  381. if($("#U_MD_HomeC_Pop")[0]){
  382. $("#U_MD_HomeC_Pop")[0].close()
  383. }
  384. LoginState = true
  385. let url = "https:" + US.Config.pbl + "luohugetTeacherInfo?code=" + encodeURIComponent(U.UF.C.queryString('code'));
  386. var myHeaders = new Headers();
  387. myHeaders.append("Content-Type", "application/json");
  388. var requestOptions = {
  389. method: 'GET',
  390. redirect: 'follow'
  391. };
  392. fetch(url, requestOptions)
  393. .then(response => response.text())
  394. .then(result => {
  395. // console.log(result)
  396. let data = JSON.parse(result).data
  397. // return
  398. if(JSON.parse(result).code == 0){
  399. let diqu = ``
  400. let diquId = data.loginid
  401. U.A.Request(US.Config.pbl + "batchRegistrationSzdjg3", [data.empname, data.loginid+"@luohu.com", 'c05b87d3-3d8e-4415-9dba-f3deccac4822', data.schoolname || "", data.mobile, "", data.identity === 1 ? 1 : 2, data.loginid,diqu,diquId], function (res) {
  402. // console.log(res);
  403. let loginData = JSON.stringify({
  404. openid: data.loginid,
  405. edu: true
  406. })
  407. var requestOptionsLogin = {
  408. method: 'POST',
  409. headers: myHeaders,
  410. body: loginData,
  411. redirect: 'follow',
  412. credentials: 'include'
  413. };
  414. fetch("https://beta.api.cocorobo.cn/api/user", requestOptionsLogin)
  415. .then(response => response.text())
  416. .then(result => {
  417. let a = JSON.parse(result)
  418. if(a.length>0){
  419. let userId = a[0][0].userid
  420. US.userInfo.userid = userId
  421. U.A.Request(US.Config.pbl + "selectUser?userid=" + userId, [], function (res) { //US.userInfo.userid
  422. loginSet(res.value[0][0], res)
  423. }, [], { "type": "GET", "withCredentials": true });
  424. }
  425. })
  426. .catch(error => {
  427. LoginState = false
  428. console.log('error', error)
  429. });
  430. }, [], { "type": "POST", "withCredentials": true })
  431. }else{
  432. U.Alert("用户登录已失效,请重新获取登录信息!");
  433. }
  434. })
  435. .catch(error => {
  436. LoginState = false
  437. console.log('error', error)
  438. });
  439. }else if(!LoginState &&Object.keys(userInfo).length === 0 && U.UF.C.queryString('tycode')){
  440. if($("#U_MD_HomeC_Pop")[0]){
  441. $("#U_MD_HomeC_Pop")[0].close()
  442. }
  443. LoginState = true
  444. let url = "https://cloud.cocorobo.cn/api/getUserInfoByCode";
  445. var myHeaders = new Headers();
  446. myHeaders.append("Content-Type", "application/json");
  447. var requestOptions = {
  448. method: 'POST',
  449. headers: myHeaders,
  450. body: JSON.stringify({
  451. code: U.UF.C.queryString('tycode'),
  452. signature: U.UF.C.queryString('signature')
  453. }),
  454. redirect: 'follow'
  455. };
  456. fetch(url, requestOptions)
  457. .then(response => response.text())
  458. .then(result => {
  459. // console.log(result)
  460. let data = JSON.parse(result).data
  461. // return
  462. if(JSON.parse(result).code == 200){
  463. U.A.Request(US.Config.pbl + "batchRegistrationSzdjg3", [data.nickName, data.userId+"@tianyuan.com", 'b47d2ea8-7044-4810-9cb7-3aaf8b74cfbc', data.orgName ? data.orgName : "e5cdf6b8-abdc-11ef-b887-005056b86db5", '', "", 1, data.userId,'',data.userId], function (res) {
  464. // console.log(res);
  465. let loginData = JSON.stringify({
  466. openid: data.userId,
  467. edu: true
  468. })
  469. var requestOptionsLogin = {
  470. method: 'POST',
  471. headers: myHeaders,
  472. body: loginData,
  473. redirect: 'follow',
  474. credentials: 'include'
  475. };
  476. fetch("https://beta.api.cocorobo.cn/api/user", requestOptionsLogin)
  477. .then(response => response.text())
  478. .then(result => {
  479. let a = JSON.parse(result)
  480. if(a.length>0){
  481. let userId = a[0][0].userid
  482. US.userInfo.userid = userId
  483. U.A.Request(US.Config.pbl + "selectUser?userid=" + userId, [], function (res) { //US.userInfo.userid
  484. loginSet(res.value[0][0], res)
  485. }, [], { "type": "GET", "withCredentials": true });
  486. }
  487. })
  488. .catch(error => {
  489. LoginState = false
  490. console.log('error', error)
  491. });
  492. }, [], { "type": "POST", "withCredentials": true })
  493. }else{
  494. U.Alert("用戶登錄已失效,請重新獲取登錄信息!");
  495. }
  496. })
  497. .catch(error => {
  498. LoginState = false
  499. console.log('error', error)
  500. });
  501. } else if(Object.keys(userInfo).length !== 0){
  502. if(US.Config.type == '2'){
  503. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/easyBg.png")'
  504. if (userInfo.org == 'eb2af5e9-ac3d-46b6-9fe3-3c1c364f0217') {
  505. U.MD.D.getNotice();
  506. }else if (userInfo.org == '150e3120-9195-11ed-b13d-005056b86db5') {
  507. U.MD.D.getNotice();
  508. } else if (userInfo.org == 'ee40e8e3-e36c-4872-8105-cf395481012s') {
  509. U.MD.D.getNotice();
  510. }
  511. }else{
  512. if (userInfo.organizeid == '91305d49-01ba-11ed-8c78-005056b86db4') {
  513. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/mingdeBg.png")'
  514. } else if (userInfo.organizeid == 'c7df0bd4-6e75-401a-a137-4e163aa62263') {
  515. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/zhongshanBg.png")'
  516. } else if (userInfo.organizeid == '580aac24-a939-49f7-a75a-40a7b5af3a17') {
  517. // $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/longweiBg.png")'
  518. } else if (userInfo.organizeid == 'b1095a3c-1d06-4ac8-854f-7c0d97f4ab41') {
  519. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/yunhaiBg.jpg")'
  520. } else if (userInfo.organizeid == '857af1c7-c8ee-4b04-85b5-fd182903adb7') {
  521. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/beijingBg.png")'
  522. } else if (userInfo.organizeid == '69893dca-1d47-11ed-8c78-005056b86db5') {
  523. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/weilaiBg.png")'
  524. } else if (userInfo.organizeid == 'efdef564-4064-11ed-8c78-005056b86db5') {
  525. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/pz.jpg")'
  526. } else if (userInfo.organizeid == 'd9db3320-503a-11ed-8c78-005056b86db5') {
  527. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/hzBg.png")'
  528. } else if (userInfo.organizeid == 'ccb9754d-59c1-11ed-8c78-005056b86db5') {
  529. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/nanfangBg.png")'
  530. } else if (userInfo.organizeid == 'f30a6615-5379-11ed-8c78-005056b86db5') {
  531. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/longhuaBg.png")'
  532. } else if (userInfo.organizeid == '4787cc87-6588-11ed-8c78-005056b86db5') {
  533. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/nanfangBg.png")'
  534. } else if (userInfo.organizeid == '9f888eae-7558-11ed-8c78-005056b86db5') {
  535. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/song.png")'
  536. } else if (userInfo.organizeid == '2b9ceb66-a1dd-11ed-b13d-005056b86db5') {
  537. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/gmxxBg.png")'
  538. } else if (userInfo.organizeid == '1c3b9def-8fbe-11ed-b13d-005056b86db5') {
  539. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/wankeBg.png")'
  540. } else if (userInfo.organizeid == '82fcb5c7-c13b-11ed-8d51-005056b86db5') {
  541. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/qiaoxiangBg.png")'
  542. } else if (userInfo.organizeid == '4c686762-1d0a-11ed-8c78-005056b86db5') {
  543. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/sies.png")'
  544. } else if (userInfo.organizeid == 'ea2a8c65-f38c-11ed-91d8-005056b86db5') {
  545. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/longhuaZXBg.png")'
  546. } else if (userInfo.organizeid == 'f297fbdc-f0a0-11ee-b534-005056b86db5') {
  547. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/010606.png")'
  548. }
  549. if (userInfo.org == 'eb2af5e9-ac3d-46b6-9fe3-3c1c364f018d') {
  550. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/yantianOrgBg.png")'
  551. } else if (userInfo.org == '7ada499f-4ec7-11ed-8c78-005056b86db5') {
  552. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/csteamBg.png")'
  553. } else if (userInfo.org == 'eb2af5e9-ac3d-46b6-9fe3-3c1c364f0217') {
  554. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/gm/bg.png")'
  555. U.MD.D.getNotice();
  556. } else if (userInfo.org == '97c4ee8b-d010-4042-986d-e9d3c217264f') {
  557. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/zhoujia.jpg")'
  558. } else if (userInfo.org == '150e3120-9195-11ed-b13d-005056b86db5') {
  559. if (!$("#tc_desktop_css")[0]) {
  560. const link = document.createElement("link");
  561. link.rel = "stylesheet";
  562. link.href =
  563. "./css/tencent/Desktop.css";
  564. link.id = "tc_desktop_css"
  565. document.body.appendChild(link);
  566. $(".avatar")[0].onclick= function(){
  567. U.MD.D.I.openApplication('tcData')
  568. }
  569. }
  570. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/tencentBg.jpg")'
  571. U.MD.D.getNotice();
  572. } else if (userInfo.org == 'ee40e8e3-e36c-4872-8105-cf395481012s') {
  573. $(".avatar")[0].onclick= function(){
  574. U.MD.D.I.openApplication('tcData')
  575. }
  576. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/szscBg.png")'
  577. U.MD.D.getNotice();
  578. } else if (userInfo.org == 'ec0af97a-7c10-4259-a7eb-db9cc8174cdc') {
  579. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/futianBg.png")'
  580. } else if (userInfo.org == 'e632b86c-f89d-11ed-91d8-005056b86db5') {
  581. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/gdjgBg.png")'
  582. } else if (userInfo.org == '54f09f1e-09f0-11ee-91d8-005056b86db5') {
  583. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/szlhyjBg.jpeg")'
  584. } else if (userInfo.org == '7b016f69-0f4f-11ee-91d8-005056b86db5') {
  585. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/dseiBg.png")'
  586. } else if (userInfo.org == '1973f6c7-1561-11ee-91d8-005056b86db5') {
  587. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/szjkyBg2.png")'
  588. } else if (userInfo.org == '2fa75e51-189a-11ee-91d8-005056b86db5') {
  589. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/chjyjBg.png")'
  590. } else if (userInfo.org == '2a9f32ea-88df-49eb-aba1-0a286f691474') {
  591. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/qhBg.jpg")'
  592. } else if (userInfo.org == '884c5665-a453-46f3-b7b6-01d575290aa9') {
  593. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/scnuaiBg.png")'
  594. } else if (userInfo.org == '2fe1a080-4425-4620-b7a0-be2f3750ffd4') {
  595. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/x010607bgImg.png")'
  596. } else if (userInfo.org == 'ec84034b-8ea4-4d27-9cba-1adcb4720bb3') {
  597. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/SPROUTLabBg.png")'
  598. }
  599. }
  600. }
  601. }
  602. U.MD.D.addLoginTime = function(){
  603. var userInfo = US.userInfo;
  604. if(Object.keys(userInfo).length !== 0){
  605. U.A.Request(US.Config.pbl + "addOperationTimeT", [userInfo.userid,'','3','600'], function (res) {
  606. }, [], { "type": "POST", "withCredentials": true });
  607. }
  608. }
  609. U.MD.D.getuser2 = function (userid, cid) {
  610. var myHeaders = new Headers();
  611. myHeaders.append("Content-Type", "application/json");
  612. let loginData = JSON.stringify({
  613. openid: userid,
  614. edu: true
  615. })
  616. var requestOptionsLogin = {
  617. method: 'POST',
  618. headers: myHeaders,
  619. body: loginData,
  620. redirect: 'follow',
  621. credentials: 'include' // 设置withCredentials为true
  622. };
  623. fetch("https://beta.api.cocorobo.cn/api/user", requestOptionsLogin)
  624. .then(response => response.text())
  625. .then(result => {
  626. let a = JSON.parse(result)
  627. if(a.length>0){
  628. if($(".U_PBL_Check2")[0]){
  629. $(".U_PBL_Check2")[0].style.display = "none";
  630. }
  631. let userId = a[0][0].userid
  632. US.userInfo.userid = userId
  633. U.A.Request(US.Config.pbl + "selectUser?userid=" + userid, [], function (res) { //US.userInfo.userid
  634. if ($("#U_MD_HomeC_Pop")[0]) {
  635. $("#U_MD_HomeC_Pop")[0].close(); //关闭登陆
  636. }
  637. loginPan(res.value[0][0], userid)
  638. US.userInfo = res.value[0][0];
  639. $(".avatar")[0].style.display = "block";
  640. if (res.value[0][0].type === 1 && $(".U_PBL_Check")[0] && res.value[0][0].org != '150e3120-9195-11ed-b13d-005056b86db5' && res.value[0][0].org != 'b47d2ea8-7044-4810-9cb7-3aaf8b74cfbc') {
  641. $(".U_PBL_Check")[0].style.display = "block";
  642. }
  643. $(".login")[0].style.display = "none";
  644. $(".register")[0].style.display = "none";
  645. $(".userName")[0].style.display = "block";
  646. $(".userName")[0].innerHTML = US.userInfo.username || US.userInfo.alias;
  647. $(".exit")[0].style.display = "block";
  648. let _vipbox = $('.U_MD_D_BD_vip_box')[0]
  649. _vipbox && (_vipbox.style.right = $(".U_MD_D_BD")[0].offsetWidth + 20 + 'px')
  650. if(res.value[0][0].type === 1 && res.value[0][0].org == 'c95e0a56-c205-11ed-8d51-005056b86db5'){
  651. U.MD.D.I.ModeCheck(2)
  652. }else{
  653. U.MD.D.I.initDesktopIcons($("#U_MD_D_K")[0], 1);
  654. }
  655. if(res.value[0][0].type === 1 && window.location.hash.indexOf('project') != -1){
  656. U.MD.D.I.openApplication("project")
  657. }
  658. if(res.value[0][0].type === 1 && window.location.hash.indexOf('study') != -1){
  659. U.MD.D.I.openApplication("study")
  660. }
  661. if(res.value[0][0].type === 2 && window.location.hash.indexOf('study') != -1){
  662. U.MD.D.I.openApplication("studentStudy")
  663. }
  664. U.MD.O.P.connect(); //登录成功后连接socket服务同步协同编辑
  665. U.MD.D.I.openInApplication("studyDetail", cid, 2, 2)
  666. U.MD.D.I.openInApplication("studyDetail", cid, 2, 2)
  667. }, [], { "type": "GET", "withCredentials": true });
  668. }
  669. })
  670. .catch(error => {
  671. LoginState = false
  672. console.log('error', error)
  673. });
  674. }
  675. //#endregion
  676. //#region 獲取ifram下的html
  677. //U.MD.D.getIfraemHtml = function (src) {
  678. // var _iframe = $$("iframe", { src: src, style: { display: "none"} });
  679. // //跨域回調設置
  680. // U.UF.DL.iframeLoad(_iframe, function () {
  681. // var _html = _iframe.contentWindow.document.body.innerHTML;
  682. // console.log(_html);
  683. // U.selectEl(_iframe).remove();
  684. // });
  685. // U.selectEl(_iframe).appendTo($('body')[0]);
  686. //};
  687. //#endregion
  688. U.MD.D.fullscreen = function () {
  689. //if (document.body.offsetWidth < 1025) {
  690. U.UF.C.fullScreen()
  691. //}
  692. document.body.addEventListener('dblclick', () => {
  693. U.UF.C.fullScreen()
  694. // const isFullScreen = document.fullscreenElement
  695. // if (isFullScreen) {
  696. // U.UF.C.cancelfullScreen()
  697. // } else {
  698. // U.UF.C.fullScreen()
  699. // }
  700. })
  701. }
  702. U.MD.D.stopSafari = function () {
  703. //阻止safari瀏覽器雙擊放大功能
  704. let lastTouchEnd = 0 //更新手指彈起的時間
  705. document.documentElement.addEventListener("touchstart", function (event) {
  706. //多根手指同時按下屏幕,禁止默認行為
  707. if (event.touches.length > 1) {
  708. event.preventDefault();
  709. }
  710. });
  711. document.documentElement.addEventListener("touchend", function (event) {
  712. let now = (new Date()).getTime();
  713. if (now - lastTouchEnd <= 300) {
  714. //當兩次手指彈起的時間小於300毫秒,認為雙擊屏幕行為
  715. event.preventDefault();
  716. } else { // 否則重新手指彈起的時間
  717. lastTouchEnd = now;
  718. }
  719. }, false);
  720. //阻止雙指放大頁面
  721. document.documentElement.addEventListener("gesturestart", function (event) {
  722. event.preventDefault();
  723. });
  724. }
  725. U.MD.D.noticeBlock = '1'
  726. U.MD.D.OpenNotice = function () {
  727. let box = $('.U_MD_D_BD_notice')[0]
  728. box.style.display = 'block'
  729. }
  730. U.MD.D.cancelNotice = function () {
  731. U.UF.EV.stopBubble();
  732. let box = $('.U_MD_D_BD_notice')[0]
  733. box.style.display = 'none'
  734. U.MD.D.noticeBlock = '2'
  735. }
  736. U.MD.D.getNotice = function () {
  737. // a77e9404-efec-11e9-96f9-028edca3b798&oid=45facc0a-1211-11ec-80ad-005056b86db5&org=undefined&role=1
  738. var uid = US.userInfo.userid,
  739. oid = US.userInfo.organizeid,
  740. org = US.userInfo.org;
  741. U.A.Request(US.Config.pbl + "selectNotice?uid=" + uid + "&oid=" + oid + "&org=" + org + "&page=1", [], function (res) {
  742. if (res.value && res.value[0].length > 0) {
  743. let box = $('.U_MD_D_BD_noticeBox_box')[0]
  744. let _res = res.value[0]
  745. if (U.MD.D.noticeBlock == '1') {
  746. $('.U_MD_D_BD_notice')[0].style.display = 'block'
  747. }
  748. $('.U_MD_D_BD_notice_img')[0].style.display = 'block'
  749. box.innerHTML = ''
  750. var num = _res.length > 3 ? 3 : _res.length
  751. for (var i = 0; i < num; i++) {
  752. var _box = $$('div', { className: 'U_MD_D_BD_noticeBox' }, box)
  753. var _title = $$('div', { className: 'U_MD_D_BD_noticeBox_title' }, _box)
  754. // $$('span', { innerHTML: '消息通知' }, _title)
  755. $$('span', { innerHTML: _res[i].title }, _title)
  756. var _content = $$('div', { className: 'U_MD_D_BD_noticeBox_content' }, _box)
  757. $$('span', { innerHTML: _res[i].content.replace(/<[^>]*>/g, "") }, _content)
  758. var _time = $$('div', { className: 'U_MD_D_BD_noticeBox_time' }, _box)
  759. $$('span', { innerHTML: _res[i].creatTime }, _time)
  760. }
  761. } else {
  762. $('.U_MD_D_BD_notice')[0].style.display = 'none'
  763. $('.U_MD_D_BD_notice_img')[0].style.display = 'none'
  764. }
  765. // setTimeout(() => {
  766. // U.MD.D.getNotice();
  767. // }, 5000);
  768. }, [], { "type": "GET", "withCredentials": true });
  769. }
  770. // // 創建 video 元素並設置屬性
  771. // const video = document.createElement("video");
  772. // video.src = "../../img/icon/video/mxStart.mp4";
  773. // video.autoplay = true;
  774. // video.muted = true;
  775. // video.style="width: 100%;"
  776. // // 添加 video 元素到頁面
  777. // document.body.appendChild(video);
  778. // // 在視頻播放完成後刪除 video 元素
  779. // video.addEventListener("ended", () => {
  780. // document.body.removeChild(video);
  781. // });
  782. function formatDate(_date) {
  783. let time = _date.replace(/-/g, '/')
  784. let date = new Date(time);
  785. const year = date.getFullYear();
  786. const month = (date.getMonth() + 1).toString().padStart(2, "0");
  787. const day = date.getDate().toString().padStart(2, "0");
  788. const hours = date.getHours().toString().padStart(2, "0");
  789. const minutes = date.getMinutes().toString().padStart(2, "0");
  790. const seconds = date.getSeconds().toString().padStart(2, "0");
  791. return `${year}年${month}月${day}日`;
  792. }
  793. function formatDate2(_date) {
  794. let date = _date;
  795. const year = date.getFullYear();
  796. const month = (date.getMonth() + 1).toString().padStart(2, "0");
  797. const day = date.getDate().toString().padStart(2, "0");
  798. const hours = date.getHours().toString().padStart(2, "0");
  799. const minutes = date.getMinutes().toString().padStart(2, "0");
  800. const seconds = date.getSeconds().toString().padStart(2, "0");
  801. return `${year}年${month}月${day}日`;
  802. }
  803. function loginPan(userInfo, userId) {
  804. const currentDate = new Date();
  805. // 判斷 isLogin1 和 isLogin2 是否為 2 或者是否過期(且過期時間是有效的日期格式)
  806. if (
  807. userInfo.isLogin1 == 2 ||
  808. (userInfo.isLogin1 &&
  809. userInfo.isLogin1 != 1 &&
  810. userInfo.isLogin1 != 2 &&
  811. new Date(userInfo.isLogin1) < currentDate) ||
  812. userInfo.isLogin2 == 2 ||
  813. (userInfo.isLogin2 != 1 &&
  814. userInfo.isLogin2 != 2 &&
  815. new Date(userInfo.isLogin2) < currentDate) ||
  816. userInfo.state != 1
  817. ) {
  818. U.MD.U.LO.logoutSystem2();
  819. return;
  820. }
  821. let vipbox = $(".U_MD_D_BD_vip_box")[0];
  822. vipbox && (vipbox.style.display = "block");
  823. let vip_time = $(".vip_time")[0];
  824. let vtime = "";
  825. let vMember = "基礎用戶";
  826. // 獲取 isLogin1 和 isLogin2 的值
  827. let isLogin1 = userInfo.isLogin1;
  828. let isLogin2 = userInfo.isLogin2;
  829. if (isLogin2 != 1 && isLogin2 != null) {
  830. vtime = formatDate(isLogin2);
  831. vMember = "高級用戶";
  832. } else if (isLogin1 != 1 && isLogin1 != null) {
  833. vtime = formatDate(isLogin1);
  834. vMember = "高級用戶";
  835. } else if (
  836. (isLogin1 == 1 && isLogin2 == 1) ||
  837. (isLogin1 == null && isLogin2 == 1)
  838. ) {
  839. vtime = formatDate2(new Date(currentDate.setFullYear(currentDate.getFullYear() + 1)));
  840. vMember = "基礎用戶";
  841. }
  842. vip_time && (vip_time.innerHTML = vtime);
  843. let orgName = userInfo.orgName;
  844. let schoolName = userInfo.schoolName;
  845. let vip_school = $(".vip_school")[0];
  846. vip_school && (vip_school.innerHTML = orgName ? orgName : schoolName);
  847. let vip_member = $(".vip_member")[0];
  848. vip_member && (vip_member.innerHTML = vMember);
  849. U.A.Request(
  850. US.Config.pbl + "addLoginOperation",
  851. [userId],
  852. function (res) {},
  853. [],
  854. { type: "POST", withCredentials: true }
  855. );
  856. if (userInfo.organizeid == "91305d49-01ba-11ed-8c78-005056b86db4") {
  857. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/mingdeBg.png")';
  858. US.Config.background = 'url("/img/icon/mingdeBg.png")';
  859. } else if (
  860. userInfo.organizeid == "c7df0bd4-6e75-401a-a137-4e163aa62263"
  861. ) {
  862. $("#U_MD_D_BG")[0].style.backgroundImage =
  863. 'url("/img/icon/zhongshanBg.png")';
  864. US.Config.background = 'url("/img/icon/zhongshanBg.png")';
  865. } else if (
  866. userInfo.organizeid == "580aac24-a939-49f7-a75a-40a7b5af3a17"
  867. ) {
  868. // $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/longweiBg.png")'
  869. } else if (
  870. userInfo.organizeid == "b1095a3c-1d06-4ac8-854f-7c0d97f4ab41"
  871. ) {
  872. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/yunhaiBg.jpg")';
  873. US.Config.background = 'url("/img/icon/yunhaiBg.png")';
  874. } else if (
  875. userInfo.organizeid == "857af1c7-c8ee-4b04-85b5-fd182903adb7"
  876. ) {
  877. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/beijingBg.png")';
  878. US.Config.background = 'url("/img/icon/beijingBg.png")';
  879. } else if (
  880. userInfo.organizeid == "69893dca-1d47-11ed-8c78-005056b86db5"
  881. ) {
  882. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/weilaiBg.png")';
  883. US.Config.background = 'url("/img/icon/weilaiBg.png")';
  884. } else if (
  885. userInfo.organizeid == "efdef564-4064-11ed-8c78-005056b86db5"
  886. ) {
  887. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/pz.jpg")';
  888. US.Config.background = 'url("/img/icon/pz.png")';
  889. } else if (
  890. userInfo.organizeid == "d9db3320-503a-11ed-8c78-005056b86db5"
  891. ) {
  892. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/hzBg.png")';
  893. US.Config.background = 'url("/img/icon/hzBg.png")';
  894. } else if (
  895. userInfo.organizeid == "ccb9754d-59c1-11ed-8c78-005056b86db5"
  896. ) {
  897. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/nanfangBg.png")';
  898. US.Config.background = 'url("/img/icon/nanfangBg.png")';
  899. } else if (
  900. userInfo.organizeid == "f30a6615-5379-11ed-8c78-005056b86db5"
  901. ) {
  902. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/longhuaBg.png")';
  903. US.Config.background = 'url("/img/icon/longhuaBg.png")';
  904. } else if (
  905. userInfo.organizeid == "4787cc87-6588-11ed-8c78-005056b86db5"
  906. ) {
  907. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/nanfangBg.png")';
  908. US.Config.background = 'url("/img/icon/nanfangBg.png")';
  909. } else if (
  910. userInfo.organizeid == "9f888eae-7558-11ed-8c78-005056b86db5"
  911. ) {
  912. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/song.png")';
  913. US.Config.background = 'url("/img/icon/song.png")';
  914. } else if (
  915. userInfo.organizeid == "2b9ceb66-a1dd-11ed-b13d-005056b86db5"
  916. ) {
  917. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/gmxxBg.png")';
  918. US.Config.background = 'url("/img/icon/gmxxBg.png")';
  919. } else if (
  920. userInfo.organizeid == "1c3b9def-8fbe-11ed-b13d-005056b86db5"
  921. ) {
  922. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/wankeBg.png")';
  923. US.Config.background = 'url("/img/icon/wankeBg.png")';
  924. } else if (
  925. userInfo.organizeid == "82fcb5c7-c13b-11ed-8d51-005056b86db5"
  926. ) {
  927. $("#U_MD_D_BG")[0].style.backgroundImage =
  928. 'url("/img/icon/qiaoxiangBg.png")';
  929. US.Config.background = 'url("/img/icon/qiaoxiangBg.png")';
  930. } else if (
  931. userInfo.organizeid == "4c686762-1d0a-11ed-8c78-005056b86db5"
  932. ) {
  933. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/sies.png")';
  934. US.Config.background = 'url("/img/icon/sies.png")';
  935. } else if (
  936. userInfo.organizeid == "ea2a8c65-f38c-11ed-91d8-005056b86db5"
  937. ) {
  938. $("#U_MD_D_BG")[0].style.backgroundImage =
  939. 'url("/img/icon/longhuaZXBg.png")';
  940. US.Config.background = 'url("/img/icon/longhuaZXBg.png")';
  941. } else if (
  942. userInfo.organizeid == "f297fbdc-f0a0-11ee-b534-005056b86db5"
  943. ) {
  944. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/010606.png")';
  945. US.Config.background = 'url("/img/icon/010606.png")';
  946. }
  947. if (userInfo.org == "eb2af5e9-ac3d-46b6-9fe3-3c1c364f018d") {
  948. $("#U_MD_D_BG")[0].style.backgroundImage =
  949. 'url("/img/icon/yantianOrgBg.png")';
  950. US.Config.background = 'url("/img/icon/yantianOrgBg.png")';
  951. } else if (userInfo.org == "7ada499f-4ec7-11ed-8c78-005056b86db5") {
  952. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/csteamBg.png")';
  953. US.Config.background = 'url("/img/icon/csteamBg.png")';
  954. } else if (userInfo.org == "eb2af5e9-ac3d-46b6-9fe3-3c1c364f0217") {
  955. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/gm/bg.png")';
  956. US.Config.background = 'url("/img/icon/bg.png")';
  957. U.MD.D.getNotice();
  958. } else if (userInfo.org == "97c4ee8b-d010-4042-986d-e9d3c217264f") {
  959. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/zhoujia.jpg")';
  960. US.Config.background = 'url("/img/icon/zhoujia.png")';
  961. } else if (userInfo.org == "150e3120-9195-11ed-b13d-005056b86db5") {
  962. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/tencentBg.jpg")';
  963. US.Config.background = 'url("/img/icon/tencentBg.png")';
  964. U.MD.D.getNotice();
  965. } else if (userInfo.org == "ee40e8e3-e36c-4872-8105-cf395481012s") {
  966. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/szscBg.png")';
  967. US.Config.background = 'url("/img/icon/szscBg.png")';
  968. U.MD.D.getNotice();
  969. } else if (userInfo.org == "ec0af97a-7c10-4259-a7eb-db9cc8174cdc") {
  970. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/futianBg.png")';
  971. US.Config.background = 'url("/img/icon/futianBg.png")';
  972. } else if (userInfo.org == "e632b86c-f89d-11ed-91d8-005056b86db5") {
  973. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/gdjgBg.png")';
  974. US.Config.background = 'url("/img/icon/gdjgBg.png")';
  975. } else if (userInfo.org == "54f09f1e-09f0-11ee-91d8-005056b86db5") {
  976. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/szlhyjBg.jpeg")';
  977. US.Config.background = 'url("/img/icon/szlhyjBg.jpeg")';
  978. } else if (userInfo.org == "7b016f69-0f4f-11ee-91d8-005056b86db5") {
  979. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/dseiBg.png")';
  980. US.Config.background = 'url("/img/icon/dseiBg.png")';
  981. } else if (userInfo.org == "1973f6c7-1561-11ee-91d8-005056b86db5") {
  982. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/szjkyBg2.png")';
  983. US.Config.background = 'url("/img/icon/szjkyBg2.png")';
  984. } else if (userInfo.org == "2fa75e51-189a-11ee-91d8-005056b86db5") {
  985. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/chjyjBg.png")';
  986. US.Config.background = 'url("/img/icon/chjyjBg.png")';
  987. } else if (userInfo.org == "2a9f32ea-88df-49eb-aba1-0a286f691474") {
  988. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/qhBg.jpg")';
  989. US.Config.background = 'url("/img/icon/qhBg.jpg")';
  990. } else if (userInfo.org == "884c5665-a453-46f3-b7b6-01d575290aa9") {
  991. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/scnuaiBg.png")';
  992. US.Config.background = 'url("/img/icon/scnuaiBg.png")';
  993. } else if (userInfo.org == "2fe1a080-4425-4620-b7a0-be2f3750ffd4") {
  994. $("#U_MD_D_BG")[0].style.backgroundImage =
  995. 'url("/img/icon/x010607bgImg.png")';
  996. US.Config.background = 'url("/img/icon/x010607bgImg.png")';
  997. } else if (userInfo.org == "ec84034b-8ea4-4d27-9cba-1adcb4720bb3") {
  998. $("#U_MD_D_BG")[0].style.backgroundImage =
  999. 'url("/img/icon/SPROUTLabBg.png")';
  1000. US.Config.background = 'url("/img/icon/SPROUTLabBg.png")';
  1001. } else if (
  1002. userInfo.org == "b47d2ea8-7044-4810-9cb7-3aaf8b74cfbc"
  1003. ) {
  1004. $("#U_MD_D_BG")[0].style.backgroundImage = 'url("/img/icon/Tianyuan.png")';
  1005. US.Config.background = 'url("/img/icon/Tianyuan.png")';
  1006. }
  1007. US.userInfo = userInfo;
  1008. $(".avatar")[0].style.display = "block";
  1009. if (
  1010. userInfo.type === 1 &&
  1011. $(".U_PBL_Check")[0] &&
  1012. userInfo.org != "150e3120-9195-11ed-b13d-005056b86db5" && userInfo.org != 'b47d2ea8-7044-4810-9cb7-3aaf8b74cfbc'
  1013. ) {
  1014. $(".U_PBL_Check")[0].style.display = "block";
  1015. }
  1016. }
  1017. function loginSet(userInfo, res){
  1018. let userId = userInfo.userid
  1019. if (res.value == null || res.value[0].length == 0) {
  1020. // U.MD.D.I.openApplication("my")
  1021. let _name = US.userInfo.alias ? US.userInfo.alias : US.userInfo.username
  1022. let _type = US.userInfo == 1 ? 2 : 1
  1023. // US.Config.pbl
  1024. // "http://localhost:7003/api/pbl/"
  1025. U.A.Request(US.Config.pbl + "updatePblMessage", [userId, _name, _type, '16d397f3-b192-11ed-9211-005056b86db5', '', '', "0"], function (res) {
  1026. window.location.reload();
  1027. }, [], { "type": "POST", "withCredentials": true });
  1028. } else {
  1029. loginPan(userInfo, userId)
  1030. }
  1031. if($(".U_PBL_Check2")[0]){
  1032. $(".U_PBL_Check2")[0].style.display = "none";
  1033. }
  1034. $(".login")[0].style.display = "none";
  1035. $(".register")[0].style.display = "none";
  1036. $(".userName")[0].style.display = "block";
  1037. $(".userName")[0].innerHTML = US.userInfo.username || US.userInfo.alias;
  1038. $(".exit")[0].style.display = "block";
  1039. let _vipbox = $('.U_MD_D_BD_vip_box')[0]
  1040. _vipbox && (_vipbox.style.right = $(".U_MD_D_BD")[0].offsetWidth + 20 + 'px')
  1041. if(userInfo.type === 1 && userInfo.org == 'c95e0a56-c205-11ed-8d51-005056b86db5'){
  1042. U.MD.D.I.ModeCheck(2)
  1043. }else{
  1044. U.MD.D.I.initDesktopIcons($("#U_MD_D_K")[0], 1);
  1045. }
  1046. let shareCourseId = window.location.href.indexOf("?shareCourseId=")!=-1?window.location.href.split("?shareCourseId=")[1].toString():''
  1047. if(shareCourseId){
  1048. console.log(shareCourseId);
  1049. U.MD.D.I.openInApplication("studyDetail", shareCourseId, 5, 1)
  1050. }
  1051. if(userInfo.type === 1 && window.location.hash.indexOf('project') != -1){
  1052. U.MD.D.I.openApplication("project")
  1053. }
  1054. if(userInfo.type === 1 && window.location.hash.indexOf('study') != -1){
  1055. U.MD.D.I.openApplication("study")
  1056. }
  1057. if(userInfo.type === 2 && window.location.hash.indexOf('study') != -1){
  1058. U.MD.D.I.openApplication("studentStudy")
  1059. }
  1060. if(userInfo.type === 1 && U.UF.C.queryString('tycode') && U.UF.C.queryString('app')){
  1061. U.MD.D.I.openApplication(U.UF.C.queryString('app'))
  1062. }
  1063. U.MD.O.P.connect(); //登录成功后连接socket服务同步协同编辑
  1064. }