Commit af2112cb authored by 郝聪敏's avatar 郝聪敏

修改抽奖页面参数异常问题

parent 4616bf57
...@@ -128,7 +128,8 @@ ...@@ -128,7 +128,8 @@
data: { data: {
pause: false, pause: false,
curQueue: [], curQueue: [],
_videoContexts: [] _videoContexts: [],
current: 0
}, },
watch: { watch: {
videoList () { videoList () {
...@@ -150,6 +151,7 @@ ...@@ -150,6 +151,7 @@
v.probability = getProbability(+newVal, +v.coinQuantity); v.probability = getProbability(+newVal, +v.coinQuantity);
}); });
this.curQueue = [...this.curQueue]; this.curQueue = [...this.curQueue];
this.updateAwardsInfo(this.current);
}, },
async getProgress(id) { async getProgress(id) {
let detail = await getAwardsDetail({ prizeId: id }); let detail = await getAwardsDetail({ prizeId: id });
...@@ -178,6 +180,7 @@ ...@@ -178,6 +180,7 @@
}, },
async bindanimationfinish(e) { async bindanimationfinish(e) {
const current = e.$wx.detail.current; const current = e.$wx.detail.current;
this.current = current;
this.pause = false; this.pause = false;
this.playCurrent(current); this.playCurrent(current);
this.trigger(e, 'change'); this.trigger(e, 'change');
...@@ -197,9 +200,20 @@ ...@@ -197,9 +200,20 @@
this.curQueue = [...this.curQueue]; this.curQueue = [...this.curQueue];
} }
}, },
updateAwardsInfo(current) {
const { id, photoUrl, videoSnapUrl, showType, name, probability } = this.curQueue[current];
this.$emit('getAwardsInfo', {
id,
photoUrl: showType.value === 1 ? encodeURIComponent(photoUrl) : encodeURIComponent(videoSnapUrl),
name,
chance: probability
});
},
playCurrent(current) { playCurrent(current) {
if (!this.curQueue || this.curQueue.length <= 1) return; if (!this.curQueue || this.curQueue.length <= 1) return;
// 更新抽奖页面参数
this.updateAwardsInfo(current);
// 播放当前视频
this._videoContexts.forEach((ctx, index) => { this._videoContexts.forEach((ctx, index) => {
if (index !== current) { if (index !== current) {
ctx && ctx.pause(); ctx && ctx.pause();
...@@ -207,15 +221,8 @@ ...@@ -207,15 +221,8 @@
ctx && ctx.play(); ctx && ctx.play();
} }
}); });
// 更新奖品进度
this.getProgress(this.curQueue[current].id); this.getProgress(this.curQueue[current].id);
const { id, photoUrl, name, probability } = this.curQueue[current];
this.$emit('getAwardsInfo', {
id,
photoUrl,
name,
chance: probability
});
}, },
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] : {};
......
...@@ -314,6 +314,7 @@ ...@@ -314,6 +314,7 @@
Notify({ message: '您的克币数为0, 无法参与抽奖', safeAreaInsetTop: true }); Notify({ message: '您的克币数为0, 无法参与抽奖', safeAreaInsetTop: true });
return; return;
} }
wx.navigateTo({ wx.navigateTo({
url: `/pages/raffle?prizeId=${id}&chance=${chance}&photoUrl=${photoUrl}&quantity=${this.mainInfo.account.quantity}&name=${name}` url: `/pages/raffle?prizeId=${id}&chance=${chance}&photoUrl=${photoUrl}&quantity=${this.mainInfo.account.quantity}&name=${name}`
}); });
...@@ -327,6 +328,7 @@ ...@@ -327,6 +328,7 @@
getSharedGold: async function(v) { getSharedGold: async function(v) {
this.showModal = 0; this.showModal = 0;
await addGold(v); await addGold(v);
this.showActivity();
let account = this.mainInfo.account || {}; let account = this.mainInfo.account || {};
let quantity = account.quantity || 0; let quantity = account.quantity || 0;
this.mainInfo.account.quantity = quantity + v.quantity; this.mainInfo.account.quantity = quantity + v.quantity;
...@@ -339,7 +341,7 @@ ...@@ -339,7 +341,7 @@
}, },
getMainInfo: async function() { getMainInfo: async function() {
this.mainInfo = await getMainInfo(); this.mainInfo = await getMainInfo();
this.sign = (this.mainInfo && this.mainInfo.signin) || true; this.sign = this.mainInfo && this.mainInfo.signin;
wx.setStorageSync('hasPhone', this.mainInfo.phone); wx.setStorageSync('hasPhone', this.mainInfo.phone);
if (this.mainInfo && this.mainInfo.innerActivity) { if (this.mainInfo && this.mainInfo.innerActivity) {
wx.setStorageSync('innerActivity', this.mainInfo.innerActivity); wx.setStorageSync('innerActivity', this.mainInfo.innerActivity);
...@@ -412,7 +414,7 @@ ...@@ -412,7 +414,7 @@
}, },
async onShow() { async onShow() {
let join = wx.getStorageSync('userJoin'); let join = wx.getStorageSync('userJoin');
if (join == 1) { if (join === 1) {
wx.removeStorageSync('userJoin'); wx.removeStorageSync('userJoin');
this.showActivity(); this.showActivity();
} }
......
...@@ -401,7 +401,7 @@ ...@@ -401,7 +401,7 @@
this.quantity = quantity || ''; this.quantity = quantity || '';
this.name = name; this.name = name;
this.chance = chance; this.chance = chance;
this.photoUrl = photoUrl; this.photoUrl = decodeURIComponent(photoUrl);
this.innerActivity = wx.getStorageSync('innerActivity'); this.innerActivity = wx.getStorageSync('innerActivity');
} }
}); });
......
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