Commit ad2ba1a7 authored by fushaowu's avatar fushaowu

feat: # 修改人员名单

parent ec6a4440
......@@ -73,9 +73,12 @@
<div><button style="margin-left: 50px" onclick="submit()">打开抽奖页面</button></div>
<div><button style="margin-left: 50px" onclick="window.open('./list.html')">打开中奖人员名单</button></div>
<div><button style="margin-left: 50px" onclick="window.open('./data.html')">百万次人均中奖次数展示</button></div>
<div><button style="margin-left: 50px" onclick="submit(1)">一等奖</button></div>
<div><button style="margin-left: 50px" onclick="submit(2)">二等奖</button></div>
<div><button style="margin-left: 50px" onclick="submit(3)">三等奖</button></div>
<div><button style="margin-left: 50px" onclick="submit(1)">特等奖</button></div>
<div><button style="margin-left: 50px" onclick="submit(2)">一等奖</button></div>
<div><button style="margin-left: 50px" onclick="submit(3)">二等奖第一组</button></div>
<div><button style="margin-left: 50px" onclick="submit(4)">二等奖第二组</button></div>
<div><button style="margin-left: 50px" onclick="submit(5)">三等奖第一组</button></div>
<div><button style="margin-left: 50px" onclick="submit(6)">三等奖第二组</button></div>
</div>
</div>
</div>
......@@ -84,26 +87,41 @@
let num = document.getElementById('num').value;
let title = document.getElementById('title').value.trim();
let info = document.getElementById('info').value;
let winPerson = localStorage.getItem('yit') ? JSON.parse(localStorage.getItem('yit')) : {};
if(index === 1) title = '一等奖'
if(index === 2) title = '二等奖'
if(index === 3) title = '三等奖'
let winPerson = localStorage.getItem('yit') ? JSON.parse(localStorage.getItem('yit')) : {};
if (index === 1) title = '特等奖';
if (index === 2) title = '一等奖';
if (index === 3) title = '二等奖第一组';
if (index === 4) title = '二等奖第二组';
if (index === 5) title = '三等奖第一组';
if (index === 6) title = '三等奖第二组';
if (winPerson[title]) {
let status = window.confirm('该标题已存在,跳转至抽奖结果页面');
status && window.open('./list.html');
} else {
if(index === 1) {
window.open('./lottery.html?num=10&title=一等奖&info=macpro一部')
return
}
if(index === 2) {
window.open('./lottery.html?num=20&title=二等奖&info==mac air一部')
return
}
if(index === 3) {
window.open('./lottery.html?num=30&title=三等奖&info=iphone 12一部')
return
}
if (index === 1) {
window.open(`./lottery.html?num=10&title=${title}&info=娇兰御廷兰花`);
return;
}
if (index === 2) {
window.open(`./lottery.html?num=20&title=${title}&info=廊湾经典护颈型枕头`);
return;
}
if (index === 3) {
window.open(`./lottery.html?num=10&title=${title}&info=耳语花器组合`);
return;
}
if (index === 4) {
window.open(`./lottery.html?num=20&title=${title}&info=汪豪公道杯`);
return;
}
if (index === 5) {
window.open(`./lottery.html?num=20&title=${title}&info=SWELL保温杯`);
return;
}
if (index === 6) {
window.open(`./lottery.html?num=20&title=${title}&info=SWELL保温杯`);
return;
}
if (num && title) {
window.open(`./lottery.html?num=${num}&title=${title}&info=${info}`);
} else {
......
......@@ -39,11 +39,11 @@
let num = 10
for (; index < times; index++) {
getRandomPerson(num, allPersonInfoMap).forEach(val => {
let { name } = val
if (map.has(name)) {
map.set(name, map.get(name) + 1);
let key = val.name + val.department
if (map.has(key)) {
map.set(key, map.get(key) + 1);
} else {
map.set(name, 1)
map.set(key, 1)
}
})
}
......
This diff is collapsed.
......@@ -14,7 +14,7 @@
<div v-for="(item, index) in winPersonList" class="list-item">
<h3 class="title">{{index}}</h3>
<div class="jump-box" style="margin-left: 20px">
<div v-for="it in item" class="jump-item">{{it.name}} {{it.firstLevelDepartment}}</div>
<div v-for="it in item" class="jump-item">{{it.name}} {{it.department}}</div>
</div>
</div>
</div>
......
......@@ -22,7 +22,7 @@
<div v-if="step !== 1" class="step2">
<h3 class="jump-title">{{lotteryStatus ? `恭喜${awardTitle}获奖员工` : `${awardTitle}幸运员工 抽奖中...`}}</h3>
<div class="jump-box">
<div v-for="item in activePersonList" class="jump-item">{{item.name}} {{item.firstLevelDepartment}}</div>
<div v-for="item in activePersonList" class="jump-item">{{item.name}} {{item.department}}</div>
</div>
</div>
</div>
......
......@@ -61,7 +61,7 @@ let vue = new Vue({
}
for (const key in winPerson) {
winPerson[key].forEach(val => {
this.candidateMap.delete(val.name);
this.candidateMap.delete(val.name + val.department);
});
}
}
......@@ -140,7 +140,7 @@ function getRandomPerson(num, candidateMap) {
let currentWinPersonMap = new Map();
while (currentWinPersonMap.size < num) {
let random = Math.floor(Math.random() * candidateList.length);
currentWinPersonMap.set(candidateList[random]['name'], candidateList[random]);
currentWinPersonMap.set(candidateList[random]['name'] + candidateList[random]['department'], candidateList[random]);
candidateList.splice(random, 1); // 删除中奖人员名单
}
return [...currentWinPersonMap.values()];
......
......@@ -3,7 +3,7 @@ const path = require('path');
xlsxj(
{
input: path.join(process.cwd(), 'file', 'test.xls'),
input: path.join(process.cwd(), 'file', '1.xlsx'),
output: path.join(process.cwd(), 'src', 'info.json'),
},
function (err, result) {
......
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