59660f44 by zhangyongfeng

删除默认配置

1 parent cd7de73b
......@@ -2,7 +2,7 @@
<el-dialog
:visible="visible"
:append-to-body="true"
width="400px"
width="390px"
@close="$emit('update:visible', false)"
class="c-LotteryConfig"
>
......@@ -19,7 +19,7 @@
>
</div>
<div class="container">
<el-form ref="form" :model="form" label-width="90px" size="mini">
<el-form ref="form" :model="form" size="mini">
<el-form-item label="抽奖标题">
<el-input v-model="form.name"></el-input>
</el-form-item>
......@@ -31,14 +31,6 @@
:step="1"
></el-input>
</el-form-item>
<el-form-item label="特等奖">
<el-input
type="number"
v-model="form.specialAward"
:min="0"
:step="1"
></el-input>
</el-form-item>
<el-form-item label="一等奖">
<el-input
type="number"
......@@ -47,39 +39,6 @@
:step="1"
></el-input>
</el-form-item>
<el-form-item label="二等奖">
<el-input
type="number"
v-model="form.secondPrize"
:min="0"
:step="1"
></el-input>
</el-form-item>
<el-form-item label="三等奖">
<el-input
type="number"
v-model="form.thirdPrize"
:min="0"
:step="1"
></el-input>
</el-form-item>
<el-form-item label="四等奖">
<el-input
type="number"
v-model="form.fourthPrize"
:min="0"
:step="1"
></el-input>
</el-form-item>
<el-form-item label="五等奖">
<el-input
type="number"
v-model="form.fifthPrize"
:min="0"
:step="1"
></el-input>
</el-form-item>
<el-form-item
:label="newitem.name"
v-for="newitem in storeNewLottery"
......
......@@ -15,6 +15,10 @@
}
*/
export function generateArray(start, end) {
return Array.from(new Array(end + 1).keys()).slice(start);
}
/**
* 取范围内随机整数
* @param {number} minNum
......@@ -30,13 +34,8 @@ export function randomNum(minNum = 1, maxNum) {
* @param {number} num 本次抽取人数
*/
export function luckydrawHandler(total, won = [], num) {
const peolist = [];
for (let i = 1; i <= total; i++) {
peolist.push(i);
}
const peolist = generateArray(1, Number(total));
const wons = won;
const res = [];
for (let j = 0; j < num; j++) {
const nodraws = peolist.filter(item => !wons.includes(item));
......
......@@ -40,25 +40,9 @@ export const listField = 'list'; // 名单
export function conversionCategoryName(key) {
let name = '';
switch (key) {
case 'specialAward':
name = '特等奖';
break;
case 'firstPrize':
name = '一等奖';
break;
case 'secondPrize':
name = '二等奖';
break;
case 'thirdPrize':
name = '三等奖';
break;
case 'fourthPrize':
name = '四等奖';
break;
case 'fifthPrize':
name = '五等奖';
break;
default:
break;
}
......
......@@ -14,20 +14,10 @@ export default new Vuex.Store({
config: {
name: '年会抽奖',
number: 70,
specialAward: 0,
firstPrize: 1,
secondPrize: 5,
thirdPrize: 8,
fourthPrize: 10,
fifthPrize: 20
firstPrize: 1
},
result: {
specialAward: [],
firstPrize: [],
secondPrize: [],
thirdPrize: [],
fourthPrize: [],
fifthPrize: []
firstPrize: []
},
newLottery: [],
list: [],
......@@ -38,12 +28,7 @@ export default new Vuex.Store({
state.config = {
name: '年会抽奖',
number: 70,
specialAward: 0,
firstPrize: 1,
secondPrize: 5,
thirdPrize: 8,
fourthPrize: 10,
fifthPrize: 20
firstPrize: 1
};
state.newLottery = [];
},
......@@ -55,32 +40,17 @@ export default new Vuex.Store({
},
setClearResult(state) {
state.result = {
specialAward: [],
firstPrize: [],
secondPrize: [],
thirdPrize: [],
fourthPrize: [],
fifthPrize: []
firstPrize: []
};
},
setClearStore(state) {
state.config = {
name: '年会抽奖',
number: 70,
specialAward: 0,
firstPrize: 1,
secondPrize: 5,
thirdPrize: 8,
fourthPrize: 10,
fifthPrize: 20
firstPrize: 1
};
state.result = {
specialAward: [],
firstPrize: [],
secondPrize: [],
thirdPrize: [],
fourthPrize: [],
fifthPrize: []
firstPrize: []
};
state.newLottery = [];
state.list = [];
......