Skip to content

Commit

Permalink
opt static source
Browse files Browse the repository at this point in the history
  • Loading branch information
WangNingkai committed Dec 9, 2018
1 parent ed4bdc7 commit 2081da7
Show file tree
Hide file tree
Showing 18 changed files with 23 additions and 17 deletions.
15 changes: 10 additions & 5 deletions app/Helpers/Constants.php
Expand Up @@ -30,13 +30,15 @@ class Constants

const FILE_ICON
= [
'stream' => ['fa-file-text-o', ['txt', 'log']],
'stream' => ['fa-file-text-o', 'text', ['txt', 'log']],
'image' => [
'fa-file-image-o',
'image',
['bmp', 'jpg', 'jpeg', 'png', 'gif', 'ico', 'jpe'],
],
'video' => [
'fa-file-video-o',
'video',
[
'mkv',
'mp4',
Expand All @@ -53,9 +55,10 @@ class Constants
'flv',
],
],
'audio' => ['fa-file-audio-o', ['ogg', 'mp3', 'wav']],
'audio' => ['fa-file-audio-o', 'music', ['ogg', 'mp3', 'wav']],
'code' => [
'fa-file-code-o',
'code',
[
'html',
'htm',
Expand All @@ -72,6 +75,7 @@ class Constants
],
'doc' => [
'fa-file-word-o',
'doc',
[
'csv',
'doc',
Expand All @@ -93,13 +97,14 @@ class Constants
'xlsx',
],
],
'pdf' => ['fa-file-pdf-o', ['pdf']],
'pdf' => ['fa-file-pdf-o', 'pdf', ['pdf']],
'zip' => [
'fa-file-archive-o',
'zip',
['zip', '7z', 'rar', 'bz', 'gz'],
],
'android' => ['fa-android', ['apk']],
'exe' => ['fa-windows', ['exe', 'msi']],
'android' => ['fa-android', 'app', ['apk']],
'exe' => ['fa-windows', 'exe', ['exe', 'msi']],
];

const SITE_THEME
Expand Down
13 changes: 6 additions & 7 deletions app/Helpers/Tool.php
Expand Up @@ -202,22 +202,21 @@ public static function getEncodeUrl($path)
}

/**
* 获取文件图标
*
* @param $ext
* @param string $ext
* @param bool $img
*
* @return string
*/
public static function getExtIcon($ext = '')
public static function getExtIcon($ext = '', $img = false)
{
$patterns = Constants::FILE_ICON;
$icon = '';
foreach ($patterns as $key => $suffix) {
if (in_array($ext, $suffix[1])) {
$icon = $suffix[0];
if (in_array($ext, $suffix[2])) {
$icon = $img ? $suffix[1] : $suffix[0];
break;
} else {
$icon = 'fa-file-text-o';
$icon = $img ? 'file' : 'fa-file-text-o';
}
}

Expand Down
Binary file added public/img/app.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/code.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/doc.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/exe.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/file.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/folder.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/image.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/loading.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/mp4.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/music.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/pdf.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/return.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/text.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/video.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/zip.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 7 additions & 5 deletions resources/views/mdui/one.blade.php
Expand Up @@ -109,7 +109,7 @@ class="mdui-m-t-3 thumb-view mdui-row-xs-3 mdui-row-sm-4 mdui-row-md-5 mdui-row-
<div class="mdui-col">
<a href="{{ route('home',\App\Helpers\Tool::getEncodeUrl(\App\Helpers\Tool::getParentUrl($path_array))) }}">
<div class="col-icon">
<img src="https://i.loli.net/2018/12/07/5c09d7355ea27.png" alt="">
<img src="{{ asset('img/return.png') }}" class="mdui-p-a-1" alt="">
</div>
<div class="col-detail mdui-text-center">
<div class="col-title">
Expand All @@ -129,7 +129,7 @@ class="mdui-m-t-3 thumb-view mdui-row-xs-3 mdui-row-sm-4 mdui-row-md-5 mdui-row-
<a href="{{ route('home',\App\Helpers\Tool::getEncodeUrl($origin_path ? $origin_path.'/'.$item['name'] : $item['name'])) }}">
<div class="col-icon">
<img
src=" https://i.loli.net/2018/12/07/5c09d6920f8ac.png"
src="{{ asset('img/folder.png') }}"
alt="">
</div>
<div class="col-detail mdui-text-center">
Expand All @@ -148,12 +148,14 @@ class="mdui-m-t-3 thumb-view mdui-row-xs-3 mdui-row-sm-4 mdui-row-md-5 mdui-row-
<a target="_blank"
href="{{ route('show',\App\Helpers\Tool::getEncodeUrl($origin_path ? $origin_path.'/'.$item['name'] : $item['name'])) }}">
<div class="col-icon">
@if(in_array($item['ext'],['bmp','jpg','jpeg','png','gif']))
@if(in_array($item['ext'],explode(' ',\App\Helpers\Tool::config('image'))))
<img class="lazy"
data-original="{{ route('thumb',['id'=>$item['id'],'size'=>'small']) }}"
src="https://i.loli.net/2018/12/04/5c0625755d6ce.gif" alt="">
src="{{ asset('img/loading.gif') }}" alt="">
@else
<img src="https://i.loli.net/2018/12/07/5c09d6920dedb.png" alt="">
<img
src="{{ asset('img/'.\App\Helpers\Tool::getExtIcon($item['ext'],true).'.png') }}"
alt="">
@endif
</div>
<div class="col-detail mdui-text-center">
Expand Down

0 comments on commit 2081da7

Please sign in to comment.