
最近公司筹划抽奖活动,希望通过网页形式实现。 员工通过简单登记,并且去抽奖,带后台方便记录中奖者信息。 不要微信的,单纯 web。
1 Nathanzheng 2017-09-29 03:12:07 +08:00 员工发个号,随便找个随机摇号网站,bingo ! |
2 Perry 2017-09-29 07:05:09 +08:00 |
3 psirnull 2017-09-29 09:44:38 +08:00 via iPhone 公司想借机开除几个抢月饼的程序员 |
4 justfindu 2017-09-29 09:51:49 +08:00 function random(){ return 'Yingc'; } |
5 lifesimple 2017-09-29 10:13:03 +08:00 let ids = []; // 输入员工工号 for(let i = 0;i < 100;i++) { ids.push(`id-${i}`) } let maxIndex = ids.length; // 总数 let awardCount = 10; // 中奖数 let awardNos = []; // 获奖序号 while(awardNos.length < awardCount) { let index = Math.floor(Math.random()*maxIndex); if(awardNos.indexOf(index) == -1) { awardNos.push(index); console.log(ids[index]); // 输出中奖员工工号 } } |
6 hgc81538 2017-09-29 11:04:37 +08:00 5 分钟现场撸代码谈总结会抽奖程序 https://75team.com/post/luckey-draw-in-5-minutes.html |