index.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
  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:"8801000638",//"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(this.currentIndex == 5){
  135. // order(0)
  136. // }else{
  137. details_page(videoArr[this.currentIndex])
  138. // }
  139. // mylib.goToDetailsOrPlay(videoArr[this.currentIndex]);
  140. // if(init.oursProduct_isVip == 1){
  141. // fullscreenPlay(videoArr[this.currentIndex]);
  142. // }else{
  143. // order(0);
  144. // }
  145. },
  146. onPress:function(){
  147. if(this.event.keyCode == 38 || this.event.keyCode == "UP"){
  148. if(init.oursProduct_isVip == 0){
  149. this.reSetClass("page_btn",3);
  150. }
  151. // else if(init.oursProduct_isVip == 0 && init.othersProduct_isVip == 1){
  152. // this.reSetClass("page_btn",4);
  153. // }
  154. else{
  155. this.reSetClass("page_btn",2);
  156. }
  157. }
  158. },
  159. },
  160. rules_btn:{
  161. line:1,
  162. onEnterPress:function(){
  163. closeRulesPopup();
  164. },
  165. onPress:function(){
  166. if(this.event.keyCode == 40 || this.event.keyCode == "DOWN"){
  167. if(rulesMark<2)rulesMark+=1;
  168. G("miniBar").style.top = rulesMark*200+"px";
  169. G("rulesPopup").style.top = (-(rulesMark*580))+"px";
  170. }else if(this.event.keyCode == 38 || this.event.keyCode == "UP"){
  171. if(rulesMark>0)rulesMark-=1;
  172. G("miniBar").style.top = rulesMark*200+"px";
  173. G("rulesPopup").style.top = (-(rulesMark*580))+"px";
  174. }
  175. }
  176. }
  177. }
  178. function onBack(){
  179. if(rulesPopup){
  180. closeRulesPopup();
  181. }else{
  182. stopPlay();
  183. Webview.closeBrwoser("返回");
  184. }
  185. }
  186. function closeRulesPopup(){
  187. try{
  188. smallvodPlay(videoId);
  189. }catch(e){
  190. }
  191. rulesPopup = false;
  192. H("rulesPopup");
  193. main.reSetClass("page_btn",1);
  194. }
  195. function details_page (id) {
  196. var playIntent = {
  197. package:"com.hunantv.operator",
  198. action: "mangotv://com.hunantv.operator/detail",
  199. data:"",
  200. extras: {
  201. media_assets_id: id,
  202. },
  203. flags: []
  204. };
  205. Webview.sendIntent("startActivity", playIntent);
  206. }
  207. function order(idx){
  208. var pid = init.oursId;
  209. var mark = "mw_oursBag";
  210. // if(idx == 1){
  211. // pid = init.oursId;
  212. // mark = "mw_othersBag";
  213. // }
  214. var orderBack = backUrl+'?'+mark+'='+uid;
  215. if(version.indexOf("5a.7") || version.indexOf("5a.8")){
  216. var product_list={
  217. "product_id":pid,
  218. "video_name":"",
  219. "video_type":"",
  220. "product_type":"2",
  221. "cat_id":"",
  222. "channel_id":"",
  223. }
  224. window.location.href = "https://hnydorder.yys.mgtv.com:8080/order/index.html?product_list="+JSON.stringify(product_list)+"&exitStr="+escape(orderBack);
  225. }else{
  226. var playIntent = {
  227. package: "com.hunantv.operator",
  228. action: "mangotv://com.hunantv.operator/order",
  229. data: "",
  230. extras: {
  231. product: {
  232. "id": pid,
  233. "time": "",
  234. "price": "",
  235. "type": "",
  236. "name": "",
  237. "bag": "",
  238. "back_url":orderBack,
  239. }
  240. },
  241. flags: []
  242. };
  243. Webview.sendIntent("startActivity", playIntent);
  244. }
  245. }
  246. function addData(fn) {
  247. ajax({
  248. url:webUrl+"index.php?m=Home&c=ThemeData&a=addData",
  249. data:{
  250. uid: uid,
  251. theme_id: init.theme_id,
  252. },
  253. success: function (res) {
  254. fn && fn(res);
  255. },
  256. error: function () {
  257. }
  258. })
  259. }
  260. function addUser(fn) {
  261. ajax({
  262. url:webUrl+"index.php?m=Home&c=DuduApi&a=addUser",
  263. data:{
  264. uid: uid,
  265. UserToken: usertoken
  266. },
  267. success: function (res) {
  268. fn && fn(res);
  269. },
  270. error: function () {
  271. }
  272. })
  273. }
  274. function authorization(contentcode,uid,usertoken,mac,version,fn) {
  275. ajax({
  276. url:webUrl+"index.php?m=Home&c=order&a=contentCTCAuth",
  277. data:{
  278. contentcode:contentcode,
  279. uid:uid, //2.0
  280. usertoken:usertoken,
  281. mac:mac,
  282. version:version,
  283. fromsource:init.fromsource,
  284. },
  285. type: "post",
  286. dataType: "json",
  287. success: function (res) {
  288. fn && fn(res);
  289. },
  290. error: function (e) {
  291. fn && fn(e);
  292. }
  293. })
  294. }
  295. function payResult(is_vip,uid,product_id){
  296. if(is_vip == 1){
  297. ajax({
  298. url:webUrl+"index.php?m=Home&c=DuduApi&a=payResult",
  299. data:{
  300. uid: uid,
  301. product_id:product_id,
  302. pay_result:0
  303. },
  304. success: function (res) {
  305. },
  306. error: function () {
  307. }
  308. })
  309. }
  310. }
  311. function createQrcode(uid,url,fn){
  312. ajax({
  313. url:webUrl+"index.php?m=Home&c=Activityv2&a=createQrcode",
  314. data:{
  315. act_id:init.act_id,
  316. is_vip:0,
  317. uid: uid,
  318. url:url,
  319. },
  320. success: function (res) {
  321. fn && fn(res);
  322. },
  323. error: function (e) {
  324. fn && fn(e);
  325. }
  326. })
  327. }
  328. function fullscreenPlay(mid) {
  329. var playIntent = {
  330. package : "com.hunantv.operator",
  331. action: "mangotv://com.hunantv.operator/player/vod",
  332. data:"",
  333. extras: {
  334. "video_index": 0,
  335. "media_asset_id": mid, //媒资包
  336. },
  337. flags: []
  338. };
  339. Webview.sendIntent("startActivity", playIntent);
  340. };
  341. function smallvodPlay(media_id,media_num){
  342. media_num = media_num || 0;
  343. stopPlay();
  344. starcorExt.setVideoWindowPosition("345", "179", "577", "323");
  345. // starcorExt.setHandler("PlayPrepared",function(prepared){
  346. var playIntent = {
  347. "video_type": "0",
  348. "media_asset_id": media_id,
  349. "video_index": media_num,
  350. };
  351. // if(prepared){
  352. starcorExt.playVideo(playIntent);
  353. // }
  354. // });
  355. };
  356. function stopPlay(){
  357. try{
  358. starcorExt.stopVideo();
  359. }catch(e){
  360. }
  361. }
  362. try{
  363. starcorExt.setHandler("Resume",function(isResumed){
  364. if(isResumed){//从全屏或设置键回来
  365. smallvodPlay(videoId);
  366. }
  367. });
  368. starcorExt.setHandler("PlayOnCompletion",function(isCompleted){
  369. if(isCompleted){//小视频播放结束
  370. smallvodPlay(videoId);
  371. }
  372. });
  373. }catch(e){
  374. }
  375. function pageInit(){
  376. if(!getStr("mw_oursBag") && !getStr("mw_othersBag") && !getStr("for")){
  377. addUser();
  378. addData();
  379. }
  380. createQrcode(uid,link,function(res){
  381. if(res.code == 0){
  382. G("QRcode").src = res.data.qrcode;
  383. }
  384. })
  385. authorization(init.contentcode,uid,usertoken,mac,version,function(res){
  386. if(res.code == 0){
  387. if(res.data.result==0){
  388. init.oursProduct_isVip = 1;
  389. addClass(G("othersProduct"),'hasOrder');
  390. if(!!getStr("mw_oursBag")){
  391. payResult(init.oursProduct_isVip,uid,init.oursId);
  392. }
  393. }else{
  394. init.oursProduct_isVip = 0;
  395. }
  396. // btnInit();
  397. // authorization(init.contentcode1,uid,usertoken,mac,version,function(res){
  398. // if(res.code == 0){
  399. // if(res.data.result==0){
  400. // init.othersProduct_isVip = 1;
  401. // addClass(G("othersProduct"),'hasOrder');
  402. // if(!!getStr("mw_othersBag")){
  403. // payResult(init.othersProduct_isVip,uid,init.othersId)
  404. // }
  405. // }else{
  406. // init.othersProduct_isVip = 0;
  407. // }
  408. // }
  409. // });
  410. }
  411. },function(){
  412. // btnInit();
  413. });
  414. btnInit();
  415. smallvodPlay(videoId);
  416. }
  417. function btnInit(){
  418. var btnConfig = {
  419. className: pageConf.focusItem,
  420. currentIndex: pageConf.focusIdx,
  421. rules: data.rules,
  422. onBack:onBack,
  423. }
  424. window.main = new tvSysBtnBind(btnConfig);
  425. main.reLoad();
  426. }
  427. pageInit();
  428. window.onunload = function(){
  429. stopPlay();
  430. }
  431. </script>
  432. </body>
  433. </html>