U.D.PB.Re.js 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. Namespace.register("U.MD.D.PB.Re"); //pb回复处理
  2. //#region 回复
  3. /*
  4. * 获取回复内容
  5. *
  6. * @param {object} 帖子信息
  7. * @param {number} 目录信息
  8. * @param {string} 显示当前回复内容很的回复ID
  9. * @param {element} 帖子内容区域
  10. * @returns {Object}
  11. */
  12. U.MD.D.PB.Re.RPMHBK = function (UDE, UP, URID) {
  13. var _UDOD = $("#UD_SYPCLRR")[0], //回复打印的内容
  14. _UCE = U.MD.D.D.FYGBL(UDE.Reply, UP, [10, 100]); //获取当前页回复数据
  15. (UP == 1) && (_UDOD.innerText = ""); //第一页打印处理
  16. if (_UCE[0]) {
  17. if (_UCE[0].length) {
  18. U.MD.D.PB.Re.PRPMHBK(_UCE[0], _UDOD, UDE, URID); //打印回复的内容
  19. }
  20. return true;
  21. }
  22. else {
  23. U.UF.A.Request(US.CROSSDOMAIN, [US.DB, "UseStudio_Blog", "UB_P_S_SelectArticleAllReply", UDE.ArticleID, (_UCE[1] - 1) * 100, _UCE[1] * 100]), U.MD.D.PB.Re.AsynRPMHBK, ["", UDE, UP, _UCE[1], URID]; //获取回复
  24. // U.UF.A.Request(US.AUTH,"pb.ReplyList", [UDE.ArticleID, (_UCE[1] - 1) * 100, _UCE[1] * 100]), U.MD.D.PB.Re.AsynRPMHBK, ["", UDE, UP, _UCE[1], URID]; //获取回复
  25. }
  26. }
  27. //分页滚动加载
  28. U.MD.D.PB.Re.FGRPMHBK = function () {
  29. U.MD.D.PB.Re.RPMHBK(U.MD.D.H.ET["NT"]["PB"]["DWZ"], this.P + 2); //滚动加载监听出发
  30. }
  31. //获取回复异步
  32. U.MD.D.PB.Re.AsynRPMHBK = function (r) {
  33. var i, context = r.context,
  34. _UDE = context[1]; //帖子信息
  35. r = r.value;
  36. (_UDE.Reply == null) && (_UDE.Reply = []); _UDE.Reply[context[2]] = []; //给回复添加实体
  37. for (i = 0; i < r.length; i++) { //生成回复分类
  38. if (!r[i].ReplyParentID) {
  39. _UDE.Reply[context[2]].push(r[i]); //回复添加到回复实体里
  40. r[i]["RR"] = _$(r).Select({ "ReplyParentID": r[i].ReplyID }); //设置回复的回复
  41. }
  42. }
  43. U.MD.D.PB.Re.RPMHBK(_UDE, context[2], context[4]); //获取回复成功 同时打印回复
  44. }
  45. /*
  46. * 获取回复内容
  47. *
  48. * @param {object} 回复信息
  49. * @param {element} 元素
  50. * @param {object} 帖子信息
  51. * @param {string} 当前回复信息的位置id
  52. * @returns {Object}
  53. */
  54. U.MD.D.PB.Re.PRPMHBK = function (UDE, UDOD, UAE, URID) {
  55. var i, j, _UCE, _UDBD, _UDTD, _UDSD, _UDND, _UDID, _UDKD, _UDLD, _UDMD, _UIMG, _UIF = US.userInfo, _UDFD = $$("frag");
  56. /*
  57. 此处为样式打印输出
  58. */
  59. for (i = 0; i < UDE.length; i++) {
  60. _UCE = UDE[i]["RR"] || [];
  61. _UDTD = $$("div", { "className": "UD_SYPCLRRO" }, _UDFD); (URID == UDE[i].ReplyID) && (_UDBD = _UDTD);
  62. _UDSD = $$("div", { "className": "UD_SYPCLRROS" }, _UDTD);
  63. _UDND = $$("div", { "className": "UD_SYPCLRROSA" }, _UDSD);
  64. _UDID = $$("div", { "className": "UD_SYPCLRROL" }, _UDND);
  65. $$("img", { "onerror": U.UF.M.ImgError, "alt": UDE[i].UserNickName, "onclick": [[U.MD.U.I.ViewOtherUserInfo, [UDE[i].ReplyAddUserID]]], "src": U.UF.M.GetImgU(UDE[i].UserThumbnailImageHead) }, _UDID);
  66. _UDID = $$("div", { "className": "UD_SYPCLRROR" }, _UDND);
  67. _UDKD = $$("div", { "className": "UD_SYPCLRRORS" }, _UDID);
  68. $$("div", { "className": "UD_SYPCLRRORSN UTDF", "innerHTML": UDE[i].UserNickName }, _UDKD);
  69. $$("div", { "className": "UD_SYPCLRRORST", "innerHTML": U.UF.D.getDateInterval(UDE[i].ReplyAddTime) }, _UDKD);
  70. _UDKD = $$("div", { "className": "UD_SYPCLRRORX" }, _UDID);
  71. _UDLD = $$("div", { "className": "UD_SYPCLRRORXC" }, _UDKD);
  72. _UDMD = $$("div", { "className": "UD_SYPCLRRORXCO", "innerHTML": UDE[i].ReplyContent }, _UDLD);
  73. $("a", _UDMD).addAttrArray({ "target": "_blank" });
  74. _UDMD = $("img", _UDMD);
  75. _UIMG = [];
  76. for (j = 0; j < _UDMD.length; j++) {
  77. _UIMG.push({ "Time": UDE.ArticleAddTime, "Thm": _UDMD[j].src, "Img": _UDMD[j].alt.indexOf(US.FILESYSTEMURL) > -1 ? _UDMD[j].alt : _UDMD[j].src });
  78. _UDMD.addAttrArray({ "style": { "cssText": "" }, "onclick": [[U.UF.M.StopBubble], [U.MD.I.Img, [_UIF, _UIMG, j]]] }, j);
  79. }
  80. _UDID = $$("div", { "className": "UD_SYPCLRROM" }, _UDND);
  81. _UDID = $$("div", { "className": "UD_SYPCLRROMO" }, _UDID);
  82. $$("div", { "className": "UD_SYPCLRROMA", "innerHTML": "回复" + (_UCE.length > 0 ? "(" + _UCE.length + ")" : ""), "onclick": [[U.MD.D.PB.Re.XPRPMHBK, [_UDSD, UDE[i], UAE]]] }, _UDID);
  83. if (UDE[i].ReplyAddUserID == US.userInfo.userid) {
  84. $$("div", { "className": "UD_SYBFOZTK UD_SYBFOZTKO", "style": { "margin": "0 0 0 5px" }, "title": "删除", "innerHTML": "删除",
  85. "onclick": [[U.UF.UI.Confirm, ["是否撤销评论", [U.MD.D.Blog.R.SCPHFRGBL, [UDE, UDE[i], UAE, _UDTD]]]]]
  86. }, _UDID);
  87. }
  88. _UDSD = $$("div", { "className": "UD_SYPCLRROX" }, _UDTD);
  89. for (j = 0; (_UCE && j < _UCE.length); j++) {
  90. _UDID = $$("div", { "className": "UD_SYPCLRROXO" }, _UDSD); (URID == _UCE[j].ReplyID) && (_UDBD = _UDID);
  91. _UDKD = $$("div", { "className": "UD_SYPCLRROL" }, _UDID);
  92. $$("img", { "onerror": U.UF.M.ImgError, "alt": _UCE[j].UserNickName, "onclick": [[U.MD.U.I.ViewOtherUserInfo, [_UCE[j].ReplyAddUserID]]], "src": U.UF.M.GetImgU(_UCE[j].UserThumbnailImageHead) }, _UDKD);
  93. _UDKD = $$("div", { "className": "UD_SYPCLRROXOR" }, _UDID);
  94. _UDLD = $$("div", { "className": "UD_SYPCLRROXORS" }, _UDKD);
  95. $$("div", { "className": "UD_SYPCLRROXORSO", "innerHTML": _UCE[j].UserNickName }, _UDLD);
  96. $$("span", { "className": "UD_SYPCLRROXORSS", "innerHTML": "回复" }, _UDLD);
  97. $$("div", { "className": "UD_SYPCLRROXORSO", "innerHTML": _UCE[j].ParentUserNickName, "style": { "marginLeft": "5px"} }, _UDLD);
  98. _UDLD = $$("div", { "className": "UD_SYPCLRRORX" }, _UDKD);
  99. _UDMD = $$("div", { "className": "UD_SYPCLRRORXC" }, _UDLD);
  100. $$("div", { "className": "UD_SYPCLRRORXCO", "innerHTML": _UCE[j].ReplyContent }, _UDMD);
  101. _UDKD = $$("div", { "className": "UD_SYPCLRROM" }, _UDID);
  102. _UDKD = $$("div", { "className": "UD_SYPCLRROMO" }, _UDKD);
  103. $$("div", { "className": "UD_SYPCLRROMA", "innerHTML": "回复", "onclick": [[U.MD.D.PB.Re.XPRPMHBK, [_UDID, _UCE[j], UAE, UDE[i]]]] }, _UDKD);
  104. if (_UCE[j].ReplyAddUserID == US.userInfo.userid) {
  105. $$("div", { "className": "UD_SYBFOZTK UD_SYBFOZTKO", "style": { "margin": "0 0 0 5px" }, "title": "删除", "innerHTML": "删除",
  106. "onclick": [[U.UF.UI.Confirm, ["是否撤销评论", [U.MD.D.Blog.R.SCPHFRGBL, [_UCE, _UCE[j], UAE, _UDID]]]]]
  107. }, _UDKD);
  108. }
  109. }
  110. }
  111. UDOD.appendChild(_UDFD);
  112. (_UDBD) && (_UDBD.scrollIntoView(false), $(UDOD).Parent(2).scrollLeft = 0); //默认滚动到指定的回复位置
  113. }
  114. //#region 功能区域
  115. //添加回复显示
  116. U.MD.D.PB.Re.XPRPMHBK = function (UDOD, UDE, UAE, UPE) {
  117. if (!U.MD.U.L.isLogin(3)) {
  118. var _UDAD, _UDKD,
  119. _UDED = $("#UD_SYPCLRCL")[0],
  120. _UDAD = $(UDOD).Child();
  121. if (_UDAD[_UDAD.length - 1].className != "UD_SYPCLRC") {
  122. (_UDED == null) && (_UDED = $("#UD_SYPCLRC")[0].cloneNode(true), $(_UDED).addAttrArray({ "id": "UD_SYPCLRCL" }));
  123. _UDKD = $($($(_UDED).Child()[0]).Child()[0]).addAttrArray({ "innerText": "发表评论...", "id": "" })[0]; //清理评论框
  124. (_UDAD = $("div", _UDED))[_UDAD.length - 1].onclick = U.UF.M.apply(this, [[U.MD.D.PB.Re.APRPMHBK, [UDE, _UDKD, UAE, UPE || UDE]]]);
  125. UDOD.appendChild(_UDED); _UDKD.focus(); //添加回复框
  126. }
  127. else { $(_UDAD[_UDAD.length - 1]).remove(); }
  128. }
  129. }
  130. //添加回复
  131. U.MD.D.PB.Re.APRPMHBK = function (UDE, UDOD, UAE, UPE) {
  132. var _UTH = UDOD.innerHTML, _UTF = "请先登录", _URID = UDE ? (UDE.ReplyParentID || UDE.ReplyID) : "";
  133. if (US.userInfo.userid) { //发表帖子
  134. _UTF = "回复的内容部能为空";
  135. if (UDOD.innerText.trim().length > 0 && _UTH != "发表评论...") {
  136. _UTF = "正在回帖请稍等";
  137. U.UF.A.Request(US.AUTH, ["ReportReply", UAE.ArticleID, UDOD.innerHTML, _URID, UDE ? UDE.ReplyAddUserID : ""]), U.MD.D.PB.Re.AsynAPRPMHBK, ["", UDE, UAE, UDOD.innerHTML, UPE]; UDOD.innerHTML = "";
  138. }
  139. }
  140. U.Alert(_UTF);
  141. }
  142. //添加回复异步
  143. U.MD.D.PB.Re.AsynAPRPMHBK = function (r) {
  144. var i, _URE,
  145. _UST = "服务器繁忙",
  146. context = r.context,
  147. _UDE = context[1],
  148. _UAID = context[3],
  149. _UAE = context[4] || context[2];
  150. r = r.value;
  151. if (r) {
  152. (_UDE ? _UAE["RR"] : _UAE["Reply"][1]).unshift((_URE = new U.MD.D.PB.Re.TPRPMHBK[_UDE ? _UDE.UserNickName : "", U.UF.D.toTimeStamp(new Date()), US.userInfo.userid, _UAID, r, _UDE ? (_UDE.ReplyParentID || _UDE.ReplyID) : "", _UDE ? _UDE.ReplyAddUserID : "", US.userInfo.UserNickName, US.userInfo.UserThumbnailImageHead]));
  153. $("#UD_SYPCLCD&div")[4].innerHTML = (_UAE.ArticleReplayNumber++) + 1; U.MD.D.PB.Re.RPMHBK(context[2], 1); _UST = "发表回复成功";
  154. }
  155. U.Alert(_UST);
  156. }
  157. //回复的实体
  158. U.MD.D.PB.Re.TPRPMHBK = function (UDE) {
  159. this.ParentUserNickName = UDE[0];
  160. this.ReplyAddTime = UDE[1];
  161. this.ReplyAddUserID = UDE[2];
  162. this.ReplyContent = UDE[3];
  163. this.ReplyID = UDE[4];
  164. this.ReplyParentID = UDE[5];
  165. this.ReplyVerifyUserID = UDE[6];
  166. this.UserNickName = UDE[7];
  167. this.UserThumbnailImageHead = UDE[8];
  168. this.RR = [];
  169. }
  170. //#endregion
  171. //#endregion