<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <meta content="telephone=no" name="format-detection">
    <meta name="wap-font-scale" content="no">
    <title>髮寶箱</title>
    <link rel="stylesheet" href="css/base.css" />
    <link rel="stylesheet" href="css/index.css">
    <script src="../../lib/fsize.js"></script>
	</head>
	<body>
		<div class="main">
			<div style="width: 100%;height: 0.2rem;"></div>
			<div class="mBox"></div>
		</div>
		<script src="../../lib/jquery-3.1.1.min.js"></script>
		<script src="../../js/time.js"></script>
		<script src="../../lib/langchange.js"></script>
		<script type="text/javascript">
			//var $url = "http://ceshi.yabolive.tv/footseen";
			var $url = "https://www.footseen.com/footseen";
			
		var	next = false;
   	var	more = true;
   	var Mpage = 1
   	var zero=true;
		
    var params = getRequest();
    sessionStorage.token=params.token;//token
    sessionStorage.uid = params.uid; //uid
    
    
    money(Mpage)
			
		 function money(m) {
        $.ajax({
            url: $ip + '/RedPacket/getSendList.html',
            type: "post",
            dataType: "JSON",
            data: {
                uid: sessionStorage.uid,
                lang: sessionStorage.lang,
                pageIndex: m,
                pageSize: 15,
                cid: "web_gw",
                os: "WEB",
                token: sessionStorage.token
            },
            error: function (msg) {
                console.log('请求出错');
            },
            success: function (res) {
                var list = res.list;
                var str = '';
                if(list.length!=0){
                    zero=false
                    	for (var i = 0; i < list.length; i++) {
                    	   str += '<div class="mDetail" data-key="'+list[i].rKey+'">';
                    	   str += '	<div class="mDetailInfo1">';
                    	   str += '		<p>'+list[i].rType+'</p>';
                    	   str += '		<p class="ellipsis">'+list[i].title+'</p>';
                    	   str += '		<p>'+replaceTime(list[i].sendTime)+'</p>';
                    	   str += '	</div>';
                    	   str += '	<div class="mDetailInfo2">';
                    	   str += '		<p>X</p>';
                    	   str += '		<p>-'+list[i].num+langList[langType].dew18+' ></p>';
                    	   if(list[i].returnnum!=0){
                            str += '		<p class="show">'+langList[langType].box8+list[i].returnnum+langList[langType].dew18+'</p>';
                    	   } else {
                    	   	str += '<p>x</p>';
                    	   }
                    	   str += '	</div>';
                    	   str += '	<div class="mDetailBottom"></div>';
                    	   str += '</div>';
                    	}
                }else if(list.length==0&&zero==true){
                		str += '<div class="notBox">';
                    str += '	<img src="img/norecord.png" class="notImg" />';
                    str += '	<p class="notText">'+langList[langType].box1+'</p>';
                    str += '</div>';
                }
                $(".mBox").append(str);
                
                $('.mDetail').unbind('click').on('click',function(){
									var obj = {
									"cid":12,
									"reqCode": new Date().getTime(),
								      "data": {
								          "msg":'跳转集合功能', 
								          "jumptype":3,
								          "url":$url+'/Nesting/box/boxDetail.html'+location.search+'&key='+$(this).attr('data-key'),
								          "isBox":true
								      }
								}
								var obj2 = JSON.stringify(obj);
								appCollaboration(obj2)
							})
                Mpage++;
                next = true;
                if (list[14] == null) {
                    more = false;
                }
            }
        })
    }

    var end = 1;
    $(window).bind("scroll", function () {
        if ($(document).scrollTop() + $(window).height() > $(document).height() - 1 && end != 0 && next)// 接近底部100px
        {
            next == false;
            if (more == true) {
                money(Mpage)
            }
        }
    });	
			

			
			
			
			
			function appCollaboration(msg) {
				var sUserAgent = navigator.userAgent.toLowerCase();
				var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
				var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
				var bIsMidp = sUserAgent.match(/midp/i) == "midp";
				var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
				var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
				var bIsAndroid = sUserAgent.match(/android/i) == "android";
				var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
				var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
				if(!(bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM)) {} else if(bIsAndroid) {
					window.yazhai.appCollaboration(msg);
				} else if(bIsIphoneOs || bIsIpad) {
					window.webkit.messageHandlers.appCollaboration.postMessage(msg);
				}
			}
			
			function appCallback(msg) {
				console.log(msg);
			}
		</script>
	</body>
</html>