View.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. Namespace.register("U.MD.U.V"); //查看用户信息弹框
  2. //#region 用户信息查看
  3. //------------------------------------------------------------------------------用户个人信息
  4. //个人信息
  5. U.MD.U.V.UIFZX = U.MD.U.V.ViewOtherUserInfo = function (userid) {
  6. var _userinfoel = $("#U_MD_U_UV").clone(true), // 用户信息元素
  7. _childs = $(_userinfoel[0]).Child(),
  8. _head = _childs[0],
  9. _middle = _childs[1],
  10. _aboutMe = _childs[2];
  11. var _div = $$('div');
  12. _div.appendChild(_head); //个人信息的头部
  13. _div.appendChild(_middle); //个人信息的中间部分
  14. _div.appendChild(_aboutMe); //个人信息的底部
  15. //弹出好友信息弹框
  16. if ($('#U_MD_F_S_TI_Info')[0])
  17. document.body.removeChild($('#U_MD_F_S_TI_Info')[0])
  18. var _form = new U.UF.UI.form("<div class='U_MD_F_S_TI'>个人信息</div>",
  19. _div,
  20. {
  21. "style": {
  22. "min-width": "460px",
  23. "width": "480px",
  24. "height": "400px"
  25. },
  26. id: "U_MD_F_S_TI_Info"
  27. },
  28. {
  29. isenlarge: false,
  30. isnarrow: false
  31. }).form;
  32. //信息加载
  33. U.A.Request(US.USER, ["ViewOtherUserInfo", userid],
  34. U.MD.U.V.ViewOtherUserInfoAsyn, ['', _head, _middle, _aboutMe, _form])
  35. // U.MD.U.V.ViewUserBlogInfo(_bloginfoel, userid, 1, true); //查看用户最新表表的博客
  36. }
  37. //打印用户信息 function(){U.MD.U.L.setLoginCallBack(function(){();});}
  38. U.MD.U.V.ViewOtherUserInfoAsyn = function (r) {
  39. var _userinfo = r.value[0],
  40. _context = r.context,
  41. _form = _context[4],
  42. TN = _userinfo.UserTelephoneNumber; //用户电话号码
  43. $(_context[1]).find('.U_MD_U_UV_Head_Left')[0].firstElementChild.src = U.MD.C.getHeadImage(_userinfo.UserImageHead || _userinfo.UserThumbnailImageHead); //打印用户头像
  44. $(_context[1]).find('.U_MD_U_UV_Name')[0].innerText = _userinfo.TrueName || _userinfo.UserName || "不详"; //打印用户名字
  45. $(_context[1]).find('.U_MD_U_UV_Desc')[0].innerText = _userinfo.UserIndividualitysignature || "不详"; //打印用户介绍
  46. $(_context[3]).find('.U_MD_U_UV_Place')[0].innerText = _userinfo.City || "不详"; //打印用户地址
  47. $(_context[3]).find('.U_MD_U_UV_MailBox')[0].innerText = _userinfo.UserEmail != "null" ? _userinfo.UserEmail : "不详"; //打印用户邮箱
  48. $(_context[3]).find('.U_MD_U_UV_PhoneNum')[0].innerText = TN ? (TN.substring(0, 3) + "****" + TN.substring(7, TN.length)) : "不详"; //打印用户的电话号码
  49. $(_context[3]).find('.U_MD_U_UV_Birthday')[0].innerText = _userinfo.Birthday ? U.UF.D.formatDateToArray(_userinfo.Birthday).slice(0, 3).join('-') : "不详"; //打印用户的出生日期
  50. //获取文件统计数据
  51. U.A.Request(US.CD, [US.DB, 'UseStudio_Users', 'GetStatisticData', _userinfo.UserId], function (data) {
  52. $('.U_MD_U_UV_Friend', _context[1])[0].innerText = data.value[0].friendCount;
  53. $('.U_MD_U_UV_Word', _context[1])[0].innerText = data.value[0].wrodCount;
  54. $('.U_MD_U_UV_Excel', _context[1])[0].innerText = data.value[0].excelCount;
  55. $('.U_MD_U_UV_Cloud', _context[1])[0].innerText = data.value[0].diskFileCount;
  56. });
  57. //添加好友事件处理
  58. var _friendinfo,
  59. _addbutton = $('.U_MD_U_UV_Head_Right_Btn', _context[1])[0],
  60. _functionbtn = $(_context[2]).find('.U_MD_U_UV_FuncArea_MarginBox_Btn'); //获取三个按钮
  61. _functionbtn[2].style.display = '';
  62. if (_userinfo.UserId == US.userInfo.userid) {
  63. _addbutton.onclick = function () {
  64. U.Alert("不可以添加自己为好友哟!");
  65. };
  66. _functionbtn[2].style.display = 'none';
  67. } else if (US.friend.friends && (_friendinfo = U.Json.select(US.friend.friends, { UserId: _userinfo.UserId })[0])) {
  68. _addbutton.onclick = function () {
  69. U.MD.F.R.deleteFriendForm(_friendinfo, function () {
  70. U.UF.F.closeWindow(_form);
  71. });
  72. //U.MD.F.M.deleteFriend(_friendinfo);
  73. //U.UF.F.closeWindow(_form); //关闭窗口函数
  74. };
  75. _addbutton.style.backgroundColor = '#e20f0f';
  76. _addbutton.innerText = '删除好友';
  77. } else {
  78. _addbutton.style.backgroundColor = '';
  79. _addbutton.onclick = function () {
  80. U.MD.F.M.addFriend(_userinfo, function () {
  81. U.UF.F.closeWindow(_form); //关闭窗口函数
  82. });
  83. }
  84. }
  85. //协同文档事件绑定
  86. _functionbtn[0].onclick = function () {
  87. U.MD.D.I.openApplication("disk", { "userid": _userinfo.UserId, "directoryid": US.disk.initTree[1][0] });
  88. }
  89. //协同他人文档事件绑定
  90. _functionbtn[1].onclick = function () {
  91. U.MD.D.I.openApplication("disk", { "userid": _userinfo.UserId, "directoryid": US.disk.initTree[2][0] });
  92. }
  93. //发起对话事件绑定
  94. _functionbtn[2].onclick = function () {
  95. if (!U.MD.U.L.isLogin()) {
  96. var _friendinfo = U.Json.select(US.friend.friends, { UserId: _userinfo.UserId })[0];
  97. if (_friendinfo) {
  98. U.MD.F.W.popupFriendsForm(_friendinfo);
  99. U.UF.F.closeWindow(_form); //关闭窗口函数
  100. } else {
  101. U.UF.UI.confirm((_userinfo.UserNickName || _userinfo.UserName) + "还不是你的好友哟!是否添加" + (_userinfo.UserNickName || _userinfo.UserName) + "为好友呢。", function () {
  102. U.MD.F.M.addFriend(_userinfo, function () {
  103. U.UF.F.closeWindow(_form); //关闭窗口函数
  104. });
  105. });
  106. }
  107. }
  108. }
  109. }
  110. /**
  111. * 添加好友状态切换 暂无使用
  112. * @param {element} button 点击元素
  113. * @param {element} userinfo 用户信息
  114. */
  115. U.MD.U.V.AddFriend = function (button, userinfo) {
  116. U.MD.F.M.addFriend(userinfo, function () {
  117. button.innerText = '删除好友';
  118. button.style.backgroundColor = '#e20f0f';
  119. button.onclick = function () {
  120. _friendinfo = U.Json.select(US.friend.friends, { UserId: userInfo.userid })[0];
  121. U.MD.F.M.deleteFriend(_friendinfo);
  122. button.innerText = '+好友';
  123. button.style.backgroundColor = '';
  124. button.onclick = function () {
  125. U.MD.U.V.AddFriend(button, userinfo);
  126. }
  127. };
  128. });
  129. }
  130. //滚动加载
  131. U.MD.U.V.GDCKYHDT = function (UDOD, userid) {
  132. _UDFE = U.MD.D.H.ET["UIF"][userid][1];
  133. U.MD.U.V.ViewUserBlogInfo(UDOD, _UDFE, userid, this.P + 2); //分页打印
  134. }
  135. //获取用户最新发表
  136. U.MD.U.V.ViewUserBlogInfo = function (UDOD, UDPE, userid, P, TF) {
  137. var _userinfoel = $(UDOD).Child();
  138. UDPE = U.MD.D.D.FYGBL(UDPE, P); //U.UF.EL.getChildrenNoText()
  139. if (UDPE[0]) {
  140. if (TF) { _userinfoel[1].innerText = ""; }
  141. if (UDPE[0].length) { U.MD.D.Blog.PGBL(_userinfoel[1], UDPE[0], true); }
  142. else if (P === 1) { U.MD.U.V.PCKYHDT(_userinfoel[1]); }
  143. } //打印文章
  144. else { U.A.Request(US.USER, ["GFA", US.EMPTYGUID, (UDPE[1] - 1) * 100, UDPE[1] * 100, userid, US.EMPTYGUID], U.MD.U.V.AsynCKYHDT, [(P == 1 ? [_userinfoel[1], true] : [$("#U_MD_U_UV_PL")[0], 1]), UDOD, userid, P, UDPE[1], _userinfoel]); }
  145. //$("div#U_MD_U_UV_PC", _userinfoel[0])[0].onscroll = U.UF.EV.scrollLoad({ "AF": function () { U.MD.U.V.GDCKYHDT(_bloginfoel, userid); } }).SCH(); //滚动加载
  146. U.UF.EV.scrollLoad($("div#U_MD_U_UV_PC", _userinfoel[0])[0], function () { U.MD.U.V.GDCKYHDT(_bloginfoel, userid); }); //滚动加载
  147. }
  148. //异步获取最新的文章
  149. U.MD.U.V.AsynCKYHDT = function (r) {
  150. var _context = r.context,
  151. UPXD = U.MD.D.H.ET["UIF"][_context[2]];
  152. r = r.value;
  153. if (!UPXD) { UPXD = U.MD.D.H.ET["UIF"][_context[2]] = [], UPXD[1] = [] };
  154. UPXD[1] = UPXD[1] || [];
  155. UPXD[1][_context[4]] = U.MD.D.Blog.ZFSGBL(r);
  156. _context[5][1].innerText = "";
  157. _context[5][0].innerText = r[0] > 0 ? "动静..(" + r[0].SumNumber + ")" : "动静";
  158. U.MD.U.V.ViewUserBlogInfo(_context[1], UPXD[1], _context[2], _context[3]); //打印用户的文章
  159. }
  160. //用户资料没有发表文章
  161. U.MD.U.V.PCKYHDT = function (UDOD) {
  162. var _userinfoel = $$("div", { "className": "U_MD_U_UV_T" }, UDOD);
  163. $$("div", { "className": "U_MD_U_UV_TS", "innerHTML": "他暂时没有相关的消息呢!!稍后再来试试吧~" }, _userinfoel);
  164. $$("div", { "className": "U_MD_U_UV_TX", "innerHTML": "Noting!!" }, _userinfoel);
  165. }
  166. //群介绍
  167. U.MD.U.V.GroupInfo = function (groupinfo) {
  168. var _userinfoel = $("#U_MD_U_GV").clone(true), // 用户信息元素
  169. _childs = $(_userinfoel[0]).Child(),
  170. _content = _childs[0];
  171. U.MD.U.V.syncData(_content, groupinfo);
  172. var _form = new U.UF.UI.form("<div class='U_MD_F_S_TI'>群信息</div>",
  173. _content,
  174. {
  175. "style": {
  176. "min-width": "480px",
  177. "width": "480px",
  178. "height": "340px"
  179. },
  180. id: "U_MD_G_Info"
  181. },
  182. {
  183. isenlarge: false,
  184. isnarrow: false
  185. }).form;
  186. }
  187. //同步群介绍的数据
  188. U.MD.U.V.syncData = function (el, groupinfo) {
  189. var _head = el.children[0], //群介绍的头部
  190. _middle = el.children[1], //群介绍的中间部分
  191. _bottom = el.children[2], //群介绍的底部
  192. _groupId = groupinfo.GroupManageID, //群的ID
  193. _groupCreaterId = groupinfo.GroupManageCreateUserID, //群主的ID
  194. _groupCreaterEl = $(_bottom).find('.U_MD_U_GV_GroupInfo_ImgArea_Creater')[0], //群主显示的元素
  195. _groupMember = U.Json.select(US.friend.groupusers, { GroupManageID: _groupId }), //群人数
  196. _cloneEl = $$('img'), //创建图片
  197. _createrImg = _cloneEl.cloneNode(), //克隆图片元素
  198. _groupMemberEl = $(_bottom).find('.U_MD_U_GV_GroupInfo_ImgArea_MemberImg')[0], //群人数显示的元素
  199. _groupBtn = $(_middle).find('.U_MD_U_GV_FuncArea_MarginBox_Btn'); //群的三个按钮
  200. $(_head).find('.U_MD_U_GV_HeadInfo_Name')[0].innerText = groupinfo.GroupManageName; //群的名字
  201. $(_head).find('.U_MD_U_GV_HeadInfo_Desc')[0].innerText = groupinfo.GroupManageDescript; //群的介绍
  202. $(_bottom).find('.U_MD_U_GV_GroupInfo_Img_TextNum')[0].innerText = _groupMember.length; //群的人数
  203. _createrImg.src = U.MD.C.getHeadImage(U.Json.selectOne(US.friend.groupusers, { UserId: _groupCreaterId }).UserThumbnailImageHead) || "/img/UserHead/UseHead.jpg"; //群头像
  204. _groupCreaterEl.appendChild(_createrImg) //把群头像添加到元素里
  205. _groupCreaterEl.onclick = function () {
  206. U.MD.U.V.ViewOtherUserInfo(_groupCreaterId);
  207. }
  208. _groupBtn[2].onclick = function () {
  209. top.U.MD.F.W.popupFriendsForm(groupinfo);
  210. }
  211. for (var i = 0; i < _groupMember.length; i++) {
  212. if (i < 6) {
  213. var _cloneImg = _cloneEl.cloneNode();
  214. _cloneImg.src = U.MD.C.getHeadImage(_groupMember[i].UserThumbnailImageHead) || "/img/UserHead/UseHead.jpg";
  215. _cloneImg.onclick = U.UF.C.closure(function (i) {
  216. U.MD.U.V.ViewOtherUserInfo(_groupMember[i].UserId);
  217. }, [i])
  218. _groupMemberEl.appendChild(_cloneImg);
  219. } else {
  220. $$('span', { className: "U_MD_U_GV_GroupInfo_ImgArea_MemberMore", innerText: "···", onclick: function () {
  221. U.MD.U.V.showAllGroupMember(_groupMember, this, _cloneEl, _groupMemberEl);
  222. }
  223. }, _groupMemberEl);
  224. return;
  225. }
  226. }
  227. }
  228. U.MD.U.V.showAllGroupMember = function (groupmember, el, cloneel, addel) {
  229. addel.style.display = "none";
  230. addel.style.height = "82px";
  231. for (var i = 6; i < groupmember.length; i++) {
  232. var _cloneImg = cloneel.cloneNode();
  233. _cloneImg.src = U.MD.C.getHeadImage(groupmember[i].UserThumbnailImageHead) || "/img/UserHead/UseHead.jpg";
  234. _cloneImg.onclick = U.UF.C.closure(function (i) {
  235. U.MD.U.V.ViewOtherUserInfo(groupmember[i].UserId);
  236. }, [i]);
  237. addel.appendChild(_cloneImg);
  238. }
  239. addel.style.display = "block";
  240. $(el).remove();
  241. }
  242. //#endregion