48ce4742-0362-4a73-a508-3f3a38554d1e.js 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. "use strict";
  2. cc._RF.push(module, '48ce4dCA2JKc6UIPzo4VU0e', 'YzRealNameAuthPanel');
  3. // common-plugin/Scripts/YzRealNameAuthPanel.ts
  4. "use strict";
  5. var __extends = (this && this.__extends) || (function () {
  6. var extendStatics = function (d, b) {
  7. extendStatics = Object.setPrototypeOf ||
  8. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  9. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  10. return extendStatics(d, b);
  11. };
  12. return function (d, b) {
  13. extendStatics(d, b);
  14. function __() { this.constructor = d; }
  15. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16. };
  17. })();
  18. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  19. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  20. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  21. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  22. return c > 3 && r && Object.defineProperty(target, key, r), r;
  23. };
  24. Object.defineProperty(exports, "__esModule", { value: true });
  25. var Utils_1 = require("./Utils");
  26. var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
  27. var YzRealNameAuthPanel = /** @class */ (function (_super) {
  28. __extends(YzRealNameAuthPanel, _super);
  29. function YzRealNameAuthPanel() {
  30. var _this = _super !== null && _super.apply(this, arguments) || this;
  31. _this.edit_real_name = null;
  32. _this.edit_id_card = null;
  33. _this.realNameAuthPanel = null;
  34. _this.msgNode = null;
  35. _this.exitPanel = null;
  36. _this.toVerifyPanel = null;
  37. _this.offLinePanel = null;
  38. _this.edit_default_color = null;
  39. _this._isOffLine = false;
  40. _this.realNameAuthLandscapePanel = null;
  41. _this.regName = /^[\u4e00-\u9fa5]{2,4}$/;
  42. _this.regIdNo = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
  43. _this._clickTime = 0;
  44. return _this;
  45. }
  46. YzRealNameAuthPanel.prototype.onLoad = function () {
  47. if (Utils_1.utils.otherConfig && Utils_1.utils.otherConfig.group) {
  48. this.node.group = Utils_1.utils.otherConfig.group;
  49. }
  50. var ratio = 0;
  51. if (cc.winSize.height < cc.winSize.width) {
  52. this.realNameAuthPanel = cc.find("Panel/RealNameAuthLandscapePanel", this.node);
  53. // 横屏游戏
  54. ratio = cc.winSize.width / 1920 * 0.75;
  55. }
  56. else {
  57. this.realNameAuthPanel = cc.find("Panel/RealNameAuthPanel", this.node);
  58. ratio = cc.winSize.width / 1080;
  59. }
  60. this.exitPanel = cc.find("Panel/ExitPanel", this.node);
  61. this.toVerifyPanel = cc.find("Panel/ToVerifyPanel", this.node);
  62. this.offLinePanel = cc.find("Panel/OfflinePanel", this.node);
  63. this.edit_id_card = this.realNameAuthPanel.getChildByName("editIdCard").getComponent(cc.EditBox);
  64. this.edit_real_name = this.realNameAuthPanel.getChildByName("editRealName").getComponent(cc.EditBox);
  65. this.msgNode = cc.find("Panel/MsgNode", this.node);
  66. this.edit_default_color = this.edit_real_name.fontColor;
  67. if (this.edit_default_color == null) {
  68. this.edit_default_color = new cc.Color(0, 0, 0, 63);
  69. }
  70. cc.find("Panel", this.node).scale = ratio;
  71. if (this._isOffLine) {
  72. this.showOfferLine();
  73. }
  74. else {
  75. this.realNameAuthPanel.active = true;
  76. }
  77. };
  78. YzRealNameAuthPanel.prototype.start = function () {
  79. // if (cc.winSize.height < cc.winSize.width) {
  80. // utils.adManager.HideBanner(BannerLocation.Home);
  81. // }
  82. };
  83. YzRealNameAuthPanel.prototype.onDestroy = function () {
  84. Utils_1.utils.emitRealNameAuthCloseEvent();
  85. };
  86. YzRealNameAuthPanel.prototype.onExitBtnClickListener = function () {
  87. Utils_1.utils.showLog("退出游戏!");
  88. Utils_1.utils.GameExit();
  89. };
  90. YzRealNameAuthPanel.prototype.onBackAuthBtnClickListener = function () {
  91. this.toVerifyPanel.active = false;
  92. this.exitPanel.active = false;
  93. this.realNameAuthPanel.active = true;
  94. };
  95. YzRealNameAuthPanel.prototype.showExitPanel = function () {
  96. this.toVerifyPanel.active = false;
  97. this.realNameAuthPanel.active = false;
  98. this.offLinePanel.active = false;
  99. this.exitPanel.active = true;
  100. };
  101. YzRealNameAuthPanel.prototype.showOfferLine = function () {
  102. this.toVerifyPanel.active = false;
  103. this.exitPanel.active = false;
  104. this.realNameAuthPanel.active = false;
  105. this.offLinePanel.active = true;
  106. };
  107. YzRealNameAuthPanel.prototype.onPostBtnClickListener = function () {
  108. var _this = this;
  109. var nowTime = new Date().getTime();
  110. if ((nowTime - this._clickTime) / 1000 < 2) {
  111. this.showMsg('请勿频繁提交!');
  112. return;
  113. }
  114. this._clickTime = nowTime;
  115. if (!this.regName.test(this.edit_real_name.string)) {
  116. this.showMsg('真实姓名填写有误!');
  117. this.edit_real_name.fontColor = cc.Color.RED;
  118. this.edit_real_name.setFocus();
  119. return false;
  120. }
  121. this.edit_real_name.fontColor = this.edit_default_color;
  122. if (!this.regIdNo.test(this.edit_id_card.string)) {
  123. this.edit_id_card.fontColor = cc.Color.RED;
  124. this.showMsg('身份证号填写有误!');
  125. this.edit_id_card.setFocus();
  126. return false;
  127. }
  128. this.edit_id_card.fontColor = this.edit_default_color;
  129. Utils_1.utils.realNameAuth(this.edit_id_card.string, this.edit_real_name.string, function (res, result) {
  130. Utils_1.utils.showLog("实名认证结束:#result=" + JSON.stringify(result));
  131. if (res) {
  132. if (result) {
  133. var res_1 = JSON.parse(result);
  134. switch (res_1.code) {
  135. case 1:
  136. _this.showMsg(res_1.msg);
  137. break;
  138. case 0:
  139. if (res_1.nonage == "0") {
  140. Utils_1.utils.setRealNameAuthLocalData("2");
  141. }
  142. else {
  143. Utils_1.utils.setRealNameAuthLocalData("1");
  144. }
  145. Utils_1.utils._isRealNameAuth = true;
  146. if (res_1.msg) {
  147. _this.showMsg(res_1.msg);
  148. }
  149. _this.scheduleOnce(function () {
  150. _this.node.destroy();
  151. }, 0.5);
  152. break;
  153. case 2:
  154. Utils_1.utils.setRealNameAuthLocalData("2");
  155. _this.showOfferLine();
  156. break;
  157. }
  158. }
  159. else {
  160. _this.showMsg("请求失败,请重新提交验证!");
  161. }
  162. }
  163. else {
  164. _this.showMsg("请求失败,请重新提交验证!");
  165. }
  166. });
  167. };
  168. YzRealNameAuthPanel.prototype.showMsg = function (str) {
  169. var msgNode = cc.instantiate(this.msgNode);
  170. msgNode.getChildByName("msgLabel").getComponent(cc.Label).string = "" + str;
  171. this.node.addChild(msgNode, cc.macro.MAX_ZINDEX);
  172. msgNode.active = true;
  173. msgNode.runAction(cc.sequence(cc.delayTime(0.8), cc.moveBy(0.3, cc.v2(0, +80)), cc.callFunc(function () {
  174. msgNode.destroy();
  175. })));
  176. };
  177. YzRealNameAuthPanel = __decorate([
  178. ccclass
  179. ], YzRealNameAuthPanel);
  180. return YzRealNameAuthPanel;
  181. }(cc.Component));
  182. exports.default = YzRealNameAuthPanel;
  183. cc._RF.pop();