Commit 2c011c6a authored by wjf's avatar wjf

l

parent 2d871c5a
function ListNode(value, next, last) {
this.value = value;
this.next = next;
this.last = last;
}
ListNode.prototype.value = null;
ListNode.prototype.next = null;
ListNode.prototype.last = null;
function List() {
}
List.prototype.head = null;
List.prototype.tail = null;
List.prototype.length = null;
List.prototype.getNodeByIndex = function (index = 0) {
if (index < -this.length || index >= this.length) {
console.error('out of range');
return null;
}
if (index === 0 || index === -this.length) {
return this.head;
} else if (index === this.length - 1 || index === -1) {
return this.tail;
} else if (index > 0) {
let last = this.head;
for (let i = 1; i <= index; i++) {
last = last.next;
}
return last;
} else if (index < 0) {
let next = this.tail;
for (let i = -2; i >= index; i--) {
next = next.last;
}
return next;
}
}
List.prototype.increase = function (value, index = this.length - 1) {
const opNode = this.getNodeByIndex(index);
if (!opNode) {
return;
}
opNode.value += value;
if (opNode.value >= 10) {
const out = ~~(opNode.value / 10);
opNode.value = opNode.value % 10;
this.increase(out, index - 1);
}
}
List.createList = function (...value) {
const newList = new List();
let last = new ListNode(value[0], null, null);
newList.head = last;
for (let i = 1; i < value.length; i++) {
let newNode = new ListNode(value[i], null, last);
last.next = newNode;
last = newNode;
}
newList.tail = last;
newList.length = value.length;
return newList;
}
const list = List.createList(1, 2, 3, 4);
list.increase(10, 2);
......@@ -17178,7 +17178,7 @@ var PrizePanel = (function (_super) {
_this.hidePanel();
return;
}
if (res.data) {
if (res.data && res.data.drawStatus == 3) {
ctrls_1.showToast('奖品发放成功\n请前往我的奖品处查看');
}
else {
......@@ -18723,7 +18723,7 @@ var LotteryScene = (function (_super) {
LotteryScene.prototype.lottery = function () {
var _this = this;
ctrls_1.showWaiting();
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.luckyDraw)
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.luckyDraw, { level: this.data.level })
.then(function (res) {
ctrls_1.hideWaiting();
if (!res.success)
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment