ShopRemoveAdView.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. var t = require;
  2. var e = module;
  3. var i = exports;
  4. var e =
  5. (this && this.__decorate) ||
  6. function (t, e, i, s) {
  7. var o,
  8. a = arguments.length,
  9. n = a < 3 ? e : null === s ? (s = Object.getOwnPropertyDescriptor(e, i)) : s;
  10. if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) n = Reflect.decorate(t, e, i, s);
  11. else
  12. for (var r = t.length - 1; 0 <= r; r--)
  13. (o = t[r]) && (n = (a < 3 ? o(n) : 3 < a ? o(e, i, n) : o(e, i)) || n);
  14. return 3 < a && n && Object.defineProperty(e, i, n), n;
  15. },
  16. s =
  17. (this && this.__awaiter) ||
  18. function (t, n, r, l) {
  19. return new (r = r || Promise)(function (i, e) {
  20. function s(t) {
  21. try {
  22. a(l.next(t));
  23. } catch (t) {
  24. e(t);
  25. }
  26. }
  27. function o(t) {
  28. try {
  29. a(l.throw(t));
  30. } catch (t) {
  31. e(t);
  32. }
  33. }
  34. function a(t) {
  35. var e;
  36. t.done
  37. ? i(t.value)
  38. : ((e = t.value) instanceof r
  39. ? e
  40. : new r(function (t) {
  41. t(e);
  42. })
  43. ).then(s, o);
  44. }
  45. a((l = l.apply(t, n || [])).next());
  46. });
  47. };
  48. Object.defineProperty(i, "__esModule", {value: !0});
  49. const o = t("App"),
  50. a = t("BaseView"),
  51. n = t("ControllerConst"),
  52. r = t("BagConst"),
  53. l = t("ShopConst"),
  54. h = t("ShopNormalItem"),
  55. {property: c, ccclass: d, menu: u} = cc._decorator;
  56. t = class extends a.default {
  57. constructor() {
  58. super(...arguments),
  59. (this.titleLab = null),
  60. (this.priceLab = null),
  61. (this.originLab = null),
  62. (this.diamnodLab = null),
  63. (this.item = null),
  64. (this.btn = null),
  65. (this.finish = null),
  66. (this.controller = null),
  67. (this.bgType = 1),
  68. (this.data = null);
  69. }
  70. initUI() {
  71. super.initUI();
  72. }
  73. open(t) {
  74. super.open(),
  75. (t = t || this.controller.model.shopGiftDatas[l.ShopGiftType.REMOVE_AD_GIFT][0]),
  76. (this.data = t),
  77. (this.titleLab.string = this.data.getName());
  78. t = o.default.Platform.getPriceNum(this.data.cfg.payId);
  79. (this.priceLab.string = t + "元"),
  80. (this.diamnodLab.string = "" + this.data.cfg.diamond),
  81. this.data.cfg.rate && (this.originLab.string = Math.ceil(t / this.data.cfg.rate) + "元");
  82. const e = o.default.ControllerManager.applyFunc(
  83. n.ControllerConst.Item,
  84. r.BagConst.GET_ITEM,
  85. this.data.items[1].id
  86. );
  87. this.item.setData(e.getItemPic(), "" + this.data.items[1].cnt),
  88. (this.btn.active = !this.data.isBuyGift()),
  89. (this.finish.active = this.data.isBuyGift());
  90. }
  91. onTouchBuyBtn() {
  92. console.log(n.ControllerConst.Shop);
  93. console.log(l.ShopConst.BUY);
  94. console.log(this.data);
  95. return s(this, void 0, void 0, function* () {
  96. (yield o.default.ControllerManager.applyFunc(n.ControllerConst.Shop, l.ShopConst.BUY, this.data)) &&
  97. this.closeView();
  98. });
  99. }
  100. };
  101. e([c(cc.Label)], t.prototype, "titleLab", void 0),
  102. e([c(cc.Label)], t.prototype, "priceLab", void 0),
  103. e([c(cc.Label)], t.prototype, "originLab", void 0),
  104. e([c(cc.Label)], t.prototype, "diamnodLab", void 0),
  105. e([c(h.ShopNormalItem)], t.prototype, "item", void 0),
  106. e([c(cc.Node)], t.prototype, "btn", void 0),
  107. e([c(cc.Node)], t.prototype, "finish", void 0),
  108. (t = e([d, u("view/Shop/ShopRemoveAdView")], t)),
  109. (i.default = t);