U.U.P.js 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. Namespace.register("U.U.P"); //积分
  2. //类型
  3. U.U.P.TF = { "Contribute": "找出漏洞", "Introduce": "推广本网站", "Upload": "上传文件", "PostArticle": "发表文章", "Online": "在线时间", "Reply": "回复文章", "SignIn": "登陆签到", "Download": "下载文件", "DiskAddition": "硬盘增加", "IllegalImage": "发布违规图片" }
  4. U.U.P.FTF = { "Upload": "UseStudioUserDiskDiv", "Download": "UseStudioUserDiskDiv", "PostArticle": "UseStudioStudyControlDiv", "Reply": "UseStudioStudyControlDiv" };
  5. //用户数据分页
  6. U.U.P.E = {};
  7. //点击积分图标
  8. U.U.P.LoginIC = function () {
  9. var _UICD = $("#UU_IC")[0], _UDGG = $("#UU_ICBG_GG")[0]; //积分的显示区域
  10. U.D.PopupWindow(_UICD); //居中弹框
  11. U.U.P.GetIC($("div#UU_IC_Pay", _UICD)[0]); //获取积分统计
  12. U.D.Tb.WindowRestore(_UICD, '', '积分中心'); //创建任务栏
  13. }
  14. //切换
  15. U.U.P.SIC = function (TF) {
  16. U.U.P.YXICD["none", "block"]; //切换到显示的div
  17. if (TF == 1) { U.U.P.GetIC($("#UU_IC_Pay")[0]); }
  18. else { U.U.P.ICSS(1); }
  19. }
  20. //切换的显示和隐藏
  21. U.U.P.YXICD = function (TF) {
  22. $('#UU_IC_HB')[0].style.display = TF[0];
  23. $('#UU_IC_Info')[0].style.display = TF[1];
  24. }
  25. //------------------------------------------------------------------------用户个人
  26. //用户积分资料
  27. U.U.P.SUIC = function (UICD) {
  28. var i, TF = 0, _UDAD = $("#UU_IC_Avatar", UICD)[0], _UET = U.U.P.E[US.userInfo.userid]["ICCSV"][0]; _UDAD.innerHTML = "";
  29. for (i = 0; i < _UET.length; i++) { TF += _UET[i].VCSumValue; } //获取用户显示的积分
  30. //显示用户积分资料
  31. $$("img", { "onerror": [[U.M.ImgError, ["this"]]], "id": "UU_IC_Avatar_img", "src": U.M.GetImgU(US.userInfo.UserThumbnailImageHead) }, _UDAD);
  32. $("#UU_IC_VCSum", UICD)[0].innerHTML = TF; //用户积分
  33. }
  34. //------------------------------------------------------------------------用户积分消耗查询(分)
  35. //用户积分查询分页
  36. U.U.P.ICSS = function (P) {
  37. var SP = Math.ceil(P * 7 / 70),
  38. _E = SP * 70,
  39. _S = _E - 69,
  40. UPDL = U.U.P.E[US.userInfo.userid];
  41. if (UPDL && (UPDL = UPDL["Page"]) && (UPDL = UPDL[SP])) {
  42. var _TP = P % 10;
  43. _TP = _TP == 0 ? 10 : _TP;
  44. _E = _TP * 7; _S = _E - 7; //分页算法
  45. var _UICL = UPDL.slice(_S, _E); //获取打印的数据
  46. U.U.P.SetICSS(_UICL, P);
  47. }
  48. else { U.A.Request("UseStudioPay.UserGetSomeVC", [_S, _E], U.U.P.AsynICSS, ["", P, SP, US.userInfo.userid]); } //获取积分明细记录
  49. }
  50. //异步用户资料查询
  51. U.U.P.AsynICSS = function (r) {
  52. var context = r.context;
  53. r = r.value;
  54. if (U.U.P.E[context[3]] == null) {
  55. U.U.P.E[context[3]] = { "Page": [] };
  56. }
  57. else if (U.U.P.E[context[3]]["Page"] == null) {
  58. U.U.P.E[context[3]]["Page"] = [];
  59. }
  60. U.U.P.E[context[3]]["Page"][context[2]] = r[0]; //添加用户数据
  61. U.U.P.ICTT(r[1], $("#UU_ICM_UU_IC_Heroes")[0]); //打印英雄榜
  62. U.U.P.ICSS(context[1]); //用户积分查询分页
  63. }
  64. //设置分页
  65. U.U.P.SetICSS = function (UICL, P) {
  66. if (UICL.length > 0) {
  67. U.U.P.ICPL(UICL, ["时间", "来源", "来源", "积分"], $("#UU_IC_Info")[0]); //打印数据
  68. U.PG.PPage($("#UU_IC_Pag")[0], UICL[0].AllCount, P, 7, { "fun": [[U.U.P.ICSS, [P]]], "page": [0] }); //分页
  69. }
  70. }
  71. //-------------------------------------------------------------------获取用户积分消耗情况(总)
  72. //获取积分
  73. U.U.P.GetIC = function (UICD) {
  74. if (U.U.P.E[US.userInfo.userid] && U.U.P.E[US.userInfo.userid]["ICCSV"]) {
  75. U.U.P.SetIC(U.U.P.E[US.userInfo.userid]["ICCSV"], UICD);
  76. }
  77. else {
  78. U.A.Request("UseStudioPay.UserCountVC", [], U.U.P.AsynGetIC, [UICD, 1, US.userInfo.userid]);
  79. } //获取积分统计
  80. }
  81. //获取积分异步
  82. U.U.P.AsynGetIC = function (r) {
  83. var context = r.context;
  84. r = r.value;
  85. if (U.U.P.E[context[2]] == null) {
  86. U.U.P.E[context[2]] = {};
  87. }
  88. U.U.P.E[context[2]]["ICCSV"] = r; //积分消耗统计
  89. U.U.P.GetIC(context[0], r); //显示积分
  90. }
  91. //打印积分详情(总)
  92. U.U.P.SetIC = function (UIC, UICD) {
  93. U.U.P.ICTT(UIC[1], $("div#UU_ICM_UU_IC_Heroes", UICD)[0]); //打印排名
  94. U.U.P.ICPL(UIC[0], ["时间", "来源", "积分", "次数"], $("div#UU_IC_Info", UICD)[0]); //积分使用获得的变化
  95. U.U.P.SUIC(UICD); //设置用户积分信息
  96. }
  97. //打印积分排名
  98. U.U.P.ICTT = function (UICL, UOD) {
  99. var i, _UCL, _UDOD, _UDTD,
  100. _UDFD = $$("frag");
  101. UOD.innerText = "";
  102. for (i = 0; i < UICL.length; i++) {
  103. _UCL = UICL[i]; //获取积分名次
  104. _UDOD = $$("div", { "style": { "marginTop": "8px" }, "onclick": [[U.M.StopBubble], [U.U.I.POUW, [_UCL.UserId]]] }, _UDFD);
  105. $$("img", { "onerror": U.M.ImgError, "src": U.M.GetImgU(_UCL.UserThumbnailImageHead), "className": "UU_IC_Heroes_img" }, _UDOD);
  106. $$("div", { "className": "UU_IC_HSOne", "innerHTML": _UCL.UserNickName }, _UDOD);
  107. _UDTD = $$("div", { "className": "UU_IC_HSTwo" }, _UDOD);
  108. $$("span", { "innerHTML": "积分:" }, _UDTD);
  109. $$("span", { "style": { "color": "#3081fe" }, "innerHTML": _UCL.VCSumValue }, _UDTD);
  110. }
  111. UOD.appendChild(_UDFD);
  112. }
  113. //打印用户积分来源
  114. U.U.P.ICPL = function (UICL, UDTF, UOD) {
  115. UOD.innerText = $("#UU_IC_Pag")[0].innerText = "";
  116. var i, j, _UCI, _UDSD,
  117. _UDOD = $$("div", { "className": "UU_IC_Values" }), _UDTD = $$("div", { "className": "UU_IC_VP" });
  118. for (i = 0; i < UDTF.length; i++) {
  119. $$("div", { "innerHTML": UDTF[i], "style": { "width": (i == 3 ? "50px " : (i == 1 ? "100px" : i == 2 ? "200px" : ""))} }, _UDOD);
  120. };
  121. for (j = 0; j < UICL.length; j++) {
  122. _UCI = UICL[j];
  123. _UDSD = $$("div", { "className": "UU_IC_SG" }, _UDTD);
  124. $$("div", { "innerHTML": U.MT.getDateInterval(_UCI.VCDateTime) }, _UDSD);
  125. $$("div", { "innerHTML": U.U.P.TF[_UCI.VCType], "style": { "width": "100px"} }, _UDSD);
  126. $$("div", { "onclick": _UCI.VCCountValue ? "" : U.U.P.FTF[_UCI.VCType] ? [[U.M.StopBubble], [U.M.divdoubleClick, [U.U.P.FTF[_UCI.VCType], _UCI.VCDetailsDataID, null, null, "ART" + _UCI.VCDetailsDataID]]] : "", "className": ("UTDF" + (_UCI.VCCountValue ? "" : " UU_IC_FS")), "style": { "color": _UCI.VCCountValue ? "" : "#3081fe", "width": "200px" }, "innerHTML": _UCI.VCCountValue ? _UCI.VCSumValue : _UCI.VCDetailsDataValue }, _UDSD);
  127. $$("div", { "innerHTML": _UCI.VCCountValue || _UCI.VCValue, "style": { "width": "50px"} }, _UDSD);
  128. }
  129. UOD.appendChild(_UDOD); UOD.appendChild(_UDTD);
  130. }
  131. //--------------------------------------------------------------------------------汇换空间----------------------------------------------------------------------------
  132. //弹出
  133. U.U.P.ICEXC = function (TF) {
  134. var _UIED = $("#UU_IC_EXC")[0];
  135. if (TF == "block") { U.D.SetDTop(_UIED); } //解决层次的问题
  136. _UIED.style.display = TF; //显示或者隐藏
  137. }
  138. //用户换去空间
  139. U.U.P.ICGK = function (UICD) {
  140. var i, _TF = 0,
  141. _UICE = U.U.P.E[US.userInfo.userid]["ICCSV"][0];
  142. UICV = UICD.value;
  143. for (i = 0; i < _UICE.length; i++) {
  144. _TF += _UICE[i].VCSumValue;
  145. } //获取用户所有的积分
  146. if (parseFloat(UICV) < 0) {
  147. U.Alert("请输入正整数");
  148. } //换取有效网盘空间
  149. else if (!U.MS.Number.test(UICV)) {
  150. U.Alert("您的输入有误,请输入数字!");
  151. } //输入的是无效数据
  152. else if (UICV > _TF) {
  153. U.Alert("您的积分不足");
  154. } //积分不足无法汇换
  155. else {
  156. U.UI.Confirm("确定确定要兑换" + UICV + "M的空间吗?", function () {
  157. // U.A.Request(US.Auth,"UseStudioManage.UserDiskAddition", [UICV], U.U.P.AsynICGK, ["", UICD, UICV]);
  158. UICD.parentNode.parentNode.parentNode.style.display = "none"; UICD.value = "";
  159. })
  160. } //于服务器同步增加用户的网盘
  161. }
  162. //汇换空间异步
  163. U.U.P.AsynICGK = function (r) {
  164. var context = r.context;
  165. r = r.value;
  166. if (r) {
  167. var i, _TF = true,
  168. ICDE = U.U.P.E[US.userInfo.userid]["ICCSV"][0];
  169. for (i = 0; i < ICDE.length; i++) {
  170. if (ICDE[i]["VCType"] == "DiskAddition") {
  171. _TF = false; ICDE[i].VCSumValue -= context[2];
  172. ICDE[i].VCCountValue += 1;
  173. }
  174. } //修改用户积分消耗信息
  175. if (_TF) {
  176. var _E = new U.U.P.PICE[1, new Date(), -context[2], "DiskAddition"],
  177. _UICE = U.U.P.E[US.userInfo.userid]["Page"];
  178. ICDE.push(_E);
  179. if (_UICE && _UICE.length > 0) {
  180. var _ICE = U.U.P.ICE(_UICE[1][0].AllCount, "0", US.userInfo.userid, new Date(), Guid.newGuid(), "硬盘增加", Guid.newGuid(), "DiskAddition", -context[2]); _UICE[1].unshift(_ICE);
  181. }
  182. } //添加用户积分消耗信息
  183. U.U.P.SUIC();
  184. U.U.P.ICPL(ICDE, ["时间", "来源", "积分", "次数"], $("#UU_IC_Info")[0]);
  185. US.userInfo.UserDiskSpace += 1; //积分使用获得的变化 //用户信息
  186. }
  187. }
  188. //-----------------------------------------------------------------------------数据结构-------------------------------------------------------------------------------
  189. //积分的结构
  190. U.U.P.PICE = function (E) {
  191. this.VCCountValue = E[0];
  192. this.VCDateTime = E[1];
  193. this.VCSumValue = E[2];
  194. this.VCType = E[3];
  195. }
  196. //积分的消耗
  197. U.U.P.ICE = function (E) {
  198. this.AllCount = E[0];
  199. this.PageNum = E[1];
  200. this.UserID = E[2];
  201. this.VCDateTime = E[3];
  202. this.VCDetailsDataID = E[4];
  203. this.VCDetailsDataValue = E[5];
  204. this.VCID = E[6];
  205. this.VCType = E[7];
  206. this.VCValue = E[8];
  207. }