123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261 |
- Namespace.register("U.MD.U.S"); //积分
- //类型
- U.MD.U.S.TF = { "Contribute": "找出漏洞", "Introduce": "推广本网站", "Upload": "上传文件", "PostArticle": "发表文章", "Online": "在线时间", "Reply": "回复文章", "SignIn": "登陆签到", "Download": "下载文件", "DiskAddition": "硬盘增加", "IllegalImage": "发布违规图片" }
- U.MD.U.S.FTF = { "Upload": "UseStudioUserDiskDiv", "Download": "UseStudioUserDiskDiv", "PostArticle": "UseStudioStudyControlDiv", "Reply": "UseStudioStudyControlDiv" };
- //用户数据分页
- U.MD.U.S.E = {};
- //点击积分图标
- U.MD.U.S.LoginIC = function () {
- var _UICD = $("#UU_IC")[0], _UDGG = $("#UU_ICBG_GG")[0]; //积分的显示区域
- U.UF.F.windowTopCenter(_UICD); //居中弹框
- U.MD.U.S.GetIC($("div#UU_IC_Pay", _UICD)[0]); //获取积分统计
- U.MD.D.T.WindowRestore(_UICD, '', '积分中心'); //创建任务栏
- }
- //切换
- U.MD.U.S.SIC = function (TF) {
- U.MD.U.S.YXICD["none", "block"]; //切换到显示的div
- if (TF == 1) { U.MD.U.S.GetIC($("#UU_IC_Pay")[0]); }
- else { U.MD.U.S.ICSS(1); }
- }
- //切换的显示和隐藏
- U.MD.U.S.YXICD = function (TF) {
- $('#UU_IC_HB')[0].style.display = TF[0];
- $('#UU_IC_Info')[0].style.display = TF[1];
- }
- //------------------------------------------------------------------------用户个人
- //用户积分资料
- U.MD.U.S.SUIC = function (UICD) {
- var i, TF = 0, _UDAD = $("#UU_IC_Avatar", UICD)[0], _UET = U.MD.U.S.E[US.userInfo.userid]["ICCSV"][0]; _UDAD.innerHTML = "";
- for (i = 0; i < _UET.length; i++) { TF += _UET[i].VCSumValue; } //获取用户显示的积分
- //显示用户积分资料
- $$("img", { "onerror": U.MD.C.imgError,
- "onerror": U.MD.C.imgError,
- "id": "UU_IC_Avatar_img", "src": U.MD.C.getHeadImage(US.userInfo.UserThumbnailImageHead)
- }, _UDAD);
- $("#UU_IC_VCSum", UICD)[0].innerHTML = TF; //用户积分
- }
- //------------------------------------------------------------------------用户积分消耗查询(分)
- //用户积分查询分页
- U.MD.U.S.ICSS = function (P) {
- var SP = Math.ceil(P * 7 / 70),
- _E = SP * 70,
- _S = _E - 69,
- UPDL = U.MD.U.S.E[US.userInfo.userid];
- if (UPDL && (UPDL = UPDL["Page"]) && (UPDL = UPDL[SP])) {
- var _TP = P % 10;
- _TP = _TP == 0 ? 10 : _TP;
- _E = _TP * 7; _S = _E - 7; //分页算法
- var _UICL = UPDL.slice(_S, _E); //获取打印的数据
- U.MD.U.S.SetICSS(_UICL, P);
- }
- else { U.A.Request("UseStudioPay.UserGetSomeVC", [_S, _E], U.MD.U.S.AsynICSS, ["", P, SP, US.userInfo.userid]); } //获取积分明细记录
- }
- //异步用户资料查询
- U.MD.U.S.AsynICSS = function (r) {
- var _context = r.context;
- r = r.value;
- if (U.MD.U.S.E[_context[3]] == null) {
- U.MD.U.S.E[_context[3]] = { "Page": [] };
- }
- else if (U.MD.U.S.E[_context[3]]["Page"] == null) {
- U.MD.U.S.E[_context[3]]["Page"] = [];
- }
- U.MD.U.S.E[_context[3]]["Page"][_context[2]] = r[0]; //添加用户数据
- U.MD.U.S.ICTT(r[1], $("#UU_ICM_UU_IC_Heroes")[0]); //打印英雄榜
- U.MD.U.S.ICSS(_context[1]); //用户积分查询分页
- }
- //设置分页
- U.MD.U.S.SetICSS = function (UICL, P) {
- if (UICL.length > 0) {
- U.MD.U.S.ICPL(UICL, ["时间", "来源", "来源", "积分"], $("#UU_IC_Info")[0]); //打印数据
- new U.UF.P.page($("#UU_IC_Pag")[0], UICL[0].AllCount, 7, P, function (P) { U.MD.U.S.ICSS(P); }); //分页
- }
- }
- //-------------------------------------------------------------------获取用户积分消耗情况(总)
- //获取积分
- U.MD.U.S.GetIC = function (UICD) {
- if (U.MD.U.S.E[US.userInfo.userid] && U.MD.U.S.E[US.userInfo.userid]["ICCSV"]) {
- U.MD.U.S.SetIC(U.MD.U.S.E[US.userInfo.userid]["ICCSV"], UICD);
- }
- else {
- U.A.Request("UseStudioPay.UserCountVC", [], U.MD.U.S.AsynGetIC, [UICD, 1, US.userInfo.userid]);
- } //获取积分统计
- }
- //获取积分异步
- U.MD.U.S.AsynGetIC = function (r) {
- var _context = r.context;
- r = r.value;
- if (U.MD.U.S.E[_context[2]] == null) {
- U.MD.U.S.E[_context[2]] = {};
- }
- U.MD.U.S.E[_context[2]]["ICCSV"] = r; //积分消耗统计
- U.MD.U.S.GetIC(_context[0], r); //显示积分
- }
- //打印积分详情(总)
- U.MD.U.S.SetIC = function (UIC, UICD) {
- U.MD.U.S.ICTT(UIC[1], $("div#UU_ICM_UU_IC_Heroes", UICD)[0]); //打印排名
- U.MD.U.S.ICPL(UIC[0], ["时间", "来源", "积分", "次数"], $("div#UU_IC_Info", UICD)[0]); //积分使用获得的变化
- U.MD.U.S.SUIC(UICD); //设置用户积分信息
- }
- //打印积分排名
- U.MD.U.S.ICTT = function (UICL, UOD) {
- var i, _UCL, _el, _UDTD,
- _UDFD = $$("frag");
- UOD.innerText = "";
- for (i = 0; i < UICL.length; i++) {
- _UCL = UICL[i]; //获取积分名次
- _el = $$("div", {
- "style":
- {
- "marginTop": "8px"
- },
- "onclick": function () {
- U.UF.EV.stopBubble();
- U.MD.U.V.POUW(_UCL.UserId);
- }
- }, _UDFD);
- $$("img", { "onerror": U.MD.C.imgError,
- "onerror": U.MD.C.imgError,
- "src": U.MD.C.getHeadImage(_UCL.UserThumbnailImageHead),
- "className": "UU_IC_Heroes_img"
- }, _el);
- $$("div", {"className": "UU_IC_HSOne","innerHTML": _UCL.UserNickName}, _el);
- _UDTD = $$("div", {"className": "UU_IC_HSTwo"}, _el);
- $$("span", {"innerHTML": "积分:"}, _UDTD);
- $$("span", {"style":{"color": "#3081fe"},"innerHTML": _UCL.VCSumValue}, _UDTD);
- }
- UOD.appendChild(_UDFD);
- }
- //打印用户积分来源
- U.MD.U.S.ICPL = function (UICL, UDTF, UOD) {
- UOD.innerText = $("#UU_IC_Pag")[0].innerText = "";
- var i, j, _UCI, _UDSD,
- _el = $$("div", { "className": "UU_IC_Values" }),
- _UDTD = $$("div", {"className": "UU_IC_VP"});
- for (i = 0; i < UDTF.length; i++) {
- $$("div", {
- "innerHTML": UDTF[i],
- "style": { "width": (i == 3 ? "50px " : (i == 1 ? "100px" : i == 2 ? "200px" : "")) }
- }, _el);
- };
- for (j = 0; j < UICL.length; j++) {
- _UCI = UICL[j];
- _UDSD = $$("div", {"className": "UU_IC_SG"}, _UDTD);
- $$("div", {"innerHTML": U.UF.D.getDateInterval(_UCI.VCDateTime)}, _UDSD);
- $$("div", {"innerHTML": U.MD.U.S.TF[_UCI.VCType], "style": { "width": "100px" }}, _UDSD);
- $$("div", {
- "onclick": _UCI.VCCountValue ? "" : U.MD.U.S.FTF[_UCI.VCType] ? function () {
- U.UF.EV.stopBubble(); U.UF.C.divdoubleClick(U.MD.U.S.FTF[_UCI.VCType],
- _UCI.VCDetailsDataID, null, null, "ART" + _UCI.VCDetailsDataID);
- } : "", "className": ("U_MD_D_Text_Abbreviation" + (_UCI.VCCountValue ? "" : " UU_IC_FS")),
- "style":
- {
- "color": _UCI.VCCountValue ? "" : "#3081fe", "width": "200px"
- },
- "innerHTML": _UCI.VCCountValue ? _UCI.VCSumValue : _UCI.VCDetailsDataValue
- }, _UDSD);
- $$("div", {"innerHTML": _UCI.VCCountValue || _UCI.VCValue,"style":{"width": "50px"}}, _UDSD);
- }
- UOD.appendChild(_el); UOD.appendChild(_UDTD);
- }
- //--------------------------------------------------------------------------------汇换空间----------------------------------------------------------------------------
- //弹出
- U.MD.U.S.ICEXC = function (TF) {
- var _UIED = $("#UU_IC_EXC")[0];
- if (TF == "block") { U.UF.F.topWindow(_UIED); } //解决层次的问题
- _UIED.style.display = TF; //显示或者隐藏
- }
- //用户换去空间
- U.MD.U.S.ICGK = function (UICD) {
- var i, _TF = 0,
- _UICE = U.MD.U.S.E[US.userInfo.userid]["ICCSV"][0];
- UICV = UICD.value;
- for (i = 0; i < _UICE.length; i++) {
- _TF += _UICE[i].VCSumValue;
- } //获取用户所有的积分
- if (parseFloat(UICV) < 0) {
- U.alert("请输入正整数");
- } //换取有效网盘空间
- else if (!U.UF.S.Number.test(UICV)) {
- U.alert("您的输入有误,请输入数字!");
- } //输入的是无效数据
- else if (UICV > _TF) {
- U.alert("您的积分不足");
- } //积分不足无法汇换
- else {
- U.UF.UI.confirm("确定确定要兑换" + UICV + "M的空间吗?", function () {
- // U.A.Request(US.USER,"UseStudioManage.UserDiskAddition", [UICV], U.MD.U.S.AsynICGK, ["", UICD, UICV]);
- UICD.parentNode.parentNode.parentNode.style.display = "none"; UICD.value = "";
- })
- } //于服务器同步增加用户的网盘
- }
- //汇换空间异步
- U.MD.U.S.AsynICGK = function (r) {
- var _context = r.context;
- r = r.value;
- if (r) {
- var i, _TF = true,
- ICDE = U.MD.U.S.E[US.userInfo.userid]["ICCSV"][0];
- for (i = 0; i < ICDE.length; i++) {
- if (ICDE[i]["VCType"] == "DiskAddition") {
- _TF = false; ICDE[i].VCSumValue -= _context[2];
- ICDE[i].VCCountValue += 1;
- }
- } //修改用户积分消耗信息
- if (_TF) {
- var _E = new U.MD.U.S.PICE[1, new Date(), -_context[2], "DiskAddition"],
- _UICE = U.MD.U.S.E[US.userInfo.userid]["Page"];
- ICDE.push(_E);
- if (_UICE && _UICE.length > 0) {
- var _ICE = U.MD.U.S.ICE(_UICE[1][0].AllCount, "0", US.userInfo.userid, new Date(), Guid.newGuid(), "硬盘增加", Guid.newGuid(), "DiskAddition", -_context[2]); _UICE[1].unshift(_ICE);
- }
- } //添加用户积分消耗信息
- U.MD.U.S.SUIC();
- U.MD.U.S.ICPL(ICDE, ["时间", "来源", "积分", "次数"], $("#UU_IC_Info")[0]);
- US.userInfo.UserDiskSpace += 1; //积分使用获得的变化 //用户信息
- }
- }
- //-----------------------------------------------------------------------------数据结构-------------------------------------------------------------------------------
- //积分的结构
- U.MD.U.S.PICE = function (E) {
- this.VCCountValue = E[0];
- this.VCDateTime = E[1];
- this.VCSumValue = E[2];
- this.VCType = E[3];
- }
- //积分的消耗
- U.MD.U.S.ICE = function (E) {
- this.AllCount = E[0];
- this.PageNum = E[1];
- this.UserID = E[2];
- this.VCDateTime = E[3];
- this.VCDetailsDataID = E[4];
- this.VCDetailsDataValue = E[5];
- this.VCID = E[6];
- this.VCType = E[7];
- this.VCValue = E[8];
- }
|