index1.html 49 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166
  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="" /> -->
  54. <p id="ptizeName"></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="" /> -->
  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"></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==2){
  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",2);
  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. },
  924. success: function (res) {
  925. fn && fn(res);
  926. },
  927. error: function () {
  928. }
  929. })
  930. }
  931. function fullscreenPlay(mid) {
  932. var playIntent = {
  933. package : "com.hunantv.operator",
  934. action: "mangotv://com.hunantv.operator/player/vod",
  935. data:"",
  936. extras: {
  937. "video_index": 0,
  938. "media_asset_id": mid, //媒资包
  939. },
  940. flags: []
  941. };
  942. Webview.sendIntent("startActivity", playIntent);
  943. };
  944. function smallvodPlay(media_id,media_num){
  945. media_num = media_num || 0;
  946. stopPlay();
  947. try{
  948. starcorExt.setVideoWindowPosition("345", "179", "577", "323");
  949. var playIntent = {
  950. "video_type": "0",
  951. "media_asset_id": media_id,
  952. "video_index": media_num,
  953. };
  954. starcorExt.playVideo(playIntent);
  955. }catch(e){}
  956. };
  957. function stopPlay(){
  958. try{
  959. starcorExt.stopVideo();
  960. }catch(e){
  961. }
  962. }
  963. try{
  964. starcorExt.setHandler("Resume",function(isResumed){
  965. if(isResumed){//从全屏或设置键回来
  966. if(main.className == "page_btn"){
  967. smallvodPlay(videoId);
  968. }
  969. }
  970. });
  971. starcorExt.setHandler("PlayOnCompletion",function(isCompleted){
  972. if(isCompleted){//小视频播放结束
  973. smallvodPlay(videoId);
  974. }
  975. });
  976. }catch(e){
  977. }
  978. function cellphoneNum(){
  979. if(G("phone").innerHTML.length>10) return;
  980. var key = this.event.keyCode;
  981. try {
  982. Webview.setInputTypeTextFlag("true");
  983. if (key >= 0 && key <= 9) {
  984. G("phone").innerText += key;
  985. }
  986. } catch (e) {
  987. if (key > 47 && key < 58) {
  988. G("phone").innerText += (key - 48);
  989. }
  990. }
  991. }
  992. function times(){
  993. getVoteChance(uid,function(res){
  994. if(res.code==0){
  995. G("number").innerHTML = res.data.num;
  996. }
  997. });
  998. getPrizeNum(uid,function(res){
  999. if(res.code==0){
  1000. init.gameNum = res.data.num>=0?res.data.num:0;
  1001. G("num").innerHTML = res.data.num>=0?res.data.num:0;
  1002. }
  1003. })
  1004. getMengbaoList(uid,function(res){
  1005. if(res.code==0){
  1006. var _html="",_li="",_span="";
  1007. var _len = res.data.length%4==0?res.data.length/4:parseInt(res.data.length/4)+1;
  1008. for(var i=0;i<_len;i++){
  1009. mengwaMediaArr.push(res.data[i].media_id);
  1010. numArr.push(res.data[i].media_id);
  1011. voteArr.push(res.data[i].media_num);
  1012. _li="";_span="";
  1013. for(var j=0;j<4;j++){
  1014. if(i*4+j>=res.data.length) return;
  1015. _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>';
  1016. _span += '<span class="voteBtn voteTxt" data-mark="1"><i>投你一票</i></span>';
  1017. }
  1018. _html += (_li + _span);
  1019. }
  1020. G("voteUl").innerHTML = _html;
  1021. }
  1022. })
  1023. }
  1024. function pageInit(){
  1025. if(!getStr("mw_oursBag") && !getStr("mw_othersBag") && !getStr("for")){
  1026. addUser();
  1027. addData();
  1028. }
  1029. createQrcode(uid,link,function(res){
  1030. if(res.code == 0){
  1031. G("QRcode").src = res.data.qrcode;
  1032. }
  1033. })
  1034. authorization(init.contentcode,uid,usertoken,mac,version,function(res){
  1035. if(res.code == 0 && res.data.result==0){
  1036. init.oursProduct_isVip = 1;
  1037. addClass(G("othersProduct"),'hasOrder');
  1038. if(!!getStr("mw_oursBag")){
  1039. payResult(init.oursProduct_isVip,uid,init.oursId);
  1040. };
  1041. times();
  1042. }else{
  1043. init.oursProduct_isVip = 0;
  1044. times();
  1045. }
  1046. },function(){
  1047. times();
  1048. });
  1049. // if(!!getCookie("itemIdx") || !!getCookie("gameItemIdx")){
  1050. // if(!!getCookie("itemIdx")){
  1051. // G("unWinToyVipPopup").style.background = "url('./img/page_08.png') no-repeat center";
  1052. // }else{
  1053. // G("unWinToyVipPopup").style.background = "url('./img/page_06.png') no-repeat center";
  1054. // }
  1055. // var idx = (!!getCookie("mark"))?getCookie("mark")-4:0;
  1056. // var h = document.getElementsByClassName("voteTxt")[0].offsetHeight+document.getElementsByClassName("voteLi")[0].offsetHeight+20
  1057. // G("scrollCont").style.top = - 770-(parseInt(idx/4/2)*h) + "px";
  1058. // S("unWinToyVipPopup");
  1059. // pageConf.focusItem = "poster";
  1060. // pageConf.focusIdx = getCookie("itemIdx");
  1061. // setCookie("gameItemIdx","");
  1062. // setCookie("itemIdx","");
  1063. // }
  1064. btnInit();
  1065. }
  1066. function juge(){
  1067. if(init.isYearVip){
  1068. init.is_vip = 2;
  1069. }
  1070. else if(init.othersProduct_isVip || init.oursProduct_isVip || init.allProduce_isVip){
  1071. init.is_vip = 1;
  1072. }
  1073. else if(init.othersProduct_isVip==0 && init.oursProduct_isVip==0){
  1074. init.is_vip = 0;
  1075. }
  1076. }
  1077. function btnInit(){
  1078. if(!!getStr("for")){
  1079. pageConf.focusItem = "ip_btn";
  1080. pageConf.focusIdx = getStr("for");
  1081. G("scrollCont").style.top = - 500 + "px";
  1082. }
  1083. if(pageConf.focusItem == "page_btn"){
  1084. smallvodPlay(videoId);
  1085. }
  1086. var btnConfig = {
  1087. className: pageConf.focusItem,
  1088. currentIndex: pageConf.focusIdx,
  1089. rules: data.rules,
  1090. onBack:onBack,
  1091. isFloatLast:true,
  1092. }
  1093. window.main = new tvSysBtnBind(btnConfig);
  1094. main.reLoad();
  1095. }
  1096. pageInit();
  1097. window.onunload = function(){
  1098. stopPlay();
  1099. }
  1100. </script>
  1101. </body>
  1102. </html>