filesbox/web/dist/design/designstatic/common/js/user.js

3 lines
125 KiB
JavaScript
Raw Normal View History

2024-07-26 06:10:54 +00:00
var Ce=(r,f,n)=>new Promise((t,i)=>{var e=o=>{try{a(n.next(o))}catch(d){i(d)}},s=o=>{try{a(n.throw(o))}catch(d){i(d)}},a=o=>o.done?t(o.value):Promise.resolve(o.value).then(e,s);a((n=n.apply(r,f)).next())});(function(r,f){setTimeout(function(){},1e3),window.tsnfors=getPar("targetServerNameForOverride")||getPar("host")?"?targetServerNameForOverride="+(getPar("targetServerNameForOverride")||getPar("host")):"",f.user={getQueryRetailId:function(n){for(var t=window.location.search.substring(1),i=t.split("&"),e=0;e<i.length;e++){var s=i[e];if(s.indexOf("diliater=")==0)return n?s.replace(/diliater=/,""):decrypt(s.replace(/diliater=/,"")).split(",")}return""},saveRetailId:function(){var n=this,t=location.origin||location.protocol+"//"+location.host,i=location.pathname;if(n.getQueryRetailId(!0))window.localStorage.encryptId=n.getQueryRetailId(!0),window.sessionStorage.encryptId=n.getQueryRetailId(!0);else if(location.href.indexOf("myroom")<0&&location.href.indexOf("aroom")<0&&location.href.indexOf("/views/")<0&&location.href.indexOf("/pay/")<0){var e=n.clearRetailId(location.search),s=window.localStorage.encryptId||window.sessionStorage.encryptId,a=t+i+(s?e?e+"&diliater="+s:"?diliater="+s:e);history.replaceState?history.replaceState({},"",a):location.href!=a&&(location.href=a)}},clearRetailId:function(n){for(var t=n.split("&"),i="",e=0,s=t.length;e<s;e++){var a=t[e];a.indexOf("?diliater=")>-1?e+1!==s&&(i+="?"):a.indexOf("diliater=")==0||(i+=i&&i!="?"?"&"+a:a)}return i},createRetailId:function(n){for(var t=this,i=location.origin||location.protocol+"//"+location.host,e=location.pathname,s=n.userId,a=t.getQueryRetailId()||decrypt&&(window.localStorage.encryptId||window.sessionStorage.encryptId)&&decrypt(window.localStorage.encryptId||window.sessionStorage.encryptId).split(",")||[],o=s?[s]:[],d=0,l=a.length;d<l;d++){var p=a[d];p&&s!=p&&o.length<4&&o.push(p)}var v=encrypt(o.join(","));window.localStorage.encryptId=v,window.sessionStorage.encryptId=v;var h=t.clearRetailId(location.search),m=i+e+(h?h+"&diliater="+v:"?diliater="+v);location.href.indexOf("myroom")<0&&location.href.indexOf("aroom")<0&&location.href.indexOf("/views/")<0&&location.href.indexOf("/pay/")<0&&(history.replaceState?history.replaceState({},"",m):location.href!=m&&(location.href=m))},funcUrlDel:function(n){var t=window.location,i=t.origin+t.pathname+"?",e=t.search.substr(1);if(e.indexOf(n)>-1){for(var s={},a=e.split("&"),o=0;o<a.length;o++)a[o]=a[o].split("="),s[a[o][0]]=a[o][1];delete s[n];var d=i+JSON.stringify(s).replace(/[\"\{\}]/g,"").replace(/\:/g,"=").replace(/\,/g,"&");return d}},clearUrlRetailId:function(){var n=this;window.localStorage.encryptId="",window.sessionStorage.encryptId="";var t=n.funcUrlDel("diliater");t&&(history.replaceState?history.replaceState("","",t):location.href=t)},isRetailId:function(){var n=0,t=getPar("sceneId")||"",i=getPar("sceneType")?getPar("sceneType"):0;if(window.roominfo&&window.CryptoJS){n=1;var e=window.roominfo;t&&i=="1",n=2}return n},getAjaxRoomInfo:function(n){var t=this;r.ajax({type:"get",url:"/api/disk/home"+window.tsnfors,dataType:"json",success:function(i){i.success&&(window.roominfo=i.data,n&&n())}})},getDressUpCouponShareList:function(n,t){var i=this;r.ajax({type:"get",headers:{token:getCookie("token")},url:"/api/order/vip/getDressUpCouponShareList"+window.tsnfors,dataType:"json",data:n,success:function(e){e.success?t&&t(e,n):layer.alert(e.message)}})},getShareCoupon:function(n,t){var i=this;r.ajax({type:"get",headers:{token:getCookie("token")},url:"/api/coupon/shareCoupon"+window.tsnfors,dataType:"json",data:n,success:function(e){t&&t(e)}})},getCdkey:function(n,t){var i=this;r.ajax({type:"post",headers:{token:getCookie("token")},url:"/api/coupon/getCdkey"+window.tsnfors,contentType:"application/json;charset=utf-8",dataType:"json",data:JSON.stringify(n),success:function(e){t&&t(e)}})},isLogin:function(n,t,i){if(f.ajaxSend)return!1;f.ajaxSend=!0;var e=this,s=getPar("redirectUrl")||"";r.ajax({type:"get",headers:{token:getCookie("token")},url:"/api/disk/options"+window.tsnfors,contentType:"application/json",dataType:"j
`);for(var i="",e=0;e<t.length;e++){var s=t.charCodeAt(e);s<128?i+=String.fromCharCode(s):s>127&&s<2048?(i+=String.fromCharCode(s>>6|192),i+=String.fromCharCode(s&63|128)):(i+=String.fromCharCode(s>>12|224),i+=String.fromCharCode(s>>6&63|128),i+=String.fromCharCode(s&63|128))}return i},n=function(t){for(var i="",e=0,s=0,a=0,o=0,d=0;e<t.length;)s=t.charCodeAt(e),s<128?(i+=String.fromCharCode(s),e++):s>191&&s<224?(o=t.charCodeAt(e+1),i+=String.fromCharCode((s&31)<<6|o&63),e+=2):(o=t.charCodeAt(e+1),d=t.charCodeAt(e+2),i+=String.fromCharCode((s&15)<<12|(o&63)<<6|d&63),e+=3);return i}}(function(r,f){var n=4;function t(a){if(this.options={id:"",canvasId:"verifyCanvas",width:"93",height:"32",type:"blend",code:""},Object.prototype.toString.call(a)=="[object Object]")for(var o in a)this.options[o]=a[o];else this.options.id=a;this.options.numArr="0,1,2,3,4,5,6,7,8,9".split(","),this.options.letterArr=i(),this._init(),this.refresh()}t.prototype={version:"1.0.0",_init:function(){var a=f.getElementById(this.options.id),o=f.createElement("canvas");this.options.width=a.offsetWidth>0?a.offsetWidth:"100",this.options.height=a.offsetHeight>0?a.offsetHeight:"30",o.id=this.options.canvasId,o.width=this.options.width,o.height=this.options.height,o.style.cursor="pointer",o.innerHTML="\u60A8\u7684\u6D4F\u89C8\u5668\u7248\u672C\u4E0D\u652F\u6301canvas",a.appendChild(o);var d=this;o.onclick=function(){d.refresh()}},refresh:function(){this.options.code="";var a=f.getElementById(this.options.canvasId);if(a.getContext)var o=a.getContext("2d");else return;if(o.textBaseline="middle",o.fillStyle=s(180,240),o.fillRect(0,0,this.options.width,this.options.height),this.options.type=="blend")var d=this.options.numArr.concat(this.options.letterArr);else if(this.options.type=="number")var d=this.options.numArr;else var d=this.options.letterArr;for(var l=1;l<=n;l++){var p=d[e(0,d.length)];this.options.code+=p,o.font=30+"px SimHei",o.fillStyle=s(50,160),o.shadowOffsetX=e(-1,1),o.shadowOffsetY=e(-1,1),o.shadowBlur=e(-2,2),o.shadowColor="rgba(0, 0, 0, 0.3)";var v=this.options.width/(n+1)*(l-1)+10,h=this.options.height/2,m=e(-15,15);o.translate(v,h),o.rotate(m*Math.PI/180),o.fillText(p,0,0),o.rotate(-m*Math.PI/180),o.translate(-v,-h)}},validate:function(a){var a=a.toLowerCase(),o=this.options.code.toLowerCase();return a==o?!0:(this.refresh(),!1)}};function i(){var a="a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z";return a.split(",")}function e(a,o){return Math.floor(Math.random()*(o-a)+a)}function s(a,o){var d=e(a,o),l=e(a,o),p=e(a,o);return"rgb("+d+","+l+","+p+")"}r.GVerify=t})(window,document);