index.html 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015
  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.oursProduct_isVip == 0){
  162. this.reSetClass("order_btn",0);
  163. }else if(init.othersProduct_isVip == 0 && init.oursProduct_isVip == 1){
  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.oursProduct_isVip == 0){
  184. this.reSetClass("order_btn",0);
  185. }else if(init.othersProduct_isVip == 0 && init.oursProduct_isVip == 1){
  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.othersProduct_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.oursProduct_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. if(this.currentIndex<=9){
  261. if(G("phone").innerHTML.length>10) return;
  262. if(this.currentIndex == 9){
  263. G("phone").innerHTML += 0;
  264. }else{
  265. G("phone").innerHTML += this.currentIndex*1+1;
  266. }
  267. }else if(this.currentIndex == 10){
  268. if(G("phone").innerHTML.length>0)
  269. G("phone").innerHTML = G("phone").innerHTML.slice(0,-1);
  270. }else if(this.currentIndex == 11){
  271. if(G("phone").innerHTML.length>0)
  272. G("phone").innerHTML = "";
  273. }
  274. },
  275. onPress:cellphoneNum,
  276. onBack:function(){
  277. if(G("phone").innerHTML.length>0){
  278. G("phone").innerHTML = G("phone").innerHTML.slice(0,-1);
  279. }else{
  280. H("exchangePopup");
  281. G("phone").innerHTML = "";
  282. this.reSetClass(heguiItem);
  283. }
  284. },
  285. },
  286. markDownBtn:{
  287. line:1,
  288. onEnterPress:function(){
  289. H("markDownPopup");
  290. this.reSetClass("page_btn",2);
  291. },
  292. onBack:function(){
  293. H("markDownPopup");
  294. this.reSetClass("page_btn",2);
  295. },
  296. },
  297. runOutBtn:{
  298. line:1,
  299. onEnterPress:function(){
  300. H("runOutPopup");
  301. this.reSetClass(heguiItem);
  302. },
  303. onBack:function(){
  304. H("runOutPopup");
  305. this.reSetClass(heguiItem);
  306. },
  307. },
  308. unWinToyBtn:{
  309. 0:[0,0,0,2],
  310. 1:[0,0,0,1],
  311. 2:[0,0,0,0],
  312. onEnterPress:function(){
  313. if(this.currentIndex==2){
  314. H("unWinToyPopup");
  315. this.reSetClass("box");
  316. }else{
  317. setCookie("unWinToy",this.currentIndex);
  318. order(this.currentIndex);
  319. }
  320. },
  321. onPress:function(){
  322. if(this.currentIndex == 0){
  323. if(this.event.keyCode == 39 || this.event.keyCode == "RIGHT"){
  324. if(init.oursProduct_isVip == 0){
  325. this.reSetClass("unWinToyBtn",1);
  326. }
  327. }
  328. }else if(this.currentIndex == 1){
  329. if(this.event.keyCode == 37 || this.event.keyCode == "LEFT"){
  330. if(init.othersProduct_isVip == 0){
  331. this.reSetClass("unWinToyBtn",0);
  332. }
  333. }
  334. }else if(this.currentIndex == 2){
  335. if(this.event.keyCode == 38 || this.event.keyCode == "UP"){
  336. if(init.othersProduct_isVip == 0){
  337. this.reSetClass("unWinToyBtn",0);
  338. }else if(init.oursProduct_isVip == 0){
  339. this.reSetClass("unWinToyBtn",1);
  340. }
  341. }
  342. }
  343. },
  344. onBack:function(){
  345. H("unWinToyPopup");
  346. this.reSetClass("box");
  347. },
  348. },
  349. unWinToyVipBtn:{
  350. line:1,
  351. up:["poster"],
  352. onEnterPress:function(){
  353. setCookie("itemIdx","");
  354. H("unWinToyVipPopup");
  355. this.reSetClass("box");
  356. },
  357. onBack:function(){
  358. setCookie("itemIdx","");
  359. H("unWinToyVipPopup");
  360. this.reSetClass("box");
  361. },
  362. },
  363. poster:{
  364. line:3,
  365. down:["unWinToyVipBtn"],
  366. onEnterPress:function(){
  367. var url = '',index=this.currentIndex;
  368. setCookie("itemIdx",index);
  369. if(index==0){
  370. fullscreenPlay("00000001000000000002000000120684")
  371. }else if(index==1){
  372. fullscreenPlay("00000001000000000014000000387305")
  373. }else if(index==2){
  374. fullscreenPlay("00000001000000000029000000278889")
  375. }
  376. },
  377. onBack:function(){
  378. setCookie("itemIdx","");
  379. H("unWinToyVipPopup");
  380. this.reSetClass("box");
  381. },
  382. },
  383. winToyBtn:{
  384. line:2,
  385. onEnterPress:function(){
  386. H("winToyPopup");
  387. if(this.currentIndex == 0){
  388. myBoxGroup();
  389. // S("myBoxPopup");
  390. // this.reSetClass("myBoxBtn");
  391. }else{
  392. this.reSetClass(heguiItem);
  393. }
  394. },
  395. onBack:function(){
  396. H("winToyPopup");
  397. this.reSetClass(heguiItem);
  398. },
  399. },
  400. CollectedSuccessBtn:{
  401. line:1,
  402. onEnterPress:function(){
  403. prize(uid,init.act_id,init.othersProduct_isVip+init.oursProduct_isVip,function(res){
  404. if (res.code == 0) {
  405. if(res.data.yes.prize_status == "real"){//中奖
  406. G("bigPrize").src = res.data.yes.prize_img;
  407. H("myBoxPopup");
  408. H("CollectedSuccessPopup");
  409. S("openBoxPopup");
  410. main.reSetClass("openBoxBtn");
  411. }else{
  412. S("runOutPopup");
  413. main.reSetClass("runOutBtn");
  414. }
  415. }else{
  416. tips(res.msg);
  417. }
  418. })
  419. },
  420. onBack:function(){
  421. H("myBoxPopup");
  422. H("CollectedSuccessPopup");
  423. this.reSetClass(heguiItem);
  424. },
  425. },
  426. openBoxBtn:{
  427. line:2,
  428. onEnterPress:function(){
  429. if(this.currentIndex == 0){
  430. userPrizelog(uid,init.act_id,init.oursProduct_isVip+init.othersProduct_isVip,function(res){
  431. if(res.code == 0){
  432. if(res.data.my_prizes[0]){
  433. if(res.data.user_phone.phone_status !=1){
  434. G('myPrize').src = res.data.my_prizes[0].show_image;
  435. H("openBoxPopup");
  436. S("exchangePopup");
  437. main.reSetClass("phoneNum",0);
  438. }else{
  439. H("openBoxPopup");
  440. S("submittedPopup");
  441. main.reSetClass("submittedBtn");
  442. }
  443. }else{
  444. //未中奖
  445. }
  446. }else{
  447. tips(res.msg)
  448. }
  449. });
  450. }else{
  451. H("openBoxPopup");
  452. this.reSetClass(heguiItem);
  453. }
  454. },
  455. onBack:function(){
  456. H("openBoxPopup");
  457. this.reSetClass(heguiItem);
  458. },
  459. },
  460. submittedBtn:{
  461. line:1,
  462. onEnterPress:function(){
  463. H("submittedPopup");
  464. this.reSetClass(heguiItem);
  465. },
  466. onBack:function(){
  467. H("submittedPopup");
  468. this.reSetClass(heguiItem);
  469. },
  470. }
  471. }
  472. // var btnConfig = {
  473. // className: pageConf.focusItem,
  474. // currentIndex: pageConf.focusIdx,
  475. // rules: data.rules,
  476. // onBack:onBack,
  477. // }
  478. function order(idx){
  479. var pid = "8801000079";
  480. var mark = "oursBag";
  481. if(idx == 1){
  482. pid = "8801000077";
  483. mark = "othersBag";
  484. }
  485. var orderBack = backUrl+'?'+mark+'='+uid;
  486. if(version.indexOf("5a.7") || version.indexOf("5a.8")){
  487. var product_list={
  488. "product_id":pid,
  489. "video_name":"",
  490. "video_type":"",
  491. "product_type":"2",
  492. "cat_id":"",
  493. "channel_id":"",
  494. }
  495. window.location.href = "https://hnydorder.yys.mgtv.com:8080/order/index.html?product_list="+JSON.stringify(product_list)+"&exitStr="+escape(orderBack);
  496. }else{
  497. var playIntent = {
  498. package: "com.hunantv.operator",
  499. action: "mangotv://com.hunantv.operator/order",
  500. data: "",
  501. extras: {
  502. product: {
  503. "id": pid,
  504. "time": "",
  505. "price": "",
  506. "type": "",
  507. "name": "",
  508. "bag": "",
  509. "back_url":orderBack,
  510. }
  511. },
  512. flags: []
  513. };
  514. Webview.sendIntent("startActivity", playIntent);
  515. }
  516. }
  517. function fullscreenPlay(mid) {
  518. var playIntent = {
  519. package : "com.hunantv.operator",
  520. action: "mangotv://com.hunantv.operator/player/vod",
  521. data:"",
  522. extras: {
  523. "video_index": 0,
  524. "media_asset_id": mid, //媒资包
  525. },
  526. flags: []
  527. };
  528. Webview.sendIntent("startActivity", playIntent);
  529. };
  530. function openBox(){
  531. if(click){
  532. click = false;
  533. if(init.gameNum){
  534. if(init.othersProduct_isVip || init.oursProduct_isVip){
  535. G("unWinToyVipPopup").style.background = "url('./img/page_06.png') no-repeat center";
  536. }else{
  537. G("unWinToyPopup").style.background = "url('./img/page_05.png') no-repeat center";
  538. }
  539. goCollect(uid,init.act_id,init.othersProduct_isVip+init.oursProduct_isVip,function(res){
  540. if(res.code==0){
  541. init.gameNum -= 1;
  542. G("times").innerHTML = init.gameNum;
  543. if(res.data.collect_status=='yes'){
  544. G("toyImg").src=res.data.collect_list[0].collect_img;
  545. S("winToyPopup");
  546. heguiItem = "box";
  547. main.reSetClass("winToyBtn");
  548. }else{
  549. if(init.othersProduct_isVip || init.oursProduct_isVip){
  550. setCookie("item","chance");
  551. S("unWinToyVipPopup");
  552. main.reSetClass("unWinToyVipBtn");
  553. }else{
  554. S("unWinToyPopup");
  555. main.reSetClass("unWinToyBtn");
  556. }
  557. }
  558. }
  559. click = true;
  560. })
  561. }else{
  562. if(init.othersProduct_isVip || init.oursProduct_isVip){
  563. G("unWinToyVipPopup").style.background = "url('./img/page_08.png') no-repeat center";
  564. setCookie("item","");
  565. S("unWinToyVipPopup");
  566. this.reSetClass("poster");
  567. }else{
  568. setCookie("item",'fromOrder0');
  569. G("unWinToyPopup").style.background = "url('./img/page_07.png') no-repeat center";
  570. S("unWinToyPopup");
  571. this.reSetClass("unWinToyBtn");
  572. }
  573. click = true;
  574. }
  575. }
  576. }
  577. function openPopups(){
  578. if(this.currentIndex==0){
  579. Webview.closeBrwoser("返回");//退出
  580. }else if(this.currentIndex==1){
  581. S("rulesPopup");
  582. this.reSetClass("rulesBtn");
  583. }else if(this.currentIndex==2){
  584. heguiItem = "page_btn";
  585. userPrizelog(uid,init.act_id,init.oursProduct_isVip+init.othersProduct_isVip,function(res){
  586. if(res.code == 0){
  587. if(res.data.my_prizes[0]){
  588. if(res.data.user_phone.phone_status !=1){
  589. G('myPrize').src = res.data.my_prizes[0].show_image;
  590. S("exchangePopup");
  591. main.reSetClass("phoneNum",0);
  592. }else{
  593. H("exchangePopup");
  594. S("submittedPopup");
  595. main.reSetClass("submittedBtn");
  596. }
  597. }else{
  598. }
  599. }else{
  600. myBoxGroup("mark");
  601. }
  602. });
  603. }
  604. }
  605. function myBoxGroup(mark){
  606. getUserCollects(uid,init.act_id,init.othersProduct_isVip+init.oursProduct_isVip,function(res){
  607. if(res.code == 0){
  608. for(var i=0;i<res.data.collect.length;i++){
  609. G("toy_"+i).innerHTML = res.data.collect[i].num;
  610. G("txt_"+i).innerHTML = res.data.collect[i].collect_name;
  611. }
  612. if(res.data.complate && res.data.complate[0].exchange_id>=1){
  613. init.canPrize = 1;
  614. if(!mark){
  615. S("myBoxPopup");
  616. }
  617. S("CollectedSuccessPopup");
  618. main.reSetClass("CollectedSuccessBtn");
  619. }else{
  620. if(mark){
  621. S("unExchangePopup");
  622. main.reSetClass("unExchangeBtn");
  623. }else{
  624. S("myBoxPopup");
  625. main.reSetClass("myBoxBtn");
  626. }
  627. }
  628. }else{
  629. if(!mark){
  630. S("myBoxPopup");
  631. main.reSetClass("myBoxBtn");
  632. }
  633. }
  634. })
  635. }
  636. function exchangePopups(){
  637. if(this.currentIndex==1){
  638. H("exchangePopup");
  639. G("phone").innerHTML = "";
  640. this.reSetClass(heguiItem);
  641. }else if(this.currentIndex==0){
  642. var phone = G("phone").innerText;
  643. var myreg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
  644. if(!myreg.test(phone)){
  645. tips('手机号码格式有误!');
  646. }else{
  647. ajax({
  648. url: webUrl + "index.php?m=Home&c=Activityv2&a=setUserInfo",
  649. data: {
  650. uid: uid,
  651. act_id: init.act_id,
  652. is_vip: init.oursProduct_isVip+init.othersProduct_isVip,
  653. phone: phone
  654. },
  655. success: function (res) {
  656. if(res.code == 0){
  657. H("exchangePopup");
  658. G("phone").innerHTML = "";
  659. S("markDownPopup");
  660. main.reSetClass("markDownBtn");
  661. }else{
  662. tips(res.msg);
  663. }
  664. }
  665. })
  666. }
  667. }
  668. }
  669. function cellphoneNum(){
  670. if(G("phone").innerHTML.length>10) return;
  671. var key = this.event.keyCode;
  672. try {
  673. // Webview.setInputTypeTextFlag("true");
  674. if (key >= 0 && key <= 9) {
  675. G("phone").innerText += key;
  676. }
  677. } catch (e) {
  678. if (key > 47 && key < 58) {
  679. G("phone").innerText += (key - 48);
  680. }
  681. }
  682. }
  683. function onBack(){
  684. if(pageItem.indexOf(main.className)>-1){
  685. // window.location.href = webUrl+"/h5v2/special/dx20191126/index.html"
  686. Webview.closeBrwoser("返回");
  687. }else{
  688. }
  689. }
  690. function payResult(is_vip,uid,product_id){
  691. if(is_vip == 1){
  692. ajax({
  693. url:webUrl+"index.php?m=Home&c=DuduApi&a=payResult",
  694. data:{
  695. uid: uid,
  696. product_id:product_id,
  697. pay_result:0
  698. },
  699. success: function (res) {
  700. },
  701. error: function () {
  702. }
  703. })
  704. }
  705. }
  706. function addUser(fn) {
  707. ajax({
  708. url:webUrl+"index.php?m=Home&c=DuduApi&a=addUser",
  709. data:{
  710. uid: uid,
  711. UserToken: usertoken
  712. },
  713. success: function (res) {
  714. fn && fn(res);
  715. },
  716. error: function () {
  717. }
  718. })
  719. }
  720. function addData(fn) {
  721. ajax({
  722. url:webUrl+"index.php?m=Home&c=ThemeData&a=addData",
  723. data:{
  724. uid: uid,
  725. theme_id: 1
  726. },
  727. success: function (res) {
  728. fn && fn(res);
  729. },
  730. error: function () {
  731. }
  732. })
  733. }
  734. function addUser(fn) {
  735. ajax({
  736. url:webUrl+"index.php?m=Home&c=DuduApi&a=addUser",
  737. data:{
  738. uid: uid,
  739. UserToken: usertoken
  740. },
  741. success: function (res) {
  742. fn && fn(res);
  743. },
  744. error: function () {
  745. }
  746. })
  747. }
  748. function authorization(contentcode,uid,usertoken,mac,version,fn) {
  749. ajax({
  750. url:webUrl+"index.php?m=Home&c=order&a=contentCTCAuth",
  751. data:{
  752. contentcode:contentcode,
  753. uid:uid, //2.0
  754. usertoken:usertoken,
  755. mac:mac,
  756. version:version,
  757. fromsource:15
  758. },
  759. type: "post",
  760. dataType: "json",
  761. success: function (res) {
  762. fn && fn(res);
  763. },
  764. error: function (e) {
  765. fn && fn(e);
  766. }
  767. })
  768. }
  769. //游戏次数
  770. function getPrizeNum(uid,act_id,is_vip,fn) {
  771. ajax({
  772. url:webUrl+"index.php?m=Home&c=Activityv2&a=getPrizeNum",
  773. data: {
  774. uid: uid,
  775. act_id: act_id,
  776. is_vip: is_vip//is_vip1+is_vip2
  777. },
  778. success: function (res) {
  779. fn && fn(res);
  780. },
  781. error: function () {
  782. fn && fn();
  783. }
  784. })
  785. }
  786. function goCollect(uid,act_id,is_vip,fn) {//开盒抽卡
  787. ajax({
  788. url:webUrl+"index.php?m=Home&c=Activityv2&a=collect",
  789. data: {
  790. uid: uid,
  791. act_id: act_id,
  792. is_vip: is_vip,//is_vip1+is_vip2
  793. },
  794. success: function (res) {
  795. fn && fn(res);
  796. },
  797. error: function () {
  798. fn && fn();
  799. }
  800. })
  801. }
  802. function getUserCollects(uid,act_id,is_vip,fn) {
  803. ajax({
  804. url:webUrl+"index.php?m=Home&c=Activityv2&a=getUserCollects",
  805. data: {
  806. uid: uid,
  807. act_id: act_id,
  808. is_vip: is_vip//is_vip1+is_vip2
  809. },
  810. success: function (res) {
  811. fn && fn(res);
  812. },
  813. error: function () {
  814. fn && fn();
  815. }
  816. })
  817. }
  818. function prize(uid,act_id,is_vip,fn) {
  819. ajax({
  820. url: webUrl + "index.php?m=Home&c=Activityv2&a=prize",
  821. data: {
  822. uid: uid,
  823. act_id: act_id,
  824. is_vip: is_vip,//is_vip1+is_vip2
  825. run: 'complate',
  826. },
  827. success: function (res) {
  828. fn && fn(res);
  829. }
  830. })
  831. }
  832. function userPrizelog(uid,act_id,is_vip,fn) {
  833. ajax({
  834. url: webUrl + "index.php?m=Home&c=Activityv2&a=userPrizelog",
  835. data: {
  836. uid: uid,
  837. act_id: act_id,
  838. is_vip: is_vip
  839. },
  840. success: function (res) {
  841. fn && fn(res);
  842. },
  843. error: function () {
  844. fn && fn();
  845. }
  846. })
  847. }
  848. function markOrder(idx){
  849. if(!!getCookie("unWinToy")){
  850. if(getCookie("item") == 'fromOrder0'){
  851. G("unWinToyPopup").style.background = "url('./img/page_07.png') no-repeat center";
  852. }else{
  853. G("unWinToyPopup").style.background = "url('./img/page_05.png') no-repeat center";
  854. }
  855. S("unWinToyPopup");
  856. pageConf.focusItem = "unWinToyBtn";
  857. pageConf.focusIdx = idx;
  858. setCookie("unWinToy","")
  859. setCookie("item",'');
  860. }else{
  861. pageConf.focusItem = "order_btn";
  862. pageConf.focusIdx = idx;
  863. }
  864. }
  865. function pageInit(){
  866. if(!getStr("oursBag") && !getStr("othersBag") && !getStr("for")){
  867. addUser();
  868. addData();
  869. }
  870. authorization(init.contentcode,uid,usertoken,mac,version,function(res){
  871. if(res.code == 0){
  872. if(res.data.result==0){
  873. init.oursProduct_isVip = 1;
  874. addClass(G("oursP"),'hasOrder');
  875. addClass(G("oursProduct"),'hasOrder');
  876. if(!!getStr("oursBag")){
  877. payResult(init.oursProduct_isVip,uid,"8801000077");
  878. }
  879. }else{
  880. init.oursProduct_isVip = 0;
  881. if(!!getStr("oursBag")){
  882. markOrder(0);
  883. }
  884. }
  885. authorization(init.contentcode1,uid,usertoken,mac,version,function(res){
  886. if(res.code == 0){
  887. if(res.data.result==0){
  888. init.othersProduct_isVip = 1;
  889. addClass(G("othersP"),'hasOrder');
  890. addClass(G("othersProduct"),'hasOrder');
  891. if(!!getStr("othersBag")){
  892. payResult(init.othersProduct_isVip,uid,"8801000079")
  893. }
  894. }else{
  895. othersProduct_isVip = 0;
  896. if(!!getStr("othersBag")){
  897. markOrder(1);
  898. }
  899. }
  900. var vv = init.oursProduct_isVip+init.othersProduct_isVip;
  901. getPrizeNum(uid,init.act_id,vv,function(res){
  902. if(res.code == 0){
  903. init.gameNum = res.data;
  904. G("times").innerHTML = res.data;
  905. if(!!getCookie("itemIdx")){
  906. if(getCookie("item") == 'chance'){
  907. G("unWinToyVipPopup").style.background = "url('./img/page_08.png') no-repeat center";
  908. }else{
  909. G("unWinToyVipPopup").style.background = "url('./img/page_06.png') no-repeat center";
  910. }
  911. S("unWinToyVipPopup");
  912. pageConf.focusItem = "poster";
  913. pageConf.focusIdx = getCookie("itemIdx");
  914. }
  915. btnInit();
  916. }else{
  917. btnInit();
  918. }
  919. })
  920. // var btnConfig = {
  921. // className: pageConf.focusItem,
  922. // currentIndex: pageConf.focusIdx,
  923. // rules: data.rules,
  924. // onBack:onBack,
  925. // }
  926. // window.main = new tvSysBtnBind(btnConfig);
  927. // main.reLoad();
  928. }
  929. else{
  930. btnInit();
  931. }
  932. });
  933. }else{
  934. btnInit();
  935. }
  936. });
  937. }
  938. function btnInit(){
  939. var btnConfig = {
  940. className: pageConf.focusItem,
  941. currentIndex: pageConf.focusIdx,
  942. rules: data.rules,
  943. onBack:onBack,
  944. }
  945. window.main = new tvSysBtnBind(btnConfig);
  946. main.reLoad();
  947. }
  948. function G(id){
  949. return document.getElementById(id)
  950. }
  951. function S(id){
  952. G(id).style.visibility = "visible";
  953. }
  954. function H(id){
  955. G(id).style.visibility = "hidden";
  956. }
  957. pageInit();
  958. </script>
  959. </body>
  960. </html>