Commit ad2ba1a7 authored by fushaowu's avatar fushaowu

feat: # 修改人员名单

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