index.html 43 KB

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