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
6e812dde
Commit
6e812dde
authored
May 29, 2020
by
郝聪敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复奖品列表重复问题;修复首页刷新问题
parent
9828cdc0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
21 deletions
+40
-21
videolist.wpy
src/components/custom/videolist.wpy
+39
-20
index.wpy
src/pages/index.wpy
+1
-1
No files found.
src/components/custom/videolist.wpy
View file @
6e812dde
...
@@ -64,8 +64,7 @@
...
@@ -64,8 +64,7 @@
circular="{{circular}}"
circular="{{circular}}"
vertical
vertical
current="1"
current="1"
bindanimationfinish="animationfinish"
bindchange="bindchange"
bindchange="cancelPause"
>
>
<!-- curQueue 循环会导致video重新插入,objectFit 不可变更 -->
<!-- curQueue 循环会导致video重新插入,objectFit 不可变更 -->
<swiper-item class="video-item" v-for="(item, idx) in curQueue" :key="item.id">
<swiper-item class="video-item" v-for="(item, idx) in curQueue" :key="item.id">
...
@@ -108,6 +107,15 @@
...
@@ -108,6 +107,15 @@
import wepy from '@wepy/core';
import wepy from '@wepy/core';
import { getProbability } from '../../common/raffleProbability';
import { getProbability } from '../../common/raffleProbability';
import { getAwardsDetail } from '../../common/api.js';
import { getAwardsDetail } from '../../common/api.js';
const fn = async function(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve();
}, time);
});
};
wepy.component({
wepy.component({
props: {
props: {
videoList: {
videoList: {
...
@@ -142,7 +150,9 @@
...
@@ -142,7 +150,9 @@
_invalidUp: 0,
_invalidUp: 0,
_invalidDown: 0,
_invalidDown: 0,
_videoContexts: [],
_videoContexts: [],
loading: false
loading: false,
isFirstUp: true,
isComputing: false
},
},
watch: {
watch: {
videoList () {
videoList () {
...
@@ -157,17 +167,18 @@
...
@@ -157,17 +167,18 @@
}
}
},
},
attached() {
attached() {
this._videoContexts = [
//
this._videoContexts = [
wx.createVideoContext('video_0', this.$wx),
//
wx.createVideoContext('video_0', this.$wx),
wx.createVideoContext('video_1', this.$wx),
//
wx.createVideoContext('video_1', this.$wx),
wx.createVideoContext('video_2', this.$wx)
//
wx.createVideoContext('video_2', this.$wx)
];
//
];
},
},
created() {
created() {
this.compute(this.userAccount);
this.compute(this.userAccount);
},
},
methods: {
methods: {
compute (newVal) {
compute (newVal) {
this.isComputing = true;
this.nextQueue.forEach(v => {
this.nextQueue.forEach(v => {
v.probability = getProbability(+newVal, +v.coinQuantity);
v.probability = getProbability(+newVal, +v.coinQuantity);
});
});
...
@@ -183,6 +194,7 @@
...
@@ -183,6 +194,7 @@
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 });
...
@@ -227,7 +239,7 @@
...
@@ -227,7 +239,7 @@
this.playCurrent(1);
this.playCurrent(1);
}
}
},
},
a
nimationfinish
(e) {
a
sync bindchange
(e) {
const current = e.$wx.detail.current;
const current = e.$wx.detail.current;
const diff = current - this._last;
const diff = current - this._last;
if (diff === 0) return;
if (diff === 0) return;
...
@@ -236,7 +248,13 @@
...
@@ -236,7 +248,13 @@
this.$emit('change', { activeId: this.curQueue[current].id });
this.$emit('change', { activeId: this.curQueue[current].id });
this.loading = true;
this.loading = true;
// setTimeout(() => {
if (current === 2 && this.isFirstUp) {
this.isFirstUp = false;
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) {
...
@@ -286,8 +304,8 @@
...
@@ -286,8 +304,8 @@
console.log('circular2');
console.log('circular2');
this.circular = false;
this.circular = false;
}
}
//
console.log(this.prevQueue.map(v => v.id), this.curQueue.map(v => v.id), this.nextQueue.map(v => v.id));
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');
...
@@ -322,13 +340,13 @@
...
@@ -322,13 +340,13 @@
chance: probability,
chance: probability,
progress: progress
progress: progress
});
});
this._videoContexts.forEach((ctx, index) => {
//
this._videoContexts.forEach((ctx, index) => {
if (index !== current) {
//
if (index !== current) {
ctx.pause();
//
ctx.pause();
} else {
//
} else {
ctx.play();
//
ctx.play();
}
//
}
});
//
});
},
},
trigger(e, type) {
trigger(e, type) {
var ext = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var ext = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
...
@@ -346,8 +364,9 @@
...
@@ -346,8 +364,9 @@
this.pause = !this.pause;
this.pause = !this.pause;
},
},
cancelPause() {
cancelPause() {
// console.log('bindchange');
this.pause = false;
this.pause = false;
}
}
,
}
}
});
});
</script>
</script>
...
...
src/pages/index.wpy
View file @
6e812dde
...
@@ -175,7 +175,7 @@
...
@@ -175,7 +175,7 @@
<view class="video-wrapper">
<view class="video-wrapper">
<view id="myvideo">
<view id="myvideo">
<van-notify id="van-notify" />
<van-notify id="van-notify" />
<video-list :videoList.sync="videoList" :userAccount="mainInfo && mainInfo.account && mainInfo.account.quantity || 0" :total="total" bindchange="changeVideo" @getAwardsInfo="getAwardsInfo">
<video-list
v-if="videoList && videoList.length"
:videoList.sync="videoList" :userAccount="mainInfo && mainInfo.account && mainInfo.account.quantity || 0" :total="total" bindchange="changeVideo" @getAwardsInfo="getAwardsInfo">
</video-list>
</video-list>
</view>
</view>
<view class="userInfo" style="{{userImgStyle}}" @tap="showMenu(!showMenus)">
<view class="userInfo" style="{{userImgStyle}}" @tap="showMenu(!showMenus)">
...
...
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