BlogPost.js 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. Namespace.register("U.MD.D.Blog.A");
  2. //Blog帖子处理
  3. //#region 朋友圈发表
  4. //blog首页点击我要发布
  5. U.MD.D.Blog.A.FBCKME = function () {
  6. U.MD.U.L.setLoginCallBack(function () {
  7. U.UF.UI.EditorLoad({
  8. imgt: 9,
  9. style: {
  10. width: "600px",
  11. height: "500px"
  12. },
  13. title: false,
  14. name: "朋友圈",
  15. car: {
  16. onpaste: "U.MD.D.H.CPTATGBL(this);"
  17. },
  18. fcb: U.MD.D.Blog.A.FBGBL,
  19. upload: true
  20. });
  21. });
  22. }
  23. //发帖子变化
  24. U.MD.D.Blog.A.BHFBGBL = function (UDOD, UTF) {
  25. if (!UTF || !U.MD.U.L.isLogin()) {
  26. var i, j, _UDTD, _UDAD,
  27. _UMT = UTF ? "removeClass" : "addClass",
  28. _UDE = ["UD_SYSXZLRSAAO", "UD_SYSXZLRSAOO", "UD_SYSXZLRSATO"];
  29. UDOD = UDOD.length ? UDOD : [UDOD];
  30. for (i = 0; i < UDOD.length; i++) {
  31. _UDAD = (_UDTD = $(UDOD[i])).Child();
  32. _UDTD[_UMT](_UDE[0], 0);
  33. for (j = 1; j < _UDAD.length; j++) {
  34. $(_UDAD[j])[_UMT](_UDE[j]);
  35. }
  36. ; if (UTF) { _UDAD[1].focus() };
  37. }
  38. }
  39. }
  40. //发表文章字限制
  41. U.MD.D.Blog.A.OKFBGBL = function (UDOD) {
  42. var _UHT = UDOD.innerText;
  43. if (!_UHT.count() > 300) {
  44. U.UF.EV.stopDefault();
  45. U.Alert("文字输入无法大于150");
  46. }
  47. //阻止输出
  48. }
  49. //发表文章
  50. U.MD.D.Blog.A.FBGBL = function (UCT, UTI, UIMG) {
  51. var i;
  52. UCT = UCT.substrU(300);
  53. if (UIMG) {
  54. for (i = 0; i < UIMG.length; i++) {
  55. UCT += UIMG[i].outerHTML;
  56. }
  57. }
  58. //添加图片
  59. U.Alert("发表中...");
  60. U.A.Request(US.AUTH, ["addArticle", US.FORUMROOTID, "", UCT, "blog"], U.MD.D.Blog.A.AsynFBGBL, ["", UCT]);
  61. //发送文章
  62. }
  63. //发表文章异步
  64. U.MD.D.Blog.A.AsynFBGBL = function (r) {
  65. var _UDE, _UKE, _UDTD, _UDOD = $("#UD_SYSXZBR")[0], _userid = US.userInfo.userid, _context = r.context;
  66. r = r.value;
  67. if (r) {
  68. _UDE = U.MD.D.Blog.A.BLEI([r, 0, 0, U.UF.D.toTimeStamp(new Date()), _context[1], _context[1].substr(0, 100), US.userInfo.userid, US.userInfo.UserName, US.userInfo.UserThumbnailImageHead, 0]);
  69. //添加实体
  70. _UKE = U.MD.D.H.ET["UL"]["HY"][_userid];
  71. (_UKE && (_UKE = _UKE[1])) && ((!_UKE.length) && (_UDOD.innerText = ""),
  72. _UKE.push(_UDE));
  73. U.MD.D.Blog.PGBL(_UDOD, [_UDE], null, 0, true);
  74. U.Alert("成功发表");
  75. }
  76. }
  77. //朋友圈的实体
  78. U.MD.D.Blog.A.BLEI = function (UTE) {
  79. return {
  80. "ArticleID": UTE[0],
  81. "AricitleReadNumber": UTE[1],
  82. "ArticleReplayNumber": UTE[2],
  83. "ArticleAddTime": UTE[3],
  84. "ArticleContent": UTE[4],
  85. "ArticleContentBrief": UTE[5],
  86. "UserID": UTE[6],
  87. "UserName": UTE[7],
  88. "UserThumbnailImageHead": UTE[8],
  89. "ArticleZFN": UTE[9]
  90. }
  91. }
  92. //#endregion
  93. //#region 转发朋友圈
  94. //转发朋友圈
  95. U.MD.D.Blog.A.PAZF = function (UDE, UDMD) {
  96. if (U.MD.U.L.isLogin()) {
  97. var _UDTD, _UDSD, _UDOD = $("#UD_SYR"), _UDAD = _UDOD.Child()
  98. _UDOD.css("display", "block");
  99. new U.UF.UI.form("<div class='UD_SYF_STI'>转发使用</div>",
  100. _UDOD[0],
  101. {
  102. "id": "UD_SYRA",
  103. "style": {
  104. "width": "500px",
  105. "height": "360px"
  106. }
  107. },
  108. {
  109. isdrag: false,
  110. isenlarge: false
  111. }).form;
  112. (_UDSD = $("div", _UDAD[1])[0]).innerHTML = "可添加内容...";
  113. U.MD.D.Blog.A.PAZFP(UDE, _UDAD[2]);
  114. (_UDTD = $(_UDAD[3]).Child())[1].onclick = function () {
  115. U.MD.D.Blog.A.SPAZFF(UDE, _UDSD, UDMD);
  116. _UDTD[0].onclick();
  117. }
  118. _UDSD.focus();
  119. }
  120. }
  121. //打印
  122. U.MD.D.Blog.A.PAZFP = function (UDE, UDOD) {
  123. UDOD.innerHTML = "";
  124. var _UTC, _UDSD, _UDMD, _UDTD = $$("div", {"className": "UD_SYRML"}, UDOD);
  125. $$("img", {
  126. "onerror": U.MD.C.imgError,
  127. "title": "点击查看",
  128. "onclick": function () {
  129. U.UF.EV.stopBubble();
  130. U.MD.U.V.ViewOtherUserInfo(UDE.UserID);
  131. },
  132. "src": U.MD.C.getHeadImage(UDE.UserThumbnailImageHead)
  133. }, _UDTD);
  134. _UDTD = $$("div", "className": "UD_SYRMR"}, UDOD);
  135. _UDSD = $$("div", {"className": "UD_SYRMRS"}, _UDTD);
  136. $$("div", {"className": "UD_SYRMRSL","innerHTML": UDE.UserNickName || UDE.UserName}, _UDSD);
  137. $$("div", {"className": "UD_SYRMRSR","innerHTML": U.UF.D.getDateInterval(UDE.ArticleAddTime)}, _UDSD);
  138. _UDSD = $$("div", {"className": "UD_SYRMRX","innerHTML": (_UTC = UDE["ArticleContentBrief"])}, _UDTD);
  139. _UDSD.innerText = (_UTC = _UDSD.innerText).length > 30 ? _UTC.substr(0, 50) + "..." : _UTC
  140. }
  141. //点击转发朋友圈
  142. U.MD.D.Blog.A.SPAZFF = function (UDE, UDOD) {
  143. if (UDE.ArticleContent && !UDE["JZ"]) {
  144. U.MD.D.Blog.A.PAZFF(UDE, UDOD);
  145. }
  146. else {
  147. U.A.Request(US.CD, [US.DB, "UseStudio_Blog", "UB_P_S_SelectArticleInformation", UDE.ArticleID], U.MD.D.Blog.A.AsynSPAZFF, ["", UDE, UDOD]);
  148. // U.A.Request(US.AUTH,"pb.ArticleContent", [UDE.ArticleID, "Blog"], U.MD.D.Blog.A.AsynSPAZFF, ["", UDE, UDOD]);
  149. }
  150. //获取内容和回复内容
  151. }
  152. //异步获取消息内容
  153. U.MD.D.Blog.A.AsynSPAZFF = function (r) {
  154. var _context = r.context;
  155. var _UDE = _context[1];
  156. var _UDOD = _context[2];
  157. //_$.Add(_UDE,r.value[0]);
  158. U.UF.C.AddObj(_UDE, r.value[0]);
  159. delete _UDE["JZ"];
  160. U.MD.D.Blog.A.SPAZFF(_UDE, _UDOD);
  161. }
  162. //发送转发
  163. U.MD.D.Blog.A.PAZFF = function (UDE, UDOD) {
  164. var _UTF, _UKE = [], _UTH = UDOD.innerHTML;
  165. if (_UTH == "可添加内容...") { (_UTH = "") };
  166. U.Alert("转发中...");
  167. U.A.Request(US.CD, ([US.DB, "UseStudio_Blog", "UB_P_A_AddZFLR", US.userInfo.userid, Guid.newGuid(), UDE.ArticleID, US.FORUMROOTID,
  168. _UTH, UDOD.innerText.substr(200) + (UDOD.innerText.length > 200 ? "..." : "") + $("img", UDOD)[0].outerHTML]), U.MD.D.Blog.A.AsynSPAZFF, ["", UDE, UDOD]);
  169. // U.A.Request(US.AUTH,"pb.ZFArticle", [US.userInfo.userid, US.FORUMROOTID, UDE.ArticleID, _UTH], U.MD.D.Blog.A.AsynPAZFF, ["", _UTH, UDE]);
  170. //服务器同步中
  171. }
  172. //发送转发异步
  173. U.MD.D.Blog.A.AsynPAZFF = function (r) {
  174. var _UKE, _UDTD = $("#UD_SYSXZLLRTA").Child()[2];
  175. _userid = US.userInfo.userid,
  176. _UGE = U.MD.D.H.ET["UL"]["HY"],
  177. _context = r.context,
  178. _UTH = _context[1],
  179. _UDE = _context[2],
  180. _UDOD = $$("div", {"innerHTML": _UTH});
  181. r = r.value;
  182. _UKE = U.MD.D.Blog.A.BLEI[r, 0, 0, U.UF.D.toTimeStamp(new Date()), _UTH, _UDOD.innerText.substr(0, 100), US.userInfo.userid, US.userInfo.UserNickName, US.userInfo.UserThumbnailImageHead, 0];
  183. _UKE.Forward = _UDE["ArticleID"];
  184. _UKE.ZF = _UDE;
  185. if (_UGE = _UGE[_userid]) {
  186. _UGE[1] = _UGE[1] || [],
  187. _UGE[1].unshift(_UKE)
  188. };
  189. //添加转发的数据
  190. if (_UDTD.className == "UD_SYSXZLLRTO") {
  191. U.MD.D.Blog.PGBL($("#UD_SYSXZLRSRD")[0], [_UKE], null, 0, true);
  192. } else {
  193. U.MD.D.H.HDSY["none", "block"];
  194. _UDTD.onclick();
  195. }
  196. //显示转发
  197. }
  198. //#endregion