Browse Source

add month navs

master
filesite 2 months ago
parent
commit
7e78ea6343
  1. 24
      themes/beauty/controller/ListController.php
  2. 30
      themes/beauty/views/list/bydate.php

24
themes/beauty/controller/ListController.php

@ -421,13 +421,6 @@ Class ListController extends Controller { @@ -421,13 +421,6 @@ Class ListController extends Controller {
throw new Exception("索引数据已失效,请重新扫描所有文件以生成索引数据!", 404);
}
//把所有文件拼接到一个数组里
$allFiles = [];
foreach($cacheData as $month => $files) {
$allFiles = array_merge($allFiles, $files);
}
//其它数据获取
//优先从缓存获取目录数据
@ -502,6 +495,23 @@ Class ListController extends Controller { @@ -502,6 +495,23 @@ Class ListController extends Controller {
}
}
//按月份筛选数据
if (!empty($para_month)) {
$newData = [];
foreach($cacheData as $month => $arr) {
if ($month != $para_month) {continue;}
$newData[$month] = $arr;
}
$cacheData = $newData;
}
//把所有文件拼接到一个数组里
$allFiles = [];
foreach($cacheData as $month => $files) {
$allFiles = array_merge($allFiles, $files);
}
//dataType支持:[image, video, audio]
$dataType = $this->get('dataType', 'html');

30
themes/beauty/views/list/bydate.php

@ -177,6 +177,27 @@ eof; @@ -177,6 +177,27 @@ eof;
echo '</ul>';
//显示月份导航菜单
if (!empty($viewData['para_year']) && !empty($viewData['cacheData_keys'][$viewData['para_year']])) {
echo '<ul class="nav nav-pills ml-1 mb-1">';
$months = $viewData['cacheData_keys'][$viewData['para_year']];
asort($months); //排序
foreach ($months as $month) {
$intMonth = str_replace('m', '', $month);
$activedClass = $month == $viewData['para_month'] ? 'active' : '';
$monthLink = Html::getLinkByParams(FSC::$app['requestUrl'], array(
'show' => $viewData['showType'],
'page' => 1,
'month' => $month,
));
echo <<<eof
<li role="presentation" class="{$activedClass}"><a href="{$monthLink}">{$intMonth}月</a></li>
eof;
}
echo '</ul>';
}
//显示图片、视频、音乐
$allFiles = $viewData['allFiles'];
if(!empty($allFiles)) { //输出所有文件
@ -325,6 +346,15 @@ if ($total > $viewData['pageSize']) { @@ -325,6 +346,15 @@ if ($total > $viewData['pageSize']) {
?>
</div>
<div class="video_previewer">
<video
class="video-js vjs-big-play-centered vjs-fluid vjs-16-9"
playsinline
poster=""
id="pr-player">
</video>
</div>
<script type="text/template" id="btn_show1to1_tmp">
<button title="Toggle zoom 1 to 1" class="f-button"><svg tabindex="-1" width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M3.51 3.07c5.74.02 11.48-.02 17.22.02 1.37.1 2.34 1.64 2.18 3.13 0 4.08.02 8.16 0 12.23-.1 1.54-1.47 2.64-2.79 2.46-5.61-.01-11.24.02-16.86-.01-1.36-.12-2.33-1.65-2.17-3.14 0-4.07-.02-8.16 0-12.23.1-1.36 1.22-2.48 2.42-2.46Z"></path><path d="M5.65 8.54h1.49v6.92m8.94-6.92h1.49v6.92M11.5 9.4v.02m0 5.18v0"></path></svg></button>
</script>
Loading…
Cancel
Save