Onload.js 51 KB

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