update related data pagination

This commit is contained in:
jack 2018-02-11 16:21:55 +08:00
parent 93d3903727
commit d337d780ce
3 changed files with 145 additions and 56 deletions

View File

@ -1,28 +1,30 @@
<?php if ($this->pageCount): ?> <?php if ($this->pageCount): ?>
<div class="pagination pagination-mini"> <nav>
<ul> <ul class="pagination pagination-sm">
<!-- Previous page link --> <!-- Previous page link -->
<?php if (isset($this->previous)): ?> <?php if (isset($this->previous)): ?>
<li><a href="javascript:void(0);" onclick="related(<?php echo $this->previous;?>)">&laquo;</a></li> <li>
<?php else: ?> <a href="javascript:void(0);" onclick="related(<?php echo $this->previous;?>)"><span>&laquo; <span class="sr-only">(current)</span></span></a>
<li class="disabled"><a href="javascript:;">&laquo;</a></li> </li>
<?php endif; ?> <?php else: ?>
<!-- Numbered page links --> <li class="disabled"><a href="javascript:void(0);"><span><span aria-hidden="true">&laquo;</span></span></a></li>
<?php foreach ($this->pagesInRange as $page): ?> <?php endif; ?>
<?php if ($page != $this->current): ?>
<li><a href="javascript:void(0);" onclick="related(<?php echo $page;?>)"><?= $page; ?></a></li>
<?php else: ?>
<li class="active"><a href="javascript:void(0);"><?= $page; ?></a></li>
<?php endif; ?>
<?php endforeach; ?>
<!-- Next page link --> <!-- Numbered page links -->
<?php if (isset($this->next)): ?> <?php foreach ($this->pagesInRange as $page): ?>
<li><a href="javascript:void(0);" onclick="related(<?php echo $this->next;?>)">&raquo;</a></li> <?php if ($page != $this->current): ?>
<?php else: ?> <li><a href="javascript:void(0);" onclick="related(<?php echo $page;?>)"><?= $page; ?></a></li>
<li class="disabled"><a href="javascript:;">&raquo;</a></li> <?php else: ?>
<?php endif; ?> <li class="disabled"><a href="javascript:void(0);"><span><span aria-hidden="true"><?= $page; ?></span></span></a></li>
</ul> <?php endif; ?>
</div> <?php endforeach; ?>
<?php endif; ?>
<!-- Next page link -->
<?php if (isset($this->next)): ?>
<li><a href="javascript:void(0);" onclick="related(<?php echo $this->next;?>)">&raquo;</a></li>
<?php else: ?>
<li class="disabled"><a href="javascript:void(0);"><span><span aria-hidden="true">&raquo;</span></span></a></li>
<?php endif; ?>
</ul>
</nav>
<?php endif; ?>

View File

