You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

655 lines
22 KiB

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <title>建党百年</title>
  6. <meta name="keywords" content="keyword1,keyword2,keyword3">
  7. <meta name="description" content="this is my page">
  8. <meta name="content-type" content="text/html; charset=UTF-8">
  9. <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0">
  10. <script src="js/jquery-1.8.3.min.js" type="text/javascript" charset="utf-8"></script>
  11. <script src="js/comment.js" type="text/javascript" charset="utf-8"></script>
  12. <link rel="stylesheet" type="text/css" href="css/common.css" />
  13. <link rel="stylesheet" type="text/css" href="css/game2.css?vs=1.1.3" />
  14. </head>
  15. <style type="text/css">
  16. .game2tips {
  17. position: absolute;
  18. z-index: 100;
  19. width: 100%;
  20. /* height: 100%; */
  21. text-align: center;
  22. line-height: 100%;
  23. color: white!important;
  24. font-size: .46rem!important;
  25. top: 5.7rem;
  26. }
  27. </style>
  28. <body>
  29. <div id="wrap">
  30. <div class="tipsNum"><img src="img/game2/firstIcon.png" /></div>
  31. <div class="titleIcon">
  32. <ul>
  33. <li><img src="img/success/suc1.png" /></li>
  34. <li><img src="img/game1/result.png" /></li>
  35. <li><img src="img/game1/result.png" /></li>
  36. <li><img src="img/game1/result.png" /></li>
  37. <li><img src="img/game1/result.png" /></li>
  38. </ul>
  39. </div>
  40. <div class="cont_wrap">
  41. <div class="tipList">
  42. <ul id="start">
  43. <!--<li class="start" id="start1">
  44. <p>1935年1月</p>
  45. </li>-->
  46. <!--<li class="start" id="start2">
  47. <p>1935年5月</p>
  48. </li>
  49. <li class="start" id="start3">
  50. <p>1935年1月</p>
  51. </li>
  52. <li class="start" id="start4">
  53. <p>1935年6月</p>
  54. </li>
  55. <li class="start" id="start5">
  56. <p>1935年9月</p>
  57. </li>-->
  58. </ul>
  59. </div>
  60. <div class="posTip">
  61. <p></p>
  62. </div>
  63. <div class="contList">
  64. <ul>
  65. <!--<li class="end" id="end1">
  66. <p class="tipImg"></p>
  67. <p class="titleText 1" style="width: .97rem;">翻雪山</p>
  68. <p class="contImg"><img src="img/game2/icon4.png" /></p>
  69. <p class="contText">红军在雪山战斗生活月之久。其间,除了要同凶残的敌人英勇作战外,还要克服重重困难,战胜极端恶劣的自然环境,爬过雪山,走过草地,实现战略转移。它既是长征精神的重要组成部分,又是长征精神的集中体现。</p>
  70. </li>
  71. <li class="end li5" id="end2">
  72. <p class="tipImg"></p>
  73. <p class="titleText 2" style="width: 1.37rem;">四渡赤水河</p>
  74. <p class="contImg"><img src="img/game2/icon3.png" /></p>
  75. <p class="contText">中央红军三个月四渡赤水,转战川贵滇三省,巧妙地穿插于国民党军重兵集团围剿之间,不断创造战机,牢牢地掌握战场的主动权,是红军长征史上以少胜多,变被动为主动的光辉战例。</p>
  76. </li>
  77. <li class="end" id="end3">
  78. <p class="tipImg"></p>
  79. <p class="titleText 3" style="width: 1.16rem;">遵义会议</p>
  80. <p class="contImg"><img src="img/game2/icon1.png" /></p>
  81. <p class="contText">中共中央政治局在贵州遵义 召开的独立自主地解决中国革命问题的一次极其重要的扩大会议。纠正博古、王明、李德等人“左”倾领导在军事指挥上的错误。</p>
  82. </li>
  83. <li class="end" id="end4">
  84. <p class="tipImg"></p>
  85. <p class="titleText 4" style="width: 1.38rem;">延安大会师</p>
  86. <p class="contImg"><img src="img/game2/icon5.png" /></p>
  87. <p class="contText">一次次的绝地逢生当4支红色大军在70年前的那个十月胜利会师的时候,中国共产党所领导的这些红色战士,不仅谱就了长征这样举世罕见的伟大史诗,而且铸就了无与伦比的精神丰碑。</p>
  88. </li>
  89. <li class="end" id="end5">
  90. <p class="tipImg"></p>
  91. <p class="titleText 5" style="width: 1.37rem;">巧渡金沙江</p>
  92. <p class="contImg"><img src="img/game2/icon2.png" /></p>
  93. <p class="contText">红军避敌锋芒、仅凭7只渡船在7天7夜间,2万多人的红军部队全部渡过金沙江 。红军摆脱了几十万敌军的围追堵截,取得了战略转移以来具有决定意义的胜利。</p>
  94. </li>-->
  95. </ul>
  96. </div>
  97. </div>
  98. <!--成功-->
  99. <div class="mask"></div>
  100. <div class="game2tips">
  101. 请将上方的时间与下方党的重大战役连接!
  102. </div>
  103. <div class="shoushi"><img src="img/shoushi/2.gif" /></div>
  104. <div class="success">
  105. <div class="sucImg">
  106. <div>
  107. <p class="text">恭喜获得第二枚徽章!</p>
  108. <p class="text textTime"></p>
  109. <p class="imgIcons"><img src="img/success/suc2.png" /></p>
  110. </div>
  111. </div>
  112. <div class="close"><img src="img/close.png" /></div>
  113. </div>
  114. <div class="deepBtn">进入第三关</div>
  115. <p class="imgIcon"><img src="img/success/suc2.png" /></p>
  116. </div>
  117. <audio id="bgmAudio" hidden="true" autoplay="autoplay">
  118. <source src="img/audio/game2Bgm.mp3" type="audio/mp3" />
  119. </audio>
  120. <audio id="trueAudio" hidden="true">
  121. <source src="img/true.mp3" type="audio/mp3" />
  122. </audio>
  123. <audio id="falseAudio" hidden="true">
  124. <source src="img/false1.mp3" type="audio/mp3" />
  125. </audio>
  126. <div id="trueXian"></div>
  127. <div id="xian"></div>
  128. </body>
  129. </html>
  130. <script src="js/common.js" type="text/javascript" charset="utf-8"></script>
  131. <script type="text/javascript">
  132. function audioAutoPlay(id) {
  133. var audio = document.getElementById(id),
  134. play = function () {
  135. audio.play();
  136. document.removeEventListener("touchstart", play, false);
  137. };
  138. audio.play();
  139. document.addEventListener("WeixinJSBridgeReady", function () {
  140. play();
  141. }, false);
  142. document.addEventListener('YixinJSBridgeReady', function () {
  143. play();
  144. }, false);
  145. document.addEventListener("touchstart", play, false);
  146. //禁止微信内h5网页下拉
  147. document.body.addEventListener('touchmove', function (e) {
  148. e.preventDefault()
  149. }, { passive: false });
  150. }
  151.    var url = location.href.split('?')[1]
  152. var audioState = url.split('=')[1];
  153. if (audioState == 'true') {
  154. audioAutoPlay('bgmAudio');
  155. }
  156. //手势隐藏
  157. var maskState1 = true
  158. $('.mask').on('touchstart', function() {
  159. if(maskState1) {
  160. fadeoutmask()
  161. maskState1 = false
  162. }
  163. })
  164. $('.shoushi').on('touchstart', function() {
  165. fadeoutmask()
  166. })
  167. function fadeoutmask() {
  168. $('.mask').fadeOut();
  169. $('.shoushi').fadeOut();
  170. $(".game2tips").fadeOut()
  171. }
  172. $('.game2tips').on('touchstart', function() {
  173. fadeoutmask()
  174. })
  175. //手势隐藏end
  176. var time = 0;
  177. var timeLength = setInterval(function() {
  178. // console.log(time)
  179. time++;
  180. }, 1000)
  181. //正确答案顺序
  182. var trueArr = [1, 2, 3, 4, 5];
  183. //题目数组
  184. var timeArr = [
  185. '1948年11月06日',
  186. '1948年06月17日',
  187. '1948年09月12日',
  188. '1946年07月13日',
  189. '1948年11月29日',
  190. '1947年05月13日',
  191. '1948年06月11日',
  192. '1948年09月16日'
  193. ];
  194. var oldTimeArr = [
  195. '1948年11月06日',
  196. '1948年06月17日',
  197. '1948年09月12日',
  198. '1946年07月13日',
  199. '1948年11月29日',
  200. '1947年05月13日',
  201. '1948年06月11日',
  202. '1948年09月16日'
  203. ];
  204. //答案数组
  205. var writeArr = [
  206. '淮海战役实现了把国民党主力部队尽可能多地消灭在长江以北的战略构想,解放了华东、中原的广大地区,使敌长江防线和统治中心南京、上海都处于我军的直接威胁之下,取得了解放战争的决定性胜利。',
  207. '豫东战役是解放战争以来,我军首次在中原地区集中兵力与敌主力进行的一次大规模兵团作战。毛主席说:“解放战争已经过了山坳子!”。',
  208. '自1945年8月我军抽调主力欲控制东北与敌作战三年以来的一次总决战。该战役一举歼灭了国民党在关外的全部主力队伍,解放了东北全境。战役规模之大,歼敌数量之众,仅次于淮海战役。',
  209. '华中野战军以3万多人的兵力对付国民党军12万余人,七战七捷,歼敌数量达到我军参战兵力总数的1.76倍,首创解放战争以来一次战役歼敌之多的记录,也创造了现代战争史上的一个奇迹。',
  210. '平津战役是解放战争中的三大决战之一,歼敌数量排名第二,和平谈判的方式也处理得非常圆满,我军伤亡人数最少,实属罕见。',
  211. '孟良崮战役是解放战争时期,陈毅、粟裕指挥,在山东省临沂市蒙阴县东南孟良崮地区对国民革命军整编第74师进行的进攻作战。该战役一举扭转了华东战局,是解放战争由战略防御转为战略进攻的重要转折点。',
  212. '晋中战役是解放战争中一场大规模运动战、速决战、歼灭战的典范之作,徐向前仅用6万余人的兵力,在40天的时间里歼灭阎锡山部10万之众,战术运用灵活机动,是我军以少胜多、以弱胜强的光辉战例。',
  213. '济南战役是国、共的第一次大诀战序幕。济南战役是解放战争时期我军进行的一次规模最大的攻城打援战例,超过了敌济南守军和可能增援敌之总数(约28万人),第一次实现了华东战场我军兵力较之敌军占优势。'
  214. ];
  215. //标题数组
  216. var titleArr = [
  217. '淮海战役',
  218. '豫东战役',
  219. '辽沈战役',
  220. '苏中战役',
  221. '平津战役',
  222. '孟良崮战役',
  223. '晋中战役',
  224. '济南战役'
  225. ];
  226. //图片数组
  227. var imgArr = [
  228. 'img/game2/icon1-1.png',
  229. 'img/game2/icon2-1.png',
  230. 'img/game2/icon3-1.png',
  231. 'img/game2/icon4-1.png',
  232. 'img/game2/icon5-1.png',
  233. 'img/game2/icon6-1.png',
  234. 'img/game2/icon7-1.png',
  235. 'img/game2/icon8-1.png',
  236. ];
  237. //打乱题目
  238. randArr(timeArr);
  239. var se = timeArr;
  240. //打乱答案顺序
  241. randArr(trueArr);
  242. //展示题目
  243. var timu = '';
  244. var newTimeArr = timeArr.slice(0, 5)
  245. function timedata(val) {
  246. var timeData = []
  247. for (var x = 0; x < val.length; x++) {
  248. var year = val[x].split('')[0] + val[x].split('')[1] + val[x].split('')[2] + val[x].split('')[3];
  249. var month = val[x].split('')[5] + val[x].split('')[6];
  250. var day = val[x].split('')[08] + val[x].split('')[9];
  251. var strtime = year + month + day
  252. timeData.push(strtime)
  253. }
  254. return timeData
  255. }
  256. function insertStr(soure, start, newStr) {
  257. return soure.slice(0, start) + newStr + soure.slice(start);
  258. }
  259. function biaozhun(val) {
  260. var biaozhuntime = val.sort()
  261. var aaa = []
  262. for (var x = 0; x < biaozhuntime.length; x++) {
  263. var a = insertStr(biaozhuntime[x], 4, '年')
  264. a = insertStr(a, 7, '月')
  265. a = insertStr(a, 10, '日')
  266. aaa.push(a)
  267. }
  268. return aaa
  269. }
  270. var newTimeArr = biaozhun(timedata(newTimeArr))
  271. console.log(newTimeArr)
  272. console.log(timeArr)
  273. for(var i = 0; i < 5; i++) {
  274. // console.log('22',timeArr.indexOf(newTimeArr[i]))
  275. //取timeArr前五个元素
  276. timu += '<li class="start" id="start' + (i + 1) + '" data-true='+timeArr.indexOf(newTimeArr[i])+'><p>' + newTimeArr[i] + '</p></li>'
  277. }
  278. $('#start').html(timu)
  279. //展示答案
  280. // var img='';
  281. // var title='';
  282. var cont = '';
  283. for(var i = 0; i < 5; i++) {
  284. console.log("111111",getArrayIndex(trueArr, i + 1))
  285. //按照展示顺序进行相对位置的答案计算
  286. // contText+=writeArr[getArrayIndex(oldTimeArr, timeArr[trueArr[i] - 1])];
  287. cont += '<li class="end" id="end' + (i + 1) + '" data-true='+getArrayIndex(trueArr, i + 1)+'><p class="tipImg"></p>' +
  288. '<p class="titleText 5" style="width: 1.37rem;">' + titleArr[getArrayIndex(oldTimeArr, timeArr[getArrayIndex(trueArr, i + 1)])] + '</p>' +
  289. '<p class="contImg"><img src="' + imgArr[getArrayIndex(oldTimeArr, timeArr[getArrayIndex(trueArr, i + 1)])] + '" /></p>' +
  290. '<p class="contText">' + writeArr[getArrayIndex(oldTimeArr, timeArr[getArrayIndex(trueArr, i + 1)])] + '</p>' +
  291. '</li>'
  292. }
  293. $('.contList ul').html(cont)
  294. // console.log(contText)
  295. var firstPoint = null; //第一次点击的坐标
  296. var secondPoint = null; //事件坐标
  297. var startIndex = null;
  298. var endIndex = null;
  299. var shubiaoD = null;
  300. // var trueArr = [3, 5, 2, 1, 4];
  301. var clickArr = [];
  302. var endArr = [];
  303. click();
  304. newstarindex=null
  305. newendindex=null
  306. var count = 10;
  307. function click() {
  308. $('#start li').on('touchstart', function(evt) {
  309. newstarindex=$(this).attr("data-true")
  310. $('.posTip p').fadeOut(500)
  311. // console.log("按下")
  312. var e = event || evt;
  313. // e.preventDefault(); //阻止其他事件
  314. //要做的事情
  315. for(var i = 1; i <= 5; i++) {
  316. if($.contains($("#start" + i)[0], e.target) || $("#start" + i)[0] == e.target) {
  317. startIndex = i - 1;
  318. if(clickArr.indexOf(startIndex) == -1) {
  319. $('.tipList li').eq(i - 1).removeClass('active')
  320. var kaishi = document.getElementById("start" + i).getBoundingClientRect();
  321. } else {
  322. startIndex = null;
  323. }
  324. }
  325. }
  326. if(kaishi) {
  327. $('.tipList li').eq(startIndex).addClass('active')
  328. firstPoint = {};
  329. var x = document.documentElement.clientWidth - document.getElementById("start" + (startIndex + 1)).offsetTop - document.getElementById("start" + (startIndex + 1)).offsetHeight + 8;
  330. var y = document.getElementById("start" + (startIndex + 1)).offsetLeft + document.getElementById("start" + (startIndex + 1)).offsetWidth / 2;
  331. firstPoint.xPoint = x;
  332. firstPoint.YPoint = y;
  333. }
  334. }).on('touchmove', function(evt) {
  335. // console.log("挪动")
  336. var e = event || evt;
  337. e.preventDefault();
  338. e.stopPropagation();
  339. var touch = e.targetTouches[0];
  340. shubiaoD = touch;
  341. secondPoint = {};
  342. secondPoint.xPoint = touch.pageX;
  343. secondPoint.YPoint = touch.pageY;
  344. if(firstPoint !== null && secondPoint !== null) {
  345. let lineLength = calcLine(firstPoint, secondPoint);
  346. let angle = getAngle(
  347. firstPoint.xPoint,
  348. firstPoint.YPoint,
  349. secondPoint.xPoint,
  350. secondPoint.YPoint
  351. );
  352. let bodyDiv = document.getElementById("xian");
  353. if(bodyDiv.lastElementChild) {
  354. // bodyDiv.lastElementChild.style.display='none';
  355. bodyDiv.lastElementChild.remove();
  356. }
  357. // 设置一个div 宽度为 两点之间的距离,并且以 transform-origin: 0 50% 为圆心旋转,角度已经算出来
  358. let lineHtmlStr =
  359. `<div id="` + count + `" class="lines" style="position:absolute;border-top: 1px solid red;width:${lineLength}px;top:${firstPoint.YPoint}px;left:${firstPoint.xPoint}px;transform:rotate(${angle}deg);transform-origin: 0 50%;z-index:1;"></div>`;
  360. count++;
  361. // 添加到body 后面
  362. bodyDiv.innerHTML = bodyDiv.innerHTML + lineHtmlStr;
  363. }
  364. for(var i = 1; i <= 5; i++) {
  365. var leftMin = document.getElementById("end" + i).offsetLeft;
  366. var leftMax = document.getElementById("end" + i).offsetLeft + document.getElementById("end" + i).offsetWidth;
  367. var bottomMin = document.documentElement.clientWidth - document.getElementById("end" + i).offsetTop - document.getElementById("end" + i).offsetHeight;
  368. var bottomMax = document.documentElement.clientWidth - document.getElementById("end" + i).offsetTop;
  369. if(leftMin <= shubiaoD.clientY && shubiaoD.clientY <= leftMax &&
  370. bottomMin <= shubiaoD.clientX && shubiaoD.clientX <= bottomMax) {
  371. if(startIndex || startIndex == 0) {
  372. if(endArr.indexOf(i - 1) == -1) {
  373. $('.contList li').eq(i - 1).addClass('active')
  374. }
  375. }
  376. } else {
  377. if(endArr.indexOf(i - 1) == -1) {
  378. $('.contList li').eq(i - 1).removeClass('active')
  379. }
  380. }
  381. }
  382. }).on('touchend', function(evt) {
  383. // console.log("松开")
  384. var e = event || evt;
  385. // e.preventDefault(); //阻止其他事件
  386. if(firstPoint !== null) {
  387. if(shubiaoD) {
  388. for(var i = 1; i <= 5; i++) {
  389. var leftMin = document.getElementById("end" + i).offsetLeft;
  390. var leftMax = document.getElementById("end" + i).offsetLeft + document.getElementById("end" + i).offsetWidth;
  391. var bottomMin = document.documentElement.clientWidth - document.getElementById("end" + i).offsetTop - document.getElementById("end" + i).offsetHeight;
  392. var bottomMax = document.documentElement.clientWidth - document.getElementById("end" + i).offsetTop;
  393. if(leftMin <= shubiaoD.clientY && shubiaoD.clientY <= leftMax &&
  394. bottomMin <= shubiaoD.clientX && shubiaoD.clientX <= bottomMax) {
  395. endIndex = i - 1;
  396. var jieshu = document.getElementById("end" + i).getBoundingClientRect();
  397. newendindex=$('#end'+i).attr("data-true")
  398. }
  399. }
  400. }
  401. }
  402. if(newstarindex==newendindex){
  403. // if(firstPoint !== null && endIndex == trueArr[startIndex] - 1) {
  404. var trueAudio = document.getElementById('trueAudio');
  405. trueAudio.play();
  406. audioAutoPlay('trueAudio')
  407. clickArr.push(startIndex);
  408. endArr.push(endIndex);
  409. // $('.contList li').eq(endIndex).css('height','3.6rem')
  410. // $('.contList li').eq(endIndex).animate({'height':'3.6rem'},1000)
  411. $('.contList li').eq(endIndex).css('height', '3.6rem')
  412. $('.contList li').eq(endIndex).find('p.contText').slideDown(1000)
  413. //生成线条
  414. secondPoint = {};
  415. var endx = document.documentElement.clientWidth - document.getElementById("end" + (endIndex + 1)).offsetTop + 8;
  416. var endy = document.getElementById("end" + (endIndex + 1)).offsetLeft + document.getElementById("end" + (endIndex + 1)).offsetWidth / 2;
  417. secondPoint.xPoint = endx;
  418. secondPoint.YPoint = endy;
  419. if(firstPoint !== null && secondPoint !== null) {
  420. let lineLength = calcLine(firstPoint, secondPoint);
  421. let angle = getAngle(
  422. firstPoint.xPoint,
  423. firstPoint.YPoint,
  424. secondPoint.xPoint,
  425. secondPoint.YPoint
  426. );
  427. let bodyDiv = document.getElementById("xian");
  428. if(bodyDiv.lastElementChild) {
  429. // bodyDiv.lastElementChild.style.display='none';
  430. bodyDiv.lastElementChild.remove();
  431. }
  432. // 设置一个div 宽度为 两点之间的距离,并且以 transform-origin: 0 50% 为圆心旋转,角度已经算出来
  433. let lineHtmlStr =
  434. `<div id="` + count + `" style="position:absolute;border-top: 1px solid red;width:${lineLength}px;top:${firstPoint.YPoint}px;left:${firstPoint.xPoint}px;transform:rotate(${angle}deg);transform-origin: 0 50%;"></div>`;
  435. count++;
  436. // 添加到body 后面
  437. bodyDiv.innerHTML = bodyDiv.innerHTML + lineHtmlStr;
  438. }
  439. let bodyDiv = document.getElementById("xian");
  440. let trueBodyDiv = document.getElementById("trueXian");
  441. // console.log(bodyDiv.lastElementChild)
  442. trueBodyDiv.appendChild(bodyDiv.lastElementChild);
  443. // bodyDiv.lastElementChild.style.display='none';
  444. if(bodyDiv.lastElementChild) {
  445. bodyDiv.lastElementChild.remove();
  446. }
  447. firstPoint = null;
  448. secondPoint = null;
  449. startIndex = null;
  450. endIndex = null;
  451. newstarindex = null;
  452. newendindex = null;
  453. if(clickArr.length == 5) {
  454. clearInterval(timeLength);
  455. setTimeout('win()', 2000)
  456. }
  457. } else {
  458. //错误
  459. if(startIndex || startIndex == 0) {
  460. $('.tipList li').eq(startIndex).removeClass('active')
  461. var falseAudio = document.getElementById('falseAudio');
  462. falseAudio.play();
  463. audioAutoPlay('falseAudio')
  464. }
  465. $('.contList li').eq(endIndex).removeClass('active')
  466. let bodyDiv = document.getElementById("xian");
  467. if(bodyDiv.lastElementChild) {
  468. // bodyDiv.lastElementChild.style.display='none';
  469. bodyDiv.lastElementChild.remove();
  470. }
  471. firstPoint = null;
  472. secondPoint = null;
  473. startIndex = null;
  474. endIndex = null;
  475. newstarindex=null
  476. newendindex=null
  477. }
  478. })
  479. $(document).on('onmove');
  480. }
  481. // 计算连线
  482. function calcLine(firstPoint, secondPoint) {
  483. // 计算出两个点之间的距离
  484. let line = Math.sqrt(
  485. Math.pow(firstPoint.xPoint - secondPoint.xPoint, 2) +
  486. Math.pow(firstPoint.YPoint - secondPoint.YPoint, 2)
  487. );
  488. return line;
  489. }
  490. // 计算角度
  491. // 获得人物中心和鼠标坐标连线,与y轴正半轴之间的夹角
  492. function getAngle(x1, y1, x2, y2) {
  493. // 获得人物中心和鼠标坐标连线,与y轴正半轴之间的夹角
  494. var x = x1 - x2;
  495. var y = y1 - y2;
  496. var z = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
  497. var cos = y / z;
  498. var radina = Math.acos(cos); // 用反三角函数求弧度
  499. var angle = 180 / (Math.PI / radina); // 将弧度转换成角度
  500. if(x2 > x1 && y2 === y1) {
  501. // 在x轴正方向上
  502. angle = 0;
  503. }
  504. if(x2 > x1 && y2 < y1) {
  505. // 在第一象限;
  506. angle = angle - 90;
  507. }
  508. if(x2 === x1 && y1 > y2) {
  509. // 在y轴正方向上
  510. angle = -90;
  511. }
  512. if(x2 < x1 && y2 < y1) {
  513. // 在第二象限
  514. angle = 270 - angle;
  515. }
  516. if(x2 < x1 && y2 === y1) {
  517. // 在x轴负方向
  518. angle = 180;
  519. }
  520. if(x2 < x1 && y2 > y1) {
  521. // 在第三象限
  522. angle = 270 - angle;
  523. }
  524. if(x2 === x1 && y2 > y1) {
  525. // 在y轴负方向上
  526. angle = 90;
  527. }
  528. if(x2 > x1 && y2 > y1) {
  529. // 在四象限
  530. angle = angle - 90;
  531. }
  532. return angle;
  533. }
  534. function win() {
  535. if(time > 3600) {
  536. var houre = parseInt(time / 3600);
  537. if(time % 3600 > 60) {
  538. var min = parseInt((time % 3600) / 60)
  539. } else {
  540. var min = 0;
  541. }
  542. var sec = (time % 3600) % 60
  543. $('.textTime').text('用时' + houre + '时' + min + '分' + sec + '秒')
  544. } else if(time > 60 && time < 3600) {
  545. $('.textTime').text('用时' + parseInt(time / 60) + '分' + (time % 60) + '秒')
  546. } else {
  547. $('.textTime').text('用时' + (time % 60) + '秒')
  548. }
  549. var showSate = false;
  550. maskState()
  551. $('.mask').fadeIn();
  552. $('.success').fadeIn();
  553. $('.imgIcon').fadeIn();
  554. $('.lines').css('z-index', '-1')
  555. $('#trueXian').css('display', 'none')
  556. $('.deepBtn').fadeIn()
  557. showSate = true;
  558. maskState()
  559. function maskState() {
  560. if(showSate) {
  561. $('.imgIcon').animate({
  562. 'top': '0',
  563. "right": '24%',
  564. 'width': '.98rem',
  565. 'height': '1.24rem',
  566. }, 2000)
  567. function yincang() {
  568. $('.titleIcon ul li').eq(1).css({
  569. 'visibility': 'hidden'
  570. })
  571. }
  572. setTimeout('yincang()', 2000)
  573. }
  574. }
  575. $('.deepBtn').click(function() {
  576. var url = location.href.split('?')[1];
  577. window.location.href = "game3.html?" + url
  578. })
  579. $('.close').on('touchstart', function() {
  580. $('.mask').fadeOut();
  581. $('.success .sucImg div').fadeOut();
  582. $('.success .close').fadeOut();
  583. $('#trueXian').css('display', 'block')
  584. })
  585. }
  586. function randArr(arr) {
  587. let i = arr.length;
  588. while(i) {
  589. let j = Math.floor(Math.random() * i--);
  590. [arr[j], arr[i]] = [arr[i], arr[j]];
  591. }
  592. return arr;
  593. }
  594. function getArrayIndex(arr, obj) {
  595. var i = arr.length;
  596. while(i--) {
  597. if(arr[i] === obj) {
  598. return i;
  599. }
  600. }
  601. return -1;
  602. }
  603. </script>