123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <meta name="page-view-size" content="1280*720" />
- <title>"鼠"你最棒,萌宝"潮"贺岁</title>
- <link rel="stylesheet" type="text/css" href="css/page.css" />
- </head>
- <body>
- <div class="main">
- <div class="code">
- <img id="QRcode" src="" alt="" />
- <span>扫码上传萌娃贺岁视频</span>
- <span>拼人气赢大奖</span>
- </div>
- <div class="page_btn pg0"></div>
- <div class="page_btn pg1"></div>
- <div class="page_btn pg2"></div>
- <div class="page_btn pg3" id="othersProduct"></div>
- <!-- <div class="page_btn pg4" id="oursProduct"></div> -->
- <ul class="list">
- <li class="ip_btn ip1"></li>
- <li class="ip_btn ip2"></li>
- <li class="ip_btn ip3"></li>
- <li class="ip_btn ip4"></li>
- <li class="ip_btn ip5"></li>
- <li class="ip_btn ip6"></li>
- </ul>
- <div id="rulesPopup" class="popup">
- <div class="rules_btn"></div>
- <div class="bar">
- <span id="miniBar" class="progress"></span>
- </div>
- </div>
- </div>
- <script src="./js/webview.js" type="text/javascript"></script>
- <script src="./js/tvSysBtnBind.v2.js" type="text/javascript"></script>
- <script src="./js/comm.js" type="text/javascript"></script>
- <script type="text/javascript">
- try {
- var uid = Webview.readSystemProp('user.id');
- var usertoken = Webview.readSystemProp('user.token');
- var mac = Webview.readSystemProp('device.mac');
- var version = Webview.readSystemProp('app.version');
- } catch (e) {
- var uid = getStr("uid") || '0100834547692768574';
- var usertoken = "00139025650832263889980824152950"
- var mac = 'OC-41-E9-DD-EC-DE'
- var version = "YYS.4.6.15.266.5.HNDX.0.0_Release"
- }
- var init = {
- act_id:2,
- gameNum:0,
- theme_id:2,
- fromsource:15,
- oursId:"8801000079",
- othersId:"8801000646",//不用
- oursProduct_isVip:0,
- othersProduct_isVip:0,
- contentcode:"00000001000000000018000000431421",//少儿月包
- // contentcode1:"D00000001201905291020410009898494",
- }
- var webUrl = 'http://111.23.13.123:8091/';
- var backUrl = webUrl+'h5v2/mw_20200108_act/index.html';
- // var indexUrl = webUrl+'html/index.html?activity='+init.act_id;
- var link = "http://111.23.12.38:8093/h5/act/index.html?mark="+uid;//http://120.78.169.79/h5/act/index.html";
- var videoId = "00000001000000000033000000121962";
- var videoArr = ["00000001000000000014000000153851","00000001000000000032000000221170","00000001000000000025000000326508","00000001000000000028000000428043","00000001000000000026000000325529","00000001000000000015000000283749"]
- var pageConf = {
- focusIdx:2,
- focusItem:"page_btn",
- }
- var rulesPopup = false;
- var rulesMark = 0;
- var data = new Object();
- data.rules = {
- page_btn:{
- 0:[2,0,0,1],
- 1:[1,-1,0,1],
- 2:[0,-1,-1,0],
- 3:[0,-1,0,["ip_btn",2]],
- // 4:[0,-2,0,["ip_btn",3]],
- onEnterPress:function(){
- switch (this.currentIndex) {
- case 0:
- onBack();
- break;
- case 1:
- stopPlay();
- rulesPopup = true;
- S("rulesPopup");
- this.reSetClass("rules_btn",1);
- break;
- case 2:
- fullscreenPlay(videoId,"1");
- break;
- case 3:
- order(0);
- break;
- // case 4:
- // order(1);
- // break;
- default:
- break;
- }
-
- },
- onPress:function(){
- if((this.event.keyCode == 40 || this.event.keyCode == "DOWN")&& this.prevIndex == 2){
- if(init.oursProduct_isVip == 0){
- this.reSetClass("page_btn",3);
- }
- // else if(init.oursProduct_isVip == 0 && init.othersProduct_isVip == 1){
- // this.reSetClass("page_btn",4);
- // }
- else{
- this.reSetClass("ip_btn",2);
- }
- }
- // else if((this.event.keyCode == 39 || this.event.keyCode == "RIGHT")&& this.prevIndex == 3){
- // if(init.oursProduct_isVip == 0){
- // this.reSetClass("page_btn",4);
- // }
- // }
- // else if((this.event.keyCode == 37 || this.event.keyCode == "LEFT")&& this.prevIndex == 4){
- // if(init.othersProduct_isVip == 0){
- // this.reSetClass("page_btn",3);
- // }
- // }
- },
- },
- ip_btn:{
- line:6,
- onEnterPress:function(){
- details_page(videoArr[this.currentIndex])
- // mylib.goToDetailsOrPlay(videoArr[this.currentIndex]);
- // if(init.oursProduct_isVip == 1){
- // fullscreenPlay(videoArr[this.currentIndex]);
- // }else{
- // order(0);
- // }
- },
- onPress:function(){
- if(this.event.keyCode == 38 || this.event.keyCode == "UP"){
- if(init.oursProduct_isVip == 0){
- this.reSetClass("page_btn",3);
- }
- // else if(init.oursProduct_isVip == 0 && init.othersProduct_isVip == 1){
- // this.reSetClass("page_btn",4);
- // }
- else{
- this.reSetClass("page_btn",2);
- }
- }
- },
- },
- rules_btn:{
- line:1,
- onEnterPress:function(){
- closeRulesPopup();
- },
- onPress:function(){
- if(this.event.keyCode == 40 || this.event.keyCode == "DOWN"){
- if(rulesMark<2)rulesMark+=1;
- G("miniBar").style.top = rulesMark*200+"px";
- G("rulesPopup").style.top = (-(rulesMark*580))+"px";
- }else if(this.event.keyCode == 38 || this.event.keyCode == "UP"){
- if(rulesMark>0)rulesMark-=1;
- G("miniBar").style.top = rulesMark*200+"px";
- G("rulesPopup").style.top = (-(rulesMark*580))+"px";
- }
- }
- }
- }
- function onBack(){
- if(rulesPopup){
- closeRulesPopup();
- }else{
- stopPlay();
- Webview.closeBrwoser("返回");
- }
- }
- function closeRulesPopup(){
- try{
- smallvodPlay(videoId);
- }catch(e){
-
- }
- rulesPopup = false;
- H("rulesPopup");
- main.reSetClass("page_btn",1);
- }
- function details_page (id) {
- var playIntent = {
- package:"com.hunantv.operator",
- action: "mangotv://com.hunantv.operator/detail",
- data:"",
- extras: {
- media_assets_id: id,
- },
- flags: []
- };
- Webview.sendIntent("startActivity", playIntent);
- }
- function order(idx){
- var pid = init.oursId;
- var mark = "mw_oursBag";
- // if(idx == 1){
- // pid = init.oursId;
- // mark = "mw_othersBag";
- // }
- var orderBack = backUrl+'?'+mark+'='+uid;
- if(version.indexOf("5a.7") || version.indexOf("5a.8")){
- var product_list={
- "product_id":pid,
- "video_name":"",
- "video_type":"",
- "product_type":"2",
- "cat_id":"",
- "channel_id":"",
- }
- window.location.href = "https://hnydorder.yys.mgtv.com:8080/order/index.html?product_list="+JSON.stringify(product_list)+"&exitStr="+escape(orderBack);
- }else{
- var playIntent = {
- package: "com.hunantv.operator",
- action: "mangotv://com.hunantv.operator/order",
- data: "",
- extras: {
- product: {
- "id": pid,
- "time": "",
- "price": "",
- "type": "",
- "name": "",
- "bag": "",
- "back_url":orderBack,
- }
- },
- flags: []
- };
- Webview.sendIntent("startActivity", playIntent);
- }
- }
- function addData(fn) {
- ajax({
- url:webUrl+"index.php?m=Home&c=ThemeData&a=addData",
- data:{
- uid: uid,
- theme_id: init.theme_id,
- },
- success: function (res) {
- fn && fn(res);
- },
- error: function () {
- }
- })
- }
- function addUser(fn) {
- ajax({
- url:webUrl+"index.php?m=Home&c=DuduApi&a=addUser",
- data:{
- uid: uid,
- UserToken: usertoken
- },
- success: function (res) {
- fn && fn(res);
- },
- error: function () {
- }
- })
- }
- function authorization(contentcode,uid,usertoken,mac,version,fn) {
- ajax({
- url:webUrl+"index.php?m=Home&c=order&a=contentCTCAuth",
- data:{
- contentcode:contentcode,
- uid:uid, //2.0
- usertoken:usertoken,
- mac:mac,
- version:version,
- fromsource:init.fromsource,
- },
- type: "post",
- dataType: "json",
- success: function (res) {
- fn && fn(res);
- },
- error: function (e) {
- fn && fn(e);
- }
- })
- }
- function payResult(is_vip,uid,product_id){
- if(is_vip == 1){
- ajax({
- url:webUrl+"index.php?m=Home&c=DuduApi&a=payResult",
- data:{
- uid: uid,
- product_id:product_id,
- pay_result:0
- },
- success: function (res) {
- },
- error: function () {
- }
- })
- }
- }
- function createQrcode(uid,url,fn){
- ajax({
- url:webUrl+"index.php?m=Home&c=Activityv2&a=createQrcode",
- data:{
- act_id:init.act_id,
- is_vip:0,
- uid: uid,
- url:url,
- },
- success: function (res) {
- fn && fn(res);
- },
- error: function (e) {
- fn && fn(e);
- }
- })
- }
-
- function fullscreenPlay(mid) {
- var playIntent = {
- package : "com.hunantv.operator",
- action: "mangotv://com.hunantv.operator/player/vod",
- data:"",
- extras: {
- "video_index": 0,
- "media_asset_id": mid, //媒资包
- },
- flags: []
- };
- Webview.sendIntent("startActivity", playIntent);
- };
- function smallvodPlay(media_id,media_num){
- media_num = media_num || 0;
- stopPlay();
- starcorExt.setVideoWindowPosition("345", "179", "577", "323");
- // starcorExt.setHandler("PlayPrepared",function(prepared){
- var playIntent = {
- "video_type": "0",
- "media_asset_id": media_id,
- "video_index": media_num,
- };
- // if(prepared){
- starcorExt.playVideo(playIntent);
- // }
- // });
- };
- function stopPlay(){
- try{
- starcorExt.stopVideo();
- }catch(e){
- }
- }
- try{
- starcorExt.setHandler("Resume",function(isResumed){
- if(isResumed){//从全屏或设置键回来
- smallvodPlay(videoId);
- }
- });
- starcorExt.setHandler("PlayOnCompletion",function(isCompleted){
- if(isCompleted){//小视频播放结束
- smallvodPlay(videoId);
- }
- });
- }catch(e){
- }
- function pageInit(){
- if(!getStr("mw_oursBag") && !getStr("mw_othersBag") && !getStr("for")){
- addUser();
- addData();
- }
- createQrcode(uid,link,function(res){
- if(res.code == 0){
- G("QRcode").src = res.data.qrcode;
- }
- })
-
- authorization(init.contentcode,uid,usertoken,mac,version,function(res){
- if(res.code == 0){
- if(res.data.result==0){
- init.oursProduct_isVip = 1;
- addClass(G("othersProduct"),'hasOrder');
- if(!!getStr("mw_oursBag")){
- payResult(init.oursProduct_isVip,uid,init.oursId);
- }
- }else{
- init.oursProduct_isVip = 0;
- }
- // btnInit();
-
- // authorization(init.contentcode1,uid,usertoken,mac,version,function(res){
- // if(res.code == 0){
- // if(res.data.result==0){
- // init.othersProduct_isVip = 1;
- // addClass(G("othersProduct"),'hasOrder');
- // if(!!getStr("mw_othersBag")){
- // payResult(init.othersProduct_isVip,uid,init.othersId)
- // }
- // }else{
- // init.othersProduct_isVip = 0;
- // }
- // }
- // });
- }
-
- },function(){
- // btnInit();
- });
- btnInit();
- smallvodPlay(videoId);
- }
- function btnInit(){
- var btnConfig = {
- className: pageConf.focusItem,
- currentIndex: pageConf.focusIdx,
- rules: data.rules,
- onBack:onBack,
- }
- window.main = new tvSysBtnBind(btnConfig);
- main.reLoad();
- }
- pageInit();
- window.onunload = function(){
- stopPlay();
- }
- </script>
- </body>
- </html>
|