Commit 2fbe8c6f authored by 郝聪敏's avatar 郝聪敏

修改奖品列表重复bug

parent 2e9a8227
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
bindchange="cancelPause" bindchange="cancelPause"
> >
<!-- curQueue 循环会导致video重新插入,objectFit 不可变更 --> <!-- curQueue 循环会导致video重新插入,objectFit 不可变更 -->
<swiper-item class="video-item" wx:for="{{curQueue}}" wx:key="index"> <swiper-item class="video-item" v-for="(item, idx) in curQueue" :key="item.id">
<view class="video-wrapper"> <view class="video-wrapper">
<!-- <video <!-- <video
id="video_{{index}}" id="video_{{index}}"
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
<video-pause :pause="pause"></video-pause> <video-pause :pause="pause"></video-pause>
</video> < !--> </video> < !-->
<view class="rightcont"> <view class="rightcont">
<view class="info">奖品库存: 1/8</view> <view class="info">奖品库存: {{item.stock}}/{{item.totalStock}}</view>
<view class="info">中奖概率: {{item.probability}}</view> <view class="info">中奖概率: {{item.probability}}</view>
<view class="progress"> <view class="progress">
<view class="text">{{item.progress}}</view> <view class="text">{{item.progress}}</view>
...@@ -148,8 +148,8 @@ ...@@ -148,8 +148,8 @@
videoList () { videoList () {
const newVal = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; const newVal = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
this.loading = false; this.loading = false;
this.init(); if (!newVal.length) return;
if (newVal.length) this._videoListChanged(newVal); this._videoListChanged(newVal);
this.compute(this.userAccount); this.compute(this.userAccount);
}, },
userAccount(newVal) { userAccount(newVal) {
...@@ -217,19 +217,6 @@ ...@@ -217,19 +217,6 @@
this.nextQueue = [...this.nextQueue]; this.nextQueue = [...this.nextQueue];
this.prevQueue = [...this.prevQueue]; this.prevQueue = [...this.prevQueue];
}, },
init() {
this.pause = false;
this.nextQueue = [];
this.prevQueue = [];
this.curQueue = [];
this.circular = false;
this._last = 1;
this._change = -1;
this._invalidUp = 0;
this._invalidDown = 0;
this._videoContexts = [];
this.loading = false;
},
_videoListChanged (newVal) { _videoListChanged (newVal) {
newVal.forEach((item, index) => { newVal.forEach((item, index) => {
item.time = 0; item.time = 0;
...@@ -248,9 +235,8 @@ ...@@ -248,9 +235,8 @@
this.playCurrent(current); this.playCurrent(current);
this.$emit('change', { activeId: this.curQueue[current].id }); this.$emit('change', { activeId: this.curQueue[current].id });
this.loading = true; this.loading = true;
this.circular = false;
setTimeout(() => { // 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) {
...@@ -278,6 +264,7 @@ ...@@ -278,6 +264,7 @@
this.curQueue[_change2] = _add; this.curQueue[_change2] = _add;
this.nextQueue.unshift(_remove); this.nextQueue.unshift(_remove);
this._change = (_change2 - 1 + 3) % 3; this._change = (_change2 - 1 + 3) % 3;
console.log('this.prevQueue.length', this.prevQueue.length);
if (this.prevQueue.length === 0) this.prevQueue.push(this.nextQueue.pop()); if (this.prevQueue.length === 0) this.prevQueue.push(this.nextQueue.pop());
} else { } else {
this._invalidDown += 1; this._invalidDown += 1;
...@@ -286,8 +273,21 @@ ...@@ -286,8 +273,21 @@
this._invalidUp -= 1; this._invalidUp -= 1;
} }
} }
this.curQueue = [...this.curQueue];
this.nextQueue = [...this.nextQueue];
this.prevQueue = [...this.prevQueue];
this.circular = true; this.circular = true;
});
if (this.nextQueue.length === 0 && current !== 0) {
console.log('circular1');
this.circular = false;
}
if (this.prevQueue.length === 0 && current !== 2) {
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));
// });
}, },
onWaiting (e) { onWaiting (e) {
this.trigger(e, 'wait'); this.trigger(e, 'wait');
......
...@@ -492,6 +492,13 @@ ...@@ -492,6 +492,13 @@
}, },
fail (res) { fail (res) {
console.log('requestSubscribeMessage fail', res); console.log('requestSubscribeMessage fail', res);
let info = '订阅消息失败,请稍后重试';
switch (res.errCode) {
case '20004':
info = '您关闭了主开关,无法进行订阅';
break;
}
Notify({ message: info, background: '#FF5D15', safeAreaInsetTop: true });
} }
}); });
}, },
......
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