index.html 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="page-view-size" content="1280*720" />
  6. <link rel="stylesheet" type="text/css" href="./css/page.css?v=201909"/>
  7. <title>移动-明侦盲盒活动</title>
  8. </head>
  9. <body>
  10. <div id="content">
  11. <div class="gameNum"><span id="times">0</span></div>
  12. <div class="pageLeft fl">
  13. <div class="myBox_btn"></div>
  14. </div>
  15. <ul id="boxUl" class="boxGroup fl">
  16. <li class="box box_1"></li>
  17. <li class="box box_2"></li>
  18. <li class="box box_3"></li>
  19. <li class="box box_4"></li>
  20. <li class="box box_5"></li>
  21. <li class="box box_6"></li>
  22. <li class="box box_7"></li>
  23. </ul>
  24. <div id="btnDiv" class="btnGroup fl">
  25. <div class="page_btn pb_1"></div>
  26. <div class="page_btn pb_2"></div>
  27. <div class="page_btn pb_3"></div>
  28. <div class="order_btn ob_1" id="oursP"></div>
  29. <div class="order_btn ob_2" id="othersP"></div>
  30. </div>
  31. <div id="rulesPopup" class="popup">
  32. <div class="rulesBtn"></div>
  33. </div>
  34. <div id="myBoxPopup" class="popup">
  35. <ul class="toyGroup">
  36. <li class="toyLi0"><img src="img/toy_bxk.png" height="133" width="117" alt=""/><span id="toy_0">0</span><i id="txt_0"></i></li>
  37. <li class="toyLi1"><img src="img/toy_dgw.png" height="133" width="117" alt=""/><span id="toy_1">0</span><i id="txt_1"></i></li>
  38. <li class="toyLi2"><img src="img/toy_hmn.png" height="133" width="117" alt=""/><span id="toy_2">0</span><i id="txt_2"></i></li>
  39. <li class="toyLi3"><img src="img/toy_lcd.png" height="133" width="117" alt=""/><span id="toy_3">0</span><i id="txt_3"></i></li>
  40. <li class="toyLi4"><img src="img/toy_stt.png" height="133" width="117" alt=""/><span id="toy_4">0</span><i id="txt_4"></i></li>
  41. <li class="toyLi5"><img src="img/toy_wgz.png" height="133" width="117" alt=""/><span id="toy_5">0</span><i id="txt_5"></i></li>
  42. <li class="toyLi6"><img src="img/toy_zys.png" height="133" width="117" alt=""/><span id="toy_6">0</span><i id="txt_6"></i></li>
  43. </ul>
  44. <div class="myBoxBtn"></div>
  45. </div>
  46. <div id="exchangePopup" class="popup">
  47. <img id="myPrize" src="" alt="" />
  48. <div id="phone"></div>
  49. <ul id="keyBoard">
  50. <li class="phoneNum">1</li>
  51. <li class="phoneNum">2</li>
  52. <li class="phoneNum">3</li>
  53. <li class="phoneNum">4</li>
  54. <li class="phoneNum">5</li>
  55. <li class="phoneNum">6</li>
  56. <li class="phoneNum">7</li>
  57. <li class="phoneNum">8</li>
  58. <li class="phoneNum">9</li>
  59. <li class="phoneNum">0</li>
  60. <li class="phoneNum otherBtn">删除</li>
  61. <li class="phoneNum otherBtn">清空</li>
  62. </ul>
  63. <div class="exchangeBtn confirm"></div>
  64. <div class="exchangeBtn cancel"></div>
  65. </div>
  66. <div id="unExchangePopup" class="popup">
  67. <div class="unExchangeBtn"></div>
  68. </div>
  69. <div id="winToyPopup" class="popup">
  70. <img id="toyImg" src="" height="264" width="172" alt="" />
  71. <div class="winToyBtn myBox"></div>
  72. <div class="winToyBtn confirm"></div>
  73. </div>
  74. <div id="unWinToyPopup" class="popup">
  75. <div id="oursProduct" class="unWinToyBtn"></div>
  76. <div id="othersProduct" class="unWinToyBtn"></div>
  77. <div class="unWinToyBtn confirm"></div>
  78. </div>
  79. <div id="unWinToyVipPopup" class="popup">
  80. <div class="pmodel pmodel_1"></div>
  81. <div class="pmodel pmodel_2"></div>
  82. <div class="pmodel pmodel_3"></div>
  83. <div class="poster poster_1"></div>
  84. <div class="poster poster_2"></div>
  85. <div class="poster poster_3"></div>
  86. <div class="unWinToyVipBtn"></div>
  87. </div>
  88. <!-- <div id="noChancePopup" class="popup">
  89. <div class="noChanceBtn"></div>
  90. </div>
  91. <div id="noChanceVipPopup" class="popup">
  92. <div class="noChanceVipBtn"></div>
  93. </div> -->
  94. <div id="CollectedSuccessPopup" class="popup">
  95. <div class="CollectedSuccessBtn"></div>
  96. </div>
  97. <div id="openBoxPopup" class="popup">
  98. <img id="bigPrize" src="" alt="" />
  99. <div class="openBoxBtn oBbtn_1"></div>
  100. <div class="openBoxBtn oBbtn_2"></div>
  101. </div>
  102. <div id="markDownPopup" class="popup">
  103. <div class="markDownBtn"></div>
  104. </div>
  105. <div id="runOutPopup" class="popup">
  106. <div class="runOutBtn"></div>
  107. </div>
  108. <div id="submittedPopup" class="popup">
  109. <div class="submittedBtn"></div>
  110. </div>
  111. </div>
  112. <script src="./js/webview.js" type="text/javascript"></script>
  113. <script src="js/tvSysBtnBind.v2.js" type="text/javascript"></script>
  114. <script src="js/comm.js?v=11" type="text/javascript"></script>
  115. <script src="js/api.js?v=11" type="text/javascript"></script>
  116. <script type="text/javascript">
  117. var pageConf = {
  118. focusIdx:1,
  119. focusItem:"box",
  120. }
  121. var click = true;
  122. var heguiItem = "box";
  123. var init = {
  124. prize:0,
  125. act_id:1,
  126. gameNum:0,
  127. canPrize:0,
  128. oursProduct_isVip:0,
  129. othersProduct_isVip:0,
  130. contentcode:"00000001000000000018000000431421",//内容标识
  131. contentcode1:"00000001000000000029000000278889",
  132. }
  133. var pageItem = ["box","myBox_btn","page_btn","order_btn"];
  134. // var popupItem = ["rulesBtn","myBoxBtn","unExchangeBtn","unExchangeBtn","exchangeBtn","phoneNum","markDownBtn","unWinToyBtn","unWinToyVipBtn","poster","winToyBtn"]
  135. var webUrl = 'http://111.23.13.123:8091/';
  136. try{
  137. var uid = Webview.readSystemProp('user.id');
  138. var usertoken = Webview.readSystemProp('user.token');//令牌
  139. var mac = Webview.readSystemProp('device.mac');//机顶盒mac地址
  140. var version = Webview.readSystemProp('app.version');//APK版本号
  141. } catch(e) {
  142. var uid = getStr("uid") || '0100834547692768574';
  143. var usertoken = "CB89C105577A4E5344E7EC39F993A4B6"
  144. var mac = 'OC-49-33-BF-10-A6'
  145. var version = "YYS.5.7.7.Y3.4.HNYD.0.0_Beta"
  146. }
  147. var backUrl = webUrl+'h5v2/yd20191203/index.html';
  148. var data = new Object();
  149. data.rules = {
  150. box:{
  151. 0:[["myBox_btn",0],0,1,3],
  152. 1:[-1,0,1,3],
  153. 2:[-1,0,["page_btn",2],3],
  154. 3:[["myBox_btn",0],-3,1,0],
  155. 4:[-1,-3,1,0],
  156. 5:[-1,-3,1,0],
  157. 6:[-1,-4,0,0],
  158. "onEnterPress":openBox,
  159. onPress:function(){
  160. if((this.event.keyCode == 39 || this.event.keyCode == "RIGHT") && this.prevIndex == 6){
  161. if(init.othersProduct_isVip == 0){
  162. this.reSetClass("order_btn",0);
  163. }else if(init.othersProduct_isVip == 1 && init.oursProduct_isVip == 0){
  164. this.reSetClass("order_btn",1);
  165. }
  166. }
  167. },
  168. },
  169. myBox_btn:{
  170. line:1,
  171. right:["box"],
  172. onEnterPress:function(){
  173. heguiItem = "myBox_btn";
  174. myBoxGroup();
  175. }
  176. },
  177. page_btn:{
  178. line:1,
  179. left:["box",2],
  180. "onEnterPress":openPopups,
  181. onPress:function(){
  182. if((this.event.keyCode == 40 || this.event.keyCode == "DOWN")&& this.prevIndex == 2){
  183. if(init.othersProduct_isVip == 0){
  184. this.reSetClass("order_btn",0);
  185. }else if(init.othersProduct_isVip == 1 && init.oursProduct_isVip == 0){
  186. this.reSetClass("order_btn",1);
  187. }
  188. }
  189. },
  190. },
  191. order_btn:{
  192. 0:[["box",7],["page_btn",2],0,0],
  193. 1:[["box",7],0,0,0],
  194. onEnterPress:function(){
  195. order(this.currentIndex);
  196. },
  197. onPress:function(){
  198. if((this.event.keyCode == 40 || this.event.keyCode == "DOWN") && this.currentIndex == 0){
  199. if(init.oursProduct_isVip == 0){
  200. this.reSetClass("order_btn",1);
  201. }
  202. }else if((this.event.keyCode == 38 || this.event.keyCode == "UP")&& this.currentIndex == 1){
  203. if(init.othersProduct_isVip == 0){
  204. this.reSetClass("order_btn",0);
  205. }else{
  206. this.reSetClass("page_btn",2);
  207. }
  208. }
  209. },
  210. },
  211. rulesBtn:{
  212. line:1,
  213. onEnterPress:function(){
  214. H("rulesPopup");
  215. this.reSetClass("page_btn",1);
  216. },
  217. onBack:function(){
  218. H("rulesPopup");
  219. this.reSetClass("page_btn",1);
  220. },
  221. },
  222. myBoxBtn:{
  223. line:1,
  224. onEnterPress:function(){
  225. H("myBoxPopup");
  226. this.reSetClass(heguiItem);
  227. },
  228. onBack:function(){
  229. H("myBoxPopup");
  230. this.reSetClass(heguiItem);
  231. },
  232. },
  233. unExchangeBtn:{
  234. line:1,
  235. onEnterPress:function(){
  236. H("unExchangePopup");
  237. this.reSetClass("page_btn",2);
  238. },
  239. onBack:function(){
  240. H("unExchangePopup");
  241. this.reSetClass("page_btn",2);
  242. },
  243. },
  244. exchangeBtn:{
  245. // 0:[0,0,0,["phoneNum",0]],
  246. 0:[0,["phoneNum",6],1,0],
  247. 1:[-1,["phoneNum",8],0,0],
  248. "onEnterPress":exchangePopups,
  249. onPress:cellphoneNum,
  250. onBack:function(){
  251. H("exchangePopup");
  252. G("phone").innerHTML = "";
  253. this.reSetClass(heguiItem);
  254. },
  255. },
  256. phoneNum:{
  257. line:6,
  258. down:["exchangeBtn",1],
  259. onEnterPress:function(){
  260. try{
  261. alert('phoneNum'+this.currentIndex+this.className+G("phone").innerHTML.length);
  262. if(this.currentIndex<=9){
  263. if(G("phone").innerHTML.length>10) return;
  264. if(this.currentIndex == 9){
  265. G("phone").innerHTML += 0;
  266. }else{
  267. G("phone").innerHTML += this.currentIndex*1+1;
  268. }
  269. }else if(this.currentIndex == 10){
  270. if(G("phone").innerHTML.length>0)
  271. G("phone").innerHTML = G("phone").innerHTML.slice(0,-1);
  272. }else if(this.currentIndex == 11){
  273. if(G("phone").innerHTML.length>0)
  274. G("phone").innerHTML = "";
  275. }
  276. }catch(e){
  277. alert(e)
  278. }
  279. },
  280. onPress:cellphoneNum,
  281. onBack:function(){
  282. if(G("phone").innerHTML.length>0){
  283. G("phone").innerHTML = G("phone").innerHTML.slice(0,-1);
  284. }else{
  285. H("exchangePopup");
  286. G("phone").innerHTML = "";
  287. this.reSetClass(heguiItem);
  288. }
  289. },
  290. },
  291. markDownBtn:{
  292. line:1,
  293. onEnterPress:function(){
  294. H("markDownPopup");
  295. this.reSetClass("page_btn",2);
  296. },
  297. onBack:function(){
  298. H("markDownPopup");
  299. this.reSetClass("page_btn",2);
  300. },
  301. },
  302. runOutBtn:{
  303. line:1,
  304. onEnterPress:function(){
  305. H("runOutPopup");
  306. this.reSetClass(heguiItem);
  307. },
  308. onBack:function(){
  309. H("runOutPopup");
  310. this.reSetClass(heguiItem);
  311. },
  312. },
  313. unWinToyBtn:{
  314. 0:[0,0,0,2],
  315. 1:[0,0,0,1],
  316. 2:[0,0,0,0],
  317. onEnterPress:function(){
  318. if(this.currentIndex==2){
  319. H("unWinToyPopup");
  320. this.reSetClass("box");
  321. }else{
  322. setCookie("unWinToy","unWinToyPopup");
  323. order(this.currentIndex);
  324. }
  325. },
  326. onPress:function(){
  327. if(this.currentIndex == 0){
  328. if(this.event.keyCode == 39 || this.event.keyCode == "RIGHT"){
  329. if(init.oursProduct_isVip == 0){
  330. this.reSetClass("unWinToyBtn",1);
  331. }
  332. }
  333. }else if(this.currentIndex == 1){
  334. if(this.event.keyCode == 37 || this.event.keyCode == "LEFT"){
  335. if(init.othersProduct_isVip == 0){
  336. this.reSetClass("unWinToyBtn",0);
  337. }
  338. }
  339. }else if(this.currentIndex == 2){
  340. if(this.event.keyCode == 38 || this.event.keyCode == "UP"){
  341. if(init.othersProduct_isVip == 0){
  342. this.reSetClass("unWinToyBtn",0);
  343. }else if(init.oursProduct_isVip == 0){
  344. this.reSetClass("unWinToyBtn",1);
  345. }
  346. }
  347. }
  348. },
  349. onBack:function(){
  350. H("unWinToyPopup");
  351. this.reSetClass("box");
  352. },
  353. },
  354. unWinToyVipBtn:{
  355. line:1,
  356. up:["poster"],
  357. onEnterPress:function(){
  358. H("unWinToyVipPopup");
  359. this.reSetClass("box");
  360. },
  361. onBack:function(){
  362. H("unWinToyVipPopup");
  363. this.reSetClass("box");
  364. },
  365. },
  366. poster:{
  367. line:3,
  368. down:["unWinToyVipBtn"],
  369. onEnterPress:function(){
  370. var url = '',index=this.currentIndex;
  371. setCookie("videoIdx",index);
  372. if(index==0){
  373. fullscreenPlay("00000001000000000002000000120684")
  374. }else if(index==1){
  375. fullscreenPlay("00000001000000000014000000387305")
  376. }else if(index==2){
  377. fullscreenPlay("00000001000000000029000000278889")
  378. }
  379. },
  380. onBack:function(){
  381. H("unWinToyVipPopup");
  382. this.reSetClass("box");
  383. },
  384. },
  385. winToyBtn:{
  386. line:2,
  387. onEnterPress:function(){
  388. H("winToyPopup");
  389. if(this.currentIndex == 0){
  390. myBoxGroup();
  391. // S("myBoxPopup");
  392. // this.reSetClass("myBoxBtn");
  393. }else{
  394. this.reSetClass(heguiItem);
  395. }
  396. },
  397. onBack:function(){
  398. H("winToyPopup");
  399. this.reSetClass(heguiItem);
  400. },
  401. },
  402. CollectedSuccessBtn:{
  403. line:1,
  404. onEnterPress:function(){
  405. prize(uid,init.act_id,init.othersProduct_isVip+init.oursProduct_isVip,function(res){
  406. if (res.code == 0) {
  407. if(res.data.yes.prize_status == "real"){//中奖
  408. G("bigPrize").src = res.data.yes.prize_img;
  409. H("myBoxPopup");
  410. H("CollectedSuccessPopup");
  411. S("openBoxPopup");
  412. main.reSetClass("openBoxBtn");
  413. }else{
  414. S("runOutPopup");
  415. main.reSetClass("runOutBtn");
  416. }
  417. }else{
  418. tips(res.msg);
  419. }
  420. })
  421. },
  422. onBack:function(){
  423. H("myBoxPopup");
  424. H("CollectedSuccessPopup");
  425. this.reSetClass(heguiItem);
  426. },
  427. },
  428. openBoxBtn:{
  429. line:2,
  430. onEnterPress:function(){
  431. if(this.currentIndex == 0){
  432. userPrizelog(uid,init.act_id,init.oursProduct_isVip+init.othersProduct_isVip,function(res){
  433. if(res.code == 0){
  434. if(res.data.my_prizes[0]){
  435. if(res.data.user_phone.phone_status !=1){
  436. G('myPrize').src = res.data.my_prizes[0].show_image;
  437. H("openBoxPopup");
  438. S("exchangePopup");
  439. main.reSetClass("phoneNum",0);
  440. }else{
  441. H("openBoxPopup");
  442. S("submittedPopup");
  443. main.reSetClass("submittedBtn");
  444. }
  445. }else{
  446. //未中奖
  447. }
  448. }else{
  449. tips(res.msg)
  450. }
  451. });
  452. }else{
  453. H("openBoxPopup");
  454. this.reSetClass(heguiItem);
  455. }
  456. },
  457. onBack:function(){
  458. H("openBoxPopup");
  459. this.reSetClass(heguiItem);
  460. },
  461. },
  462. submittedBtn:{
  463. line:1,
  464. onEnterPress:function(){
  465. H("submittedPopup");
  466. this.reSetClass(heguiItem);
  467. },
  468. onBack:function(){
  469. H("submittedPopup");
  470. this.reSetClass(heguiItem);
  471. },
  472. }
  473. }
  474. // var btnConfig = {
  475. // className: pageConf.focusItem,
  476. // currentIndex: pageConf.focusIdx,
  477. // rules: data.rules,
  478. // onBack:onBack,
  479. // }
  480. function order(idx){
  481. var pid = "8801000079";
  482. var mark = "oursBag";
  483. if(idx == 1){
  484. pid = "8801000077";
  485. mark = "othersBag";
  486. }
  487. var orderBack = backUrl+'?'+mark+'='+uid;
  488. if(version.indexOf("5a.7") || version.indexOf("5a.8")){
  489. var product_list={
  490. "product_id":pid,
  491. "video_name":"",
  492. "video_type":"",
  493. "product_type":"2",
  494. "cat_id":"",
  495. "channel_id":"",
  496. }
  497. window.location.href = "https://hnydorder.yys.mgtv.com:8080/order/index.html?product_list="+JSON.stringify(product_list)+"&exitStr="+escape(orderBack);
  498. }else{
  499. var playIntent = {
  500. package: "com.hunantv.operator",
  501. action: "mangotv://com.hunantv.operator/order",
  502. data: "",
  503. extras: {
  504. product: {
  505. "id": pid,
  506. "time": "",
  507. "price": "",
  508. "type": "",
  509. "name": "",
  510. "bag": "",
  511. "back_url":orderBack,
  512. }
  513. },
  514. flags: []
  515. };
  516. Webview.sendIntent("startActivity", playIntent);
  517. }
  518. }
  519. function fullscreenPlay(mid) {
  520. var playIntent = {
  521. package : "com.hunantv.operator",
  522. action: "mangotv://com.hunantv.operator/player/vod",
  523. data:"",
  524. extras: {
  525. "video_index": 0,
  526. "media_asset_id": mid, //媒资包
  527. },
  528. flags: []
  529. };
  530. Webview.sendIntent("startActivity", playIntent);
  531. };
  532. function openBox(){
  533. if(click){
  534. click = false;
  535. if(init.gameNum){
  536. if(init.othersProduct_isVip || init.oursProduct_isVip){
  537. G("unWinToyVipPopup").style.background = "url('./img/page_06.png') no-repeat center";
  538. }else{
  539. G("unWinToyPopup").style.background = "url('./img/page_05.png') no-repeat center";
  540. }
  541. goCollect(uid,init.act_id,init.othersProduct_isVip+init.oursProduct_isVip,function(res){
  542. if(res.code==0){
  543. init.gameNum -= 1;
  544. G("times").innerHTML = init.gameNum;
  545. if(res.data.collect_status=='yes'){
  546. G("toyImg").src=res.data.collect_list[0].collect_img;
  547. S("winToyPopup");
  548. heguiItem = "box";
  549. main.reSetClass("winToyBtn");
  550. }else{
  551. if(init.othersProduct_isVip || init.oursProduct_isVip){
  552. S("unWinToyVipPopup");
  553. main.reSetClass("unWinToyVipBtn");
  554. }else{
  555. S("unWinToyPopup");
  556. main.reSetClass("unWinToyBtn");
  557. }
  558. }
  559. }
  560. click = true;
  561. })
  562. }else{
  563. if(init.othersProduct_isVip || init.oursProduct_isVip){
  564. G("unWinToyVipPopup").style.background = "url('./img/page_08.png') no-repeat center";
  565. S("unWinToyVipPopup");
  566. this.reSetClass("poster");
  567. }else{
  568. G("unWinToyPopup").style.background = "url('./img/page_07.png') no-repeat center";
  569. S("unWinToyPopup");
  570. this.reSetClass("unWinToyBtn");
  571. }
  572. click = true;
  573. }
  574. }
  575. }
  576. function openPopups(){
  577. if(this.currentIndex==0){
  578. Webview.closeBrwoser("返回");//退出
  579. }else if(this.currentIndex==1){
  580. S("rulesPopup");
  581. this.reSetClass("rulesBtn");
  582. }else if(this.currentIndex==2){
  583. heguiItem = "page_btn";
  584. userPrizelog(uid,init.act_id,init.oursProduct_isVip+init.othersProduct_isVip,function(res){
  585. if(res.code == 0){
  586. if(res.data.my_prizes[0]){
  587. if(res.data.user_phone.phone_status !=1){
  588. G('myPrize').src = res.data.my_prizes[0].show_image;
  589. S("exchangePopup");
  590. main.reSetClass("phoneNum",0);
  591. }else{
  592. H("exchangePopup");
  593. S("submittedPopup");
  594. main.reSetClass("submittedBtn");
  595. }
  596. }else{
  597. }
  598. }else{
  599. myBoxGroup("mark");
  600. }
  601. });
  602. }
  603. }
  604. function myBoxGroup(mark){
  605. getUserCollects(uid,init.act_id,init.othersProduct_isVip+init.oursProduct_isVip,function(res){
  606. if(res.code == 0){
  607. for(var i=0;i<res.data.collect.length;i++){
  608. G("toy_"+i).innerHTML = res.data.collect[i].num;
  609. G("txt_"+i).innerHTML = res.data.collect[i].collect_name;
  610. }
  611. if(res.data.complate && res.data.complate[0].exchange_id>=1){
  612. init.canPrize = 1;
  613. if(!mark){
  614. S("myBoxPopup");
  615. }
  616. S("CollectedSuccessPopup");
  617. main.reSetClass("CollectedSuccessBtn");
  618. }else{
  619. if(mark){
  620. S("unExchangePopup");
  621. main.reSetClass("unExchangeBtn");
  622. }else{
  623. S("myBoxPopup");
  624. main.reSetClass("myBoxBtn");
  625. }
  626. }
  627. }else{
  628. if(!mark){
  629. S("myBoxPopup");
  630. main.reSetClass("myBoxBtn");
  631. }
  632. }
  633. })
  634. }
  635. function exchangePopups(){
  636. try{
  637. alert('exchangePopups'+this.currentIndex+this.className);
  638. if(this.currentIndex==1){
  639. H("exchangePopup");
  640. G("phone").innerHTML = "";
  641. this.reSetClass(heguiItem);
  642. }else if(this.currentIndex==0){
  643. var phone = G("phone").innerText;
  644. var myreg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
  645. if(!myreg.test(phone)){
  646. tips('手机号码格式有误!');
  647. }else{
  648. ajax({
  649. url: webUrl + "index.php?m=Home&c=Activityv2&a=setUserInfo",
  650. data: {
  651. uid: uid,
  652. act_id: init.act_id,
  653. is_vip: init.oursProduct_isVip+init.othersProduct_isVip,
  654. phone: phone
  655. },
  656. success: function (res) {
  657. if(res.code == 0){
  658. H("exchangePopup");
  659. G("phone").innerHTML = "";
  660. S("markDownPopup");
  661. main.reSetClass("markDownBtn");
  662. }else{
  663. tips(res.msg);
  664. }
  665. }
  666. })
  667. }
  668. }
  669. }catch(e){
  670. alert(e);
  671. }
  672. }
  673. function cellphoneNum(){
  674. if(G("phone").innerHTML.length>10) return;
  675. var key = this.event.keyCode;
  676. try {
  677. Webview.setInputTypeTextFlag("true");
  678. if (key >= 0 && key <= 9) {
  679. G("phone").innerText += key;
  680. }
  681. } catch (e) {
  682. if (key > 47 && key < 58) {
  683. G("phone").innerText += (key - 48);
  684. }
  685. }
  686. }
  687. function onBack(){
  688. if(pageItem.indexOf(main.className)>-1){
  689. // window.location.href = webUrl+"/h5v2/special/dx20191126/index.html"
  690. Webview.closeBrwoser("返回");
  691. }else{
  692. }
  693. }
  694. function payResult(is_vip,uid,product_id){
  695. if(is_vip == 1){
  696. ajax({
  697. url:webUrl+"index.php?m=Home&c=DuduApi&a=payResult",
  698. data:{
  699. uid: uid,
  700. product_id:product_id,
  701. pay_result:0
  702. },
  703. success: function (res) {
  704. },
  705. error: function () {
  706. }
  707. })
  708. }
  709. }
  710. function addUser(fn) {
  711. ajax({
  712. url:webUrl+"index.php?m=Home&c=DuduApi&a=addUser",
  713. data:{
  714. uid: uid,
  715. UserToken: usertoken
  716. },
  717. success: function (res) {
  718. fn && fn(res);
  719. },
  720. error: function () {
  721. }
  722. })
  723. }
  724. function addData(fn) {
  725. ajax({
  726. url:webUrl+"index.php?m=Home&c=ThemeData&a=addData",
  727. data:{
  728. uid: uid,
  729. theme_id: 1
  730. },
  731. success: function (res) {
  732. fn && fn(res);
  733. },
  734. error: function () {
  735. }
  736. })
  737. }
  738. function addUser(fn) {
  739. ajax({
  740. url:webUrl+"index.php?m=Home&c=DuduApi&a=addUser",
  741. data:{
  742. uid: uid,
  743. UserToken: usertoken
  744. },
  745. success: function (res) {
  746. fn && fn(res);
  747. },
  748. error: function () {
  749. }
  750. })
  751. }
  752. function authorization(contentcode,uid,usertoken,mac,version,fn) {
  753. ajax({
  754. url:webUrl+"index.php?m=Home&c=order&a=contentCTCAuth",
  755. data:{
  756. contentcode:contentcode,
  757. uid:uid, //2.0
  758. usertoken:usertoken,
  759. mac:mac,
  760. version:version,
  761. fromsource:15
  762. },
  763. type: "post",
  764. dataType: "json",
  765. success: function (res) {
  766. fn && fn(res);
  767. },
  768. error: function (e) {
  769. fn && fn(e);
  770. }
  771. })
  772. }
  773. //游戏次数
  774. function getPrizeNum(uid,act_id,is_vip,fn) {
  775. ajax({
  776. url:webUrl+"index.php?m=Home&c=Activityv2&a=getPrizeNum",
  777. data: {
  778. uid: uid,
  779. act_id: act_id,
  780. is_vip: is_vip//is_vip1+is_vip2
  781. },
  782. success: function (res) {
  783. fn && fn(res);
  784. },
  785. error: function () {
  786. fn && fn();
  787. }
  788. })
  789. }
  790. function goCollect(uid,act_id,is_vip,fn) {//开盒抽卡
  791. ajax({
  792. url:webUrl+"index.php?m=Home&c=Activityv2&a=collect",
  793. data: {
  794. uid: uid,
  795. act_id: act_id,
  796. is_vip: is_vip,//is_vip1+is_vip2
  797. },
  798. success: function (res) {
  799. fn && fn(res);
  800. },
  801. error: function () {
  802. fn && fn();
  803. }
  804. })
  805. }
  806. function getUserCollects(uid,act_id,is_vip,fn) {
  807. ajax({
  808. url:webUrl+"index.php?m=Home&c=Activityv2&a=getUserCollects",
  809. data: {
  810. uid: uid,
  811. act_id: act_id,
  812. is_vip: is_vip//is_vip1+is_vip2
  813. },
  814. success: function (res) {
  815. fn && fn(res);
  816. },
  817. error: function () {
  818. fn && fn();
  819. }
  820. })
  821. }
  822. function prize(uid,act_id,is_vip,fn) {
  823. ajax({
  824. url: webUrl + "index.php?m=Home&c=Activityv2&a=prize",
  825. data: {
  826. uid: uid,
  827. act_id: act_id,
  828. is_vip: is_vip,//is_vip1+is_vip2
  829. run: 'complate',
  830. },
  831. success: function (res) {
  832. fn && fn(res);
  833. }
  834. })
  835. }
  836. function userPrizelog(uid,act_id,is_vip,fn) {
  837. ajax({
  838. url: webUrl + "index.php?m=Home&c=Activityv2&a=userPrizelog",
  839. data: {
  840. uid: uid,
  841. act_id: act_id,
  842. is_vip: is_vip
  843. },
  844. success: function (res) {
  845. fn && fn(res);
  846. },
  847. error: function () {
  848. fn && fn();
  849. }
  850. })
  851. }
  852. function pageInit(){
  853. if(!getStr("oursBag") && !getStr("othersBag") && !getStr("for")){
  854. addUser();
  855. addData();
  856. }
  857. authorization(init.contentcode,uid,usertoken,mac,version,function(res){
  858. if(res.code == 0){
  859. if(res.data.result==0){
  860. init.oursProduct_isVip = 1;
  861. addClass(G("oursP"),'hasOrder');
  862. addClass(G("oursProduct"),'hasOrder');
  863. if(!!getStr("oursBag")){
  864. payResult(init.oursProduct_isVip,uid,"8801000077");
  865. }
  866. }else{
  867. init.oursProduct_isVip = 0;
  868. if(!!getStr("oursBag")){
  869. if(!!getCookie("unWinToy")){
  870. pageConf.focusItem = "unWinToyBtn";
  871. S("unWinToyPopup")
  872. setCookie("unWinToy",'');
  873. }else{
  874. pageConf.focusItem = "order_btn";
  875. }
  876. pageConf.focusIdx = 0;
  877. }
  878. }
  879. authorization(init.contentcode1,uid,usertoken,mac,version,function(res){
  880. if(res.code == 0){
  881. if(res.data.result==0){
  882. init.othersProduct_isVip = 1;
  883. addClass(G("othersP"),'hasOrder');
  884. addClass(G("othersProduct"),'hasOrder');
  885. if(!!getStr("othersBag")){
  886. payResult(init.othersProduct_isVip,uid,"8801000079")
  887. }
  888. }else{
  889. othersProduct_isVip = 0;
  890. if(!!getStr("othersBag")){
  891. if(!!getCookie("unWinToy")){
  892. pageConf.focusItem = "unWinToyBtn";
  893. S("unWinToyPopup")
  894. setCookie("unWinToy",'');
  895. }else{
  896. pageConf.focusItem = "order_btn";
  897. }
  898. pageConf.focusIdx = 1;
  899. }
  900. }
  901. var vv = init.oursProduct_isVip+init.othersProduct_isVip;
  902. getPrizeNum(uid,init.act_id,vv,function(res){
  903. if(res.code == 0){
  904. init.gameNum = res.data;
  905. G("times").innerHTML = res.data;
  906. if(!!getCookie("videoIdx")){
  907. if(res.data == 0){
  908. G("unWinToyVipPopup").style.background = "url('./img/page_08.png') no-repeat center";
  909. }else{
  910. G("unWinToyVipPopup").style.background = "url('./img/page_06.png') no-repeat center";
  911. }
  912. S("unWinToyVipPopup");
  913. pageConf.focusItem = "poster";
  914. pageConf.focusIdx = getCookie("videoIdx");
  915. setCookie("videoIdx","");
  916. }
  917. btnInit();
  918. }else{
  919. btnInit();
  920. }
  921. })
  922. // var btnConfig = {
  923. // className: pageConf.focusItem,
  924. // currentIndex: pageConf.focusIdx,
  925. // rules: data.rules,
  926. // onBack:onBack,
  927. // }
  928. // window.main = new tvSysBtnBind(btnConfig);
  929. // main.reLoad();
  930. }
  931. else{
  932. btnInit();
  933. }
  934. });
  935. }else{
  936. btnInit();
  937. }
  938. });
  939. }
  940. function btnInit(){
  941. var btnConfig = {
  942. className: pageConf.focusItem,
  943. currentIndex: pageConf.focusIdx,
  944. rules: data.rules,
  945. onBack:onBack,
  946. }
  947. window.main = new tvSysBtnBind(btnConfig);
  948. main.reLoad();
  949. }
  950. function G(id){
  951. return document.getElementById(id)
  952. }
  953. function S(id){
  954. G(id).style.visibility = "visible";
  955. }
  956. function H(id){
  957. G(id).style.visibility = "hidden";
  958. }
  959. pageInit();
  960. </script>
  961. </body>
  962. </html>