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

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

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