index.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="page-view-size" content="1280*720" />
  6. <title>"鼠"你最棒,萌宝"潮"贺岁</title>
  7. <link rel="stylesheet" type="text/css" href="css/page.css" />
  8. </head>
  9. <body>
  10. <div class="main">
  11. <div class="code">
  12. <img id="QRcode" src="" alt="" />
  13. <span>扫码上转萌娃贺岁视频</span>
  14. <span>拼人气赢大奖</span>
  15. </div>
  16. <div class="page_btn pg0"></div>
  17. <div class="page_btn pg1"></div>
  18. <div class="page_btn pg2"></div>
  19. <div class="page_btn pg3" id="othersProduct"></div>
  20. <!-- <div class="page_btn pg4" id="oursProduct"></div> -->
  21. <ul class="list">
  22. <li class="ip_btn ip1"></li>
  23. <li class="ip_btn ip2"></li>
  24. <li class="ip_btn ip3"></li>
  25. <li class="ip_btn ip4"></li>
  26. <li class="ip_btn ip5"></li>
  27. <li class="ip_btn ip6"></li>
  28. </ul>
  29. <div id="rulesPopup" class="popup">
  30. <div class="rules_btn"></div>
  31. <div class="bar">
  32. <span id="miniBar" class="progress"></span>
  33. </div>
  34. </div>
  35. </div>
  36. <script src="./js/webview.js" type="text/javascript"></script>
  37. <script src="./js/tvSysBtnBind.v2.js" type="text/javascript"></script>
  38. <script src="./js/comm.js" type="text/javascript"></script>
  39. <script type="text/javascript">
  40. try {
  41. var uid = Webview.readSystemProp('user.id');
  42. var usertoken = Webview.readSystemProp('user.token');
  43. var mac = Webview.readSystemProp('device.mac');
  44. var version = Webview.readSystemProp('app.version');
  45. } catch (e) {
  46. var uid = getStr("uid") || '0100834547692768574';
  47. var usertoken = "00139025650832263889980824152950"
  48. var mac = 'OC-41-E9-DD-EC-DE'
  49. var version = "YYS.4.6.15.266.5.HNDX.0.0_Release"
  50. }
  51. var init = {
  52. act_id:2,
  53. gameNum:0,
  54. theme_id:2,
  55. fromsource:15,
  56. oursId:"8801000077",
  57. othersId:"8801000646",//不用
  58. oursProduct_isVip:0,
  59. othersProduct_isVip:0,
  60. contentcode:"00000001000000000018000000431421",//少儿月包
  61. // contentcode1:"D00000001201905291020410009898494",
  62. }
  63. var webUrl = 'http://111.23.13.123:8091/';
  64. var backUrl = webUrl+'h5v2/mw_20200108_act/index.html';
  65. // var indexUrl = webUrl+'html/index.html?activity='+init.act_id;
  66. var link = "http://111.23.12.38:8093/h5/act/index.html?mark="+uid;//http://120.78.169.79/h5/act/index.html";
  67. var videoId = "00000001000000000033000000121962";
  68. var videoArr = ["00000001000000000014000000153851","00000001000000000032000000221170","00000001000000000025000000326508","00000001000000000028000000428043","00000001000000000026000000325529","00000001000000000015000000283749"]
  69. var pageConf = {
  70. focusIdx:2,
  71. focusItem:"page_btn",
  72. }
  73. var rulesPopup = false;
  74. var rulesMark = 0;
  75. var data = new Object();
  76. data.rules = {
  77. page_btn:{
  78. 0:[2,0,0,1],
  79. 1:[1,-1,0,1],
  80. 2:[0,-1,-1,0],
  81. 3:[0,-1,0,["ip_btn",2]],
  82. // 4:[0,-2,0,["ip_btn",3]],
  83. onEnterPress:function(){
  84. switch (this.currentIndex) {
  85. case 0:
  86. onBack();
  87. break;
  88. case 1:
  89. stopPlay();
  90. rulesPopup = true;
  91. S("rulesPopup");
  92. this.reSetClass("rules_btn",1);
  93. break;
  94. case 2:
  95. fullscreenPlay(videoId,"1");
  96. break;
  97. case 3:
  98. order(0);
  99. break;
  100. case 4:
  101. order(1);
  102. break;
  103. default:
  104. break;
  105. }
  106. },
  107. onPress:function(){
  108. if((this.event.keyCode == 40 || this.event.keyCode == "DOWN")&& this.prevIndex == 2){
  109. if(init.othersProduct_isVip == 0){
  110. this.reSetClass("page_btn",3);
  111. }else if(init.oursProduct_isVip == 0 && init.othersProduct_isVip == 1){
  112. this.reSetClass("page_btn",4);
  113. }else{
  114. this.reSetClass("ip_btn",2);
  115. }
  116. }else if((this.event.keyCode == 39 || this.event.keyCode == "RIGHT")&& this.prevIndex == 3){
  117. if(init.oursProduct_isVip == 0){
  118. this.reSetClass("page_btn",4);
  119. }
  120. }
  121. // else if((this.event.keyCode == 37 || this.event.keyCode == "LEFT")&& this.prevIndex == 4){
  122. // if(init.othersProduct_isVip == 0){
  123. // this.reSetClass("page_btn",3);
  124. // }
  125. // }
  126. },
  127. },
  128. ip_btn:{
  129. line:6,
  130. onEnterPress:function(){
  131. if(init.othersProduct_isVip == 1){
  132. fullscreenPlay(videoArr[this.currentIndex]);
  133. }else{
  134. order(0);
  135. }
  136. },
  137. onPress:function(){
  138. if(this.event.keyCode == 38 || this.event.keyCode == "UP"){
  139. if(init.othersProduct_isVip == 0){
  140. this.reSetClass("page_btn",3);
  141. }else if(init.oursProduct_isVip == 0 && init.othersProduct_isVip == 1){
  142. this.reSetClass("page_btn",4);
  143. }else{
  144. this.reSetClass("page_btn",2);
  145. }
  146. }
  147. },
  148. },
  149. rules_btn:{
  150. line:1,
  151. onEnterPress:function(){
  152. closeRulesPopup();
  153. },
  154. onPress:function(){
  155. if(this.event.keyCode == 40 || this.event.keyCode == "DOWN"){
  156. if(rulesMark<2)rulesMark+=1;
  157. G("miniBar").style.top = rulesMark*200+"px";
  158. G("rulesPopup").style.top = (-(rulesMark*540))+"px";
  159. }else if(this.event.keyCode == 38 || this.event.keyCode == "UP"){
  160. if(rulesMark>0)rulesMark-=1;
  161. G("miniBar").style.top = rulesMark*200+"px";
  162. G("rulesPopup").style.top = (-(rulesMark*540))+"px";
  163. }
  164. }
  165. }
  166. }
  167. function onBack(){
  168. if(rulesPopup){
  169. closeRulesPopup();
  170. }else{
  171. stopPlay();
  172. Webview.closeBrwoser("返回");
  173. }
  174. }
  175. function closeRulesPopup(){
  176. try{
  177. smallvodPlay(videoId);
  178. }catch(e){
  179. }
  180. rulesPopup = false;
  181. H("rulesPopup");
  182. main.reSetClass("page_btn",1);
  183. }
  184. function order(idx){
  185. if(init.gameNum==0 && (init.othersProduct_isVip || init.oursProduct_isVip)){
  186. S("timeOutPopup");
  187. main.reSetClass("timeOutBtn");
  188. }else{
  189. var pid = init.oursId;
  190. var mark = "mw_oursBag";
  191. // if(idx == 1){
  192. // pid = init.oursId;
  193. // mark = "mw_othersBag";
  194. // }
  195. var orderBack = backUrl+'?'+mark+'='+uid;
  196. if(version.indexOf("5a.7") || version.indexOf("5a.8")){
  197. var product_list={
  198. "product_id":pid,
  199. "video_name":"",
  200. "video_type":"",
  201. "product_type":"2",
  202. "cat_id":"",
  203. "channel_id":"",
  204. }
  205. window.location.href = "https://hnydorder.yys.mgtv.com:8080/order/index.html?product_list="+JSON.stringify(product_list)+"&exitStr="+escape(orderBack);
  206. }else{
  207. var playIntent = {
  208. package: "com.hunantv.operator",
  209. action: "mangotv://com.hunantv.operator/order",
  210. data: "",
  211. extras: {
  212. product: {
  213. "id": pid,
  214. "time": "",
  215. "price": "",
  216. "type": "",
  217. "name": "",
  218. "bag": "",
  219. "back_url":orderBack,
  220. }
  221. },
  222. flags: []
  223. };
  224. Webview.sendIntent("startActivity", playIntent);
  225. }
  226. }
  227. }
  228. function addData(fn) {
  229. ajax({
  230. url:webUrl+"index.php?m=Home&c=ThemeData&a=addData",
  231. data:{
  232. uid: uid,
  233. theme_id: init.theme_id,
  234. },
  235. success: function (res) {
  236. fn && fn(res);
  237. },
  238. error: function () {
  239. }
  240. })
  241. }
  242. function addUser(fn) {
  243. ajax({
  244. url:webUrl+"index.php?m=Home&c=DuduApi&a=addUser",
  245. data:{
  246. uid: uid,
  247. UserToken: usertoken
  248. },
  249. success: function (res) {
  250. fn && fn(res);
  251. },
  252. error: function () {
  253. }
  254. })
  255. }
  256. function authorization(contentcode,uid,usertoken,mac,version,fn) {
  257. ajax({
  258. url:webUrl+"index.php?m=Home&c=order&a=contentCTCAuth",
  259. data:{
  260. contentcode:contentcode,
  261. uid:uid, //2.0
  262. usertoken:usertoken,
  263. mac:mac,
  264. version:version,
  265. fromsource:init.fromsource,
  266. },
  267. type: "post",
  268. dataType: "json",
  269. success: function (res) {
  270. fn && fn(res);
  271. },
  272. error: function (e) {
  273. fn && fn(e);
  274. }
  275. })
  276. }
  277. function payResult(is_vip,uid,product_id){
  278. if(is_vip == 1){
  279. ajax({
  280. url:webUrl+"index.php?m=Home&c=DuduApi&a=payResult",
  281. data:{
  282. uid: uid,
  283. product_id:product_id,
  284. pay_result:0
  285. },
  286. success: function (res) {
  287. },
  288. error: function () {
  289. }
  290. })
  291. }
  292. }
  293. function createQrcode(uid,url,fn){
  294. ajax({
  295. url:webUrl+"index.php?m=Home&c=Activityv2&a=createQrcode",
  296. data:{
  297. act_id:init.act_id,
  298. is_vip:0,
  299. uid: uid,
  300. url:url,
  301. },
  302. success: function (res) {
  303. fn && fn(res);
  304. },
  305. error: function (e) {
  306. fn && fn(e);
  307. }
  308. })
  309. }
  310. function fullscreenPlay(mid) {
  311. var playIntent = {
  312. package : "com.hunantv.operator",
  313. action: "mangotv://com.hunantv.operator/player/vod",
  314. data:"",
  315. extras: {
  316. "video_index": 0,
  317. "media_asset_id": mid, //媒资包
  318. },
  319. flags: []
  320. };
  321. Webview.sendIntent("startActivity", playIntent);
  322. };
  323. function smallvodPlay(media_id,media_num){
  324. media_num = media_num || 0;
  325. stopPlay();
  326. starcorExt.setVideoWindowPosition("345", "179", "577", "323");
  327. // starcorExt.setHandler("PlayPrepared",function(prepared){
  328. var playIntent = {
  329. "video_type": "0",
  330. "media_asset_id": media_id,
  331. "video_index": media_num,
  332. };
  333. // if(prepared){
  334. starcorExt.playVideo(playIntent);
  335. // }
  336. // });
  337. };
  338. function stopPlay(){
  339. try{
  340. starcorExt.stopVideo();
  341. }catch(e){
  342. }
  343. }
  344. try{
  345. starcorExt.setHandler("Resume",function(isResumed){
  346. if(isResumed){//从全屏或设置键回来
  347. smallvodPlay(videoId);
  348. }
  349. });
  350. starcorExt.setHandler("PlayOnCompletion",function(isCompleted){
  351. if(isCompleted){//小视频播放结束
  352. smallvodPlay(videoId);
  353. }
  354. });
  355. }catch(e){
  356. }
  357. function pageInit(){
  358. if(!getStr("mw_oursBag") && !getStr("mw_othersBag") && !getStr("for")){
  359. addUser();
  360. addData();
  361. }
  362. createQrcode(uid,link,function(res){
  363. if(res.code == 0){
  364. G("QRcode").src = res.data.qrcode;
  365. }
  366. })
  367. authorization(init.contentcode,uid,usertoken,mac,version,function(res){
  368. if(res.code == 0){
  369. if(res.data.result==0){
  370. init.oursProduct_isVip = 1;
  371. addClass(G("oursProduct"),'hasOrder');
  372. if(!!getStr("mw_oursBag")){
  373. payResult(init.oursProduct_isVip,uid,init.oursId);
  374. }
  375. }else{
  376. init.oursProduct_isVip = 0;
  377. }
  378. btnInit();
  379. // authorization(init.contentcode1,uid,usertoken,mac,version,function(res){
  380. // if(res.code == 0){
  381. // if(res.data.result==0){
  382. // init.othersProduct_isVip = 1;
  383. // addClass(G("othersProduct"),'hasOrder');
  384. // if(!!getStr("mw_othersBag")){
  385. // payResult(init.othersProduct_isVip,uid,init.othersId)
  386. // }
  387. // }else{
  388. // init.othersProduct_isVip = 0;
  389. // }
  390. // }
  391. // });
  392. }
  393. },function(){
  394. btnInit();
  395. });
  396. smallvodPlay(videoId);
  397. }
  398. function btnInit(){
  399. var btnConfig = {
  400. className: pageConf.focusItem,
  401. currentIndex: pageConf.focusIdx,
  402. rules: data.rules,
  403. onBack:onBack,
  404. }
  405. window.main = new tvSysBtnBind(btnConfig);
  406. main.reLoad();
  407. }
  408. pageInit();
  409. window.onunload = function(){
  410. stopPlay();
  411. }
  412. </script>
  413. </body>
  414. </html>