Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mini-program-wepy
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ui
mini-program-wepy
Commits
8eeb9e21
Commit
8eeb9e21
authored
May 29, 2020
by
郝聪敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改奖品列表重复问题
parent
6e812dde
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
51 deletions
+43
-51
videolist.wpy
src/components/custom/videolist.wpy
+43
-51
No files found.
src/components/custom/videolist.wpy
View file @
8eeb9e21
...
@@ -151,8 +151,7 @@
...
@@ -151,8 +151,7 @@
_invalidDown: 0,
_invalidDown: 0,
_videoContexts: [],
_videoContexts: [],
loading: false,
loading: false,
isFirstUp: true,
isFirstUp: true,
isComputing: false
},
},
watch: {
watch: {
videoList () {
videoList () {
...
@@ -178,7 +177,8 @@
...
@@ -178,7 +177,8 @@
},
},
methods: {
methods: {
compute (newVal) {
compute (newVal) {
this.isComputing = true;
if (!this.curQueue.length) return;
this.nextQueue.forEach(v => {
this.nextQueue.forEach(v => {
v.probability = getProbability(+newVal, +v.coinQuantity);
v.probability = getProbability(+newVal, +v.coinQuantity);
});
});
...
@@ -194,7 +194,6 @@
...
@@ -194,7 +194,6 @@
this.curQueue = [...this.curQueue];
this.curQueue = [...this.curQueue];
this.nextQueue = [...this.nextQueue];
this.nextQueue = [...this.nextQueue];
this.prevQueue = [...this.prevQueue];
this.prevQueue = [...this.prevQueue];
this.isComputing = false;
},
},
async getProgress(id) {
async getProgress(id) {
const detail = await getAwardsDetail({ prizeId: id });
const detail = await getAwardsDetail({ prizeId: id });
...
@@ -252,60 +251,53 @@
...
@@ -252,60 +251,53 @@
this.isFirstUp = false;
this.isFirstUp = false;
await fn(700);
await fn(700);
}
}
// if (timeout) clearTimeout(timeout);
// timeout = setTimeout(() => {
const direction = diff === 1 || diff === -2 ? 'up' : 'down';
const direction = diff === 1 || diff === -2 ? 'up' : 'down';
if (direction === 'up') {
if (direction === 'up') {
if (this._invalidDown === 0) {
if (this._invalidDown === 0) {
const change = (this._change + 1) % 3;
const change = (this._change + 1) % 3;
const add = this.nextQueue.shift();
const add = this.nextQueue.shift();
const remove = this.curQueue[change];
const remove = this.curQueue[change];
if (add) {
if (add) {
this.prevQueue.push(remove);
this.prevQueue.push(remove);
this.curQueue[change] = add;
this.curQueue[change] = add;
this._change = change;
this._change = change;
if (this.nextQueue.length === 0) this.nextQueue.push(this.prevQueue.shift());
if (this.nextQueue.length === 0) this.nextQueue.push(this.prevQueue.shift());
} else {
this._invalidUp += 1;
}
} else {
} else {
this._invalid
Down -
= 1;
this._invalid
Up +
= 1;
}
}
} else {
this._invalidDown -= 1;
}
}
if (direction === 'down') {
}
if (this._invalidUp === 0) {
if (direction === 'down') {
const _change2 = this._change;
if (this._invalidUp === 0) {
const _remove = this.curQueue[_change2];
const _change2 = this._change;
const _add = this.prevQueue.pop();
const _remove = this.curQueue[_change2];
if (_add) {
const _add = this.prevQueue.pop();
this.curQueue[_change2] = _add;
if (_add) {
this.nextQueue.unshift(_remove);
this.curQueue[_change2] = _add;
this._change = (_change2 - 1 + 3) % 3;
this.nextQueue.unshift(_remove);
console.log('this.prevQueue.length', this.prevQueue.length);
this._change = (_change2 - 1 + 3) % 3;
if (this.prevQueue.length === 0) this.prevQueue.push(this.nextQueue.pop());
if (this.prevQueue.length === 0) this.prevQueue.push(this.nextQueue.pop());
} else {
this._invalidDown += 1;
}
} else {
} else {
this._invalid
Up -
= 1;
this._invalid
Down +
= 1;
}
}
} else {
this._invalidUp -= 1;
}
}
this.curQueue = [...this.curQueue];
}
this.nextQueue = [...this.nextQueue];
this.curQueue = [...this.curQueue];
this.prevQueue = [...this.prevQueue];
this.nextQueue = [...this.nextQueue];
this.circular = true;
this.prevQueue = [...this.prevQueue];
this.circular = true;
if (this.nextQueue.length === 0 && current !== 0) {
if (this.nextQueue.length === 0 && current !== 0) {
console.log('circular1');
this.circular = false;
this.circular = false;
}
}
if (this.prevQueue.length === 0 && current !== 2) {
if (this.prevQueue.length === 0 && current !== 2) {
this.circular = false;
console.log('circular2');
}
this.circular = false;
}
console.log(this.prevQueue.map(v => v.id), this.curQueue.map(v => v.id), this.nextQueue.map(v => v.id));
// }, 700);
},
},
onWaiting (e) {
onWaiting (e) {
this.trigger(e, 'wait');
this.trigger(e, 'wait');
...
@@ -366,7 +358,7 @@
...
@@ -366,7 +358,7 @@
cancelPause() {
cancelPause() {
// console.log('bindchange');
// console.log('bindchange');
this.pause = false;
this.pause = false;
}
,
}
}
}
});
});
</script>
</script>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment