html5实现最震撼公司年会抽奖(源码)
文章目录
作者:xcLeigh
文章地址:https://blog.csdn.net/weixin_43151418/article/details/128640998
html5实现最震撼公司年会抽奖(源码)
html5实现最震撼公司年会抽奖(源码),可以直接配置员工信息然后使用的,实现动态配置员工信息,实现员工只能中一次奖,实现奖品可灵活配置,实现样式灵活调整,实现抽奖酷炫音效,并且有多种震撼音效可选,可以直接运行index.html使用。
1.设计来源
1.1 主界面
抽奖主界面,上侧是公司活动名称,中边是员工信息(抽奖名单),下边是奖项信息。
员工信息:上来展示的16个随机抽取的员工,目前总共60个人员信息。
奖品信息:目前设置的三个奖项,特等奖1人,一等奖3人,二等奖十人,这个可以根据自己的需求配置。
1.2 抽奖效果
抽奖效果是动态的文字切换和背景抽奖音效,图片体现不出来效果,具体效果见下面的视频演示。
1.3 中奖效果
上边是中奖员工,下边是中奖奖品,奖品那个地方色调可以自己调。
2.效果和源码配置
2.1 动态效果
html实现酷炫的公司年会抽奖
2.2 员工信息配置
目前配置了六十个人员信息,可根据自己的需求来,也可以把这块代码改为后台数据请求。如果不需要后台的,直接配置使用即可。
staff_name:人员名称
staff_no:人员编号
var userInfo="[";
userInfo+='{"staff_name":"刘亦菲","staff_no":"0000001"},';
userInfo+='{"staff_name":"陈赫","staff_no":"0000002"},';
userInfo+='{"staff_name":"陈坤","staff_no":"0000003"},';
userInfo+='{"staff_name":"邓超","staff_no":"0000004"},';
userInfo+='{"staff_name":"胡歌","staff_no":"0000005"},';
userInfo+='{"staff_name":"胡军","staff_no":"0000006"},';
userInfo+='{"staff_name":"何炅","staff_no":"0000007"},';
userInfo+='{"staff_name":"黄渤","staff_no":"0000008"},';
userInfo+='{"staff_name":"黄磊","staff_no":"0000009"},';
userInfo+='{"staff_name":"黄晓明","staff_no":"0000010"},';
userInfo+='{"staff_name":"李晨","staff_no":"0000011"},';
userInfo+='{"staff_name":"李易峰","staff_no":"0000012"},';
userInfo+='{"staff_name":"刘昊然","staff_no":"0000013"},';
userInfo+='{"staff_name":"井柏然","staff_no":"0000014"},';
userInfo+='{"staff_name":"杨洋","staff_no":"0000015"},';
userInfo+='{"staff_name":"彭昱畅","staff_no":"0000016"},';
userInfo+='{"staff_name":"陈好","staff_no":"0000017"},';
userInfo+='{"staff_name":"高圆圆","staff_no":"0000018"},';
userInfo+='{"staff_name":"刘涛","staff_no":"0000019"},';
userInfo+='{"staff_name":"孙俪","staff_no":"0000020"},';
userInfo+='{"staff_name":"杨幂","staff_no":"0000021"},';
userInfo+='{"staff_name":"佟丽娅","staff_no":"0000022"},';
userInfo+='{"staff_name":"唐嫣","staff_no":"0000023"},';
userInfo+='{"staff_name":"汤唯","staff_no":"0000024"},';
userInfo+='{"staff_name":"霍思燕","staff_no":"0000025"},';
userInfo+='{"staff_name":"蒋勤勤","staff_no":"0000026"},';
userInfo+='{"staff_name":"杨紫","staff_no":"0000027"},';
userInfo+='{"staff_name":"张子枫","staff_no":"0000028"},';
userInfo+='{"staff_name":"关晓彤","staff_no":"0000029"},';
userInfo+='{"staff_name":"周冬雨","staff_no":"0000030"}';
userInfo+='{"staff_name":"刘嘉玲","staff_no":"0000031"},';
userInfo+='{"staff_name":"高圆圆","staff_no":"0000032"},';
userInfo+='{"staff_name":"陈紫涵","staff_no":"0000033"},';
userInfo+='{"staff_name":"梅艳芳","staff_no":"0000034"},';
userInfo+='{"staff_name":"蔡依林","staff_no":"0000035"},';
userInfo+='{"staff_name":"陈晓旭","staff_no":"0000036"},';
userInfo+='{"staff_name":"陈美琪","staff_no":"0000037"},';
userInfo+='{"staff_name":"程瑷瑗","staff_no":"0000038"},';
userInfo+='{"staff_name":"杜若溪","staff_no":"0000039"},';
userInfo+='{"staff_name":"范冰冰","staff_no":"0000040"},';
userInfo+='{"staff_name":"范文芳","staff_no":"0000041"},';
userInfo+='{"staff_name":"付梦妮","staff_no":"0000042"},';
userInfo+='{"staff_name":"刘雨欣","staff_no":"0000043"},';
userInfo+='{"staff_name":"何琢言","staff_no":"0000044"},';
userInfo+='{"staff_name":"陈乔恩","staff_no":"0000045"},';
userInfo+='{"staff_name":"蔡少芬","staff_no":"0000046"},';
userInfo+='{"staff_name":"陈钰琪","staff_no":"0000047"},';
userInfo+='{"staff_name":"邓家佳","staff_no":"0000048"},';
userInfo+='{"staff_name":"何泓珊","staff_no":"0000049"},';
userInfo+='{"staff_name":"黄圣依","staff_no":"0000050"},';
userInfo+='{"staff_name":"盖丽丽","staff_no":"0000051"},';
userInfo+='{"staff_name":"李亚男","staff_no":"0000052"},';
userInfo+='{"staff_name":"梁静茹","staff_no":"0000053"},';
userInfo+='{"staff_name":"李小璐","staff_no":"0000054"},';
userInfo+='{"staff_name":"郭雪芙","staff_no":"0000055"},';
userInfo+='{"staff_name":"李冰冰","staff_no":"0000056"},';
userInfo+='{"staff_name":"郭珍霓","staff_no":"0000057"},';
userInfo+='{"staff_name":"罗震环","staff_no":"0000058"},';
userInfo+='{"staff_name":"江疏影","staff_no":"0000059"},';
userInfo+='{"staff_name":"蒋依依","staff_no":"0000060"}';
userInfo+="]";
2.3 奖品信息配置
奖品信息可以灵活配置,showPrize传类型(人数)即可
<div id="prizeDiv" class="rightDivson">
<div class="btnDiv" onclick="showPrize(4);">特等奖(1人)<br/>华为Mate60 Pro</div>
<div class="btnDiv" onclick="showPrize(1);">一等奖(3人)<br/>颈椎按摩仪</div>
<div class="btnDiv" onclick="showPrize(3);">二等奖(10人)<br/>小米高清投影仪</div>
<div style="clear: both;"></div>
</div>
2.4 抽奖音效配置
可以自定义选中抽奖音效,在这块代码配置就行。
<audio src="./resource/price1.mp3" autoplay loop></audio>
内置四种酷炫抽奖音效:
2.5 源代码
这里是主界面的代码,其他图片、js、css等代码,见下面的 源码下载 ,里面有所有代码资源和相关说明。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<title>公司年会抽奖活动</title>
<link href="css/prize.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>
</head>
<body οncοntextmenu="return false" οndragstart="return false" onselectstart="return false" οnselect="document.selection.empty()" οncοpy="document.selection.empty()" onbeforecopy="return false" οnmοuseup="document.selection.empty()">
<div class="bg2">
<span onclick="clearPri()">2023年公司年会抽奖活动</span>
</div>
<input id="priceinput" type="text" value="4" disabled style="display: none;" >
<div class="pageDiv">
<div class="leftDiv">
<!-- 中奖人员 -->
<div id="prizeInfo" class="leftDivson" style="display: none;">
<table style="width:100%; height: 100%; position: absolute; margin:auto;padding:auto;border: 0px;">
<tr>
<td style="height: 40px;"><div style="font-weight: bold;font-size: 36px;padding: 20px;">恭 喜 以 下 员 工 中 奖</div></td>
</tr>
<tr>
<td style="vertical-align: top;">
<ul id="myul">
</ul>
<div style="width: 100%;text-align: center; font-size: 36px; letter-spacing:10px; line-height: 50px;">
<span id="zjName"></span>
</div>
</td>
</tr>
</table>
</div>
<!-- 抽奖人员 -->
<div id="staffInfo" class="leftDivson">
<table style="width:100%; height: 100%; position: absolute; margin:auto;padding:auto;border: 0px;">
<tr style="height: 10%;">
<td colspan="9"><div style="font-weight: bold;font-size: 36px; padding: 15px;">抽 奖 名 单</div></td>
</tr>
</table>
</div>
</div>
<div class="rightDiv">
<!-- 奖项明细 -->
<div id="prizeDetailDiv" class="rightDivson" style="background-image: url('img/guang.png');background-repeat: no-repeat;background-size: cover;display: none;">
<div id="prizeDetailDivImg" class="rightDivsonimg">
<div id="btnPrize" class="yxDiv" onclick="goPrize();">
<span id="cjfont" style="padding-top: 30px; display: block;font-weight: bold;font-size: 20px;">开 始</span>
</div>
<div class="yxDiv1" onclick="goBack();">
返 回
</div>
<div id="detaildiv" class="yxDiv1" style="display: none;" onclick="godetail();">
详 细
</div>
</div>
</div>
<!-- 各种奖项 -->
<div id="prizeDiv" class="rightDivson">
<div class="btnDiv" onclick="showPrize(4);">特等奖(1人)<br/>现金1000元</div>
<div class="btnDiv" onclick="showPrize(1);">一等奖(2人)<br/>现金500元</div>
<div class="btnDiv" onclick="showPrize(3);">二等奖(10人)<br/>现金200元</div>
<div style="clear: both;"></div>
</div>
</div>
</div>
<audio src="./resource/price1.mp3" autoplay loop></audio>
<script type="text/javascript" src="./js/index.js"></script>
</body>
</html>
源码下载
💞 关注博主 带你实现畅游前后端
🏰 加入社区 带你体验马航不孤单
💯 神秘个人简介 带你体验不一样得介绍
🎀 酷炫邀请函 带你体验高大上得邀请
① 🉑提供云服务部署(有自己的阿里云);
② 🉑提供前端、后端、应用程序、H5、小程序、公众号等相关业务;
如🈶合作请联系我,期待您的联系。
注:本文撰写于CSDN平台,作者:xcLeigh(所有权归作者所有),https://blog.csdn.net/weixin_43151418,如果相关下载没有跳转,请查看这个地址,相关链接没有跳转,皆是抄袭本文,转载请备注本文原地址。
亲,码字不易,动动小手,欢迎 点赞 ➕ 收藏,如 🈶 问题请留言(评论),博主看见后一定及时给您答复,💌💌💌
原文地址:https://blog.csdn.net/weixin_43151418/article/details/135160131(防止抄袭,原文地址不可删除)