index.html 42 KB

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