V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
Yingc
V2EX  ›  问与答

中秋节快到,有没有抽奖源码分享?

  •  
  •   Yingc · 2017-09-29 00:53:25 +08:00 · 2711 次点击
    这是一个创建于 2372 天前的主题,其中的信息可能已经有所发展或是发生改变。

    最近公司筹划抽奖活动,希望通过网页形式实现。 员工通过简单登记,并且去抽奖,带后台方便记录中奖者信息。 不要微信的,单纯 web。

    Nathanzheng
        1
    Nathanzheng  
       2017-09-29 03:12:07 +08:00
    员工发个号,随便找个随机摇号网站,bingo !
    Perry
        2
    Perry  
       2017-09-29 07:05:09 +08:00
    psirnull
        3
    psirnull  
       2017-09-29 09:44:38 +08:00 via iPhone
    公司想借机开除几个抢月饼的程序员
    justfindu
        4
    justfindu  
       2017-09-29 09:51:49 +08:00
    function random(){
    return 'Yingc';
    }
    lifesimple
        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]); // 输出中奖员工工号
    }
    }
    hgc81538
        6
    hgc81538  
       2017-09-29 11:04:37 +08:00
    5 分钟现场撸代码——谈总结会抽奖程序
    https://75team.com/post/luckey-draw-in-5-minutes.html
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2717 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 15:30 · PVG 23:30 · LAX 08:30 · JFK 11:30
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.