From 10e56822a9b744a326592d0ed1d00b07e14baefc Mon Sep 17 00:00:00 2001 From: filesite Date: Mon, 23 Dec 2024 12:44:53 +0800 Subject: [PATCH] improve default page --- themes/beauty/views/list/bydate.php | 10 ++++- themes/beauty/views/site/index.php | 60 +++++++++++++++++++---------- 2 files changed, 48 insertions(+), 22 deletions(-) diff --git a/themes/beauty/views/list/bydate.php b/themes/beauty/views/list/bydate.php index 4a5e197..18c0444 100644 --- a/themes/beauty/views/list/bydate.php +++ b/themes/beauty/views/list/bydate.php @@ -423,9 +423,17 @@ eof; $index++; } }else { + $tipPrefix = '照片、视频'; + if ($viewData['showType'] == 'image') { + $tipPrefix = '照片'; + }else if ($viewData['showType'] == 'video') { + $tipPrefix = '视频'; + }else if ($viewData['showType'] == 'audio') { + $tipPrefix = '音乐'; + } echo << -

咦?没有文件哦

+

咦?没有{$tipPrefix}文件哦

人面不知何处去,桃花依旧笑春风...

eof; diff --git a/themes/beauty/views/site/index.php b/themes/beauty/views/site/index.php index 80d3f7b..2d80d7b 100644 --- a/themes/beauty/views/site/index.php +++ b/themes/beauty/views/site/index.php @@ -6,6 +6,11 @@ $imgExts = !empty(FSC::$app['config']['supportedImageExts']) ? FSC::$app['config $videoExts = !empty(FSC::$app['config']['supportedVideoExts']) ? FSC::$app['config']['supportedVideoExts'] : array('mp4', 'mov', 'm3u8'); $audioExts = !empty(FSC::$app['config']['supportedAudioExts']) ? FSC::$app['config']['supportedAudioExts'] : array('mp3'); $supportedExts = array_merge($imgExts, $videoExts, $audioExts); +//首页单独获取所有支持的文件总数 +$totalForIndex = 0; +if (empty($selectedId) && !empty($viewData['allFiles'])) { + $totalForIndex = Html::getDataTotal($viewData['allFiles'], $supportedExts); +} if ($viewData['showType'] == 'image') { $supportedExts = $imgExts; }else if ($viewData['showType'] == 'video') { @@ -337,7 +342,7 @@ eof; //分割目录和文件 echo ''; - if (!empty($category['directories'])) { //两级目录支持 + if (!empty($selectedId) && !empty($category['directories'])) { //两级目录支持 $arrowImg = $dir_ext_status == 'opened' ? 'arrow-up.svg' : 'arrow-down.svg'; $btnTxt = $dir_ext_status == 'opened' ? '收拢目录' : '展开目录'; echo << '所有', - 'image' => '照片', - 'video' => '视频', - 'audio' => '音乐', - ); - - echo ''; //空目录显示提示信息 if ( - ( empty($selectedId) && empty($category['directories']) ) || - ( !empty($selectedId) && empty($category['files']) ) + (!empty($selectedId) && $total == 0) //非首页 + || + (empty($selectedId) && $totalForIndex > 0 && $total == 0) //首页空数据时不显示 ) { + $tipPrefix = '照片、视频'; + if ($viewData['showType'] == 'image') { + $tipPrefix = '照片'; + }else if ($viewData['showType'] == 'video') { + $tipPrefix = '视频'; + }else if ($viewData['showType'] == 'audio') { + $tipPrefix = '音乐'; + } echo << -

咦?没有文件哦

+

咦?当前目录没有{$tipPrefix}文件哦

- 空目录吗?复制照片、视频等文件到目录后点右上角“清空缓存数据刷新”图标清空缓存。 -
- 如果不是空目录,点右上角“清空缓存数据刷新”图标清空缓存,网页有 10 分钟缓存。 + 复制{$tipPrefix}到此目录后点右上角“清空缓存数据”刷新图标清空缓存。

eof;