index1.html 51 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="page-view-size" content="1280*720" />
  6. <title>"鼠"你最棒,萌宝"潮"贺岁</title>
  7. <link rel="stylesheet" type="text/css" href="css/page1.css" />
  8. </head>
  9. <body>
  10. <div class="main">
  11. <div id="scrollCont">
  12. <div class="code">
  13. <img id="QRcode" src="" alt="" />
  14. <span>扫码上传萌娃贺岁视频</span>
  15. <span>拼人气赢大奖</span>
  16. </div>
  17. <div class="page_btn pg0"></div>
  18. <div class="page_btn pg1"></div>
  19. <div class="page_btn pg2"></div>
  20. <div class="page_btn pg3"></div>
  21. <div class="page_btn pg4" id="othersProduct"></div>
  22. <!-- <div class="page_btn pg5" id="oursProduct"></div> -->
  23. <div class="prizeNum">抽奖机会:<span id="num"></span></div>
  24. <ul class="list" id="ipUl">
  25. <li class="ip_btn ip1"></li>
  26. <li class="ip_btn ip2"></li>
  27. <li class="ip_btn ip3"></li>
  28. <li class="ip_btn ip4"></li>
  29. <li class="ip_btn ip5"></li>
  30. <li class="ip_btn ip6"></li>
  31. </ul>
  32. <div class="voteGroup">
  33. <div class="tit1">
  34. <img src="img/tit1.png" height="63" width="472" alt="" />
  35. <div class="times"><img src="img/piaoshu.png" height="29" width="109" alt="" /><span id="number"></span></div>
  36. </div>
  37. <ul class="voteList" id="voteUl">
  38. <!-- <li class="voteLi">
  39. <div class="u_img"><img src="img/demo.jpg" alt="" /><i></i></div><div class="u_msg">张宇涵</div><span class="voteBtn">投你一票</span>
  40. </li> -->
  41. </ul>
  42. </div>
  43. <div id="rulesPopup" class="popup">
  44. <div class="rules_btn"></div>
  45. <div class="bar">
  46. <span id="miniBar" class="progress"></span>
  47. </div>
  48. </div>
  49. <div id="lotteryPopup" class="popup">
  50. <div class="lottery_btn confirm"></div>
  51. </div>
  52. <div id="prizePopup" class="popup">
  53. <img id="prizeImg" src="" alt="" style="position: absolute;left: 515px;top: 180px;"/>
  54. <p id="ptizeName" style="text-align: center;width: 180px;height: 50px;line-height: 50px;position: absolute;left: 554px;top: 457px;color: #dd002b;font-size: 25px;font-weight: bold;"></p>
  55. <div class="prizeBtn cancel"></div>
  56. <div class="prizeBtn toExchange"></div>
  57. </div>
  58. <div id="exchangePopup" class="popup">
  59. <img id="myPrize" src="" alt="" style="position: absolute;left: 330px;top: 260px;" />
  60. <div id="phone"></div>
  61. <ul id="keyBoard">
  62. <li class="phoneNum">1</li>
  63. <li class="phoneNum">2</li>
  64. <li class="phoneNum">3</li>
  65. <li class="phoneNum">4</li>
  66. <li class="phoneNum">5</li>
  67. <li class="phoneNum">6</li>
  68. <li class="phoneNum">7</li>
  69. <li class="phoneNum">8</li>
  70. <li class="phoneNum">9</li>
  71. <li class="phoneNum">0</li>
  72. <li class="phoneNum otherBtn">删除</li>
  73. <li class="phoneNum otherBtn">清空</li>
  74. </ul>
  75. <div class="exchangeBtn confirm"></div>
  76. <div class="exchangeBtn cancel"></div>
  77. </div>
  78. <div id="unWinToyPopup" class="popup">
  79. <div id="product1" class="unWinToyBtn"></div>
  80. <!-- <div id="product2" class="unWinToyBtn"></div> -->
  81. <div class="unWinToyBtn confirm"></div>
  82. </div>
  83. <div id="unWinToyVipPopup" class="popup">
  84. <div class="pmodel pmodel_1"></div>
  85. <div class="pmodel pmodel_2"></div>
  86. <div class="pmodel pmodel_3"></div>
  87. <div class="poster poster_1"></div>
  88. <div class="poster poster_2"></div>
  89. <div class="poster poster_3"></div>
  90. <div class="unWinToyVipBtn confirm"></div>
  91. </div>
  92. <!-- 中奖查询 -->
  93. <div id="awardPopup" class="popup">
  94. <div id="prizelog"></div>
  95. <div id="myAward"></div>
  96. <div id="myPhone"></div>
  97. <div class="awardBtn cancel"></div>
  98. <div class="awardBtn toAward"></div>
  99. </div>
  100. <div id="markDownPopup" class="popup">
  101. <div class="markDownBtn confirm"></div>
  102. </div>
  103. </div>
  104. </div>
  105. <script src="./js/webview.js" type="text/javascript"></script>
  106. <script src="./js/tvSysBtnBind.v2.js" type="text/javascript"></script>
  107. <script src="./js/comm.js" type="text/javascript"></script>
  108. <script type="text/javascript">
  109. try {
  110. var uid = Webview.readSystemProp('user.id');
  111. var usertoken = Webview.readSystemProp('user.token');
  112. var mac = Webview.readSystemProp('device.mac');
  113. var version = Webview.readSystemProp('app.version');
  114. } catch (e) {
  115. var uid = getStr("uid") || '0100834547692768574';
  116. var usertoken = "00139025650832263889980824152950"
  117. var mac = 'OC-41-E9-DD-EC-DE'
  118. var version = "YYS.4.6.15.266.5.HNDX.0.0_Release"
  119. }
  120. var init = {
  121. is_vip:0,
  122. act_id:2,
  123. gameNum:0,
  124. theme_id:2,
  125. fromsource:15,
  126. oursId:"8801000638",//"8801000079",
  127. othersId:"8801000646",//不用
  128. oursProduct_isVip:0,
  129. othersProduct_isVip:0,
  130. contentcode:"00000001000000000018000000431421",//少儿月包 00000001000000000025000000024157
  131. // contentcode1:"D00000001201905291020410009898494",
  132. }
  133. var webUrl = 'http://111.23.13.123:8091/';
  134. var backUrl = webUrl+'h5v2/mw_20200108_act/index1.html';
  135. // var indexUrl = webUrl+'html/index.html?activity='+init.act_id;
  136. var link = "http://111.23.12.38:8093/h5/act/index.html?mark="+uid;//http://120.78.169.79/h5/act/index.html";
  137. var videoId = "00000001000000000033000000121962";
  138. var videoArr = ["00000001000000000014000000153851","00000001000000000032000000221170","00000001000000000025000000326508","00000001000000000028000000428043","00000001000000000026000000325529","00000001000000000015000000283749"]
  139. var mengwaMediaArr = [],voteArr = [],numArr=[];
  140. var pageConf = {
  141. focusIdx:3,
  142. focusItem:"page_btn",
  143. }
  144. var listM = 0;
  145. var heguiItem = "";
  146. var changeOrwin = "";
  147. var rulesPopup = false;
  148. var errorMark = false;
  149. var rulesMark = 0;
  150. var data = new Object();
  151. data.rules = {
  152. page_btn:{
  153. 0:[3,0,0,1],
  154. 1:[2,-1,0,1],
  155. 2:[1,-1,0,1],
  156. 3:[0,-1,-1,0],
  157. 4:[0,-1,0,["ip_btn",2]],
  158. onEnterPress:function(){
  159. switch (this.currentIndex) {
  160. case 0:
  161. onBack();
  162. break;
  163. case 1:
  164. stopPlay();
  165. rulesPopup = true;
  166. S("rulesPopup");
  167. this.reSetClass("rules_btn",1);
  168. break;
  169. case 2:
  170. prizelog(uid,init.act_id,function(res){
  171. if (res.code == 0) {
  172. var content = [];
  173. for (var i = 0; i < res.data.length; i++) {
  174. var temp = document.createElement("div");
  175. temp.className = "prizelogRow"
  176. var span1 = document.createElement("div");
  177. span1.className = "prizelogCol1";
  178. var span2 = document.createElement("div");
  179. span2.className = "prizelogCol2";
  180. var span3 = document.createElement("div");
  181. span3.className = "prizelogCol3";
  182. span1.innerText = res.data[i].user_phone;
  183. span2.innerText = res.data[i].prize_name;
  184. span3.innerText = res.data[i].created_at;
  185. temp.appendChild(span1);
  186. temp.appendChild(span2);
  187. temp.appendChild(span3);
  188. content[i] = temp;
  189. }
  190. if (content.length > 4) {
  191. var start = 0;
  192. var end = 4;
  193. var newsHtml = G("prizelog");
  194. var newsTimer = setInterval(function () {
  195. newsHtml.innerHTML = '';
  196. var showNews = content.slice(start, end);
  197. for (var i = 0; i < showNews.length; i++) {
  198. newsHtml.appendChild(showNews[i]);
  199. }
  200. start += 1;
  201. end += 1;
  202. if (start > content.length - 1) {
  203. start = 0;
  204. end = 4;
  205. }
  206. }, 1500)
  207. } else {
  208. var newsHtml = G("prizelog");
  209. newsHtml.innerHTML = '';
  210. var showNews = content;
  211. for (var i = 0; i < showNews.length; i++) {
  212. newsHtml.appendChild(showNews[i]);
  213. }
  214. }
  215. }
  216. })
  217. userPrizelog(uid,init.act_id,function(res){
  218. if(res.code==0){
  219. if (res.data.my_prizes[0]) {
  220. G("myAward").innerText = res.data.my_prizes[0].prize_name;
  221. G("myPrize").src = res.data.my_prizes[0].show_image;
  222. G("myPhone").innerText = res.data.my_prizes[0].user_phone;
  223. }
  224. if (res.data.user_phone) {
  225. document.getElementById("myPhone").innerText = res.data.user_phone.user_phone;
  226. }
  227. if(res.data.my_prizes[0] && res.data.user_phone.phone_status==2){
  228. init.canPrize = 1;
  229. }else if(res.data.my_prizes[0] && res.data.user_phone.phone_status==1){
  230. init.canPrize = 2
  231. }
  232. }
  233. });
  234. stopPlay();
  235. S("awardPopup");
  236. this.reSetClass("awardBtn");
  237. break;
  238. case 3:
  239. fullscreenPlay(videoId,"1");
  240. break;
  241. case 4:
  242. order(0);
  243. break;
  244. default:
  245. break;
  246. }
  247. },
  248. onPress:function(){
  249. if((this.event.keyCode == 40 || this.event.keyCode == "DOWN")&& this.prevIndex == 3){
  250. if(init.oursProduct_isVip == 0){
  251. this.reSetClass("page_btn",4);
  252. }else{
  253. stopPlay();
  254. G("scrollCont").style.top = - 500 + "px";
  255. this.reSetClass("ip_btn",2);
  256. }
  257. }
  258. },
  259. },
  260. ip_btn:{
  261. line:6,
  262. down:["voteBtn"],
  263. onEnterPress:function(){
  264. details_page(videoArr[this.currentIndex]);
  265. },
  266. onPress:function(){
  267. stopPlay();
  268. G("scrollCont").style.top = - 500 + "px";
  269. if(errorMark){
  270. errorMark = false;
  271. return;
  272. }
  273. if(this.event.keyCode == 38 || this.event.keyCode == "UP"){
  274. try{
  275. smallvodPlay(videoId);
  276. }catch(e){
  277. }
  278. G("scrollCont").style.top = 0;
  279. if(init.oursProduct_isVip == 0){
  280. this.reSetClass("page_btn",4);
  281. }
  282. else{
  283. this.reSetClass("page_btn",3);
  284. }
  285. }
  286. },
  287. },
  288. voteBtn:{
  289. line:4,
  290. up:["ip_btn",2],
  291. onEnterPress:function(){
  292. if(!this.current.getAttribute("data-mark")){
  293. var idx = this.currentIndex>3?this.currentIndex-4:this.currentIndex;
  294. fullscreenPlay(mengwaMediaArr[idx],numArr[idx]);
  295. }else{
  296. vote(uid,voteArr[this.currentIndex-4],function(res){
  297. if(res.code == 0){
  298. G("number").innerHTML = res.data.num;
  299. G("vote"+(main.currentIndex-4)).innerHTML = G("vote"+(main.currentIndex-4)).innerHTML*1+1;
  300. tips("投票成功");
  301. getPrizeNum(uid,function(res){
  302. if(res.code==0){
  303. init.gameNum = res.data.num>=0?res.data.num:0;
  304. G("num").innerHTML = res.data.num>=0?res.data.num:0;
  305. if( res.data.num>0){
  306. setCookie("mark",main.currentIndex)
  307. S("lotteryPopup");
  308. main.reSetClass("lottery_btn",0);
  309. }
  310. }
  311. })
  312. }else if(res.code == "-1"){
  313. tips("您的票已用完");
  314. }
  315. })
  316. }
  317. },
  318. onPress:function(){
  319. if(this.event.keyCode == 40 || this.event.keyCode == "DOWN"){
  320. if(this.prevIndex+4>=this.hotbtn.length){
  321. if(this.prevIndex == this.hotbtn.length-1) return;
  322. if(this.prevIndex == this.hotbtn.length-2){
  323. this.reSetClass("voteBtn",this.hotbtn.length-1);
  324. }else{
  325. this.reSetClass("voteBtn",this.hotbtn.length-listM);
  326. }
  327. }else if(!!this.prev.getAttribute("data-mark") && !!this.hotbtn[this.prevIndex+4].getAttribute("data-mark")){
  328. this.reSetClass("voteBtn",this.hotbtn.length-2);
  329. }
  330. }else if(this.event.keyCode == 38 || this.event.keyCode == "UP"){
  331. if(this.prev.getAttribute("data-key")){
  332. this.reSetClass("voteBtn",this.prevIndex-listM);
  333. }
  334. }
  335. if(!this.current.getAttribute("data-mark")){
  336. var h = document.getElementsByClassName("voteTxt")[0].offsetHeight+document.getElementsByClassName("voteLi")[0].offsetHeight+20
  337. G("scrollCont").style.top = - 770-(parseInt(this.currentIndex/4/2)*h) + "px";
  338. }
  339. errorMark = true;
  340. },
  341. },
  342. rules_btn:{
  343. line:1,
  344. onEnterPress:function(){
  345. closeRulesPopup();
  346. },
  347. onPress:function(){
  348. if(this.event.keyCode == 40 || this.event.keyCode == "DOWN"){
  349. if(rulesMark<2)rulesMark+=1;
  350. G("miniBar").style.top = rulesMark*200+"px";
  351. G("rulesPopup").style.top = (-(rulesMark*580))+"px";
  352. }else if(this.event.keyCode == 38 || this.event.keyCode == "UP"){
  353. if(rulesMark>0)rulesMark-=1;
  354. G("miniBar").style.top = rulesMark*200+"px";
  355. G("rulesPopup").style.top = (-(rulesMark*580))+"px";
  356. }
  357. }
  358. },lottery_btn:{
  359. line:1,
  360. onEnterPress:function(){
  361. prize(function(res){
  362. if(res.code==0){
  363. init.gameNum -= 1;
  364. H("lotteryPopup");
  365. if(res.data.yes.prize_status=="none"){
  366. nowin("nowin");
  367. }else if(res.data.yes.prize_status=="real"){//中奖
  368. G("prizeImg").src = res.data.yes.prize_img;
  369. G("ptizeName").innerHTML = res.data.yes.prize_name;
  370. G("myPrize").src = res.data.yes.prize_img;
  371. S("prizePopup");
  372. main.reSetClass("prizeBtn",1);
  373. }
  374. }
  375. })
  376. },
  377. onPress:function(){
  378. },
  379. onBack:function(){
  380. H("lotteryPopup");
  381. this.reSetClass("voteBtn");
  382. }
  383. },
  384. awardBtn:{
  385. line:2,
  386. onEnterPress:function(){
  387. if(this.currentIndex == 0){
  388. try{
  389. smallvodPlay(videoId);
  390. }catch(e){
  391. }
  392. H("awardPopup");
  393. this.reSetClass("page_btn",2);
  394. }else if(this.currentIndex == 1){
  395. if(init.canPrize == 1){
  396. H("awardPopup");
  397. S("exchangePopup");
  398. heguiItem = "page_btn";
  399. this.reSetClass("exchangeBtn",0);
  400. }else if(init.canPrize == 2){
  401. tips("您已提交手机号码!")
  402. }else{
  403. tips("您还未中奖,请继续加油噢!")
  404. }
  405. }
  406. },
  407. onBack:function(){
  408. try{
  409. smallvodPlay(videoId);
  410. }catch(e){
  411. }
  412. H("awardPopup");
  413. this.reSetClass("page_btn",2);
  414. },
  415. },
  416. prizeBtn:{
  417. line:2,
  418. onEnterPress:function(){
  419. if(this.currentIndex == 0){
  420. H("prizePopup");
  421. this.reSetClass("voteBtn");
  422. }else{
  423. H("prizePopup");
  424. S("exchangePopup");
  425. heguiItem = "voteBtn";
  426. this.reSetClass("exchangeBtn",0);
  427. }
  428. },
  429. onBack:function(){
  430. H("prizePopup");
  431. this.reSetClass("voteBtn");
  432. },
  433. },
  434. exchangeBtn:{
  435. 0:[0,["phoneNum",6],1,0],
  436. 1:[-1,["phoneNum",8],0,0],
  437. "onEnterPress":exchangePopups,
  438. "onPress":cellphoneNum,
  439. onBack:function(){
  440. H("exchangePopup");
  441. G("phone").innerHTML = "";
  442. if(heguiItem == "page_btn"){
  443. try{
  444. smallvodPlay(videoId);
  445. }catch(e){
  446. }
  447. }
  448. this.reSetClass(heguiItem);
  449. },
  450. },
  451. phoneNum:{
  452. line:6,
  453. down:["exchangeBtn",1],
  454. onEnterPress:function(){
  455. if(this.currentIndex<=9){
  456. if(G("phone").innerHTML.length>10) return;
  457. if(this.currentIndex == 9){
  458. G("phone").innerHTML += 0;
  459. }else{
  460. G("phone").innerHTML += this.currentIndex*1+1;
  461. }
  462. }else if(this.currentIndex == 10){
  463. if(G("phone").innerHTML.length>0)
  464. G("phone").innerHTML = G("phone").innerHTML.slice(0,-1);
  465. }else if(this.currentIndex == 11){
  466. if(G("phone").innerHTML.length>0)
  467. G("phone").innerHTML = "";
  468. }
  469. },
  470. "onPress":cellphoneNum,
  471. onBack:function(){
  472. if(G("phone").innerHTML.length>0){
  473. G("phone").innerHTML = G("phone").innerHTML.slice(0,-1);
  474. }else{
  475. H("exchangePopup");
  476. G("phone").innerHTML = "";
  477. if(heguiItem == "page_btn"){
  478. try{
  479. smallvodPlay(videoId);
  480. }catch(e){
  481. }
  482. }
  483. this.reSetClass(heguiItem);
  484. }
  485. },
  486. },
  487. markDownBtn:{
  488. line:1,
  489. onEnterPress:function(){
  490. H("markDownPopup");
  491. if(heguiItem == "page_btn"){
  492. try{
  493. smallvodPlay(videoId);
  494. }catch(e){
  495. }
  496. }
  497. this.reSetClass(heguiItem);
  498. },
  499. onBack:function(){
  500. H("markDownPopup");
  501. if(heguiItem == "page_btn"){
  502. try{
  503. smallvodPlay(videoId);
  504. }catch(e){
  505. }
  506. }
  507. this.reSetClass(heguiItem);
  508. },
  509. },
  510. unWinToyBtn:{
  511. 0:[0,0,0,1],
  512. 1:[0,-1,0,0],
  513. // 2:[0,0,0,0],
  514. onEnterPress:function(){
  515. if(this.currentIndex==1){
  516. H("unWinToyPopup");
  517. this.reSetClass("voteBtn");
  518. }else{
  519. order(this.currentIndex);
  520. }
  521. },
  522. onPress:function(){
  523. // if(this.prevIndex == 0){
  524. // if(this.event.keyCode == 40 || this.event.keyCode == "DOWN"){
  525. // if(init.oursProduct_isVip == 0){
  526. // this.reSetClass("unWinToyBtn",1);
  527. // }else{
  528. // this.reSetClass("unWinToyBtn",2);
  529. // }
  530. // }
  531. // }else if(this.prevIndex == 1){
  532. // if(this.event.keyCode == 38 || this.event.keyCode == "UP"){
  533. // if(init.othersProduct_isVip == 0){
  534. // this.reSetClass("unWinToyBtn",0);
  535. // }
  536. // }
  537. // }else if(this.prevIndex == 2){
  538. // if(this.event.keyCode == 38 || this.event.keyCode == "UP"){
  539. // if(init.oursProduct_isVip == 1){
  540. // this.reSetClass("unWinToyBtn",0);
  541. // }else if(init.oursProduct_isVip == 0){
  542. // this.reSetClass("unWinToyBtn",1);
  543. // }else if(init.othersProduct_isVip == 0){
  544. // this.reSetClass("unWinToyBtn",0);
  545. // }
  546. // }
  547. // }
  548. },
  549. onBack:function(){
  550. H("unWinToyPopup");
  551. this.reSetClass("voteBtn");
  552. },
  553. },
  554. unWinToyVipBtn:{
  555. line:1,
  556. up:["poster"],
  557. onEnterPress:function(){
  558. if(this.currentIndex==0){
  559. H("unWinToyVipPopup");
  560. if(!!getCookie("mark")&&(!!getCookie("gameItemIdx") || !!getCookie("itemIdx"))){
  561. this.reSetClass("voteBtn",getCookie("mark"));
  562. }else{
  563. this.reSetClass("voteBtn");
  564. }
  565. setCookie("gameItemIdx","");
  566. setCookie("itemIdx","");
  567. setCookie("mark","");
  568. }
  569. },
  570. onBack:function(){
  571. H("unWinToyVipPopup");
  572. if(!!getCookie("mark")&&(!!getCookie("gameItemIdx") || !!getCookie("itemIdx"))){
  573. this.reSetClass("voteBtn",getCookie("mark"));
  574. }else{
  575. this.reSetClass("voteBtn");
  576. }
  577. setCookie("gameItemIdx","");
  578. setCookie("itemIdx","");
  579. setCookie("mark","");
  580. },
  581. },
  582. poster:{
  583. line:3,
  584. down:["unWinToyVipBtn"],
  585. onEnterPress:function(){
  586. var url = '',index=this.currentIndex;
  587. if(changeOrwin == "nowin"){
  588. setCookie("gameItemIdx",index);
  589. }else{
  590. setCookie("itemIdx",index);
  591. }
  592. toZhuanti(index);
  593. },
  594. onBack:function(){
  595. H("unWinToyVipPopup");
  596. if(!!getCookie("mark")&&(!!getCookie("gameItemIdx") || !!getCookie("itemIdx"))){
  597. this.reSetClass("voteBtn",getCookie("mark"));
  598. }else{
  599. this.reSetClass("voteBtn");
  600. }
  601. setCookie("gameItemIdx","");
  602. setCookie("itemIdx","");
  603. setCookie("mark","");
  604. },
  605. },
  606. }
  607. function onBack(){
  608. if(rulesPopup){
  609. closeRulesPopup();
  610. }else{
  611. stopPlay();
  612. Webview.closeBrwoser("返回");
  613. // window.location.href = indexUrl;
  614. }
  615. }
  616. function userPrizelog(uid,act_id,fn) {
  617. juge();
  618. ajax({
  619. url: webUrl + "index.php?m=Home&c=Activityv2&a=userPrizelog",
  620. data: {
  621. uid: uid,
  622. act_id: act_id,
  623. is_vip: init.is_vip,
  624. },
  625. success: function (res) {
  626. fn && fn(res);
  627. },
  628. error: function () {
  629. fn && fn();
  630. }
  631. })
  632. }
  633. function exchangePopups(){
  634. if(this.currentIndex==1){
  635. H("exchangePopup");
  636. G("phone").innerHTML = "";
  637. if(heguiItem == "page_btn"){
  638. try{
  639. smallvodPlay(videoId);
  640. }catch(e){
  641. }
  642. }
  643. this.reSetClass(heguiItem);
  644. }else if(this.currentIndex==0){
  645. var phone = G("phone").innerText;
  646. var myreg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
  647. if(!myreg.test(phone)){
  648. tips('手机号码格式有误!');
  649. }else{
  650. juge();
  651. ajax({
  652. url: webUrl + "index.php?m=Home&c=Activityv2&a=setUserInfo",
  653. data: {
  654. uid: uid,
  655. act_id: init.act_id,
  656. is_vip: init.is_vip,
  657. phone: phone
  658. },
  659. success: function (res) {
  660. if(res.code == 0){
  661. H("exchangePopup");
  662. G("phone").innerHTML = "";
  663. S("markDownPopup");
  664. main.reSetClass("markDownBtn");
  665. }else{
  666. tips(res.msg);
  667. }
  668. }
  669. })
  670. }
  671. }
  672. }
  673. function toZhuanti(idx){
  674. var exitStr = escape(backUrl);
  675. var url = '';
  676. if(index==0){
  677. fullscreenPlay("00000001000000000002000000120684")
  678. }else if(index==1){
  679. fullscreenPlay("00000001000000000014000000387305")
  680. }else if(index==2){
  681. fullscreenPlay("00000001000000000029000000278889")
  682. }
  683. // window.location.href = url;
  684. }
  685. function details_page (id) {
  686. var playIntent = {
  687. package:"com.hunantv.operator",
  688. action: "mangotv://com.hunantv.operator/detail",
  689. data:"",
  690. extras: {
  691. media_assets_id: id,
  692. },
  693. flags: []
  694. };
  695. Webview.sendIntent("startActivity", playIntent);
  696. }
  697. function nowin(type){
  698. if(init.oursProduct_isVip==1||init.othersProduct_isVip==1){
  699. changeOrwin = type;
  700. if(type == "nowin"){
  701. G("unWinToyVipPopup").style.background = "url('./img/page_06.png') no-repeat center";
  702. }else{
  703. G("unWinToyVipPopup").style.background = "url('./img/page_08.png') no-repeat center";
  704. }
  705. S("unWinToyVipPopup");
  706. main.reSetClass("poster");
  707. }else{
  708. if(type == "nowin"){
  709. G("unWinToyPopup").style.background = "url('./img/page_05.png') no-repeat center";
  710. }else{
  711. G("unWinToyPopup").style.background = "url('./img/page_07.png') no-repeat center";
  712. }
  713. S("unWinToyPopup");
  714. main.reSetClass("unWinToyBtn");
  715. }
  716. }
  717. function closeRulesPopup(){
  718. try{
  719. smallvodPlay(videoId);
  720. }catch(e){
  721. }
  722. rulesPopup = false;
  723. H("rulesPopup");
  724. main.reSetClass("page_btn",1);
  725. }
  726. function order(idx){
  727. var pid = init.oursId;
  728. var mark = "mw_oursBag";
  729. // if(idx == 1){
  730. // pid = init.oursId;
  731. // mark = "mw_othersBag";
  732. // }
  733. var orderBack = backUrl+'?'+mark+'='+uid;
  734. if(version.indexOf("5a.7") || version.indexOf("5a.8")){
  735. var product_list={
  736. "product_id":pid,
  737. "video_name":"",
  738. "video_type":"",
  739. "product_type":"2",
  740. "cat_id":"",
  741. "channel_id":"",
  742. }
  743. window.location.href = "https://hnydorder.yys.mgtv.com:8080/order/index.html?product_list="+JSON.stringify(product_list)+"&exitStr="+escape(orderBack);
  744. }else{
  745. var playIntent = {
  746. package: "com.hunantv.operator",
  747. action: "mangotv://com.hunantv.operator/order",
  748. data: "",
  749. extras: {
  750. product: {
  751. "id": pid,
  752. "time": "",
  753. "price": "",
  754. "type": "",
  755. "name": "",
  756. "bag": "",
  757. "back_url":orderBack,
  758. }
  759. },
  760. flags: []
  761. };
  762. Webview.sendIntent("startActivity", playIntent);
  763. }
  764. }
  765. function prizelog(uid,act_id,fn) {
  766. juge();
  767. ajax({
  768. url: webUrl + "index.php?m=Home&c=Activityv2&a=prizelog",
  769. data: {
  770. uid: uid,
  771. act_id: act_id,
  772. is_vip: init.is_vip,
  773. },
  774. success: function (res) {
  775. fn && fn(res);
  776. },
  777. error: function () {
  778. fn && fn();
  779. }
  780. })
  781. }
  782. function prize(fn) {
  783. juge();
  784. ajax({
  785. url: webUrl + "index.php?m=Home&c=Activityv2&a=prize",
  786. data: {
  787. uid: uid,
  788. act_id: init.act_id,
  789. is_vip: init.is_vip,//is_vip1+is_vip2
  790. run: "complate",//'complate',
  791. is_test:1,
  792. },
  793. success: function (res) {
  794. fn && fn(res);
  795. },error:function(res){
  796. window.location.href = "../index.html";
  797. }
  798. })
  799. }
  800. function addData(fn) {
  801. ajax({
  802. url:webUrl+"index.php?m=Home&c=ThemeData&a=addData",
  803. data:{
  804. uid: uid,
  805. theme_id: init.theme_id,
  806. },
  807. success: function (res) {
  808. fn && fn(res);
  809. },
  810. error: function () {
  811. }
  812. })
  813. }
  814. function addUser(fn) {
  815. ajax({
  816. url:webUrl+"index.php?m=Home&c=DuduApi&a=addUser",
  817. data:{
  818. uid: uid,
  819. UserToken: usertoken
  820. },
  821. success: function (res) {
  822. fn && fn(res);
  823. },
  824. error: function () {
  825. }
  826. })
  827. }
  828. function authorization(contentcode,uid,usertoken,mac,version,fn) {
  829. ajax({
  830. url:webUrl+"index.php?m=Home&c=order&a=contentCTCAuth",
  831. data:{
  832. contentcode:contentcode,
  833. uid:uid, //2.0
  834. usertoken:usertoken,
  835. mac:mac,
  836. version:version,
  837. fromsource:init.fromsource,
  838. },
  839. type: "post",
  840. dataType: "json",
  841. success: function (res) {
  842. fn && fn(res);
  843. },
  844. error: function (e) {
  845. fn && fn(e);
  846. }
  847. })
  848. }
  849. function payResult(is_vip,uid,product_id){
  850. if(is_vip == 1){
  851. ajax({
  852. url:webUrl+"index.php?m=Home&c=DuduApi&a=payResult",
  853. data:{
  854. uid: uid,
  855. product_id:product_id,
  856. pay_result:0
  857. },
  858. success: function (res) {
  859. },
  860. error: function () {
  861. }
  862. })
  863. }
  864. }
  865. function createQrcode(uid,url,fn){
  866. ajax({
  867. url:webUrl+"index.php?m=Home&c=Activityv2&a=createQrcode",
  868. data:{
  869. act_id:init.act_id,
  870. is_vip:0,
  871. uid: uid,
  872. url:url,
  873. },
  874. success: function (res) {
  875. fn && fn(res);
  876. },
  877. error: function (e) {
  878. fn && fn(e);
  879. }
  880. })
  881. }
  882. function getMengbaoList(uid,fn) {
  883. juge();
  884. ajax({
  885. url:webUrl+"index.php?m=Home&c=Activityv2&a=getMengbaoList",
  886. data:{
  887. act_id:init.act_id,
  888. uid: uid,
  889. is_vip: init.is_vip,
  890. limit:100,
  891. },
  892. success: function (res) {
  893. fn && fn(res);
  894. },
  895. error: function () {
  896. }
  897. })
  898. }
  899. function getVoteChance(uid,fn) {
  900. juge();
  901. ajax({
  902. url:webUrl+"index.php?m=Home&c=Activityv2&a=getVoteChance",
  903. data:{
  904. act_id:init.act_id,
  905. uid: uid,
  906. is_vip: init.is_vip,
  907. },
  908. success: function (res) {
  909. fn && fn(res);
  910. },
  911. error: function () {
  912. }
  913. })
  914. }
  915. function vote(uid,voteid,fn) {
  916. juge();
  917. ajax({
  918. url:webUrl+"index.php?m=Home&c=Activityv2&a=vote",
  919. data:{
  920. act_id:init.act_id,
  921. uid: uid,
  922. is_vip: init.is_vip,
  923. mengbao_id:voteid,
  924. score:1,
  925. },
  926. success: function (res) {
  927. fn && fn(res);
  928. },
  929. error: function () {
  930. }
  931. })
  932. }
  933. function getPrizeNum(uid,fn) {
  934. juge();
  935. ajax({
  936. url:webUrl+"index.php?m=Home&c=Activityv2&a=getPrizeNum",
  937. data:{
  938. act_id:init.act_id,
  939. uid: uid,
  940. is_vip: init.is_vip,
  941. test:1,
  942. },
  943. success: function (res) {
  944. fn && fn(res);
  945. },
  946. error: function () {
  947. }
  948. })
  949. }
  950. function fullscreenPlay(mid,idx) {
  951. idx = idx || 0;
  952. var playIntent = {
  953. package : "com.hunantv.operator",
  954. action: "mangotv://com.hunantv.operator/player/vod",
  955. data:"",
  956. extras: {
  957. "video_index": idx,
  958. "media_asset_id": mid, //媒资包
  959. },
  960. flags: []
  961. };
  962. Webview.sendIntent("startActivity", playIntent);
  963. };
  964. function smallvodPlay(media_id,media_num){
  965. media_num = media_num || 0;
  966. stopPlay();
  967. try{
  968. starcorExt.setVideoWindowPosition("345", "179", "577", "323");
  969. var playIntent = {
  970. "video_type": "0",
  971. "media_asset_id": media_id,
  972. "video_index": media_num,
  973. };
  974. starcorExt.playVideo(playIntent);
  975. }catch(e){}
  976. };
  977. function stopPlay(){
  978. try{
  979. starcorExt.stopVideo();
  980. }catch(e){
  981. }
  982. }
  983. try{
  984. starcorExt.setHandler("Resume",function(isResumed){
  985. if(isResumed){//从全屏或设置键回来
  986. if(main.className == "page_btn"){
  987. smallvodPlay(videoId);
  988. }
  989. }
  990. });
  991. starcorExt.setHandler("PlayOnCompletion",function(isCompleted){
  992. if(isCompleted){//小视频播放结束
  993. smallvodPlay(videoId);
  994. }
  995. });
  996. }catch(e){
  997. }
  998. function cellphoneNum(){
  999. if(G("phone").innerHTML.length>10) return;
  1000. var key = this.event.keyCode;
  1001. try {
  1002. if (key >= 0 && key <= 9) {
  1003. G("phone").innerText += key;
  1004. }
  1005. } catch (e) {
  1006. if (key > 47 && key < 58) {
  1007. G("phone").innerText += (key - 48);
  1008. }
  1009. }
  1010. }
  1011. function times(){
  1012. getVoteChance(uid,function(res){
  1013. if(res.code==0){
  1014. G("number").innerHTML = res.data.num;
  1015. }
  1016. });
  1017. getPrizeNum(uid,function(res){
  1018. if(res.code==0){
  1019. init.gameNum = res.data.num>=0?res.data.num:0;
  1020. G("num").innerHTML = res.data.num>=0?res.data.num:0;
  1021. }
  1022. })
  1023. getMengbaoList(uid,function(res){
  1024. if(res.code==0){
  1025. var _html="",_li="",_span="";
  1026. listM = res.data.length%4;
  1027. var _len = res.data.length%4==0?res.data.length/4:parseInt(res.data.length/4)+1;
  1028. for(var i=0;i<_len;i++){
  1029. mengwaMediaArr.push(res.data[i].media_id);
  1030. numArr.push(res.data[i].media_id);
  1031. voteArr.push(res.data[i].media_num);
  1032. _li="";_span="";
  1033. for(var j=0;j<4;j++){
  1034. if(i*4+j<res.data.length){
  1035. _li+= '<li class="voteLi"><div class="u_img voteBtn"><img src="'+res.data[i*4+j].image+'" alt="" /><i id="vote'+(i*4+j)+'">'+res.data[i*4+j].score+'</i></div><div class="u_msg">'+res.data[i*4+j].name+'&nbsp;&nbsp;'+res.data[i*4+j].age+'</div></li>';
  1036. if(i==_len-1&&res.data.length%4!=0){
  1037. _span += '<span class="voteBtn voteTxt" data-mark="1" data-key="1"><i>投你一票</i></span>';
  1038. }else{
  1039. _span += '<span class="voteBtn voteTxt" data-mark="1"><i>投你一票</i></span>';
  1040. }
  1041. }else if(i*4+j>=res.data.length&&(i*4+j)<res.data.length+(4-(res.data.length%4))){
  1042. _li+= '<li class="voteLi" style="width: 239px;height: 200px;"></li>';
  1043. _span += '<span class="blacktxt"><i></i></span>';
  1044. }
  1045. }
  1046. _html += (_li + _span);
  1047. }
  1048. G("voteUl").innerHTML = _html;
  1049. }
  1050. })
  1051. }
  1052. function pageInit(){
  1053. if(!getStr("mw_oursBag") && !getStr("mw_othersBag") && !getStr("for")){
  1054. addUser();
  1055. addData();
  1056. }
  1057. createQrcode(uid,link,function(res){
  1058. if(res.code == 0){
  1059. G("QRcode").src = res.data.qrcode;
  1060. }
  1061. })
  1062. authorization(init.contentcode,uid,usertoken,mac,version,function(res){
  1063. if(res.code == 0 && res.data.result==0){
  1064. init.oursProduct_isVip = 1;
  1065. addClass(G("othersProduct"),'hasOrder');
  1066. if(!!getStr("mw_oursBag")){
  1067. payResult(init.oursProduct_isVip,uid,init.oursId);
  1068. };
  1069. times();
  1070. }else{
  1071. init.oursProduct_isVip = 0;
  1072. times();
  1073. }
  1074. },function(){
  1075. times();
  1076. });
  1077. // if(!!getCookie("itemIdx") || !!getCookie("gameItemIdx")){
  1078. // if(!!getCookie("itemIdx")){
  1079. // G("unWinToyVipPopup").style.background = "url('./img/page_08.png') no-repeat center";
  1080. // }else{
  1081. // G("unWinToyVipPopup").style.background = "url('./img/page_06.png') no-repeat center";
  1082. // }
  1083. // var idx = (!!getCookie("mark"))?getCookie("mark")-4:0;
  1084. // var h = document.getElementsByClassName("voteTxt")[0].offsetHeight+document.getElementsByClassName("voteLi")[0].offsetHeight+20
  1085. // G("scrollCont").style.top = - 770-(parseInt(idx/4/2)*h) + "px";
  1086. // S("unWinToyVipPopup");
  1087. // pageConf.focusItem = "poster";
  1088. // pageConf.focusIdx = getCookie("itemIdx");
  1089. // setCookie("gameItemIdx","");
  1090. // setCookie("itemIdx","");
  1091. // }
  1092. btnInit();
  1093. }
  1094. function juge(){
  1095. if(init.isYearVip){
  1096. init.is_vip = 2;
  1097. }
  1098. else if(init.othersProduct_isVip || init.oursProduct_isVip || init.allProduce_isVip){
  1099. init.is_vip = 1;
  1100. }
  1101. else if(init.othersProduct_isVip==0 && init.oursProduct_isVip==0){
  1102. init.is_vip = 0;
  1103. }
  1104. }
  1105. function btnInit(){
  1106. if(!!getStr("for")){
  1107. pageConf.focusItem = "ip_btn";
  1108. pageConf.focusIdx = getStr("for");
  1109. G("scrollCont").style.top = - 500 + "px";
  1110. }
  1111. if(pageConf.focusItem == "page_btn"){
  1112. smallvodPlay(videoId);
  1113. }
  1114. var btnConfig = {
  1115. className: pageConf.focusItem,
  1116. currentIndex: pageConf.focusIdx,
  1117. rules: data.rules,
  1118. onBack:onBack,
  1119. isFloatLast:true,
  1120. }
  1121. window.main = new tvSysBtnBind(btnConfig);
  1122. main.reLoad();
  1123. }
  1124. pageInit();
  1125. window.onunload = function(){
  1126. stopPlay();
  1127. }
  1128. </script>
  1129. </body>
  1130. </html>