fix: 兼容原有不含配置单次抽奖人数的数据

This commit is contained in:
ex_zhangwenlei@exiot.cmcc
2024-01-24 23:01:59 +08:00
parent 00655fa3fd
commit f1a56a80c9
3 changed files with 6 additions and 6 deletions

View File

@@ -174,7 +174,7 @@ onMounted(() => {
<input type="file" class="" id="explore" style="display: none" @change="handleFileChange" <input type="file" class="" id="explore" style="display: none" @change="handleFileChange"
:accept="limitType" /> :accept="limitType" />
<span class="btn btn-primary btn-sm">上传文件</span> <span class="btn btn-primary btn-sm">导入人员数据</span>
</div> </div>
</label> </label>
<!-- <button class="btn btn-primary btn-sm">上传excel</button> --> <!-- <button class="btn btn-primary btn-sm">上传excel</button> -->

View File

@@ -67,7 +67,7 @@ const selectPrize = (item: IPrizeConfig) => {
const changePrizeStatus=(item:IPrizeConfig)=>{ const changePrizeStatus=(item:IPrizeConfig)=>{
if(item.isUsed==true){ if(item.isUsed==true){
item.isUsedCount=0; item.isUsedCount=0;
if(item.separateCount.countList.length){ if(item.separateCount&&item.separateCount.countList.length){
item.separateCount.countList.forEach((countItem:any)=>{ item.separateCount.countList.forEach((countItem:any)=>{
countItem.isUsedCount=0; countItem.isUsedCount=0;
}) })
@@ -75,7 +75,7 @@ const changePrizeStatus=(item:IPrizeConfig)=>{
} }
else{ else{
item.isUsedCount=item.count; item.isUsedCount=item.count;
if(item.separateCount.countList.length){ if(item.separateCount&&item.separateCount.countList.length){
item.separateCount.countList.forEach((countItem:any)=>{ item.separateCount.countList.forEach((countItem:any)=>{
countItem.isUsedCount=countItem.count; countItem.isUsedCount=countItem.count;
}) })
@@ -206,7 +206,7 @@ watch(() => prizeList.value, (val: IPrizeConfig[]) => {
</option> </option>
</select> </select>
</label> </label>
<label class="w-full max-w-xs mb-10 form-control"> <label class="w-full max-w-xs mb-10 form-control" v-if="item.separateCount">
<div class="label"> <div class="label">
<span class="label-text">单次抽取个数</span> <span class="label-text">单次抽取个数</span>
</div> </div>

View File

@@ -408,7 +408,7 @@ const stopLottery = async () => {
let leftover = currentPrize.value.count - currentPrize.value.isUsedCount let leftover = currentPrize.value.count - currentPrize.value.isUsedCount
const customCount=currentPrize.value.separateCount const customCount=currentPrize.value.separateCount
if(customCount.enable&&customCount.countList.length>0){ if(customCount&&customCount.enable&&customCount.countList.length>0){
for(let i=0;i<customCount.countList.length;i++){ for(let i=0;i<customCount.countList.length;i++){
if(customCount.countList[i].isUsedCount<customCount.countList[i].count){ if(customCount.countList[i].isUsedCount<customCount.countList[i].count){
leftover=customCount.countList[i].count-customCount.countList[i].isUsedCount leftover=customCount.countList[i].count-customCount.countList[i].isUsedCount
@@ -466,7 +466,7 @@ const continueLottery = async () => {
} }
const customCount=currentPrize.value.separateCount const customCount=currentPrize.value.separateCount
if(customCount.enable&&customCount.countList.length>0){ if(customCount&&customCount.enable&&customCount.countList.length>0){
for(let i=0;i<customCount.countList.length;i++){ for(let i=0;i<customCount.countList.length;i++){
if(customCount.countList[i].isUsedCount<customCount.countList[i].count){ if(customCount.countList[i].isUsedCount<customCount.countList[i].count){
customCount.countList[i].isUsedCount+= luckyCount.value customCount.countList[i].isUsedCount+= luckyCount.value