index.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448
  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:"8801000079",
  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.oursProduct_isVip == 0){
  110. this.reSetClass("page_btn",3);
  111. }
  112. // else if(init.oursProduct_isVip == 0 && init.othersProduct_isVip == 1){
  113. // this.reSetClass("page_btn",4);
  114. // }
  115. else{
  116. this.reSetClass("ip_btn",2);
  117. }
  118. }
  119. // else if((this.event.keyCode == 39 || this.event.keyCode == "RIGHT")&& this.prevIndex == 3){
  120. // if(init.oursProduct_isVip == 0){
  121. // this.reSetClass("page_btn",4);
  122. // }
  123. // }
  124. // else if((this.event.keyCode == 37 || this.event.keyCode == "LEFT")&& this.prevIndex == 4){
  125. // if(init.othersProduct_isVip == 0){
  126. // this.reSetClass("page_btn",3);
  127. // }
  128. // }
  129. },
  130. },
  131. ip_btn:{
  132. line:6,
  133. onEnterPress:function(){
  134. if(init.oursProduct_isVip == 1){
  135. fullscreenPlay(videoArr[this.currentIndex]);
  136. }else{
  137. order(0);
  138. }
  139. },
  140. onPress:function(){
  141. if(this.event.keyCode == 38 || this.event.keyCode == "UP"){
  142. if(init.oursProduct_isVip == 0){
  143. this.reSetClass("page_btn",3);
  144. }
  145. // else if(init.oursProduct_isVip == 0 && init.othersProduct_isVip == 1){
  146. // this.reSetClass("page_btn",4);
  147. // }
  148. else{
  149. this.reSetClass("page_btn",2);
  150. }
  151. }
  152. },
  153. },
  154. rules_btn:{
  155. line:1,
  156. onEnterPress:function(){
  157. closeRulesPopup();
  158. },
  159. onPress:function(){
  160. if(this.event.keyCode == 40 || this.event.keyCode == "DOWN"){
  161. if(rulesMark<2)rulesMark+=1;
  162. G("miniBar").style.top = rulesMark*200+"px";
  163. G("rulesPopup").style.top = (-(rulesMark*540))+"px";
  164. }else if(this.event.keyCode == 38 || this.event.keyCode == "UP"){
  165. if(rulesMark>0)rulesMark-=1;
  166. G("miniBar").style.top = rulesMark*200+"px";
  167. G("rulesPopup").style.top = (-(rulesMark*540))+"px";
  168. }
  169. }
  170. }
  171. }
  172. function onBack(){
  173. if(rulesPopup){
  174. closeRulesPopup();
  175. }else{
  176. stopPlay();
  177. Webview.closeBrwoser("返回");
  178. }
  179. }
  180. function closeRulesPopup(){
  181. try{
  182. smallvodPlay(videoId);
  183. }catch(e){
  184. }
  185. rulesPopup = false;
  186. H("rulesPopup");
  187. main.reSetClass("page_btn",1);
  188. }
  189. function order(idx){
  190. var pid = init.oursId;
  191. var mark = "mw_oursBag";
  192. // if(idx == 1){
  193. // pid = init.oursId;
  194. // mark = "mw_othersBag";
  195. // }
  196. var orderBack = backUrl+'?'+mark+'='+uid;
  197. if(version.indexOf("5a.7") || version.indexOf("5a.8")){
  198. var product_list={
  199. "product_id":pid,
  200. "video_name":"",
  201. "video_type":"",
  202. "product_type":"2",
  203. "cat_id":"",
  204. "channel_id":"",
  205. }
  206. window.location.href = "https://hnydorder.yys.mgtv.com:8080/order/index.html?product_list="+JSON.stringify(product_list)+"&exitStr="+escape(orderBack);
  207. }else{
  208. var playIntent = {
  209. package: "com.hunantv.operator",
  210. action: "mangotv://com.hunantv.operator/order",
  211. data: "",
  212. extras: {
  213. product: {
  214. "id": pid,
  215. "time": "",
  216. "price": "",
  217. "type": "",
  218. "name": "",
  219. "bag": "",
  220. "back_url":orderBack,
  221. }
  222. },
  223. flags: []
  224. };
  225. Webview.sendIntent("startActivity", playIntent);
  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("othersProduct"),'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. btnInit();
  397. smallvodPlay(videoId);
  398. }
  399. function btnInit(){
  400. var btnConfig = {
  401. className: pageConf.focusItem,
  402. currentIndex: pageConf.focusIdx,
  403. rules: data.rules,
  404. onBack:onBack,
  405. }
  406. window.main = new tvSysBtnBind(btnConfig);
  407. main.reLoad();
  408. }
  409. pageInit();
  410. window.onunload = function(){
  411. stopPlay();
  412. }
  413. </script>
  414. </body>
  415. </html>