index.html 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>陪你学一夏,全能宝贝大比拼</title>
  5. <!--#include virtual="/h5v2/htm2/head.htm" -->
  6. <style type="text/css">
  7. body {
  8. width: 1280px;
  9. height: 720px;
  10. overflow: hidden;
  11. background: url(img/bg.jpg) no-repeat 0 0;
  12. }
  13. .btn_focus_btn {
  14. border: 3px solid #fff;
  15. border-radius: 20px;
  16. box-shadow: 0px 0px 10px #3794e2;
  17. }
  18. .midea {
  19. width: 175px;
  20. height: 258px;
  21. border: 4px solid #fff8d3;
  22. border-radius: 15px;
  23. overflow: hidden;
  24. }
  25. .btn_focus_midea {
  26. border: 4px solid #51a546;
  27. box-shadow: 0px 0px 10px #3794e2;
  28. }
  29. .midea_0 {
  30. width: 176px;
  31. height: 258px;
  32. overflow: hidden;
  33. position: absolute;
  34. left: 123px;
  35. top: 394px;
  36. }
  37. .midea_1 {
  38. width: 176px;
  39. height: 258px;
  40. overflow: hidden;
  41. position: absolute;
  42. left: 338px;
  43. top: 394px;
  44. }
  45. .midea_2 {
  46. width: 176px;
  47. height: 258px;
  48. overflow: hidden;
  49. position: absolute;
  50. left: 552px;
  51. top: 394px;
  52. }
  53. .midea_3 {
  54. width: 176px;
  55. height: 258px;
  56. overflow: hidden;
  57. position: absolute;
  58. left: 767px;
  59. top: 394px;
  60. }
  61. .midea_4 {
  62. width: 176px;
  63. height: 258px;
  64. overflow: hidden;
  65. position: absolute;
  66. left: 980px;
  67. top: 394px;
  68. }
  69. #mideaGroup img {
  70. width: 100%;
  71. border-radius: 10px;
  72. }
  73. div#default_tip_css {
  74. position: absolute;
  75. left: 340px;
  76. top: 325px;
  77. padding: 30px 50px;
  78. width: 600px;
  79. height: 150px;
  80. background-color: #4c4a4b;
  81. border-radius: 10px;
  82. text-align: center;
  83. font-size: 36px;
  84. color: #ffffff;
  85. border: solid 2px #ffffff;
  86. margin: auto;
  87. z-index: 333;
  88. visibility: hidden;
  89. }
  90. </style>
  91. </head>
  92. <body>
  93. <div id="indexDiv"></div>
  94. <div id="mideaGroup"></div>
  95. <div id="ruleDiv" style="visibility:hidden;"></div>
  96. <!--#include virtual="/h5v2/htm2/foot.htm" -->
  97. <!--#include virtual="activity_cfg.htm" -->
  98. <script type="text/javascript">
  99. // 记录用户
  100. function addUser(fn) {
  101. ajax({
  102. url: webUrl + "index.php?m=Home&c=DuduApi&a=addUser",
  103. data: {
  104. uid: uid,
  105. UserToken: UserToken
  106. },
  107. success: function(res) {
  108. fn && fn(res);
  109. },
  110. error: function() {}
  111. })
  112. }
  113. // 主题统计
  114. function addData(fn) {
  115. ajax({
  116. url: webUrl + "index.php?m=Home&c=ThemeData&a=addData",
  117. data: {
  118. uid: uid,
  119. theme_code: 'looktv'
  120. },
  121. success: function(res) {
  122. fn && fn(res);
  123. },
  124. error: function() {}
  125. })
  126. }
  127. //鉴权
  128. function authorization(fn) {
  129. ajax({
  130. url: webUrl + "index.php?m=Home&c=order&a=contentCTCAuth",
  131. data: {
  132. contentcode: ACTIVITY_CFG.CONTENT_CODE,
  133. userid: uid, //1.0
  134. uid: uid, //2.0
  135. usertoken: UserToken,
  136. mac: mac,
  137. version: version,
  138. fromsource: fromsource
  139. },
  140. type: "post",
  141. dataType: "json",
  142. success: function(res) {
  143. if (res.code == 0) {
  144. if (res.data.result == 0) {
  145. dudu_is_vip = 1;
  146. } else {
  147. dudu_is_vip = 0;
  148. }
  149. } else {
  150. dudu_is_vip = 0;
  151. }
  152. fn && fn();
  153. },
  154. error: function() {
  155. fn && fn();
  156. }
  157. })
  158. }
  159. //统计
  160. function payResult() {
  161. if (dudu_is_vip == 1) {
  162. ajax({
  163. url: webUrl + "index.php?m=Home&c=DuduApi&a=payResult",
  164. data: {
  165. uid: uid,
  166. product_id: mid_product_id,
  167. pay_result: 0
  168. },
  169. success: function(res) {},
  170. error: function() {}
  171. })
  172. }
  173. }
  174. function fullscreenPlay(mid, idx) {
  175. idx = idx || 0;
  176. var playIntent = {
  177. package: "com.hunantv.operator",
  178. action: "mangotv://com.hunantv.operator/player/vod",
  179. data: "",
  180. extras: {
  181. "video_index": idx,
  182. "media_asset_id": mid, //媒资包
  183. },
  184. flags: []
  185. };
  186. Webview.sendIntent("startActivity", playIntent);
  187. };
  188. function stopPlay() {
  189. try {
  190. starcorExt.stopVideo();
  191. } catch (e) {}
  192. }
  193. try {
  194. starcorExt.setHandler("Resume", function(isResumed) {
  195. if (isResumed) { //从全屏或设置键回来
  196. }
  197. });
  198. } catch (e) {}
  199. var uid = PageH5.getParam('uid') || '0100834547692768574';
  200. var UserToken = "00139025650832263889980824152950"
  201. var mac = 'OC-41-E9-DD-EC-DE'
  202. var version = "YYS.4.6.15.266.5.HNDX.0.0_Release"
  203. try {
  204. uid = Webview.readSystemProp('user.id'); //用户ID
  205. UserToken = Webview.readSystemProp('user.token'); //用户令牌
  206. mac = Webview.readSystemProp('device.mac'); //机顶盒mac地址
  207. version = Webview.readSystemProp('app.version'); //APK版本号
  208. } catch (e) {}
  209. var linkImage = CONFIG.SPACER; //透明图片
  210. var buttons = []; //按钮数组
  211. var act_id = ACTIVITY_CFG.ACT_ID,
  212. act_code = ACTIVITY_CFG.ACT_CODE; //活动id及code
  213. var fromsource = ACTIVITY_CFG.FROM_SOURCE, //来源,电信4,联通5
  214. dudu_is_vip = 0, //1是会员,0是非会员
  215. mid_product_id = '', //记录订购成功时候用
  216. ruleDivIsShow = false, //规则是否展开
  217. remainTimes = 0; //游戏剩余次数
  218. var prizeImg = ''; //获奖时的图片
  219. var isLock = false; //是否锁住按键
  220. var title_idx = PageH5.getParam('titleIdx') ? PageH5.getParam('titleIdx') : 0; //titleIdx
  221. var f = PageH5.getParam('f');
  222. if (PageH5.cookie.get('focusMark')) {
  223. var focusMark = JSON.parse(PageH5.cookie.get('focusMark'));
  224. if (focusMark.title_idx)
  225. title_idx = focusMark.title_idx;
  226. if (focusMark.focus)
  227. f = focusMark.focus;
  228. PageH5.cookie.set('focusMark', '');
  229. }
  230. var midea = [
  231. [{ //语言
  232. 'name': '可爱巧虎岛 第五季',
  233. 'img': '',
  234. 'id': '00000001000000000048000000082109',
  235. }, {
  236. 'name': '小猪佩奇 全集',
  237. 'img': '',
  238. 'id': '00000001000000000043000000296717',
  239. }, {
  240. 'name': '超级宝贝JOJO',
  241. 'img': '',
  242. 'id': '00000001000000000025000000333852',
  243. }, {
  244. 'name': '我的汤姆猫短片',
  245. 'img': '',
  246. 'id': '00000001000000000014000000323353',
  247. }, {
  248. 'name': '海绵宝宝 第九季',
  249. 'img': '',
  250. 'id': '00000001000000000030000000345063',
  251. }],
  252. [{ //国学
  253. 'name': '宝宝巴士之奇妙汉字 第一季',
  254. 'img': '',
  255. 'id': '00000001000000000043000000266913',
  256. }, {
  257. 'name': '贝乐虎古诗',
  258. 'img': '',
  259. 'id': '00000001000000000031000000254351',
  260. }, {
  261. 'name': '贝乐虎三字经',
  262. 'img': '',
  263. 'id': '00000001000000000015000000381334',
  264. }, {
  265. 'name': '猫小帅古诗',
  266. 'img': '',
  267. 'id': '00000001000000000028000000271453',
  268. }, {
  269. 'name': '兔小贝成语学堂',
  270. 'img': '',
  271. 'id': '00000001000000000032000000022865',
  272. }],
  273. [{ //才艺
  274. 'name': '超级飞侠唱儿歌',
  275. 'img': '',
  276. 'id': '00000001000000000032000000022701',
  277. }, {
  278. 'name': '超级飞侠画世界',
  279. 'img': '',
  280. 'id': '00000001000000000036000000264704',
  281. }, {
  282. 'name': '超级飞侠彩笔画 第二季',
  283. 'img': '',
  284. 'id': '00000001000000000040000000325516',
  285. }, {
  286. 'name': '小鸡彩虹舞台秀第六季',
  287. 'img': '',
  288. 'id': '00000001000000000037000000327175',
  289. }, {
  290. 'name': '芭比之梦想豪宅全集',
  291. 'img': '',
  292. 'id': '00000001000000000002000000074481',
  293. }],
  294. [{ //巧手
  295. 'name': '小伶玩具',
  296. 'img': '',
  297. 'id': '00000001000000000007000000166844',
  298. }, {
  299. 'name': '和小鹿问问一起做手工',
  300. 'img': '',
  301. 'id': '00000001000000000047000000295791',
  302. }, {
  303. 'name': '和迷你卡车学习',
  304. 'img': '',
  305. 'id': '00000001000000000045000000170689',
  306. }, {
  307. 'name': '阿哦玩具',
  308. 'img': '',
  309. 'id': '00000001000000000038000000446889',
  310. }, {
  311. 'name': '超级飞侠欢乐玩粘土',
  312. 'img': '',
  313. 'id': '00000001000000000003000000092944',
  314. }],
  315. [{ //科学
  316. 'name': '猪猪侠之恐龙日记 第二季',
  317. 'img': '',
  318. 'id': '00000001000000000025000000316080',
  319. }, {
  320. 'name': '汪汪队立大功之百科知识',
  321. 'img': '',
  322. 'id': '00000001000000000014000000236195',
  323. }, {
  324. 'name': '百变马丁 第六季',
  325. 'img': '',
  326. 'id': '00000001000000000032000000375988',
  327. }, {
  328. 'name': '阿U学科学 第二季',
  329. 'img': '',
  330. 'id': '00000001000000000007000000081017',
  331. }, {
  332. 'name': '超级飞侠大百科 第一季',
  333. 'img': '',
  334. 'id': '00000000000000000001000000001002',
  335. }]
  336. ]
  337. var typeArr = ['yy', 'gx', 'cy', 'ds', 'kx'];
  338. PageH5.eventHandler = function(keyCode) {
  339. if (keyCode == KEY_LEFT && (!isLock)) {
  340. PageH5.Button.move('left');
  341. } else if (keyCode == KEY_RIGHT && (!isLock)) {
  342. PageH5.Button.move('right');
  343. } else if (keyCode == KEY_UP && (!isLock)) {
  344. PageH5.Button.move('up');
  345. } else if (keyCode == KEY_DOWN && (!isLock)) {
  346. PageH5.Button.move('down');
  347. } else if (keyCode == KEY_ENTER && (!isLock)) {
  348. PageH5.Button.click();
  349. } else if ((keyCode == KEY_BACK || keyCode == KEY_EXIT) && (!isLock)) {
  350. back();
  351. }
  352. }
  353. function init() {
  354. PageH5.cookie.set('activity_userid', uid);
  355. PageH5.cookie.set('activity_is_vip', dudu_is_vip);
  356. var html = '';
  357. html += '<div style="position:absolute;left:1110px;top:18px;"><img id="back" src="./img/btn_back.png"/></div>';
  358. html += '<div style="position:absolute;left:1110px;top:62px;"><img id="rule" src="./img/btn_rules.png"/></div>';
  359. html += '<div style="position:absolute;left:1110px;top:106px;"><img id="medal" src="./img/btn_medal.png"/></div>';
  360. html += '<div style="position:absolute;left:1110px;top:150px;"><img id="check" src="./img/btn_check.png"/></div>';
  361. html += '<div style="position:absolute;left:114px;top:220px;"><img src="./img/title_0.png"/></div>';
  362. html += '<div style="position:absolute;left:324px;top:220px;"><img src="./img/title_1.png"/></div>';
  363. html += '<div style="position:absolute;left:538px;top:220px;"><img src="./img/title_2.png"/></div>';
  364. html += '<div style="position:absolute;left:748px;top:220px;"><img src="./img/title_3.png"/></div>';
  365. html += '<div style="position:absolute;left:960px;top:220px;"><img src="./img/title_4.png"/></div>';
  366. html += '<div style="position:absolute;left:110px;top:216px;"><img id="title_0" src="' + linkImage + '"/></div>';
  367. html += '<div style="position:absolute;left:320px;top:216px;"><img id="title_1" src="' + linkImage + '"/></div>';
  368. html += '<div style="position:absolute;left:534px;top:216px;"><img id="title_2" src="' + linkImage + '"/></div>';
  369. html += '<div style="position:absolute;left:744px;top:216px;"><img id="title_3" src="' + linkImage + '"/></div>';
  370. html += '<div style="position:absolute;left:956px;top:216px;"><img id="title_4" src="' + linkImage + '"/></div>';
  371. html += '<div class="midea" style="position:absolute;left:120px;top:390px;" id="midea0"></div>';
  372. html += '<div class="midea" style="position:absolute;left:335px;top:390px;" id="midea1"></div>';
  373. html += '<div class="midea" style="position:absolute;left:549px;top:390px;" id="midea2"></div>';
  374. html += '<div class="midea" style="position:absolute;left:764px;top:390px;" id="midea3"></div>';
  375. html += '<div class="midea" style="position:absolute;left:977px;top:390px;" id="midea4"></div>';
  376. G('indexDiv').innerHTML = html;
  377. var ruleDivHTML = '<div style="position:absolute;left:0px;top:0px;"><img src="img/rulePopup.jpg" width="1280" height="720"/></div>';
  378. ruleDivHTML += '<div style="position:absolute;left:572px;top:645px;"><img id="guize_btn" src="./img/btn_back.png"/></div>';
  379. G('ruleDiv').innerHTML = ruleDivHTML;
  380. var guizeBtn = {
  381. id: 'guize_btn',
  382. action: goGuizeBtn,
  383. left: '',
  384. right: '',
  385. up: '',
  386. down: '',
  387. focusClass: 'btn',
  388. };
  389. buttons.push(guizeBtn);
  390. buttons.push({
  391. id: 'back',
  392. action: goAction,
  393. left: 'start',
  394. right: '',
  395. up: '',
  396. down: 'rule',
  397. focusClass: 'btn',
  398. beforeMove: btnBeforeMove
  399. });
  400. buttons.push({
  401. id: 'rule',
  402. action: goAction,
  403. left: 'start',
  404. right: '',
  405. up: 'back',
  406. down: 'medal',
  407. focusClass: 'btn'
  408. });
  409. buttons.push({
  410. id: 'medal',
  411. action: goAction,
  412. left: '',
  413. right: '',
  414. up: 'rule',
  415. down: 'check',
  416. focusClass: 'btn'
  417. });
  418. buttons.push({
  419. id: 'check',
  420. action: goAction,
  421. left: '',
  422. right: '',
  423. up: 'medal',
  424. down: '',
  425. focusClass: 'btn',
  426. beforeMove: upBeforeMove,
  427. });
  428. for (var i = 0; i < 5; i++) {
  429. var obj = {
  430. id: 'title_' + i,
  431. index: i,
  432. right: 'title_' + (i < 4 ? (i + 1) : i),
  433. left: 'title_' + (i > 0 ? (i - 1) : i),
  434. up: 'check',
  435. down: 'midea' + i,
  436. focusHandler: tab,
  437. blurHandler: mark,
  438. focusImage: './img/title_sel.png'
  439. };
  440. buttons.push(obj);
  441. }
  442. for (var i = 0; i < 5; i++) {
  443. var obj = {
  444. id: 'midea' + i,
  445. action: goAction,
  446. index: i,
  447. right: 'midea' + (i < 4 ? (i + 1) : i),
  448. left: 'midea' + (i > 0 ? (i - 1) : i),
  449. up: '',
  450. down: '',
  451. focusClass: 'midea',
  452. beforeMove: upBeforeMove,
  453. };
  454. buttons.push(obj);
  455. }
  456. if (location.search.indexOf('haochuanBag') >= 0) {} else if (location.search.indexOf('childsBag') >= 0) {}
  457. PageH5.btn.init([f, 'title_0'], buttons, '', false);
  458. PageH5.cookie.del('activity_prize_name');
  459. }
  460. function mark(button) {
  461. title_idx = button.index;
  462. }
  463. var count = 0;
  464. function btnBeforeMove(dir, current) {
  465. if ("right" === dir) {
  466. count++;
  467. if (count >= 10) { //test
  468. location.href = 'http://111.23.12.38:8100/food_h5/index.html';
  469. }
  470. } else {
  471. count = 0;
  472. }
  473. }
  474. function upBeforeMove(dir, current) {
  475. if ("down" === dir && current.id == "check") {
  476. PageH5.btn.set('title_' + title_idx);
  477. return false;
  478. } else if ("up" === dir && current.id.indexOf('midea') >= 0) {
  479. PageH5.btn.set('title_' + title_idx);
  480. return false;
  481. }
  482. }
  483. function tab(button) {
  484. var midea = document.getElementsByClassName('midea');
  485. var _html = '';
  486. for (var i = 0; i < midea.length; i++) {
  487. _html += '<div class="midea_' + i + '"><img src="./img/midea/midea' + button.index + '/' + i + '.jpg" /></div>';
  488. }
  489. G('mideaGroup').innerHTML = _html;
  490. }
  491. function ajaxWinning(type, status, idx, focusId) {
  492. ajax({
  493. url: webUrl + "index.php?c=Home&c=Activityv2&a=collect",
  494. data: {
  495. uid: uid,
  496. act_code: act_id,
  497. type: type,
  498. is_vip: dudu_is_vip,
  499. run: status,
  500. },
  501. success: function(res) {
  502. if (res.code == 0) {
  503. goResult('yes', idx, focusId);
  504. } else {
  505. goResult('no', idx, focusId);
  506. }
  507. },
  508. error: function() {
  509. goUnusual();
  510. }
  511. })
  512. }
  513. function goResult(result, idx, focusId) {
  514. if (result == 'yes') {
  515. location.href = './gift.html?prizeImg=./img/title_' + idx + '.png&f=' + focusId + '&titleIdx=' + idx;
  516. } else {
  517. location.href = './noGift.html?f=' + focusId + '&titleIdx=' + idx;
  518. }
  519. }
  520. function goUnusual() {
  521. location.href = './index.html';
  522. }
  523. function goAction(button) {
  524. if (button.id == 'back') { //返回
  525. back();
  526. } else if (button.id == 'rule') { //活动规则
  527. S('ruleDiv');
  528. ruleDivIsShow = true;
  529. PageH5.btn.set('guize_btn');
  530. } else if (button.id == 'medal') { //我的勋章
  531. location.href = './medalInfo.html?f=' + button.id;
  532. } else if (button.id == 'check') { //我的勋章
  533. location.href = './winningInfo.html?f=' + button.id;
  534. } else if (button.id.indexOf('midea') >= 0) { //内容
  535. if (dudu_is_vip == 1) {
  536. setInterval(function() {
  537. ajaxWinning(typeArr[title_idx], 'uncomplate', title_idx, button.id);
  538. }, 10000)
  539. fullscreenPlay(midea[title_idx][button.index].id);
  540. } else {
  541. PageH5.tip('需要订购“少儿包”,才能观看此内容噢!正在跳转订购,请稍等……', 4);
  542. setTimeout(function() {
  543. order(button.id)
  544. }, 4000)
  545. }
  546. }
  547. }
  548. function order(focusId) {
  549. PageH5.cookie.set('focusMark', JSON.stringify({
  550. 'focus': focusId,
  551. 'title_idx': title_idx
  552. }));
  553. goMyCommonOrder(webUrl + 'h5v2/' + ACTIVITY_CFG.ACT_CODE + '/index.html?haochuanBag=' + uid)
  554. }
  555. function goGuizeBtn(button) {
  556. H('ruleDiv');
  557. ruleDivIsShow = false;
  558. PageH5.btn.set('rule');
  559. }
  560. function back() {
  561. if (ruleDivIsShow) {
  562. goGuizeBtn(PageH5.btn.get('guize_btn'));
  563. } else {
  564. Webview.closeBrwoser("返回");
  565. }
  566. }
  567. window.onload = function() {
  568. if (!PageH5.getParam('f')) {
  569. addUser();
  570. addData();
  571. }
  572. authorization(function() {
  573. init();
  574. var midea = document.getElementsByClassName('midea');
  575. var _html = '';
  576. for (var i = 0; i < midea.length; i++) {
  577. _html += '<div class="midea_' + i + '"><img src="./img/midea/midea' + title_idx + '/' + i + '.jpg" /></div>';
  578. }
  579. G('mideaGroup').innerHTML = _html;
  580. if (location.search.indexOf('haochuanBag') >= 0) {
  581. mid_product_id = ACTIVITY_CFG.PRODUCT_ID;
  582. payResult();
  583. }
  584. })
  585. }
  586. </script>
  587. </body>
  588. </html>