@ -26,38 +26,45 @@
<div class="container"> <div class="container">
<div class="col-lg-12"> <div class="col-lg-12">
<div class="content-left col-sm-8"> <div class="content-left col-sm-8">
<div class="data-content"> <div class="data-wrap" >
<h2><?php echo $this->escape($md->title); ?></h2> <div class="data-content">
<?php if ($md->title_en) echo '<h3>'.$this->escape($md->title_en).'</h3>';?> <h2><?php echo $this->escape($md->title); ?></h2>
<div class="data-info"> <?php if ($md->title_en) echo '<h3>'.$this->escape($md->title_en).'</h3>';?>
<?php <div class="data-info">
$kw=array('discipline'=>'学科','place'=>'地点','theme'=>'主题','temporal'=>'时间','stratum'=>'地层'); <?php
$kt=''; $kw=array('discipline'=>'学科','place'=>'地点','theme'=>'主题','temporal'=>'时间','stratum'=>'地层');
$i=0; $kt='';
foreach($this->keys as $cg) :
if ($kt==$cg['keytype']) :
$i+=1;
else :
if (!empty($kt)) echo '</span>';
$kt=$cg['keytype'];
$i=0; $i=0;
endif; foreach($this->keys as $cg) :
if ($i==0) { if ($kt==$cg['keytype']) :
?> $i+=1;
<span> else :
<a href="/data/tag/keytype/<?php echo $kt; ?>"><?php echo $kw[$kt]; ?>: </a> if (!empty($kt)) echo '</span>';
<? $kt=$cg['keytype'];
} $i=0;
echo '<a href="/data/tag/key/'.urlencode($cg['keyword']).'">'.$cg['keyword'].'</a>'; endif;
endforeach; if ($i==0) {
?> ?>
<span>
<a href="/data/tag/keytype/<?php echo $kt; ?>"><?php echo $kw[$kt]; ?>: </a>
<?
}
echo '<a href="/data/tag/key/'.urlencode($cg['keyword']).'">'.$cg['keyword'].'</a>';
endforeach;
?>
</div>
<div class="thumb">
<a class="colorbox" title="<?php echo $md->title; ?>" href="/service/bigthumb/uuid/<?php echo $md->uuid; ?>"><img src="/service/thumb/uuid/<?php echo $md->uuid;?>"/></a>
</div>
<p style="word-break:break-all;word-wrap:break-word;overflow:hidden;">
<?php echo str_replace(array("\r\n", "\n", "\r"),'</p><p>',$md->description);?>
</p>
</div> </div>
<div class="thumb">
<a class="colorbox" title="<?php echo $md->title; ?>" href="/service/bigthumb/uuid/<?php echo $md->uuid; ?>"><img src="/service/thumb/uuid/<?php echo $md->uuid;?>"/></a> <div class="unfold-field">
<div class="unflod-field_mask"></div>
<div class="unfold-field_text"><span>展开全文</span></div>
</div> </div>
<p style="word-break:break-all;word-wrap:break-word;overflow:hidden;">
<?php echo str_replace(array("\r\n", "\n", "\r"),'</p><p>',$md->description);?>
</p>
</div> </div>
<div class="use-state"> <div class="use-state">
@ -405,6 +412,20 @@ $(function() {
$('#show-list').click(function(e) { $('#show-list').click(function(e) {
method.filelist.get($(this).attr('rel')); method.filelist.get($(this).attr('rel'));
}); });
var unfoldField=document.querySelector(".unfold-field");
var wrapH=document.querySelector(".data-wrap").offsetHeight;
var wrap=document.querySelector(".data-wrap");
var contentH=document.querySelector(".data-content").offsetHeight;
if(contentH>wrapH){
unfoldField.style.display="block";
}
wrap.style.visibility="visible";
unfoldField.onclick=function(){
this.parentNode.removeChild(this);
wrap.style.maxHeight="100%";
wrap.style.visible="visible";
}
}); });
//ajax literature //ajax literature
function literature(page){ function literature(page){

View File

@ -214,4 +214,70 @@ a.download-btn:hover{
height: 32px; height: 32px;
font-size: 14px; font-size: 14px;
line-height: 32px; line-height: 32px;
}
.data-wrap{
max-height:600px; /*设置默认高度*/
overflow: hidden;
position:relative;
visibility: hidden;
}
.unfold-field{
display:none;
position:absolute;
font-size: 0;
bottom:0;
width:100%;
height:130px;
z-index: 3;
}
.unfold-field .unflod-field_mask {
height: 84px;
width: 100%;
background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0,hsla(0,0%,100%,0)),to(#fff));
background-image: linear-gradient(-180deg,hsla(0,0%,100%,0),#fff);
}
.unfold-field_text{
cursor: pointer;
width:100%;
color: #406599;;
height:46px;
/*font-size: 0px;*/
line-height: 46px;
text-align: center;
background:#fff;
}
.unfold-field_text span{
display:inline-block;
font-size: 14px;
border: 1px solid #406599;
height:28px;
width: 140px;
text-align: center;
line-height: 28px;
margin-top: 16px;
}
.unfold-field_text span::after{
content:"";
vertical-align: middle;
background-size: contain;
background-repeat: no-repeat;
width: 9px;
height: 6px;
display: inline-block;
margin-left: 5px;
}
.relate-data-list ul li{
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
line-height: 26px;
margin: 20px 0;
}
.relate-data-list ul li a{
color: #959595;
text-decoration: none;
} }