123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339 |
- Namespace.register("U.MD.D.CM"); //评论模块
- U.MD.D.CM.RP = {}; //用户回复
- U.MD.D.CM.Num = 20; //每页显示的评论数量
- //#region 评论使用
- //弹出评论
- U.MD.D.CM.CKPLXS = function (UFID, fun) {
- var _UDTD;
- var _UDOD = $("#UD_SYPL");
- var _UDAD = _UDOD.childs();
- U.UI.Form({ onresize: U.UF.Mapply(null, function () { U.MD.D.CM.Size(_UDAD[0]); }), title: "<div class='UD_SYF_STI'>" + fun + "</div>", content: (_UDOD = _UDOD[0]), style: { width: "720px", "maxHeight": "90%", "height": "650px" }, hst: { style: { padding: "0"}} }).form;
- U.MD.D.CM.Size(_UDAD[0]);
- U.MD.D.CM.CMSS(UFID, 1, (_UDTD = _UDAD.addAttrArray({ "scrollTop": 0 }, 0)[0])); //初始化数据
- $(".UD_SYPCLRCDO", _UDAD[1])[0].onclick = U.UF.Mapply(this, function () { U.MD.D.CM.TJCKPLXS(UFID, $("div", _UDAD[1])[3]); }); //添加回复按钮
- _UDTD.onscroll = U.UF.MSSCH({ "AF": U.UF.Mapply(null, function () { U.MD.D.CM.GDCKPLXS(UFID, _UDTD); }) }).SCH(); //设置滚动加载
- }
- //弹出评论
- U.MD.D.CM.CKPLXS = function (UFID, fun) {//U.DK.DI.js,U.DK.RE.js使用了,但被注释了 UM1.js uformd.js使用了, 没有地方明显使用,无法调试
- var _UDTD;
- var _UDOD = $("#UD_SYPL");
- var _UDAD = _UDOD.childs();
- U.UI.Form({ onresize: U.UF.Mapply(null, function () { U.MD.D.CM.Size(_UDAD[0]); }), title: "<div class='UD_SYF_STI'>" + fun + "</div>", content: (_UDOD = _UDOD[0]), style: { width: "720px", "maxHeight": "90%", "height": "650px" }, hst: { style: { padding: "0"}} }).form;
- U.MD.D.CM.Size(_UDAD[0]);
- U.MD.D.CM.CMSS(UFID, 1, (_UDTD = _UDAD.addAttrArray({ "scrollTop": 0 }, 0)[0])); //初始化数据
- $(".UD_SYPCLRCDO", _UDAD[1])[0].onclick = U.UF.Mapply(this, function () { U.MD.D.CM.TJCKPLXS(UFID, $("div", _UDAD[1])[3]); }); //添加回复按钮
- _UDTD.onscroll = U.UF.MSSCH({ "AF": U.UF.Mapply(null, function () { U.MD.D.CM.GDCKPLXS(UFID, _UDTD); }) }).SCH(); //设置滚动加载
- }
- //大小变化设置
- U.MD.D.CM.Size = function (UDOD) {//只被同一文件下的 U.MD.D.CM.CKPLXS 使用了??
- var _UDPD = $(UDOD).parentElement(2);
- var _UDAD = $(UDOD).parentElement().Child();
- $(UDOD).css("height", _UDPD[0].offsetHeight - _UDAD[_UDAD.length - 1].offsetHeight - 15 + "px"); //改变高度?
- }
- //添加回复
- U.MD.D.CM.TJCKPLXS = function (UFID, UDOD) {
- U.MD.D.CM.MR(UFID, UDOD, 1);
- }
- //获取回复评论,参数1为回复id,参数2为页数。
- U.MD.D.CM.CMSS = function (UFID, UP, UDOD, UTF) {
- UDOD = UDOD || $("div");
- var _UCE,
- _UM = U.MD.D.CM.Num, _UE = UP * _UM,
- _US = _UE - _UM,
- _UDE = U.MD.D.CM.RP[UFID];
- if (_UDE) { _UCE = _UDE.slice(_US, _UE) }; if (UP == 1) { UDOD.innerText = "" };
- if (UTF || _UCE) {
- if (_UCE.length) { U.MD.D.CM.SetRPSS(_UCE, UDOD); }
- else if (UP == 1) { U.MD.D.CM.WSJDY(UDOD); }
- } //打印数据
- else {
- U.A.Request("Reply.SelectData", ["SelectData", UFID, _US, 100], U.MD.D.CM.CMSG, [UP == 1 ? [UDOD, true] : null, UFID, UP, UDOD]);
- } //获取数据
- }
- //滚动加载
- U.MD.D.CM.GDCKPLXS = function (UFID, UDOD) {
- U.MD.D.CM.CMSS(UFID, this.P + 2, UDOD);
- }
- //回复和回复的回复区分
- U.MD.D.CM.QFOTP = function (UDE) {
- var i, j, _UCE;
- for (i = 0; i < UDE[1].length; i++) {
- _UCE = U.Json.select(UDE[0], { "ReplyID": UDE[1][i]["ReplyBindingID"] })[0];
- if (_UCE) {
- if (!_UCE["NextP"]) { _UCE["NextP"] = [] };
- _UCE["NextP"].push(UDE[1][i]);
- for (j = (i + 1); j < UDE[1].length; j++) {
- if (UDE[1][j]["ReplyBindingID"] == _UCE["ReplyID"]) {
- _UCE["NextP"].push(UDE[1].splice(j, 1)[0]);
- }
- }
- }
- }
- return UDE[0];
- }
- //数据打印处理
- U.MD.D.CM.SetRPSS = function (UDE, UDOD) {
- var i, j, _UCE, _UKE, _UDTD,
- UDFD = $$("frag");
- for (i = 0; i < UDE.length; i++) {
- _UCE = UDE[i];
- _UDTD = $("div", U.MD.D.CM.UOSS(UDE[i], UDFD));
- _UDTD = _UDTD[_UDTD.length - 1];
- for (j = 0; j < (_UCE["NextP"] || { "length": 0 }).length; j++) {
- _UKE = _UCE["NextP"][j];
- U.MD.D.CM.UTSS(_UKE, _UCE, _UDTD);
- } //用户回复的回复聊天
- }
- UDOD.appendChild(UDFD);
- }
- //无数据的打印
- U.MD.D.CM.WSJDY = function (UDOD) {
- $$("div", {"className": "UD_SYSXZBECCT UD_SYSXZBECCTS","innerHTML": "暂无评论哦~"}, UDOD); //创建暂无评论div
- }
- //回复打印
- U.MD.D.CM.UOSS = function (UDE, UDFD) {//动态创建
- var _UDOD, _UDTD, _UDSD, _UDGD, _UDND, _UDUD;
- _UDOD = $$("div",{"className": "UD_CM_HFPL"}, UDFD);
- _UDTD = $$("div",{"className": "UD_CM_HFPLO"}, _UDOD);
- $$("img",
- {
- "onerror": [U.UF.MImgError,
- ["retElement"]],
- "className": "UD_CM_HFPLLImg",
- "onclick": function () {
- U.MD.U.V.ViewOtherUserInfo(UDE.UserID);
- },
- "src": U.UF.MGetImgU(UDE.ReplyUserThumbnailImageHead),
- "alt": "点击查看资料"
- }, _UDTD)
- $$("div",{"className": "UDK_L_DiskGE UD_CM_HFPLL"}, _UDOD);
- _UDSD = $$("div", {"className": "UD_CM_HFPLR "}, _UDOD);
- $$("div",
- {
- "title": "查看该用户",
- "className": "UD_CM_HFPLRUs",
- "innerHTML": UDE.UserName,
- "onclick": function () {
- parent.U.MD.U.V.POUW(UDE.ReplyAddUserID);
- }
- }, _UDSD);
- $$("div",{"className": "UD_CM_HFPLRVa","innerHTML": " 发表評論:"}, _UDSD);
- $$("div",
- {
- "innerHTML": UDE.ReplyContent,
- "className": "UD_CM_OCT UC_TF",
- "onselectstart": "U.UF.MStopBubble();return true;"
- }, _UDSD);
- _UDGD = $$("div",{"className": "UD_CM_OCRT"}, _UDSD);
- $$("div",{"className": "UD_CM_OCRTT","innerHTML": U.MT.formatDateToArray(UDE.ReplyAddTime)}, _UDGD);
- $$("div",{"className": "UD_CM_OCRTTX","innerHTML": "來自" + (UDE.UserName)}, _UDGD);
- $$("div",
- {
- "className": "UD_CM_OCRTTB",
- "style":
- {
- "color": "#3863dc"
- },
- "onclick": function () {
- U.MD.D.CM.UTTP(UDE, _UDSD);
- },
- "innerHTML": "回复"
- }, _UDGD);
- $$("div",{"className": "UD_CM_URFV"}, _UDSD);
- return _UDOD;
- }
- //下级回复
- U.MD.D.CM.UTSS = function (UDE, UPE, UDFD) {//动态创建
- var _UOOD, _UOTD, _UOSD, _UOFD, _UOSD;
- _UOOD = $$("div",{"className": "UD_CM_HFPL"}, UDFD);
- _UOTD = $$("div",{"className": "UD_CM_HFPLR UD_CM_HFPLRO","style":{"marginLeft": "0"}}, _UOOD);
- $$("div",
- {
- "className": "UD_CM_HFPLRUs",
- "onclick": function () {
- U.UF.MStopBubble();
- U.MD.U.V.ViewOtherUserInfo(UDE.UserID);
- },
- "innerHTML": UDE.UserName
- }, _UOTD);
- $$("div",{"className": "UD_CM_OCTE","innerHTML": "回复了"}, _UOTD);
- $$("div",
- {
- "className": "UD_CM_HFPLRUs",
- "onclick": function () {
- U.UF.MStopBubble();
- U.MD.U.V.ViewOtherUserInfo(UDE.ReplyParentID);
- },
- "innerHTML": '@' + UDE.ReplyParentNickname
- }, _UOTD); //
- $$("div",{"className": "UD_CM_OCT","innerHTML": UDE.ReplyContent}, _UOTD);
- _UDGD = $$("div",{"className": "UD_CM_OCRT"}, _UOTD);
- $$("div",{"className": "UD_CM_OCRTT","innerHTML": U.MT.formatDateToArray(UDE.ReplyAddTime)}, _UDGD);
- $$("div",{"className": "UD_CM_OCRTTX","innerHTML": "來自" + (UDE.UserName)}, _UDGD);
- $$("div",
- {
- "className": "UD_CM_OCRTTB",
- "onclick": function () { U.MD.D.CM.UTTP(UDE, _UOOD, true); },
- "innerHTML": "回复" + "<br />"
- }, _UDGD);
- $$("div",{"className": "UDK_L_DiskGE UD_CM_HFPLLR"}, _UOOD);
- $$("img",
- {
- "onerror": [U.UF.MImgError, [this]],
- "className": "UD_CM_HFPLLImg",
- "onclick": function () {
- U.MD.U.V.ViewOtherUserInfo(UDE.UserID);
- },
- "src": U.UF.MGetImgU(UDE.ReplyUserThumbnailImageHead),
- "style":
- {
- "marginLeft": "10px"
- }
- }, _UOOD);
- return _UOOD;
- }
- //子回复的回复框
- U.MD.D.CM.UTTP = function (UDE, UDOD, UTF) {
- var _UDMD,
- _UDSD = $("#UD_SYPLDT")[0],
- _UDTD = UTF ? $(UDOD).Parent() : UDOD;
- if (_UDSD) {
- $(_UDTD).append(_UDSD, 0, UTF ? UDOD.nextSibling : null);
- _UDSD.style.display = "block";
- _UDMD = $(_UDSD).find("div");
- }
- else {
- _UDMD = $(UDOD).parentElement("UD_SYPL");
- _UDMD = $(_UDMD).childs()[2];
- _UDMD = $(_UDMD).childs()[0];
- var _el = $(_UDMD).clone(true);
- _el.addAttrArray({ "className": "UD_SYPLDC UD_SYPLDCO", "id": "UD_SYPLDT", "style": { "display": "block"} });
- _el.appendTo(_UDTD, 0, UDOD.nextSibling);
- }
- _UDMD[_UDMD.length - 1].onclick = U.UF.Mapply(this, function ()
- { U.MD.D.CM.MR(UDE.FileID, _UDMD[2], 2, (UDE["ReplyBindingID"] || UDE["ReplyID"]), UDE["UserID"], UDE["UserName"]); }); //点击发表评论
- // _UDMD[2].onfocus = U.UF.Mapply(_UDMD[2],function(){U.MD.D.SY.KBJJQ( [_UDMD[2]("发表评论...", "<div></div>", _UDMD[4], { "GS": "M", "getData": U.MD.D.SY.ATGBL, "UDOD": _UDMD[1], "URL": "http://main.1473.cn/USUpfile.ashx?typename=UseStudioEditor", "ID": "UD_SYPLDCO"}]);}); //上传按钮
- _UDMD[2].focus();
- return _UDMD;
- }
- //发送回复隐藏
- U.MD.D.CM.BNPE = function (UDOD) {
- UDOD.innerHTML = "发表评论...";
- $(UDOD).Parent(3).style.display = "none";
- }
- ////#endregion
- //-------------------------------------------------------------------------------------添加回复-------------------------------------------------------------
- //回复实体
- U.MD.D.CM.TCM = function (UDE) {
- U.UF.C.AddObj(this, {
- "FileID": UDE[0],
- "UserID": UDE[1],
- "UserName": UDE[2],
- "ReplyID": UDE[3],
- "ReplyContent": UDE[4],
- "ReplyAddTime": UDE[5],
- "ReplyIP": UDE[6],
- "ReplyAddress": UDE[7],
- "ReplyDeep": UDE[8],
- "ReplyUserThumbnailImageHead": UDE[9],
- "ReplyBindingID": UDE[10],
- "ReplyParentID": UDE[11],
- "ReplyParentNickname": UDE[12]
- });
- }
- //添加回复
- U.MD.D.CM.MR = function (UFID, UDOD, UD, UPID, userid, UN, cb) {
- if (!U.MD.U.L.isLogin()) {//登录用户允许发表
- var _UCE = [],
- _UIH = UDOD.innerHTML; //回复的内容
- if (!UDOD.innerText) { U.Alert("请输入内容"); }
- else {
- var _UDE = new U.MD.D.CM.TCM((_UCE = [UFID, US.userInfo.userid, US.userInfo.UserNickName, Guid.newGuid(), _UIH, new Date(), US.userInfo.LoginIP || "", US.userInfo.LoginAddress || "", UD, US.userInfo.UserThumbnailImageHead || "", UPID || "", userid || "", UN || ""]));
- UDOD.innerText = "";
- UDOD.focus();
- UDOD.blur();
- _UCE.splice(5, 1);
- _UCE.unshift("InsertData");
- U.A.Request("Reply.InsertData", (_UCE), U.MD.D.CM.AsynMR, ["", _UDE, UDOD, cb]); //插入数据库
- }
- }
- }
- //添加回复的回调
- U.MD.D.CM.AsynMR = function (r) {
- var _UCE, _UDOD, _UDTD,
- _UGE = U.MD.D.CM.RP,
- _context = r.context,
- _UDE = _context[1],
- _UDMD = _context[2],
- _UCB = _context[3],
- _UFID = _UDE["FileID"];
- r = r.value;
- if (r !== false) {
- if (_UDE["ReplyBindingID"]) {
- _UCE = U.Json.select(_UGE[_UFID], { "ReplyID": _UDE["ReplyBindingID"] })[0];
- if (!_UCE["NextP"]) { _UCE["NextP"] = [] }; _UCE["NextP"].unshift(_UDE);
- } //回复的回复
- else {
- if (!_UGE[_UFID]) { _UGE[_UFID] = [] }; _UDE["NextP"] = [];
- _UGE[_UFID].unshift(_UDE);
- } //回复
- if (_UCB) { _UCB(_UDE); }
- else {
- if (_UDE["ReplyBindingID"]) {
- U.MD.D.CM.BNPE(_UDMD);
- _UDTD = $(_UDMD).Parent(4);
- if (_UDTD.className != "UD_CM_URFV") { _UDTD = $(_UDTD).find(".UD_CM_URFV")[0] }; _UDOD = U.MD.D.CM.UTSS(_UDE, _UCE);
- }
- else {
- _UDTD = $("#UD_SYPL").Child()[0];
- if (_UGE[_UFID].length == 1) { _UDTD.innerText = "" };
- _UDOD = U.MD.D.CM.UOSS(_UDE);
- }
- _UDTD.insertBefore(_UDOD, _UDTD.firstChild);
- U.UF.MSCT(0, $("#UD_SYPLC")[0]);
- }
- }
- }
- //排序数据,分类数据
- U.MD.D.CM.CMSG = function (r) {//标签有别的js使用
- var _context = r.context,
- _UDE = U.MD.D.CM.RP,
- _UFID = _context[1],
- _UP = _context[2],
- _UDOD = _context[3],
- _UDND = _context[4],
- _UTF = _context[5];
- r = r.value;
- if (r) {
- if (r[0].length == 0) {
- _context[3].onscroll = null;
- }
- else {
- if (!_UDE[_UFID]) { _UDE[_UFID] = [] };
- _UDE[_UFID] = _UDE[_UFID].concat(U.MD.D.CM.QFOTP(r));
- if (!_UTF) { U.MD.D.CM.CMSS(_UFID, _UP, _UDOD, true) };
- return true;
- }
- }
- else { U.Alert("服务器繁忙"); }
- }
|