<?php
require($_SERVER['DOCUMENT_ROOT']."/admin/common.php");
$offset=10;
$page=$_GET['page'];
$fy=isset($page)?$page:0;
$pages=$page*$offset;
$pagesql= mysqli_query($link,"select * from `sc_commodtiy` order by id desc limit $pages,$offset")
?>
<!doctype html>
<html lang="zh-CN">
<head>
<!-- 必须的 meta 标签 -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap 的 CSS 文件 -->
<link rel="stylesheet" href="/src/css/bootstrap.min.css">
<script src="/src/js/jquery.slim.min.js"></script>
<script src="/src/js/bootstrap.bundle.min.js"></script>
<script src="/src/js/jquery/1.10.2/jquery.min.js"></script>
<script src="/src/fwb/index.js"></script>
<link href="/admin/css/style.css" rel="stylesheet">
<title>Hello, world!</title>
<style type="text/css" media="all">
.table {
text-align: center;
}
tr p {
max-width: 200px;
max-height: 40px;
overflow: auto;
overflow-x: hidden;
margin: auto;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
p::-webkit-scrollbar {
border-right: 2px solid #999;
}
tr:hover {
background: rgba(49, 94, 251, 0.1);
}
#spExplain {
max-width: 250px;
max-height: 40px;
overflow: auto;
overflow-x: hidden;
margin: auto;
}
#editor—wrapper {
border: 1px solid #ccc;
z-index: 100;
/* 按需定义 */
}
#toolbar-container {
border-bottom: 1px solid #ccc;
}
#editor-container {
height: 500px;
}
/*.boxCenter {*/
/* max-width: 90%;*/
/* margin: 10px auto;*/
/*}*/
.input-group-text {
width: 100px;
}
.custom-file-label::after {
position: absolute;
top: 0;
right: 0;
bottom: 0;
z-index: 3;
display: block;
height: calc(0rem);
padding: 0rem 0rem;
line-height: 1.5;
color: #495057;
content: "";
background-color: #e9ecef;
border-left: inherit;
border-radius: 0 .25rem .25rem 0;
}
.fileImg {
display: none;
}
img {
max-width: 100%;
}
.w-e-image-container {
width: 100% !important;
}
.modal-dialog{
max-width: 800px !important;
margin: 1.75rem auto;
}
</style>
</head>
<body>
<h3>商品列表</h3>
<!--列表商品-->
<div class="boxCenter">
<table class="table">
<thead class="thead-light">
<tr>
<th scope="col">商品ID</th>
<th scope="col">商品名称</th>
<th scope="col">商品图</th>
<th scope="col">商品说明</th>
<th scope="col">是否推荐</th>
<th scope="col">商品价格</th>
<th scope="col">额外收费</th>
<th scope="col">商品库存</th>
<th scope="col">所属分类</th>
<th scope="col">上架时间</th>
<th scope="col">是否修改</th>
</tr>
</thead>
<tbody>
<?php
while($sp=mysqli_fetch_array($pagesql)){
?>
<tr>
<th scope="row">
<p>
<?php echo $sp['id']?>
</p>
</th>
<td>
<p>
<?php echo $sp['spName']?>
</p>
</td>
<td><img class="" src="<?php echo $sp['spImg']?>" alt="" style="max-width:80px;max-height: 40px;" /></td>
<td>
<p>
<div id="spExplain">
<?php echo $sp['spExplain']?>
</div>
</p>
</td>
<td>
<p>
<?php echo $sp['spSf']?>
</p>
</td>
<td>
<p>
<?php echo $sp['spMoney']?>
</p>
</td>
<td>
<p>
<?php echo $sp['spKc']?>
</p>
</td>
<td>
<p>
<?php echo $sp['spSf']?>
</p>
</td>
<td>
<p>
<?php echo $sp['spClass']?>
</p>
</td>
<td>
<p>
<?php echo $sp['time']?>
</p>
</td>
<td>
<p><a href="javascript:" class="delect" id="<?php echo $sp['id']?>">删除/<a href="javascript:" class="bt"
id="<?php echo $sp['id']?>" data-toggle="modal" data-target="#exampleModal"
data-whatever="@mdo">修改</a></p>
</td>
</tr>
<?php }?>
</tbody>
</table>
<!--分页-->
<nav aria-label="Page navigation example" id="pageBt">
<ul class="pagination justify-content-end">
<li class="page-item">
<a class="page-link" href="javascript:" id="page">上一页</a>
</li>
<li class="page-item">
<a class="page-link" href="javascript:" id="addpage">下一页</a>
</li>
<script>
function page(id) {
const page = document.getElementById(id);
var ar = [];
page.onclick = function () {
let url = window.location.href
ar.push(url.split('='))
var pages = Number((ar[0][1])) - 1
if (isNaN(pages)) {
pages = 1
this.href = "index.php?page=" + pages
} else {
if (pages < 0) {
alert('已经是第一页了')
pages = 0
}
this.href = "index.php?page=" + pages
}
}
}
function addpage(id) {
var ar = [];
var tr = document.querySelectorAll('tr')
let url = window.location.href
ar.push(url.split('='))
var pages = Number((ar[0][1]))
if (isNaN(pages) && tr.length < 11) {
document.getElementById('pageBt').style.display = "none"
}
var tr = document.querySelectorAll('tr')
if (tr.length < 11) {
const page = document.getElementById(id);
console.log('尾页')
page.id = "weiye"
page.innerText = "尾页"
}
const page = document.getElementById(id);
var ar = [];
if (page) {
page.onclick = function () {
let url = window.location.href
ar.push(url.split('='))
var pages = Number((ar[0][1])) + 1
if (isNaN(pages)) {
pages = 1
this.href = "index.php?page=" + pages
} else {
this.href = "index.php?page=" + pages
}
}
}
}
page('page')
addpage('addpage')
</script>
</ul>
</nav>
</div>
<!--弹窗-->
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">修改商品</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form class="" action="" method="post" accept-charset="utf-8">
<div class="boxCenter">
<!--网站描述词-->
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1">商品UID</span>
</div>
<input type="text" class="form-control-id" placeholder="商品UID" aria-label="Username"
aria-describedby="basic-addon1" id="spId" disabled>
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span clas