<?php
error_reporting(0); 
include("../../config/wap.php");
session_start();
if(!isset($_SESSION['username'])){echo "<script>alert('请重新登录!')</script><script>top.location.href='/m$dshz'</script>";exit;}
$username=$_SESSION['username'];
$type="where name='$username'";
$user=queryall(user,$type);
$userid=$user['userid'];
if(!$user){echo "<script>alert('请重新登录!')</script><script>top.location.href='/m$dshz'</script>";exit;}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="gb2312">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>私有片库</title>
<meta name="viewport" content="initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link href="/2019newui/m/css/common.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="/2019newui/js/jquery.min.js"></script>
<script src="/2019newui/js/bootstrap.min.js"></script>
<script src="/layui/layui.js"></script>
<link href="/layui/css/m.css" rel="stylesheet"/>
<link href="/2019newui/page.css" rel="stylesheet" type="text/css"/>
<style> 
.del{width: 20px;height: 20px;display: block;background: url(/2019newui/images/delete.png) no-repeat;background-size:90%;}
.b-line {position: relative;}
.tab-nav {height: 44px;line-height: 44px;display: block;position: relative;background: #fff;z-index: 1;width: 100%;margin: 0 auto;}
.tab-nav-item {
    height: 44px;
    line-height: 44px;
    position: relative;
    text-align: center;
    color: #585858;
    font-size: 0.9rem;
    display: block;
    float: left;
    width: 50%;


}
 .mark {
            margin: 10px auto 0;
            text-align: center;
        }

            .mark input {
                width: 50px;
                height: 25px;
                background-color: #e6e6e6;
                margin: 0 7px 0 7px;
                border-radius: 5px;
                text-align: center;
                color: #098707;
            }
.mark_body {
            position: relative;
            display: inline-block;
            left: 50%;
            top: 0px;
            width: auto;
            min-width: 300px;
            -webkit-transform: translate(-50%, 0%);
            -moz-transform: translate(-50%, 0%);
            -ms-transform: translate(-50%, 0%);
            -o-transform: translate(-50%, 0%);
            transform: translate(-50%, 0%);
            margin-top: 10px;
            /*border: 1px solid #ccc;*/
        }
.tab-nav-item.tab-active {
    /* background-color: #51bd03; */
}

.tab-nav-item.tab-active a {
    color: #ff1767;
    font-size: 0.8rem;
}

.tab-nav-item a {
    display: inherit;
    font-size: 0.8rem;
    color: #666;
}

.tab-panel {
    position: relative;
    overflow: hidden;
}

.tab-panel .tab-panel-item {
    width: 100%;
    position: absolute;
    top: 0;
    -webkit-transform: translateX(-100%);
    transform: translateX(-100%);
}

.tab-panel .tab-panel-item.tab-active ~ .tab-panel-item {
    -webkit-transform: translateX(100%);
    transform: translateX(100%);
}

.tab-panel .tab-panel-item.tab-active {
    position: relative;
    -webkit-transition: -webkit-transform .15s;
    transition: -webkit-transform .15s;
    transition: transform .15s;
    transition: transform .15s, -webkit-transform .15s;
    -webkit-transform: translateX(0);
    transform: translateX(0);
}

.tab-nav-item.tab-active:before {
    content: '';
    width: 12%;
    height: 2px;
    position: absolute;
    left: 50%;
    bottom: 0;
    margin-left: -6%;
    z-index: 4;
    background-image: -webkit-gradient(linear,left top,right top,from(#ff6143),to(#ff1767));
    background-image: -webkit-linear-gradient(left,#ff6143,#ff1767);
    background-image: -moz-linear-gradient(left,#ff6143,#ff1767);
    background-image: linear-gradient(to right,#ff6143,#ff1767);
    background-color: #ff6143;
}

.tab-panel-item .aui-flex {
    -webkit-box-align: inherit;
    -webkit-align-items: inherit;
    align-items: inherit;
}
</style> 
</head>
<body>
<div class="page-group">
<div class="page" id='topic'>
<header class="aui-navBar aui-navBar-fixed"  style="border-bottom: 1px solid #ddd;">
<a href="javascript:;"  onclick="window.history.back(-1);" class="aui-navBar-item"><i class="icon layui-icon" style="font-size: 20px;">&#xF060;</i></a>
<div class="aui-center"><span class="aui-center-title">私有片库</span></div>
</header>
<?php 
$page_size=10; 
$sql = "WHERE 1=1";
$sql .=" and userid='$userid'";
$resul= mysql_query("select * from  daili  ".$sql."");
$count= mysql_num_rows($resul);
?>
<?php if($count=='0'){?>
<?php }else{?>
<header class="aui-navBar aui-navBar-fixed">
<ul class="tab-nav b-line">
<li class="tab-nav-item"><a  onclick="yjgai()"><span>一键改价</span></a></li>
<li class="tab-nav-item"><a  onclick="yjsc()" ><span>一键清空</span></a></li>
</ul>
</header>
<?php }?>
<div class="divHeight"></div>
<div class="tab-panel">
<div class="tab-panel-item tab-active">
<div class="aui-product">
<?php 
$page_size=10; 
$sql = "WHERE 1=1";
$sql .=" and userid='$userid'";
$resul= mysql_query("select * from  daili  ".$sql."");
$count= mysql_num_rows($resul);
if($count=='0'){echo '<center>暂无记录</center>';}
$page_count= ceil($count/$page_size); 
$init=1; 
$page_len=7; 
$max_p=$page_count; 
$pages=$page_count; 
if(empty($_GET['page'])||$_GET['page']<0){ 
$page=1; 
}else { 
$page=$_GET['page']; 
} 
$offset=$page_size*($page-1); 
$query = mysql_query("select * from  daili  ".$sql."  order by id desc     limit $offset, $page_size");
while ($a=mysql_fetch_array($query)) { 
?> 
<a href="javascript:;" class="aui-flex b-line">
<div class="aui-product-img"><img src="<?php if($a[pic]){?><?php echo $a[pic]?><?php }else{?>/2019newui/images/nopic.jpg<?php }?>" alt=""  onClick="play('<?php echo $a[id]?>','dl')"  ></div>
<div class="aui-flex-box" onClick="play('<?php echo $a[id]?>','dl')"  >
<h2>打赏金:<?php echo $a['sj']?>-<?php echo $a['money']?> 元</h2>
<h2><?php echo $a['name']?></h2>
<h3><?php echo $a['shijian']?></h3>
</div>
<div class="aui-arrow-text"><span class="del" style="float: right;" onClick="sc('<?php echo $a[id]?>','dl')" ></span></div>
</a>
<?php 
} 
$page_len = ($page_len%2)?$page_len:$pagelen+1;//页码个数 
$pageoffset = ($page_len-1)/2;//页码个数左右偏移量 
if($page!=1){ 
$keyt.="<li><a href=\""."/msppage/1/\">首页</a></li>"; //首页 
$keyt.="<li><a href=\""."/msppage/".($page-1)."/\">上页 </a></li>"; //上一页 
}else { 
$keyt.="<li>首页</li>"; //首页 
$keyt.="<li>上页</li>"; //上一页  
} 
if($pages>$page_len){ 
//如果当前页小于等于左偏移 
if($page<=$pageoffset){ 
$init=1; 
$max_p = $page_len; 
}else{//如果当前页大于左偏移 
//如果当前页码右偏移超出最大分页数 
if($page+$pageoffset>=$pages+1){ 
$init = $pages-$page_len+1; 
}else{ 
//左右偏移都存在时的计算 
$init = $page-$pageoffset; 
$max_p = $page+$pageoffset; 
} 
} 
} 
for($i=$init;$i<=$max_p;$i++){ 
if($i==$page){ 
$keyt.='<li class="active">'.$i.'</li>'; 
} else { 
$keyt.="<li><a href=\""."/msppage/".$i."/\">".$i."</a></li>"; 
} 
} 
if($page!=$pages){ 
$keyt.="<li><a href=\""."/msppage/".($page+1)."/\">下页 </a></li>";//下一页 
$keyt.="<li><a href=\""."/msppage/{$pages}/\">尾页</a></li>"; //最后一页 
}else { 
$keyt.="<li>下页</li>";//下一页 
$keyt.="<li>尾页</li>"; //最后一页 
} 
$keyt.='<li class="totalPage">跳转<input type="text" onkeyup="cq(this.value)" value="'.$page.'" ><span>页</span></li><br>';
$keyt.="<li class='totalPage'>当前第 <b>$page</b> 页/共 <b>$pages</b> 页</li>"; 
$keyt.="<li class='totalPage'>每页<b>$page_size</b>条数据</li>"; 
$keyt.="<li class='totalPage'>总共<b>$count</b>条数据 "; 
?> 
</div>
</div>
</div>
<?php if($count=="0"){?>
<?php }else{?>
<div style="height:10px;"></div>
</div>
<div id="pagination" class="pagination">
<ul>
<?php if($count =="0"){?><?php }else{?><?php echo $keyt?><?php }?>
</ul>
</div>
<script>
layui.use(['form', 'layedit', 'laydate', 'element', 'jquery', 'layer'], function(){
var form = layui.form
,layer   = layui.layer
,layedit = layui.layedit
,element = layui.element
,$= layui.jquery
,laydate = layui.laydate;
});
</script>
<script type="text/javascript">
function sc(id) {
layer.confirm("确定要删除吗？", { title: "确认" }, function (index) {
layer.close(index);
var index = layer.load(3, {
shade: [0.1,'#fff'] 
});
$.ajax({
type : "post",
url : "/mpost<?php echo $dshz?>",
dataType: "json",  
async: true,
data: {id: id,lx:'sc'},
timeout: 10000 ,
success : function(data){
if(data.zt=='1'){  
layer.closeAll('loading');
layer.msg('删除成功');
location.reload();
} 
},
error:function(){
}
});
});
}
function yjgai() {
layer.open({
type: 1,
title: "一键更改价格",
area: '300px',
shade: 0.8,
id: 'LAY_layuipro',
btn: ['确认'],
moveType: 1,
<?php if($sjsz==1){?>
content: '<div class="mark_body"><div class="mark"><div style="margin: 5px 0;">起始金额 :<span><input type="text" value="2"  id="sjmoney" >元 </span><br><br>结束金额:<span><input type="text" value="5"  id="gdmoney"   ></span>元</div><div>(如固定价格则填相同的价格)</div></div></div>',
<?php }else{?>
content: '<div class="mark_body"><div class="mark"><div style="margin: 5px 0;">固定金额 :<span><input type="text" value="2"  id="sjmoney" >元 </span></div></div></div>',
<?php }?>
success: function(layero){
var btn = layero.find('.layui-layer-btn');
btn.css('text-align', 'center');
btn.on("click",function(){
var sjmoney = $("#sjmoney").val();
var gdmoney = $("#gdmoney").val();
var index = layer.load(3, {
shade: [0.1,'#fff'] 
});
$.ajax({
type : "post",
url : "/mpost<?php echo $dshz?>",
dataType: "json",  
async: true,
data: {lx: 'jiagegengxin2',sjmoney:sjmoney,gdmoney:gdmoney},
timeout: 10000 ,
success : function(data){
if(data.zt=='1'){  
layer.closeAll('loading');
layer.msg('一键更改价格成功');
location.reload();
}else{
layer.closeAll('loading');
layer.msg(data.msg);
} 
},
error:function(){
}
});
});
},
cancel: function(index, layero){
location.reload();
}
});
}
function yjsc() {
layer.confirm("确定删除片库吗？", { title: "确认" }, function (index) {
layer.close(index);
var index = layer.load(3, {
shade: [0.1,'#fff'] 
});
$.ajax({
type : "post",
url : "/mpost<?php echo $dshz?>",
dataType: "json",  
async: true,
data: {lx: 'scpk'},
timeout: 10000 ,
success : function(data){
if(data.zt=='1'){  
layer.closeAll('loading');
layer.msg('删除成功');
location.reload();
}else{
layer.msg(data.msg);
location.reload();
} 
},
error:function(){
}
});
});
}


function play(id,lx) {
var url='/sjplay_'+id+'_'+lx+'<?php echo $dshz?>';
layer.open({
type: 2,
title: '视频预览(预览前<?php echo $shipinsj?>秒视频)',
shadeClose: true,
shade: 0.8,
area: ['300px', '250px'],
content:url
}); 
}
function cq(page) {
if(page><?php echo $count?>){
layer.msg('当前共<?php echo $count?>页<br>请正确输入页码');
}else{
window.location.href='/msppage/'+page+'/';
} 
}
</script>
<?php }?>
<footer class="aui-footer aui-footer-fixed">
<a href="/mmain<?php echo $dshz?>" class="aui-tabBar-item"><i class="icon layui-icon" style="font-size: 30px;">&#xF015;</i><span class="aui-tabBar-item-text">首页</span></a>
<a href="/mdingdan<?php echo $dshz?>" class="aui-tabBar-item"><i class="icon layui-icon" style="font-size: 30px;">&#xF123;</i><span class="aui-tabBar-item-text">订单</span></a>
<a href="/muser<?php echo $dshz?>" class="aui-tabBar-item"><i class="icon layui-icon" style="font-size: 30px;">&#xF007;</i><span class="aui-tabBar-item-text">我的</span></a>
</footer>
</body>
</html>