index.html 18 KB

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