Global.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. import i18n from './locales/index';
  2. import {LOCAL_WD_PASS, LOCAL_WD_PASS_SET_TIME} from "@constants/localkey";
  3. import {decrypt, encrypt, localStorageGet, localStorageSet} from "@utils/helpers";
  4. // import symbol from "@assets/symbol-defs.svg";
  5. // import symbol_m from "@assets/symbol-mobile.svg";
  6. global.i18n=i18n;
  7. // global.symbol=symbol;
  8. // global.symbol_m=symbol_m;
  9. global.CASH_BASE=100;
  10. global.DOLLAR="R$";
  11. global.dispatch=null;
  12. global.msgBox=null;
  13. global.msgBoxShow=(params)=>{
  14. if (global.msgBox)global.msgBox.show(params);
  15. }
  16. global.msgBoxHide=()=>{
  17. if (global.msgBox)global.msgBox.hide();
  18. }
  19. global.authLockPath=null;
  20. global.device="mobile";
  21. global.width=100;
  22. global.height=100;
  23. global.isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent);
  24. //游客id 指纹
  25. global.BFP=null;
  26. //wd pass
  27. global.getWDPass=()=>{
  28. let pass=localStorageGet(LOCAL_WD_PASS,"");
  29. if (pass!=null&&pass!==""){
  30. pass=decrypt(pass);
  31. let lsettime=localStorageGet(LOCAL_WD_PASS_SET_TIME,"");
  32. if (lsettime!=null){
  33. lsettime=Number(lsettime);
  34. let now=Date.now();
  35. let during=now-lsettime;
  36. //10m
  37. let deadline=10*60*1000;
  38. if (during<deadline)return pass;
  39. else {
  40. localStorageSet(LOCAL_WD_PASS,"");
  41. localStorageSet(LOCAL_WD_PASS_SET_TIME,"");
  42. }
  43. }
  44. }
  45. return "";
  46. }
  47. global.setWDPass=(value)=>{
  48. if (value==null)return;
  49. if (value!==""){
  50. value=encrypt(value);
  51. }
  52. localStorageSet(LOCAL_WD_PASS,value);
  53. localStorageSet(LOCAL_WD_PASS_SET_TIME,Date.now());
  54. }
  55. global.showDropCoins=()=>{
  56. if (global.dropCoins)global.dropCoins.show();
  57. }
  58. global.hideDropCoins=()=>{
  59. if (global.dropCoins)global.dropCoins.hide();
  60. }
  61. global.showMailNew=()=>{
  62. if (global.mailNew)global.mailNew.show();
  63. }
  64. global.hideMailNew=()=>{
  65. if (global.mailNew)global.mailNew.hide();
  66. }
  67. global.showInstallBox=()=>{
  68. if (global.installBox)global.installBox.show();
  69. }
  70. global.hideInstallBox=()=>{
  71. if (global.installBox)global.installBox.hide();
  72. }
  73. global.showBindPhone=()=>{
  74. if (global.bindPhone)global.bindPhone.show();
  75. }
  76. global.hideBindPhone=()=>{
  77. if (global.bindPhone)global.bindPhone.hide();
  78. }
  79. global.showBindPrompt=()=>{
  80. if (global.bindPrompt)global.bindPrompt.show();
  81. }
  82. global.hideBindPrompt=()=>{
  83. if (global.bindPrompt)global.bindPrompt.hide();
  84. }
  85. global.showProtectReward=()=>{
  86. if (global.protectReward)global.protectReward.show();
  87. }
  88. global.hideProtectReward=()=>{
  89. if (global.protectReward)global.protectReward.hide();
  90. }
  91. global.showLoadingCircular=(showMask=false)=>{
  92. if (global.loadingCircular)global.loadingCircular.show(showMask);
  93. }
  94. global.hideLoadingCircular=()=>{
  95. if (global.loadingCircular)global.loadingCircular.hide();
  96. }
  97. global.showFirstPay=()=>{
  98. if (global.firstPay)global.firstPay.show();
  99. }
  100. global.hideFirstPay=()=>{
  101. if (global.firstPay)global.firstPay.hide();
  102. }
  103. //wd pass