Commit dab8aa92 authored by zhaofei's avatar zhaofei

s

parent fd85770f
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
<view class="probability-prize-content-form"> <view class="probability-prize-content-form">
<form inline="true"> <form inline="true">
<form-item <form-item
a:if="{{type !== 'rank'}}"
style="width:100%" style="width:100%"
size="large" size="large"
class="probability-prize-content-formItem" class="probability-prize-content-formItem"
...@@ -165,7 +166,7 @@ ...@@ -165,7 +166,7 @@
</form-item> </form-item>
<form-item <form-item
a:if="{{type==='probability'}}" a:if="{{type==='probability' && !prizeInitData.isBackUp}}"
style="width:100%" style="width:100%"
size="large" size="large"
class="probability-prize-content-formItem" class="probability-prize-content-formItem"
......
...@@ -380,7 +380,7 @@ Component({ ...@@ -380,7 +380,7 @@ Component({
const { imageTips } = this.data; const { imageTips } = this.data;
const { type: dialogType, maxRankLimit } = this.props; const { type: dialogType, maxRankLimit } = this.props;
if (dialogType == "probability") { if (dialogType == "probability" && isBackUp) {
let probabilityRexp = /^\d+(\.\d{1,2})?$/; let probabilityRexp = /^\d+(\.\d{1,2})?$/;
if ( if (
!probabilityRexp.test(probability) || !probabilityRexp.test(probability) ||
......
...@@ -34,7 +34,7 @@ export const validateRangeNumber = (number, [min, max] = [], fixed = 0) => { ...@@ -34,7 +34,7 @@ export const validateRangeNumber = (number, [min, max] = [], fixed = 0) => {
console.error('数字范围的最小值不能大于最大值'); console.error('数字范围的最小值不能大于最大值');
return; return;
} }
if(number != 0){ if (number != 0) {
if (!pattern.test(number) || number === '') return false; if (!pattern.test(number) || number === '') return false;
} }
...@@ -49,13 +49,17 @@ export const rateTableValidator = (rule, value, callback, source, options) => { ...@@ -49,13 +49,17 @@ export const rateTableValidator = (rule, value, callback, source, options) => {
if (!value.length || !value) { if (!value.length || !value) {
return new Error('请至少配置一个奖品'); return new Error('请至少配置一个奖品');
} }
if(value.length){ if (value.length) {
value.forEach(item=>{ value.forEach(item => {
n += Number(item.probability) n += Number(item.probability)
}) })
} }
if(n>100){ const backUp = value.filter(item => item.backUp);
return new Error('总概率不能大于100%'); if (backUp.length > 1) {
return new Error('降级奖品最多配置一个');
}
if (n > 100) {
return new Error('总概率不能大于100%');
} }
return callback() return callback()
}; };
......
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