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