Commit 595af488 authored by 郝聪敏's avatar 郝聪敏

Merge branch 'feature/animation' into 'master'

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

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