index.html 6.92 KB
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="Author" content="李靖">
    <meta name="Keywords" content="">
    <meta name="Description" content="">
    <title>抽奖页</title>
    <meta name="viewport"
          content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
    <link rel="stylesheet" type="text/css" href="css/reset.css"/>
    <link rel="stylesheet" type="text/css" href="css/style.css"/>
    <script type="text/javascript" src="js/jquery.min.js"></script>
    <script type="text/javascript" src="js/autoSize.js"></script>
    <script type="text/javascript" src="js/style.js"></script>
    <script>
        var aArr = new Array();//每个盒子的点击状态
        var boxNumLimit = 9;//箱子个数
        $(
                function () {
                    $(".a-box-ul li").live("click", function () {
                        var liNnm = $(this).index();

                        $.ajax({
                            url: '/activity/brandDraw/getBrandActInfoById?id=' + $(this).attr("id"),
                            type: "get",
                            dataType: 'json',
                            success: function (data) {
                                if (data.code === 200) {
                                    var arr = data.data;
                                    if (aArr[liNnm] === 0) {
                                        aArr[liNnm] = 1;
                                        opened(liNnm);
                                        if (arr.prize == 1) {
                                            var newCover = awaCover(arr.prizeRemark);
                                            var res = addPrize(88, arr.id);
                                            if (res.code == 200) {
                                                $("body").append(newCover);
                                            } else {
                                            }
                                            $("body").append(noAwa());
                                        } else {
                                            var newCover = noAwa();
                                            $("body").append(newCover);
                                        }
                                    } else {
                                        aArr[liNnm] = 2;
                                        var newCover = awaBrand(arr.boxImage);
                                        $("body").append(newCover);
                                    }
                                } else {
                                    //系统异常
                                }
                            }
                        });
                    });
                }
        );

        //测试用,假数据
        /*	var dataRequestUrl="http://new.yohoboys.com/customerevent/default/page";
         var _cid=0;
         $.getJSON(dataRequestUrl+"?cid="+_cid+"&offset=0"+"&callback=?",
         function(json) {
         var arr=JSON.parse(json);
         for(var i=0; i<boxNumLimit; i++){
         aArr[i] = 0;
         var _obj=arr[i];
         $(".a-box-ul").append('<li awa="no"><img src='+_obj.pic+' /></li>');
         $(".awa-list-ul ul").append('<li><span>'+ _obj.title+'</span><span>2016/08/08 16:00</span></li>');
         $(".act-list-ul").append('<a><li>'+ _obj.title+'</li></a>');
         }
         }
         );*/

        $.ajax({
            url: '/activity/brandDraw/getBrandActList',
            type: "get",
            contentType: "application/json",
            dataType: 'json',
            success: function (data) {
                if (data.code === 200) {
                    var arr = data.data;
                    for (var i = 0; i < boxNumLimit; i++) {
                        aArr[i] = 0;
                        var _obj = arr[i];
                        var boxid = _obj.id;
                        $(".a-box-ul").append('<li awa="yes" id=' + boxid + '><img src="images/awa.png" /></li>');
                    }
                } else {
                    //  $(".a-box-ul").append('<li awa="yes"><img src=' + _obj.boxImage + ' /></li>');
                }
            }
        });

        //我的奖品

        $(function () {
                    $(".check-awa-btn").live("click", function () {
                        $.ajax({
                            url: '/activity/brandDraw/getBrandPrizeListByUid?uid=' + 2,
                            type: "get",
                            contentType: "application/json",
                            dataType: 'json',
                            success: function (data) {
                                if (data.code === 200) {
                                    var arr = data.data;
                                    for (var i = 0; i < arr.length; i++) {
                                        var _obj = arr[i];
                                        if (_obj != null) {
                                            var dtime = _obj.createTime;
                                            if (dtime > 0) {
                                                var strTime = new Date(parseInt(dtime) * 1000).toISOString().slice(0, 16).replace("T", " ");
                                            }
                                            $(".awa-list-ul ul").empty();
                                            $(".awa-list-ul ul").append('<li><span>' + _obj.prizeRemark + '</span><span>' + strTime + '</span></li>');
                                            $(".act-list-ul").append('<a><li>' + _obj.brandInfo + '</li></a>');
                                        }
                                    }
                                } else {
                                    //   $(".a-box-ul").append('<li awa="yes"><img src=' + _obj.boxImage + ' /></li>');
                                }
                            }
                        });
                    });
                }
        );

    </script>
</head>
<body>
<div class="a-container c-bg">
    <a class="rule-btn">
        <img src="images/rule-btn.png"/>
    </a>

    <div class="a-box clearfix">
        <ul class="a-box-ul clearfix"></ul>
        <div class="awa-list-c">
            <a class="close-list-btn">
                <img src="images/close-list-btn.jpg">
            </a>

            <h1>我的奖品</h1>

            <div class="awa-list-ul">
                <ul></ul>
            </div>
        </div>
        <a class="check-awa-btn">
            <img src="images/my-awa.png"/>
        </a>
    </div>
    <div class="a-box clearfix">
        <div class="act-list-c">
            <ul class="act-list-ul">
            </ul>
        </div>
        <a class="check-act-btn">查看活动</a>
    </div>
    <a class="hot-awa" href="#">
        <img src="images/hot-awa.png"/>
    </a>
</div>
<div class="dia-c">
    <a class="close-btn">
        <img src="images/close-btn.png"/>
    </a>
    <img src="images/rule.png"/>
</div>
</body>
</html>