index.html 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858
  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=201906"/>
  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="othersP"></div>
  29. </div>
  30. <div id="rulesPopup" class="popup">
  31. <div class="rulesBtn"></div>
  32. </div>
  33. <div id="myBoxPopup" class="popup">
  34. <ul class="toyGroup">
  35. <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>
  36. <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>
  37. <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>
  38. <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>
  39. <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>
  40. <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>
  41. <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>
  42. </ul>
  43. <div class="myBoxBtn"></div>
  44. </div>
  45. <div id="exchangePopup" class="popup">
  46. <img id="myPrize" src="" alt="" />
  47. <div id="phone"></div>
  48. <ul id="keyBoard">
  49. <li class="phoneNum">1</li>
  50. <li class="phoneNum">2</li>
  51. <li class="phoneNum">3</li>
  52. <li class="phoneNum">4</li>
  53. <li class="phoneNum">5</li>
  54. <li class="phoneNum">6</li>
  55. <li class="phoneNum">7</li>
  56. <li class="phoneNum">8</li>
  57. <li class="phoneNum">9</li>
  58. <li class="phoneNum">0</li>
  59. <li class="phoneNum otherBtn">删除</li>
  60. <li class="phoneNum otherBtn">清空</li>
  61. </ul>
  62. <div class="exchangeBtn confirm"></div>
  63. <div class="exchangeBtn cancel"></div>
  64. </div>
  65. <div id="unExchangePopup" class="popup">
  66. <div class="unExchangeBtn"></div>
  67. </div>
  68. <div id="winToyPopup" class="popup">
  69. <img id="toyImg" src="" height="264" width="172" alt="" />
  70. <div class="winToyBtn myBox"></div>
  71. <div class="winToyBtn confirm"></div>
  72. </div>
  73. <div id="unWinToyPopup" class="popup">
  74. <div id="othersProduct" class="unWinToyBtn"></div>
  75. <div class="unWinToyBtn confirm"></div>
  76. </div>
  77. <div id="unWinToyVipPopup" class="popup">
  78. <div class="pmodel pmodel_1"></div>
  79. <div class="pmodel pmodel_2"></div>
  80. <div class="pmodel pmodel_3"></div>
  81. <div class="poster poster_1"></div>
  82. <div class="poster poster_2"></div>
  83. <div class="poster poster_3"></div>
  84. <div class="unWinToyVipBtn"></div>
  85. </div>
  86. <!-- <div id="noChancePopup" class="popup">
  87. <div class="noChanceBtn"></div>
  88. </div>
  89. <div id="noChanceVipPopup" class="popup">
  90. <div class="noChanceVipBtn"></div>
  91. </div> -->
  92. <div id="CollectedSuccessPopup" class="popup">
  93. <div class="CollectedSuccessBtn"></div>
  94. </div>
  95. <div id="openBoxPopup" class="popup">
  96. <img id="bigPrize" src="" alt="" />
  97. <div class="openBoxBtn oBbtn_1"></div>
  98. <div class="openBoxBtn oBbtn_2"></div>
  99. </div>
  100. <div id="markDownPopup" class="popup">
  101. <div class="markDownBtn"></div>
  102. </div>
  103. <div id="runOutPopup" class="popup">
  104. <div class="runOutBtn"></div>
  105. </div>
  106. <div id="submittedPopup" class="popup">
  107. <div class="submittedBtn"></div>
  108. </div>
  109. </div>
  110. <script src="./js/webview.js" type="text/javascript"></script>
  111. <script src="js/tvSysBtnBind.v2.js" type="text/javascript"></script>
  112. <script src="js/comm.js?v=11" type="text/javascript"></script>
  113. <script src="js/api.js?v=11" type="text/javascript"></script>
  114. <script type="text/javascript">
  115. var pageConf = {
  116. focusIdx:1,
  117. focusItem:"box",
  118. }
  119. var click = true;
  120. var heguiItem = "box";
  121. var init = {
  122. prize:0,
  123. act_id:5,
  124. gameNum:0,
  125. canPrize:0,
  126. othersProduct_isVip:0,
  127. contentcode:"D00000001201808211755370019993899",//内容标识
  128. contentcode1:"D00000001201911281044560065291302"
  129. }
  130. var pageItem = ["box","myBox_btn","page_btn","order_btn"];
  131. // var popupItem = ["rulesBtn","myBoxBtn","unExchangeBtn","unExchangeBtn","exchangeBtn","phoneNum","markDownBtn","unWinToyBtn","unWinToyVipBtn","poster","winToyBtn"]
  132. var webUrl = 'http://111.23.13.123:8090/';
  133. try{
  134. var uid = Webview.readSystemProp('user.id');
  135. var usertoken = Webview.readSystemProp('user.token');//令牌
  136. var mac = Webview.readSystemProp('device.mac');//机顶盒mac地址
  137. var version = Webview.readSystemProp('app.version');//APK版本号
  138. } catch(e) {
  139. var uid = getStr("uid") || '6830027';
  140. var usertoken = "00139025650832263889980824152950"
  141. var mac = 'OC-41-E9-DD-EC-DE'
  142. var version = "YYS.4.6.15.266.5.HNDX.0.0_Release"
  143. }
  144. var backUrl = webUrl+'h5v2/yd20191203/index.html';
  145. var data = new Object();
  146. data.rules = {
  147. box:{
  148. 0:[["myBox_btn",0],0,1,3],
  149. 1:[-1,0,1,3],
  150. 2:[-1,0,["page_btn",2],3],
  151. 3:[["myBox_btn",0],-3,1,0],
  152. 4:[-1,-3,1,0],
  153. 5:[-1,-3,1,0],
  154. 6:[-1,-4,0,0],
  155. "onEnterPress":openBox,
  156. onPress:function(){
  157. if((this.event.keyCode == 39 || this.event.keyCode == "RIGHT") && this.currentIndex == 6){
  158. if(init.othersProduct_isVip == 0){
  159. this.reSetClass("order_btn",0);
  160. }
  161. }
  162. },
  163. },
  164. myBox_btn:{
  165. line:1,
  166. right:["box"],
  167. onEnterPress:function(){
  168. heguiItem = "myBox_btn";
  169. myBoxGroup();
  170. }
  171. },
  172. page_btn:{
  173. line:1,
  174. left:["box",2],
  175. "onEnterPress":openPopups,
  176. onPress:function(){
  177. if((this.event.keyCode == 40 || this.event.keyCode == "DOWN")&& this.prevIndex == 2){
  178. if(init.othersProduct_isVip == 0){
  179. this.reSetClass("order_btn",0);
  180. }
  181. }
  182. },
  183. },
  184. order_btn:{
  185. line:1,
  186. up:["page_btn"],
  187. left:["box",6],
  188. onEnterPress:function(){
  189. order();
  190. },
  191. },
  192. rulesBtn:{
  193. line:1,
  194. onEnterPress:function(){
  195. H("rulesPopup");
  196. this.reSetClass("page_btn",1);
  197. },
  198. onBack:function(){
  199. H("rulesPopup");
  200. this.reSetClass("page_btn",1);
  201. },
  202. },
  203. myBoxBtn:{
  204. line:1,
  205. onEnterPress:function(){
  206. H("myBoxPopup");
  207. this.reSetClass(heguiItem);
  208. },
  209. onBack:function(){
  210. H("myBoxPopup");
  211. this.reSetClass(heguiItem);
  212. },
  213. },
  214. unExchangeBtn:{
  215. line:1,
  216. onEnterPress:function(){
  217. H("unExchangePopup");
  218. this.reSetClass("page_btn",2);
  219. },
  220. onBack:function(){
  221. H("unExchangePopup");
  222. this.reSetClass("page_btn",2);
  223. },
  224. },
  225. exchangeBtn:{
  226. // 0:[0,0,0,["phoneNum",0]],
  227. 0:[0,["phoneNum",6],1,0],
  228. 1:[-1,["phoneNum",8],0,0],
  229. "onEnterPress":exchangePopups,
  230. onPress:cellphoneNum,
  231. onBack:function(){
  232. H("exchangePopup");
  233. G("phone").innerHTML = "";
  234. this.reSetClass(heguiItem);
  235. },
  236. },
  237. phoneNum:{
  238. line:6,
  239. // up:["exchangeBtn",0],
  240. down:["exchangeBtn",1],
  241. onEnterPress:function(){
  242. if(this.currentIndex<=9){
  243. if(G("phone").innerHTML.length>10) return;
  244. if(this.currentIndex == 9){
  245. G("phone").innerHTML += 0;
  246. }else{
  247. G("phone").innerHTML += this.currentIndex*1+1;
  248. }
  249. }else if(this.currentIndex == 10){
  250. if(G("phone").innerHTML.length>0)
  251. G("phone").innerHTML = G("phone").innerHTML.slice(0,-1);
  252. }else if(this.currentIndex == 11){
  253. if(G("phone").innerHTML.length>0)
  254. G("phone").innerHTML = "";
  255. }
  256. },
  257. onPress:cellphoneNum,
  258. onBack:function(){
  259. if(G("phone").innerHTML.length>0){
  260. G("phone").innerHTML = G("phone").innerHTML.slice(0,-1);
  261. }else{
  262. H("exchangePopup");
  263. G("phone").innerHTML = "";
  264. this.reSetClass(heguiItem);
  265. }
  266. },
  267. },
  268. markDownBtn:{
  269. line:1,
  270. onEnterPress:function(){
  271. H("markDownPopup");
  272. this.reSetClass("page_btn",2);
  273. },
  274. onBack:function(){
  275. H("markDownPopup");
  276. this.reSetClass("page_btn",2);
  277. },
  278. },
  279. runOutBtn:{
  280. line:1,
  281. onEnterPress:function(){
  282. H("runOutPopup");
  283. this.reSetClass(heguiItem);
  284. },
  285. onBack:function(){
  286. H("runOutPopup");
  287. this.reSetClass(heguiItem);
  288. },
  289. },
  290. unWinToyBtn:{
  291. 0:[0,0,0,1],
  292. 1:[0,-1,0,0],
  293. onEnterPress:function(){
  294. if(this.currentIndex==1){
  295. H("unWinToyPopup");
  296. this.reSetClass("box");
  297. }else{
  298. order();
  299. }
  300. },
  301. onBack:function(){
  302. H("unWinToyPopup");
  303. this.reSetClass("box");
  304. },
  305. },
  306. unWinToyVipBtn:{
  307. line:1,
  308. up:["poster"],
  309. onEnterPress:function(){
  310. H("unWinToyVipPopup");
  311. this.reSetClass("box");
  312. },
  313. onBack:function(){
  314. H("unWinToyVipPopup");
  315. this.reSetClass("box");
  316. },
  317. },
  318. poster:{
  319. line:3,
  320. down:["unWinToyVipBtn"],
  321. onEnterPress:function(){
  322. var url = '',index=this.currentIndex;
  323. backUrl = backUrl+'?for=poster'+index;
  324. if(index==0){
  325. url = 'http://10.255.0.219/en/pandian2018/index.html?activityId=1991&exitStr=' + escape(backUrl);
  326. }else if(index==1){
  327. url = 'http://10.255.0.219/en/pandian2018/index.html?activityId=1956&exitStr=' + escape(backUrl);
  328. }else if(index==2){
  329. url = 'http://10.255.0.219/en/pandian2018/index.html?activityId=1467&exitStr=' + escape(backUrl);
  330. }
  331. window.location.href = url;
  332. },
  333. onBack:function(){
  334. H("unWinToyVipPopup");
  335. this.reSetClass("box");
  336. },
  337. },
  338. winToyBtn:{
  339. line:2,
  340. onEnterPress:function(){
  341. H("winToyPopup");
  342. if(this.currentIndex == 0){
  343. myBoxGroup();
  344. // S("myBoxPopup");
  345. // this.reSetClass("myBoxBtn");
  346. }else{
  347. this.reSetClass(heguiItem);
  348. }
  349. },
  350. onBack:function(){
  351. H("winToyPopup");
  352. this.reSetClass(heguiItem);
  353. },
  354. },
  355. CollectedSuccessBtn:{
  356. line:1,
  357. onEnterPress:function(){
  358. prize(uid,init.act_id,init.othersProduct_isVip,function(res){
  359. if (res.code == 0) {
  360. if(res.data.yes.prize_status == "real"){//中奖
  361. G("bigPrize").src = res.data.yes.prize_img;
  362. H("myBoxPopup");
  363. H("CollectedSuccessPopup");
  364. S("openBoxPopup");
  365. main.reSetClass("openBoxBtn");
  366. }else{
  367. S("runOutPopup");
  368. main.reSetClass("runOutBtn");
  369. }
  370. }else{
  371. tips(res.msg);
  372. }
  373. })
  374. },
  375. onBack:function(){
  376. H("myBoxPopup");
  377. H("CollectedSuccessPopup");
  378. this.reSetClass(heguiItem);
  379. },
  380. },
  381. openBoxBtn:{
  382. line:2,
  383. onEnterPress:function(){
  384. if(this.currentIndex == 0){
  385. userPrizelog(uid,init.act_id,init.othersProduct_isVip,function(res){
  386. if(res.code == 0){
  387. if(res.data.my_prizes[0]){
  388. if(res.data.user_phone.phone_status !=1){
  389. G('myPrize').src = res.data.my_prizes[0].show_image;
  390. H("openBoxPopup");
  391. S("exchangePopup");
  392. main.reSetClass("phoneNum",0);
  393. }else{
  394. H("openBoxPopup");
  395. S("submittedPopup");
  396. main.reSetClass("submittedBtn");
  397. }
  398. }else{
  399. //未中奖
  400. }
  401. }else{
  402. tips(res.msg)
  403. }
  404. });
  405. }else{
  406. H("openBoxPopup");
  407. this.reSetClass(heguiItem);
  408. }
  409. },
  410. onBack:function(){
  411. H("openBoxPopup");
  412. this.reSetClass(heguiItem);
  413. },
  414. },
  415. submittedBtn:{
  416. line:1,
  417. onEnterPress:function(){
  418. H("submittedPopup");
  419. this.reSetClass(heguiItem);
  420. },
  421. onBack:function(){
  422. H("submittedPopup");
  423. this.reSetClass(heguiItem);
  424. },
  425. }
  426. }
  427. if(!!getCookie("jumpToPay")){
  428. pageConf.focusItem = "order_btn";
  429. pageConf.focusIdx = getCookie("jumpToPay");
  430. }
  431. var btnConfig = {
  432. className: pageConf.focusItem,
  433. currentIndex: pageConf.focusIdx,
  434. rules: data.rules,
  435. onBack:onBack,
  436. }
  437. function order(){
  438. var product_list={
  439. "product_id":"8801000077",
  440. "time":"30",
  441. "product_type":"1",
  442. "price":"29.9",
  443. "button_name":"影视包",
  444. "name":"影视包",
  445. "bag":"ys_bag",
  446. "back_url":backUrl+'?'+mark+'='+uid,
  447. }
  448. setCookie("jumpToPay",0);
  449. window.location.href = "http://10.255.0.219/en/jump_order/index.html?product_list="+JSON.stringify(product_list);
  450. }
  451. function openBox(){
  452. if(click){
  453. click = false;
  454. if(init.gameNum){
  455. if(init.othersProduct_isVip){
  456. G("unWinToyVipPopup").style.background = "url('./img/page_06.png') no-repeat center";
  457. }else{
  458. G("unWinToyPopup").style.background = "url('./img/page_05.png') no-repeat center";
  459. }
  460. goCollect(uid,init.act_id,init.othersProduct_isVip,function(res){
  461. if(res.code==0){
  462. init.gameNum -= 1;
  463. G("times").innerHTML = init.gameNum;
  464. if(res.data.collect_status=='yes'){
  465. G("toyImg").src=res.data.collect_list[0].collect_img;
  466. S("winToyPopup");
  467. heguiItem = "box";
  468. main.reSetClass("winToyBtn");
  469. }else{
  470. if(init.othersProduct_isVip){
  471. S("unWinToyVipPopup");
  472. main.reSetClass("unWinToyVipBtn");
  473. }else{
  474. S("unWinToyPopup");
  475. main.reSetClass("unWinToyBtn");
  476. }
  477. }
  478. }
  479. click = true;
  480. })
  481. }else{
  482. if(init.othersProduct_isVip){
  483. G("unWinToyVipPopup").style.background = "url('./img/page_08.png') no-repeat center";
  484. S("unWinToyVipPopup");
  485. this.reSetClass("poster");
  486. }else{
  487. G("unWinToyPopup").style.background = "url('./img/page_07.png') no-repeat center";
  488. S("unWinToyPopup");
  489. this.reSetClass("unWinToyBtn");
  490. }
  491. click = true;
  492. }
  493. }
  494. }
  495. function openPopups(){
  496. if(this.currentIndex==0){
  497. Webview.closeBrwoser("返回");//退出
  498. }else if(this.currentIndex==1){
  499. S("rulesPopup");
  500. this.reSetClass("rulesBtn");
  501. }else if(this.currentIndex==2){
  502. heguiItem = "page_btn";
  503. userPrizelog(uid,init.act_id,init.othersProduct_isVip,function(res){
  504. if(res.code == 0){
  505. if(res.data.my_prizes[0]){
  506. if(res.data.user_phone.phone_status !=1){
  507. G('myPrize').src = res.data.my_prizes[0].show_image;
  508. S("exchangePopup");
  509. main.reSetClass("phoneNum",0);
  510. }else{
  511. H("exchangePopup");
  512. S("submittedPopup");
  513. main.reSetClass("submittedBtn");
  514. }
  515. }else{
  516. }
  517. }else{
  518. myBoxGroup("mark");
  519. }
  520. });
  521. }
  522. }
  523. function myBoxGroup(mark){
  524. getUserCollects(uid,init.act_id,init.othersProduct_isVip,function(res){
  525. if(res.code == 0){
  526. for(var i=0;i<res.data.collect.length;i++){
  527. G("toy_"+i).innerHTML = res.data.collect[i].num;
  528. G("txt_"+i).innerHTML = res.data.collect[i].collect_name;
  529. }
  530. if(res.data.complate && res.data.complate[0].exchange_id>=1){
  531. init.canPrize = 1;
  532. if(!mark){
  533. S("myBoxPopup");
  534. }
  535. S("CollectedSuccessPopup");
  536. main.reSetClass("CollectedSuccessBtn");
  537. }else{
  538. if(mark){
  539. S("unExchangePopup");
  540. main.reSetClass("unExchangeBtn");
  541. }else{
  542. S("myBoxPopup");
  543. main.reSetClass("myBoxBtn");
  544. }
  545. }
  546. }else{
  547. if(!mark){
  548. S("myBoxPopup");
  549. main.reSetClass("myBoxBtn");
  550. }
  551. }
  552. })
  553. }
  554. function exchangePopups(){
  555. if(this.currentIndex==1){
  556. H("exchangePopup");
  557. G("phone").innerHTML = "";
  558. this.reSetClass(heguiItem);
  559. }else if(this.currentIndex==0){
  560. var phone = G("phone").innerText;
  561. var myreg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
  562. if(!myreg.test(phone)){
  563. tips('手机号码格式有误!');
  564. }else{
  565. ajax({
  566. url: webUrl + "index.php?m=Home&c=Activityv2&a=setUserInfo",
  567. data: {
  568. uid: uid,
  569. act_id: init.act_id,
  570. is_vip: init.othersProduct_isVip,
  571. phone: phone
  572. },
  573. success: function (res) {
  574. if(res.code == 0){
  575. H("exchangePopup");
  576. G("phone").innerHTML = "";
  577. S("markDownPopup");
  578. main.reSetClass("markDownBtn");
  579. }else{
  580. tips(res.msg);
  581. }
  582. }
  583. })
  584. }
  585. }
  586. }
  587. function cellphoneNum(){
  588. console.log(this.event.keyCode)
  589. if(G("phone").innerHTML.length>10) return;
  590. var key = this.event.keyCode;
  591. try {
  592. Webview.setInputTypeTextFlag("true");
  593. if (key >= 0 && key <= 9) {
  594. G("phone").innerText += key;
  595. }
  596. } catch (e) {
  597. if (key > 47 && key < 58) {
  598. G("phone").innerText += (key - 48);
  599. }
  600. }
  601. }
  602. function onBack(){
  603. if(pageItem.indexOf(main.className)>-1){
  604. // window.location.href = webUrl+"/h5v2/special/dx20191126/index.html"
  605. Webview.closeBrwoser("返回");
  606. }else{
  607. }
  608. }
  609. function payResult(is_vip,uid,product_id){
  610. if(is_vip == 1){
  611. ajax({
  612. url:webUrl+"index.php?m=Home&c=DuduApi&a=payResult",
  613. data:{
  614. uid: uid,
  615. product_id:product_id,
  616. pay_result:0
  617. },
  618. success: function (res) {
  619. },
  620. error: function () {
  621. }
  622. })
  623. }
  624. }
  625. function addUser(fn) {
  626. ajax({
  627. url:webUrl+"index.php?m=Home&c=DuduApi&a=addUser",
  628. data:{
  629. uid: uid,
  630. UserToken: usertoken
  631. },
  632. success: function (res) {
  633. fn && fn(res);
  634. },
  635. error: function () {
  636. }
  637. })
  638. }
  639. function addData(fn) {
  640. ajax({
  641. url:webUrl+"index.php?m=Home&c=ThemeData&addData&a=addData",
  642. data:{
  643. uid: uid,
  644. theme_id: 1
  645. },
  646. success: function (res) {
  647. fn && fn(res);
  648. },
  649. error: function () {
  650. }
  651. })
  652. }
  653. function addUser(fn) {
  654. ajax({
  655. url:webUrl+"index.php?m=Home&c=DuduApi&a=addUser",
  656. data:{
  657. uid: uid,
  658. UserToken: usertoken
  659. },
  660. success: function (res) {
  661. fn && fn(res);
  662. },
  663. error: function () {
  664. }
  665. })
  666. }
  667. function authorization(contentcode,uid,usertoken,mac,version,fn) {
  668. ajax({
  669. url:webUrl+"index.php?m=Home&c=order&a=contentCTCAuth",
  670. data:{
  671. contentcode:contentcode,
  672. uid:uid, //2.0
  673. usertoken:usertoken,
  674. mac:mac,
  675. version:version,
  676. fromsource:4
  677. },
  678. type: "post",
  679. dataType: "json",
  680. success: function (res) {
  681. fn && fn(res);
  682. },
  683. error: function (e) {
  684. fn && fn(e);
  685. }
  686. })
  687. }
  688. //游戏次数
  689. function getPrizeNum(uid,act_id,is_vip,fn) {
  690. ajax({
  691. url:webUrl+"index.php?m=Home&c=Activityv2&a=getPrizeNum",
  692. data: {
  693. uid: uid,
  694. act_id: act_id,
  695. is_vip: is_vip//is_vip1+is_vip2
  696. },
  697. success: function (res) {
  698. fn && fn(res);
  699. },
  700. error: function () {
  701. fn && fn();
  702. }
  703. })
  704. }
  705. function goCollect(uid,act_id,is_vip,fn) {//开盒抽卡
  706. ajax({
  707. url:webUrl+"index.php?m=Home&c=Activityv2&a=collect",
  708. data: {
  709. uid: uid,
  710. act_id: act_id,
  711. is_vip: is_vip,//is_vip1+is_vip2
  712. },
  713. success: function (res) {
  714. fn && fn(res);
  715. },
  716. error: function () {
  717. fn && fn();
  718. }
  719. })
  720. }
  721. function getUserCollects(uid,act_id,is_vip,fn) {
  722. ajax({
  723. url:webUrl+"index.php?m=Home&c=Activityv2&a=getUserCollects",
  724. data: {
  725. uid: uid,
  726. act_id: act_id,
  727. is_vip: is_vip//is_vip1+is_vip2
  728. },
  729. success: function (res) {
  730. fn && fn(res);
  731. },
  732. error: function () {
  733. fn && fn();
  734. }
  735. })
  736. }
  737. function prize(uid,act_id,is_vip,fn) {
  738. ajax({
  739. url: webUrl + "index.php?m=Home&c=Activityv2&a=prize",
  740. data: {
  741. uid: uid,
  742. act_id: act_id,
  743. is_vip: is_vip,//is_vip1+is_vip2
  744. run: 'complate',
  745. },
  746. success: function (res) {
  747. fn && fn(res);
  748. }
  749. })
  750. }
  751. function userPrizelog(uid,act_id,is_vip,fn) {
  752. ajax({
  753. url: webUrl + "index.php?m=Home&c=Activityv2&a=userPrizelog",
  754. data: {
  755. uid: uid,
  756. act_id: act_id,
  757. is_vip: is_vip
  758. },
  759. success: function (res) {
  760. fn && fn(res);
  761. },
  762. error: function () {
  763. fn && fn();
  764. }
  765. })
  766. }
  767. function pageInit(){
  768. if(!getStr("oursBag") && !getStr("othersBag") && !getStr("for")){
  769. addUser();
  770. addData();
  771. }
  772. authorization(init.contentcode1,uid,usertoken,mac,version,function(res){
  773. if(res.code == 0){
  774. if(res.data.result==0){
  775. init.othersProduct_isVip = 1;
  776. addClass(G("othersP"),'hasOrder');
  777. addClass(G("othersProduct"),'hasOrder');
  778. if(!!getStr("othersBag") || (getCookie("jumpToPay")).toString()=="0"){
  779. payResult(init.othersProduct_isVip,uid,"10664")
  780. }
  781. }else{
  782. othersProduct_isVip = 0;
  783. }
  784. getPrizeNum(uid,init.act_id,init.othersProduct_isVip,function(res){
  785. if(res.code == 0){
  786. init.gameNum = res.data;
  787. G("times").innerHTML = res.data;
  788. }
  789. })
  790. }
  791. window.main = new tvSysBtnBind(btnConfig);
  792. main.reLoad();
  793. });
  794. setCookie("jumpToPay","");
  795. }
  796. function G(id){
  797. return document.getElementById(id)
  798. }
  799. function S(id){
  800. G(id).style.visibility = "visible";
  801. }
  802. function H(id){
  803. G(id).style.visibility = "hidden";
  804. }
  805. pageInit();
  806. </script>
  807. </body>
  808. </html>