Browse Source

加背景音乐

hxt 2 years ago
parent
commit
525d0e2fa5
7 changed files with 95 additions and 22 deletions
  1. 12 0
      css/index.css
  2. 13 0
      gameready.html
  3. BIN
      img/bg.mp3
  4. BIN
      img/mute.png
  5. 51 1
      index.html
  6. 4 5
      js/game.js
  7. 15 16
      question.json

+ 12 - 0
css/index.css

@@ -10,6 +10,8 @@ p,
 ul,
 li,
 div,
+dl,
+dt,dd,
 section {
 	padding: 0;
 	margin: 0;
@@ -325,6 +327,16 @@ body {
 #success {
 	display: none;
 }
+.mute { position: absolute; z-index: 999; top: 5vw; right: 5vw; width: 8vw; height: 8vw; background: url(../img/mute.png) no-repeat; background-size: 100% auto; opacity: 1;}
+.mute * { position: absolute; width: 100%; height: 100%; background: url(../img/mute.png) no-repeat; background-size: 100% auto;}
+.mute dt {-webkit-animation: muteANI 2s linear infinite;  background-position: 0 41%;}
+.mute dd { display: none; background-position: 0 83.5%; }
+.mute.on dt { display: none;}
+.mute.on dd { display: block;}
+@-webkit-keyframes muteANI{
+	0%{ -webkit-transform: rotate(0deg);}
+	100%{-webkit-transform: rotate(360deg);}
+}
 
 .question {
 	box-sizing: border-box;

+ 13 - 0
gameready.html

@@ -186,6 +186,18 @@
 				font-size: 12px;
 				margin-top: 20px;
 			}
+.btn {
+	display: block;
+	width: 43vw;
+	min-height:12vw;
+	margin: 10vw auto;
+}
+
+.btn img {
+	display: block;
+	width: 100%;
+	height: auto;
+}
 		</style>
 	</head>
 	<body>
@@ -198,6 +210,7 @@
 				<div></div>
 				<div></div>
 				<p class="wait-text">游戏已经开始,请等待下一轮</p>
+				<a href="https://www.100t.com/gjnh/2022.php"class="btn"><img src="img/btn.png"></a>
 			</div>
 		</section>
 	</body>

BIN
img/bg.mp3


BIN
img/mute.png


+ 51 - 1
index.html

@@ -49,8 +49,58 @@
 			</section>
 			<section class="time-box"></section>
 		</div>
+		<!--静音按钮-->
+		<dl class="mute">
+			<dt></dt>
+			<dd></dd>
+			<audio id="music" preload="auto" src="img/bg.mp3" loop="loop"></audio>
+		</dl>
 		<script src="js/jquery.js"></script>
 		<script src="js/jquery.transit.min.js"></script>
-		<script src="js/game.js"></script>
+		<script>
+		document.addEventListener('DOMContentLoaded', function() {
+			function audioAutoPlay(id) {
+				var audio = document.getElementById(id);
+				audio.play();
+				document.addEventListener("WeixinJSBridgeReady", function() {
+					audio.play();
+				}, false);
+				audio.onended = function() {
+					if (audio.id == 'music') {
+						audio.play();
+					} else {
+						audio.pause();
+						return
+					}
+				}
+			}
+		
+			function audioPause(id) {
+				var audio = document.getElementById(id);
+				audio.pause();
+				document.addEventListener("WeixinJSBridgeReady", function() {
+					audio.pause();
+				}, false);
+				document.addEventListener('YixinJSBridgeReady', function() {
+					audio.pause();
+				}, false);
+			}
+			audioAutoPlay('music');
+			
+			
+			gv={};
+			gv.isTouch = window.ontouchstart === undefined ? false : true;
+			gv.evtDown = gv.isTouch ? "touchstart" : "mousedown";
+			$(".mute").on(gv.evtDown, function() {
+				$(this).toggleClass('on')
+				if ($(this).hasClass('on')) {
+					audioPause('music');
+				} else {
+					audioAutoPlay('music');
+				}
+			})
+		})
+		</script>
+		<script src="js/game.js?V=2022"></script>
 	</body>
 </html>

+ 4 - 5
js/game.js

@@ -22,7 +22,7 @@ var $go = $("#go"),
 	$ren = $("#ren");
 var quesData, quesLen = 0,
 	quesFlag = 0,
-	quesHtml, quesTimer, quesInter, quesCount = quesEnd = 15,
+	quesHtml, quesTimer, quesInter, quesCount = quesEnd = 100000,
 	isQuesEnd = false;
 
 function getQueryString(name) {
@@ -44,7 +44,6 @@ if (round_id == 2) {
 $.getJSON(questionUrl, function(res) {
 	quesData = res.ques;
 	quesLen = quesData.length;
-	console.log(quesData);
 	$("#allQues").html(quesLen);
 });
 var ansArr = ["A", -1, "B"]
@@ -69,7 +68,7 @@ function preload(imgs, callback) {
 }
 
 if (!uid || !uname) {
-	window.location.href = "http://www.100t.com/gjnh/2022.php";
+	// window.location.href = "http://www.100t.com/gjnh/2022.php";
 } else {
 	$.post(registUrl, JSON.stringify({
 		uid,
@@ -79,7 +78,7 @@ if (!uid || !uname) {
 	preload(["bg.png", "figure.png", "img1.png", "img2.png", "img3.png", "line.png",
 		"qus-top.png",
 		"text-bg.png",
-		"time-box.png", "trap1.png", "trap2.png", "trap3.png", "trap4.png"
+		"time-box.png", "trap1.png", "trap2.png", "trap3.png", "trap4.png","mute.png"
 	], function() {})
 	waiting(function() {
 		$load.fadeOut(function() {
@@ -243,7 +242,7 @@ function getRandAns() {
 			}
 			var rand = Math.floor(Math.random() * tempPeople.length);
 			var id = tempPeople.splice(rand, 1)[0];
-			delay = Math.floor(Math.random() * 12000) + "ms";
+			delay = Math.floor(Math.random() * 8000) + "ms";
 			if (id) {
 				getIn(id, i, j, delay);
 			} else {

+ 15 - 16
question.json

@@ -1,19 +1,18 @@
 {
 	"ques":[
-			{"text":"本届冬奥会中国代表团共获得9枚金牌<br>A.正确<br>B.错误","right":"A"},
-	{"text":"本届冬奥会中国代表团获奖牌榜季军<br>A.正确<br>B.错误","right":"A"},
-	{"text":"青霉素属于一种抗生素。<br>A.正确<br>B.错误","right":"A"},
-	{"text":"卡拉ok是日本人发明的。<br>A.正确<br>B.错误","right":"A"},
-	{"text":"人不惑之年是指50岁。<br>A.正确<br>B.错误","right":"B"},
-	{"text":"五粮液数浓香型白酒。<br>A.正确<br>B.错误","right":"A"},
-	{"text":"2012年伦敦奥运会中国是金牌榜第一名。<br>A.正确<br>B.错误","right":"B"},
-	{"text":"按照《中国人民银行法》规定,中央银行可以对企业直接发放贷款。<br>A.正确<br>B.错误","right":"B"},
-	{"text":"金融机构是指特意从事货币、信用活动的中介组织。<br>A.正确<br>B.错误","right":"A"},
-	{"text":"政策性银行经营时以盈利为目的。<br>A.正确<br>B.错误","right":"B"},
-	{"text":"上市公司董事会成员中应当有1/3以上的独立董事。<br>A.正确<br>B.错误","right":"A"},
-	{"text":"欧洲债券是国际债券的一种<br>A.正确<br>B.错误","right":"A"},
-	{"text":"将廉洁从业、合规执业、诚信执业和()等情况纳入绩效考核与人员管理体系,加强正向引导激励和反向惩戒约束作用<br>A.培训宣导<br>B.践行企业文化","right":"B"},
-	{"text":"以下哪个平台是公司打造的专业风险管理平台<br>A.风险*说<br>B.金规指","right":"A"},
-	{"text":"下列业务中,哪项业务风险是以信用风险为主?<br>A.财富管理业务<br>B.融资类业务","right":"B"}
-	]
+		{"text":"本届冬奥会谷爱凌是否为中国获得金牌<br>A.正确<br>B.错误","right":"A"},
+		{"text":"五粮液属于浓香型白酒。<br>A.正确<br>B.错误","right":"A"},
+		{"text":"2022中国女足获得了亚洲杯冠军。<br>A.正确<br>B.错误","right":"A"},
+		{"text":"青霉素属于一种抗生素。<br>A.正确<br>B.错误","right":"A"},
+		{"text":"二维码是日本人发明的。<br>A.正确<br>B.错误","right":"A"},
+		{"text":"人不惑之年是指50岁。<br>A.正确<br>B.错误","right":"B"},
+		{"text":"按照《中国人民银行法》规定,中央银行可以对企业直接发放贷款。<br>A.正确<br>B.错误","right":"B"},
+		{"text":"金融机构是指专门从事货币、信用活动的中介组织。<br>A.正确<br>B.错误","right":"A"},
+		{"text":"政策性银行经营时以盈利为目的。<br>A.正确<br>B.错误","right":"B"},
+		{"text":"上市公司董事会成员中应当有1/3以上的独立董事。<br>A.正确<br>B.错误","right":"A"},
+		{"text":"证券公司开展柜台交易业务中,需要向投资者收取履约保证金的,保证金应存入在证券公司指定的金融机构开立的专门账户。<br>A.正确<br>B.错误","right":"B"},
+		{"text":"国金投行的全称是国金证券股份有限公司上海承销保荐分公司。<br>A.正确<br>B.错误","right":"B"},
+		{"text":"证券行业文化建设将廉洁从业、合规执业、诚信执业和( )等情况纳入绩效考核与人员管理体系,加强正向引导激励和反向惩戒约束作用。<br>A.培训宣导<br>B.践行企业文化","right":"B"},
+		{"text":"以下哪个平台是公司打造的专业风险管理平台<br>A.风险*说<br>B.金规指","right":"A"},
+		{"text":"下列业务中,哪项业务风险是以信用风险为主?<br>A.财富管理业务<br>B.融资类业务","right":"B"}]
 }