|
@@ -0,0 +1,373 @@
|
|
|
+<!DOCTYPE html>
|
|
|
+<html>
|
|
|
+<head>
|
|
|
+<title></title>
|
|
|
+<!--#include virtual="/h5v2/htm2/head.htm" -->
|
|
|
+<style type="text/css">
|
|
|
+body{
|
|
|
+ background-image: url(img/bg.jpg);
|
|
|
+}
|
|
|
+</style>
|
|
|
+</head>
|
|
|
+<body>
|
|
|
+
|
|
|
+<div id="indexDiv"></div>
|
|
|
+<div id="ruleDiv" style="visibility:hidden;"></div>
|
|
|
+
|
|
|
+<!--#include virtual="/h5v2/htm2/foot.htm" -->
|
|
|
+<!--#include virtual="activity_cfg.htm" -->
|
|
|
+<script type="text/javascript">
|
|
|
+
|
|
|
+ // 记录用户
|
|
|
+ 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(fn) {
|
|
|
+ ajax({
|
|
|
+ url:webUrl+"index.php?m=Home&c=order&a=contentCTCAuth",
|
|
|
+ data:{
|
|
|
+ contentcode:ACTIVITY_CFG.CONTENT_CODE,
|
|
|
+ userid:uid, //1.0
|
|
|
+ uid:uid, //2.0
|
|
|
+ usertoken:UserToken,
|
|
|
+ mac:mac,
|
|
|
+ version:version,
|
|
|
+ fromsource:fromsource
|
|
|
+ },
|
|
|
+ type: "post",
|
|
|
+ dataType: "json",
|
|
|
+ success: function (res) {
|
|
|
+ if (res.code == 0) {
|
|
|
+ if(res.data.result == 0){
|
|
|
+ dudu_is_vip = 1;
|
|
|
+ }else{
|
|
|
+ dudu_is_vip = 0;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ dudu_is_vip = 0;
|
|
|
+ }
|
|
|
+ fn && fn();
|
|
|
+ },
|
|
|
+ error: function () {
|
|
|
+ fn && fn();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ function child_authorization(fn) {
|
|
|
+ ajax({
|
|
|
+ url:webUrl+"index.php?m=Home&c=order&a=contentCTCAuth",
|
|
|
+ data:{
|
|
|
+ contentcode:ACTIVITY_CFG.CHILD_CONTENT_CODE,
|
|
|
+ userid:uid, //1.0
|
|
|
+ uid:uid, //2.0
|
|
|
+ usertoken:UserToken,
|
|
|
+ mac:mac,
|
|
|
+ version:version,
|
|
|
+ fromsource:fromsource
|
|
|
+ },
|
|
|
+ type: "post",
|
|
|
+ dataType: "json",
|
|
|
+ success: function (res) {
|
|
|
+ if (res.code == 0) {
|
|
|
+ if(res.data.result == 0){
|
|
|
+ child_is_vip = 1;
|
|
|
+ }else{
|
|
|
+ child_is_vip = 0;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ child_is_vip = 0;
|
|
|
+ }
|
|
|
+ fn && fn();
|
|
|
+ },
|
|
|
+ error: function () {
|
|
|
+ fn && fn();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ //统计
|
|
|
+ function payResult(){
|
|
|
+ if(dudu_is_vip == 1 || child_is_vip == 1){
|
|
|
+ ajax({
|
|
|
+ url:webUrl+"index.php?m=Home&c=DuduApi&a=payResult",
|
|
|
+ data:{
|
|
|
+ uid: uid,
|
|
|
+ product_id:mid_product_id,
|
|
|
+ pay_result:0
|
|
|
+ },
|
|
|
+ success: function (res) {
|
|
|
+ },
|
|
|
+ error: function () {
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //参与次数,抽奖次数
|
|
|
+ function getPrizeNum(fn) {
|
|
|
+ ajax({
|
|
|
+ url:webUrl+"index.php?m=Home&c=Activityv2&a=getPrizeNum",
|
|
|
+ data: {
|
|
|
+ uid: uid,
|
|
|
+ act_id: act_id,
|
|
|
+ is_vip: dudu_is_vip + child_is_vip
|
|
|
+ },
|
|
|
+ success: function (res) {
|
|
|
+ if(res.code==0){
|
|
|
+ remainTimes = res.data;
|
|
|
+ }
|
|
|
+ fn && fn();
|
|
|
+ },
|
|
|
+ error: function () {
|
|
|
+ fn && fn();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ var uid = PageH5.getParam('uid') || '1234567';
|
|
|
+ var UserToken = '';
|
|
|
+ var mac = '';
|
|
|
+ var version = '';
|
|
|
+ try {
|
|
|
+ uid = Webview.readSystemProp('user.id'); //用户ID
|
|
|
+ UserToken = Webview.readSystemProp('user.token'); //用户令牌
|
|
|
+ mac = Webview.readSystemProp('device.mac'); //机顶盒mac地址
|
|
|
+ version = Webview.readSystemProp('app.version'); //APK版本号
|
|
|
+ } catch (e) {
|
|
|
+ }
|
|
|
+ var linkImage = CONFIG.SPACER;//透明图片
|
|
|
+ var buttons = [];//按钮数组
|
|
|
+
|
|
|
+ var act_id = ACTIVITY_CFG.ACT_ID, act_code = ACTIVITY_CFG.ACT_CODE;//活动id及code
|
|
|
+
|
|
|
+ var fromsource = ACTIVITY_CFG.FROM_SOURCE,//来源,电信4,联通5
|
|
|
+ dudu_is_vip = 0,//1是会员,0是非会员
|
|
|
+ child_is_vip = 0,//1是会员,0是非会员
|
|
|
+ mid_product_id = '',//记录订购成功时候用
|
|
|
+ ruleDivIsShow = false,//规则是否展开
|
|
|
+ remainTimes = 0;//游戏剩余次数
|
|
|
+ var prizeImg = '';//获奖时的图片
|
|
|
+ var isLock = false;//是否锁住按键
|
|
|
+
|
|
|
+ PageH5.eventHandler = function(keyCode){
|
|
|
+ if(keyCode==KEY_LEFT && (!isLock)){
|
|
|
+ PageH5.Button.move('left');
|
|
|
+ }else if(keyCode==KEY_RIGHT && (!isLock)){
|
|
|
+ PageH5.Button.move('right');
|
|
|
+ }else if(keyCode==KEY_UP && (!isLock)){
|
|
|
+ PageH5.Button.move('up');
|
|
|
+ }else if(keyCode==KEY_DOWN && (!isLock)){
|
|
|
+ PageH5.Button.move('down');
|
|
|
+ }else if(keyCode==KEY_ENTER && (!isLock)){
|
|
|
+ PageH5.Button.click();
|
|
|
+ }else if((keyCode==KEY_BACK || keyCode==KEY_EXIT) && (!isLock)){
|
|
|
+ back();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ function init(){
|
|
|
+ PageH5.cookie.set('activity_userid', uid);
|
|
|
+ PageH5.cookie.set('activity_is_vip', dudu_is_vip+','+child_is_vip);
|
|
|
+
|
|
|
+ var html = '';
|
|
|
+ html+='<div style="position:absolute;left:1108px;top:6px;"><img id="back" src="'+linkImage+'"/></div>';
|
|
|
+ html+='<div style="position:absolute;left:1108px;top:58px;"><img id="rule" src="'+linkImage+'"/></div>';
|
|
|
+ html+='<div style="position:absolute;left:1108px;top:110px;"><img id="winner" src="'+linkImage+'"/></div>';
|
|
|
+ html+='<div style="position:absolute;left:1108px;top:162px;"><img id="xxjnh" src="'+linkImage+'"/></div>';
|
|
|
+ html+='<div style="position:absolute;left:506px;top:615px;"><img id="start" src="'+linkImage+'"/></div>';
|
|
|
+
|
|
|
+ html+='<div style="position:absolute;left:857px;top:586px;"><img id="cj0Src" src="img/'+(checkTime('6/1/2020 10:00:00','6/1/2020 11:00:00')?"h_10_link1":"h_10_link2")+'.png"/></div>';
|
|
|
+ html+='<div style="position:absolute;left:854px;top:583px;"><img id="cj0" src="'+linkImage+'"/></div>';
|
|
|
+ html+='<div style="position:absolute;left:1007px;top:586px;"><img id="cj1Src" src="img/'+(checkTime('6/1/2020 16:00:00','6/1/2020 17:00:00')?"h_16_link1":"h_16_link2")+'.png"/></div>';
|
|
|
+ html+='<div style="position:absolute;left:1004px;top:583px;"><img id="cj1" src="'+linkImage+'"/></div>';
|
|
|
+
|
|
|
+ html+='<div id="syCount" style="position:absolute;left:410px;top:680px;width:320px;height:30px;line-height:30px;text-align:center;font-size:24px;color:#000000;"></div>';
|
|
|
+ G('indexDiv').innerHTML = html;
|
|
|
+ G('syCount').innerHTML= '今日还剩游戏次数:<font color="red">'+remainTimes+'</font>';
|
|
|
+
|
|
|
+ var ruleDivHTML = '<div style="position:absolute;left:0px;top:0px;"><img src="img/rulePopup.jpg" width="1280" height="720"/></div>';
|
|
|
+ ruleDivHTML+='<div style="position:absolute;left:572px;top:645px;"><img id="guize_btn" src="'+linkImage+'"/></div>';
|
|
|
+ G('ruleDiv').innerHTML = ruleDivHTML;
|
|
|
+
|
|
|
+ buttons.push({id: 'back', action: goAction,left: 'start',right: '',up: '',down: 'rule',focusImage:'img/back_focus.png'});
|
|
|
+ buttons.push({id: 'rule', action: goAction,left: 'start',right: '',up: 'back',down: 'winner',focusImage:'img/guize_focus.png'});
|
|
|
+ buttons.push({id: 'winner', action: goAction,left: 'start',right: '',up: 'rule',down: ['xxjnh','cj0','cj1','start'],focusImage:'img/winner_focus.png'});
|
|
|
+ buttons.push({id: 'xxjnh', action: goAction,left: 'start',right: '',up: 'winner',down: ['cj0','cj1','start'],focusImage:'img/xxjnh_focus.png'});
|
|
|
+ buttons.push({id: 'start', action: goAction,left: '',right: ['cj0','cj1','xxjnh','winner'],up: ['xxjnh','winner'],down: '',focusImage:'img/start_focus.png'});
|
|
|
+ buttons.push({id: 'cj0', action: goAction,left: 'start',right: 'cj1',up: ['xxjnh','winner'],down: '',focusImage:'img/h_10_focus.png'});
|
|
|
+ buttons.push({id: 'cj1', action: goAction,left: ['cj0','start'],right: '',up: ['xxjnh','winner'],down: '',focusImage:'img/h_16_focus.png'});
|
|
|
+
|
|
|
+ var guizeBtn = {
|
|
|
+ id: 'guize_btn', action: goGuizeBtn,
|
|
|
+ left: '',
|
|
|
+ right: '',
|
|
|
+ up: '',
|
|
|
+ down: '',
|
|
|
+ focusImage:'img/sure_focus.png'
|
|
|
+ };
|
|
|
+ buttons.push(guizeBtn);
|
|
|
+
|
|
|
+ var f = PageH5.getParam('f');
|
|
|
+ if(location.search.indexOf('haochuanBag')>=0){
|
|
|
+ }else if(location.search.indexOf('childsBag')>=0){
|
|
|
+ }
|
|
|
+ PageH5.btn.init([f,'start'], buttons, '', false);
|
|
|
+ PageH5.cookie.del('activity_prize_name');
|
|
|
+ }
|
|
|
+
|
|
|
+ function ajaxWinning(status,fn) {
|
|
|
+ ajax({
|
|
|
+ url: webUrl + "index.php?m=Home&c=Activityv2&a=prize",
|
|
|
+ data: {
|
|
|
+ uid: uid,
|
|
|
+ act_id: act_id,
|
|
|
+ is_vip: dudu_is_vip + child_is_vip,
|
|
|
+ run: status,
|
|
|
+ vip_0: (dudu_is_vip + child_is_vip)==0?"can":"uncan" //有机会获取 少儿会员0元包
|
|
|
+ },
|
|
|
+ success: function (res) {
|
|
|
+ if (res.code == 0) {
|
|
|
+ if(res.data.yes.prize_status == "none"){//没中奖
|
|
|
+ goResult('no');
|
|
|
+ }else if(res.data.yes.prize_status == "real"){//中实物
|
|
|
+ prizeImg = res.data.yes.prize_img;
|
|
|
+ PageH5.cookie.set('activity_prize_name', escape(res.data.yes.prize_name));
|
|
|
+ goResult('yes');
|
|
|
+ }else if(res.data.yes.prize_status == "vitual"){//虚拟
|
|
|
+ var prizeName = res.data.yes.prize_name;
|
|
|
+ if(prizeName.indexOf('少儿会员')!=-1){
|
|
|
+ location.href = url_prefix + 'selyg.html?sourceflag=prize';
|
|
|
+ }else{
|
|
|
+ location.href = url_prefix + 'klg.html?sourceflag=prize';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{//接口死局跳转到活动首页
|
|
|
+ goUnusual();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error: function () {
|
|
|
+ goUnusual();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ function goResult(result){
|
|
|
+ if(result=='yes'){
|
|
|
+ location.href = url_prefix + 'gift.html?prizeImg='+prizeImg;
|
|
|
+ }else{
|
|
|
+ if(dudu_is_vip==1 || child_is_vip==1){
|
|
|
+ location.href = url_prefix + 'noGift.html';
|
|
|
+ }else{
|
|
|
+ location.href = url_prefix + 'noGift_free.html';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ function goUnusual(){
|
|
|
+ location.href = url_prefix + 'index.html';
|
|
|
+ }
|
|
|
+
|
|
|
+ function goCJ(){
|
|
|
+ isLock = true;
|
|
|
+ ajaxWinning(Math.random()>0.5?'complate':'nocomplate');
|
|
|
+ }
|
|
|
+
|
|
|
+ function goAction(button){
|
|
|
+ if(button.id=='back'){//返回
|
|
|
+ back();
|
|
|
+ }else if(button.id=='rule'){//活动规则
|
|
|
+ S('ruleDiv');
|
|
|
+ ruleDivIsShow = true;
|
|
|
+ PageH5.btn.set('guize_btn');
|
|
|
+ }else if(button.id=='winner'){//我的礼物
|
|
|
+ location.href = url_prefix + 'winnerInfo.html?f='+button.id;
|
|
|
+ }else if(button.id=='xxjnh'){//线下嘉年华
|
|
|
+ PageH5.tip('xxjnh');
|
|
|
+ }else if(button.id=='start'){
|
|
|
+ if(remainTimes<=0){
|
|
|
+ if(dudu_is_vip==1 || child_is_vip==1){
|
|
|
+ location.href = url_prefix + 'cyg.html';
|
|
|
+ }else{
|
|
|
+ location.href = url_prefix + 'cyg_free.html';
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ goCJ();
|
|
|
+ }
|
|
|
+ }else if(button.id=='cj0'){//10
|
|
|
+ if(checkTime('6/1/2020 10:00:00','6/1/2020 11:00:00')){
|
|
|
+ goCJ();
|
|
|
+ }else{
|
|
|
+ PageH5.tip('抱歉,10点限量送时间未到!');
|
|
|
+ }
|
|
|
+ }else if(button.id=='cj1'){//16
|
|
|
+ if(checkTime('6/1/2020 16:00:00','6/1/2020 17:00:00')){
|
|
|
+ goCJ();
|
|
|
+ }else{
|
|
|
+ PageH5.tip('抱歉,16点限量送时间未到!');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ function goGuizeBtn(button){
|
|
|
+ H('ruleDiv');
|
|
|
+ ruleDivIsShow = false;
|
|
|
+ PageH5.btn.set('rule');
|
|
|
+ }
|
|
|
+
|
|
|
+ function back(){
|
|
|
+ if(ruleDivIsShow){
|
|
|
+ goGuizeBtn(PageH5.btn.get('guize_btn'));
|
|
|
+ }else{
|
|
|
+ Webview.closeBrwoser("返回");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ function checkTime(beginTimeStr,endTimeStr){
|
|
|
+ // beginTimeStr和endTimeStr 月/日/年 如:6/1/2020 10:00:00
|
|
|
+ var flag = false;
|
|
|
+ try{
|
|
|
+ var cTime = new Date();
|
|
|
+ var sTime = new Date(Date.parse(beginTimeStr));
|
|
|
+ var eTime = new Date(Date.parse(endTimeStr));
|
|
|
+ if(cTime>=sTime && cTime<=eTime){
|
|
|
+ flag = true;
|
|
|
+ }
|
|
|
+ }catch(e){
|
|
|
+ }
|
|
|
+ return flag;
|
|
|
+ }
|
|
|
+
|
|
|
+ window.onload = function(){
|
|
|
+ addUser();
|
|
|
+
|
|
|
+ child_authorization(function(){
|
|
|
+ getPrizeNum(function(){
|
|
|
+ init();
|
|
|
+ if(location.search.indexOf('haochuanBag')>=0 && dudu_is_vip==1){
|
|
|
+ mid_product_id = ACTIVITY_CFG.PRODUCT_ID;
|
|
|
+ payResult();
|
|
|
+ }else if(location.search.indexOf('childsBag')>=0 && child_is_vip==1){
|
|
|
+ mid_product_id = ACTIVITY_CFG.CHILD_PRODUCT_ID;
|
|
|
+ payResult();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+</script>
|
|
|
+</body>
|
|
|
+</html>
|