163 lines
7.3 KiB
JavaScript
163 lines
7.3 KiB
JavaScript
System.register(["__unresolved_0", "cc", "__unresolved_1"], function (_export, _context) {
|
|
"use strict";
|
|
|
|
var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, Component, Prefab, instantiate, director, dwebAjax, _dec, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _dec2, _dec3, _class4, _class5, _descriptor6, _descriptor7, _crd, ccclass, property, Item, ItemList;
|
|
|
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
|
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
|
|
function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
|
|
|
|
function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
|
|
|
|
function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); }
|
|
|
|
function _reportPossibleCrUseOfdwebAjax(extras) {
|
|
_reporterNs.report("dwebAjax", "./ajax", _context.meta, extras);
|
|
}
|
|
|
|
return {
|
|
setters: [function (_unresolved_) {
|
|
_reporterNs = _unresolved_;
|
|
}, function (_cc) {
|
|
_cclegacy = _cc.cclegacy;
|
|
__checkObsolete__ = _cc.__checkObsolete__;
|
|
__checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
|
|
_decorator = _cc._decorator;
|
|
Component = _cc.Component;
|
|
Prefab = _cc.Prefab;
|
|
instantiate = _cc.instantiate;
|
|
director = _cc.director;
|
|
}, function (_unresolved_2) {
|
|
dwebAjax = _unresolved_2.default;
|
|
}],
|
|
execute: function () {
|
|
_crd = true;
|
|
|
|
_cclegacy._RF.push({}, "27335xaDl9Jw5lK1s+Pnap/", "ItemList", undefined);
|
|
|
|
__checkObsolete__(['_decorator', 'Component', 'Node', 'Prefab', 'instantiate', 'director']);
|
|
|
|
({
|
|
ccclass,
|
|
property
|
|
} = _decorator);
|
|
|
|
_export("Item", Item = (_dec = ccclass("Item"), _dec(_class = (_class2 = class Item {
|
|
constructor() {
|
|
_initializerDefineProperty(this, "bctype", _descriptor, this);
|
|
|
|
_initializerDefineProperty(this, "num", _descriptor2, this);
|
|
|
|
_initializerDefineProperty(this, "type", _descriptor3, this);
|
|
|
|
_initializerDefineProperty(this, "price", _descriptor4, this);
|
|
|
|
_initializerDefineProperty(this, "time", _descriptor5, this);
|
|
}
|
|
|
|
}, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "bctype", [property], {
|
|
configurable: true,
|
|
enumerable: true,
|
|
writable: true,
|
|
initializer: function initializer() {
|
|
return "";
|
|
}
|
|
}), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "num", [property], {
|
|
configurable: true,
|
|
enumerable: true,
|
|
writable: true,
|
|
initializer: function initializer() {
|
|
return "";
|
|
}
|
|
}), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "type", [property], {
|
|
configurable: true,
|
|
enumerable: true,
|
|
writable: true,
|
|
initializer: function initializer() {
|
|
return "";
|
|
}
|
|
}), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "price", [property], {
|
|
configurable: true,
|
|
enumerable: true,
|
|
writable: true,
|
|
initializer: function initializer() {
|
|
return "";
|
|
}
|
|
}), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, "time", [property], {
|
|
configurable: true,
|
|
enumerable: true,
|
|
writable: true,
|
|
initializer: function initializer() {
|
|
return "";
|
|
}
|
|
})), _class2)) || _class));
|
|
|
|
_export("ItemList", ItemList = (_dec2 = property([Item]), _dec3 = property(Prefab), ccclass(_class4 = (_class5 = class ItemList extends Component {
|
|
constructor() {
|
|
super(...arguments);
|
|
|
|
_initializerDefineProperty(this, "items", _descriptor6, this);
|
|
|
|
_initializerDefineProperty(this, "itemPrefab", _descriptor7, this);
|
|
}
|
|
|
|
onLoad() {
|
|
var _this = this;
|
|
|
|
return _asyncToGenerator(function* () {
|
|
var data = {};
|
|
(_crd && dwebAjax === void 0 ? (_reportPossibleCrUseOfdwebAjax({
|
|
error: Error()
|
|
}), dwebAjax) : dwebAjax).sendAjax("/api/v1/recharge", data, "POST", /*#__PURE__*/_asyncToGenerator(function* (res) {
|
|
if (res.code == "200" && res.data.items) {
|
|
// this.items = res.data.items;
|
|
for (var i = 0; i < _this.items.length; ++i) {
|
|
var item = instantiate(_this.itemPrefab);
|
|
var _data = res.data.items[i];
|
|
|
|
_this.node.addChild(item);
|
|
|
|
console.log(1);
|
|
item.getComponent("ItemTemplate").init(_data);
|
|
}
|
|
} else if (res.code == "10001") {
|
|
console.log("登录失效");
|
|
director.loadScene("login");
|
|
} else {
|
|
console.log(res);
|
|
return;
|
|
}
|
|
})); // for (let i = 0; i < this.items.length; ++i) {
|
|
// const item = instantiate(this.itemPrefab);
|
|
// const data = this.items[i];
|
|
// this.node.addChild(item);
|
|
// item.getComponent("ItemTemplate").init(data);
|
|
// }
|
|
})();
|
|
}
|
|
|
|
}, (_descriptor6 = _applyDecoratedDescriptor(_class5.prototype, "items", [_dec2], {
|
|
configurable: true,
|
|
enumerable: true,
|
|
writable: true,
|
|
initializer: function initializer() {
|
|
return [];
|
|
}
|
|
}), _descriptor7 = _applyDecoratedDescriptor(_class5.prototype, "itemPrefab", [_dec3], {
|
|
configurable: true,
|
|
enumerable: true,
|
|
writable: true,
|
|
initializer: function initializer() {
|
|
return null;
|
|
}
|
|
})), _class5)) || _class4));
|
|
|
|
_cclegacy._RF.pop();
|
|
|
|
_crd = false;
|
|
}
|
|
};
|
|
});
|
|
//# sourceMappingURL=38435cce6b8af86b3bbf630a11bbe99d1df68371.js.map
|