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