index.html 41 KB

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