index1.html 49 KB

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