index1.html 51 KB

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