Commit 356617a7 authored by zhijie.xue's avatar zhijie.xue

修复签到成功后进入抽奖,概率未变化的问题

parent b797594b
......@@ -236,7 +236,8 @@
id,
photoUrl: encodeURIComponent(photoUrl),
name,
chance: getProbability(this.userAccount, coinQuantity)
chance: getProbability(this.userAccount, coinQuantity),
coinQuantity
});
}
},
......
......@@ -234,6 +234,7 @@
import { debounce, compressShareImage } from '../common/utils';
import Notify from '../components/vant/notify/notify';
import Dialog from '../components/vant/dialog/dialog';
import {getProbability} from '../common/raffleProbability';
import { login, register, getMainInfo, addGold, getPrizeList, signIn, getActivityFeed, checkCornCode } from '../common/api.js';
let flag = false;
wepy.page({
......@@ -334,26 +335,23 @@
console.error(res.errCode);
});
const { coins } = await signIn();
wepy.wx.hideLoading();
if (coins === 0) return;
that.mainInfo.account.quantity = coins;
}, 700)();
} else {
wepy.wx.hideLoading();
}
} else {
wepy.wx.hideLoading();
}
},
fail (res) {
console.error('requestSubscribeMessage fail', res);
},
complete() {
wepy.wx.hideLoading();
}
});
},
getAwards: function() {
const { id, photoUrl, name, chance } = this.awardsInfo;
const { id, photoUrl, name, coinQuantity } = this.awardsInfo;
if ((!id && id !== 0) || !this.mainInfo || !this.mainInfo.account) {
Notify({ message: '服务器异常,请稍后重试', safeAreaInsetTop: true });
return;
......@@ -367,8 +365,10 @@
return;
}
const userCoins = this.mainInfo.account.quantity;
const chance = getProbability(userCoins, coinQuantity);
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=${userCoins}&name=${name}`
});
},
getAwardsInfo: function(v) {
......
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