Commit dbfc7724 authored by ziyu's avatar ziyu

Merge branch 'master' of git.quantgroup.cn:ui/mini-program-wepy into feature/corn

parents 109aa81b 5912a589
...@@ -9,7 +9,7 @@ function getCommonDivisor(firstNum, secondNum) { ...@@ -9,7 +9,7 @@ function getCommonDivisor(firstNum, secondNum) {
function getProbability (quantity, coinQuantity) { function getProbability (quantity, coinQuantity) {
// 如果用户克币数是0 // 如果用户克币数是0
if (quantity === 0) { if (quantity === 0) {
return '0/' + coinQuantity; return '0';
} }
var divisor = getCommonDivisor(quantity, coinQuantity); var divisor = getCommonDivisor(quantity, coinQuantity);
var value = quantity / divisor; var value = quantity / divisor;
......
...@@ -161,7 +161,9 @@ ...@@ -161,7 +161,9 @@
let detail = await getAwardsDetail({ prizeId: id }); let detail = await getAwardsDetail({ prizeId: id });
detail = detail || {}; detail = detail || {};
if (detail.join > detail.quantity) detail.join = detail.quantity; if (detail.join > detail.quantity) detail.join = detail.quantity;
const progress = Math.round((detail.join / detail.quantity) * 100) + '%'; const progressFloat = detail.join / detail.quantity;
let progress = Math.round(progressFloat * 100) + '%';
if (progressFloat > 0 && progressFloat < 1) progress = '1%';
this.curQueue.forEach(v => { this.curQueue.forEach(v => {
if (v.id === id) { if (v.id === id) {
...@@ -207,10 +209,10 @@ ...@@ -207,10 +209,10 @@
} }
}, },
updateAwardsInfo(current) { updateAwardsInfo(current) {
const { id, photoUrl, videoSnapUrl, showType, name, probability } = this.curQueue[current]; const { id, photoUrl, name, probability } = this.curQueue[current];
this.$emit('getAwardsInfo', { this.$emit('getAwardsInfo', {
id, id,
photoUrl: showType.value === 1 ? encodeURIComponent(photoUrl) : encodeURIComponent(videoSnapUrl), photoUrl: encodeURIComponent(photoUrl),
name, name,
chance: probability chance: probability
}); });
......
...@@ -263,11 +263,7 @@ ...@@ -263,11 +263,7 @@
} }
} }
wx.requestSubscribeMessage({ wx.requestSubscribeMessage({
tmplIds: [ tmplIds,
'xbA7XopO2j0V0Ne0F61UzSxoyfKrf92GQk6Z4pQvnd4',
'_yZWJYT-3lGCQG6g7Wa7F-0zxvGaPe4zwAI9D4zW4EY',
'7YzXgiVNGXiRvXNmR6WUtH_WplUyo97eAy45dsyviKQ'
],
success (res) { success (res) {
console.log('requestSubscribeMessage success', res); console.log('requestSubscribeMessage success', res);
if (res.errMsg === 'requestSubscribeMessage:ok') { if (res.errMsg === 'requestSubscribeMessage:ok') {
......
...@@ -257,7 +257,7 @@ ...@@ -257,7 +257,7 @@
store, store,
data: { data: {
progress: '0%', progress: '0%',
progressStyle: '', progressStyle: 'width:0%',
isCheck: true, isCheck: true,
batchId: null, batchId: null,
quantity: '', quantity: '',
...@@ -270,8 +270,8 @@ ...@@ -270,8 +270,8 @@
innerActivity: '', innerActivity: '',
isError: false, isError: false,
code: '', code: '',
errorText:'', errorText: '',
errorBtn:'确定', errorBtn: '确定'
}, },
methods: { methods: {
check() { check() {
...@@ -294,7 +294,7 @@ ...@@ -294,7 +294,7 @@
if (detail.encryptedData) { if (detail.encryptedData) {
this.btnfont = '参与中...'; this.btnfont = '参与中...';
wx.checkSession({ wx.checkSession({
success (){ success () {
goprize(); goprize();
}, },
async fail () { async fail () {
...@@ -323,8 +323,8 @@ ...@@ -323,8 +323,8 @@
this.btnfont = '立即参与'; this.btnfont = '立即参与';
let code = data.joinCode; let code = data.joinCode;
if (code === undefined) code = 3; if (code === undefined) code = 3;
//参与抽奖成功 // 参与抽奖成功
if(+code === 0) { if (+code === 0) {
wx.setStorageSync('userJoin', 1); wx.setStorageSync('userJoin', 1);
} }
Dialog.alert({ Dialog.alert({
...@@ -357,7 +357,10 @@ ...@@ -357,7 +357,10 @@
this.batchId = detail.id; this.batchId = detail.id;
if (detail.quantity) { if (detail.quantity) {
if (detail.join > detail.quantity) detail.join = detail.quantity; if (detail.join > detail.quantity) detail.join = detail.quantity;
this.progress = Math.round((detail.join / detail.quantity) * 100) + '%'; const progressFloat = detail.join / detail.quantity;
this.progress = Math.round(progressFloat * 100) + '%';
// 当进度介于0 - 1之间时显示1
if (progressFloat > 0 && progressFloat < 1) this.progress = '1%';
this.progressStyle = 'width:' + this.progress; this.progressStyle = 'width:' + this.progress;
} }
}, },
...@@ -373,12 +376,12 @@ ...@@ -373,12 +376,12 @@
this.code = ''; this.code = '';
}, },
checkCode () { checkCode () {
if(this.code === '') { if (this.code === '') {
this.errorText = '请输入邀请码'; this.errorText = '请输入邀请码';
this.isError = true; this.isError = true;
return; return;
} }
if(this.errorBtn !== '确定') { if (this.errorBtn !== '确定') {
return; return;
} }
this.errorBtn = '验证中...'; this.errorBtn = '验证中...';
...@@ -388,12 +391,12 @@ ...@@ -388,12 +391,12 @@
this.closeModal(); this.closeModal();
this.confirmRaff(); this.confirmRaff();
} else { } else {
let index = data.checkCode+2; let index = data.checkCode + 2;
let mesg = ['邀请码错误,请重新输入','该邀请码已被使用,请重新输入'] let mesg = ['邀请码错误,请重新输入', '该邀请码已被使用,请重新输入'];
this.errorText = mesg[index]; this.errorText = mesg[index];
this.isError = true; this.isError = true;
} }
}).catch(()=>{ }).catch(() => {
this.errorBtn = '确定'; this.errorBtn = '确定';
}); });
} }
...@@ -408,8 +411,8 @@ ...@@ -408,8 +411,8 @@
} }
}, },
watch: { watch: {
code(val,oldval) { code(val, oldval) {
if (val!==oldval && this.isError) { if (val !== oldval && this.isError) {
this.isError = false; this.isError = false;
} }
} }
......
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