Feat: Theme config
This commit is contained in:
parent
53c79bfa65
commit
84e2ec0f19
12 changed files with 41 additions and 369 deletions
|
@ -30,7 +30,7 @@ class Home extends Controller{
|
|||
}
|
||||
$policyData["max_size"] = $policyData["max_size"]/(1024*1024);
|
||||
return view('home', [
|
||||
'options' => Option::getValues(['basic','upload']),
|
||||
'options' => Option::getValues(['basic','upload'],$this->userObj->userSQLData),
|
||||
'userInfo' => $userInfo,
|
||||
'extLimit' => $extLimit,
|
||||
'policyData' => $policyData,
|
||||
|
|
|
@ -30,7 +30,7 @@ class Share extends Controller{
|
|||
$shareObj->numIncrease("view_num");
|
||||
if($shareObj->shareData["source_type"] == "dir"){
|
||||
return view('share_dir', [
|
||||
'options' => Option::getValues(['basic','share']),
|
||||
'options' => Option::getValues(['basic','share'],$this->userObj->userSQLData),
|
||||
'userInfo' => $shareObj->shareOwner->userSQLData,
|
||||
'dirData' => $shareObj->dirData,
|
||||
'shareData' => $shareObj->shareData,
|
||||
|
@ -42,7 +42,7 @@ class Share extends Controller{
|
|||
]);
|
||||
}else{
|
||||
return view('share_single', [
|
||||
'options' => Option::getValues(['basic','share']),
|
||||
'options' => Option::getValues(['basic','share'],$this->userObj->userSQLData),
|
||||
'userInfo' => $shareObj->shareOwner->userSQLData,
|
||||
'fileData' => $shareObj->fileData,
|
||||
'shareData' => $shareObj->shareData,
|
||||
|
|
|
@ -34,7 +34,7 @@ class Viewer extends Controller{
|
|||
$url = "/Share/Preview/".input("get.shareKey");
|
||||
}
|
||||
return view('video', [
|
||||
'options' => Option::getValues(['basic']),
|
||||
'options' => Option::getValues(['basic'],$this->userObj->userSQLData),
|
||||
'userInfo' => $userInfo,
|
||||
'groupData' => $groupData,
|
||||
'url' => $url,
|
||||
|
@ -55,7 +55,7 @@ class Viewer extends Controller{
|
|||
$url = "/Share/Content/".input("get.shareKey");
|
||||
}
|
||||
return view('markdown', [
|
||||
'options' => Option::getValues(['basic']),
|
||||
'options' => Option::getValues(['basic'],$this->userObj->userSQLData),
|
||||
'userInfo' => $userInfo,
|
||||
'groupData' => $groupData,
|
||||
'url' => $url,
|
||||
|
|
|
@ -5,10 +5,27 @@ use think\Model;
|
|||
use think\Db;
|
||||
|
||||
class Option extends Model{
|
||||
static function getValues($groups = ['basic']){
|
||||
static function getValues($groups = ['basic'],$userInfo=null){
|
||||
$t = Db::name('options')->where('option_type','in',$groups)->column('option_value','option_name');
|
||||
if(in_array("basic",$groups)){
|
||||
return array_merge($t,self::getThemeOptions($t,$userInfo));
|
||||
}
|
||||
return $t;
|
||||
}
|
||||
|
||||
static function getThemeOptions($basicOptions,$userInfo){
|
||||
$themes = json_decode($basicOptions["themes"],true);
|
||||
if($userInfo==null){
|
||||
return ["themeColor"=>$basicOptions["defaultTheme"],"themeConfig"=>$themes[$basicOptions["defaultTheme"]]];
|
||||
}else{
|
||||
$userOptions = json_decode($userInfo["options"],true);
|
||||
if(empty($userOptions)||!array_key_exists("preferTheme",$userOptions)||!array_key_exists($userOptions["preferTheme"],$themes)){
|
||||
return ["themeColor"=>$basicOptions["defaultTheme"],"themeConfig"=>$themes[$basicOptions["defaultTheme"]]];
|
||||
}
|
||||
return ["themeColor"=>$userOptions["preferTheme"],"themeConfig"=>$themes[$userOptions["preferTheme"]]];
|
||||
}
|
||||
}
|
||||
|
||||
static function getValue($optionName){
|
||||
return Db::name('options')->where('option_name',$optionName)->value('option_value');
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<meta charset="utf-8">
|
||||
<link rel="shortcut icon" href="/favicon.ico">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="theme-color" content="{$options.themeColor}" />
|
||||
<!--
|
||||
manifest.json provides metadata used when your web app is added to the
|
||||
homescreen on Android. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||
|
@ -21,48 +22,7 @@
|
|||
-->
|
||||
<title>我的文件 - {$options.siteName}</title>
|
||||
<script type="text/javascript">
|
||||
colorTheme = {
|
||||
"palette": {
|
||||
"common": {
|
||||
"black": "#000",
|
||||
"white": "#fff"
|
||||
},
|
||||
"background": {
|
||||
"paper": "#fff",
|
||||
"default": "#fafafa"
|
||||
},
|
||||
"primary": {
|
||||
"light": "#7986cb",
|
||||
"main": "#3f51b5",
|
||||
"dark": "#303f9f",
|
||||
"contrastText": "#fff"
|
||||
},
|
||||
"secondary": {
|
||||
"light": "#ff4081",
|
||||
"main": "#f50057",
|
||||
"dark": "#c51162",
|
||||
"contrastText": "#fff"
|
||||
},
|
||||
"error": {
|
||||
"light": "#e57373",
|
||||
"main": "#f44336",
|
||||
"dark": "#d32f2f",
|
||||
"contrastText": "#fff"
|
||||
},
|
||||
"text": {
|
||||
"primary": "rgba(0, 0, 0, 0.87)",
|
||||
"secondary": "rgba(0, 0, 0, 0.54)",
|
||||
"disabled": "rgba(0, 0, 0, 0.38)",
|
||||
"hint": "rgba(0, 0, 0, 0.38)"
|
||||
},
|
||||
"explorer": {
|
||||
"filename": "#474849",
|
||||
"icon": "#8f8f8f",
|
||||
"bgSelected": "#D5DAF0",
|
||||
"emptyIcon": "#e8e8e8",
|
||||
}
|
||||
}
|
||||
};
|
||||
colorTheme = {:json_encode($options["themeConfig"])};
|
||||
isHomePage = true;
|
||||
pageId="";
|
||||
isSharePage = false;
|
||||
|
|
|
@ -5,11 +5,12 @@
|
|||
<meta charset="utf-8">
|
||||
<link rel="shortcut icon" href="/favicon.ico">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="theme-color" content="{$options.themeColor}" />
|
||||
<!--
|
||||
manifest.json provides metadata used when your web app is added to the
|
||||
homescreen on Android. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||
-->
|
||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
|
||||
<link rel="manifest" href="/manifest.json">
|
||||
<!--
|
||||
Notice the use of %PUBLIC_URL% in the tags above.
|
||||
It will be replaced with the URL of the `public` folder during the build.
|
||||
|
@ -21,48 +22,7 @@
|
|||
-->
|
||||
<title>{$dirData.folder_name} - {$options.siteName}</title>
|
||||
<script type="text/javascript">
|
||||
colorTheme = {
|
||||
"palette": {
|
||||
"common": {
|
||||
"black": "#000",
|
||||
"white": "#fff"
|
||||
},
|
||||
"background": {
|
||||
"paper": "#fff",
|
||||
"default": "#fafafa"
|
||||
},
|
||||
"primary": {
|
||||
"light": "#7986cb",
|
||||
"main": "#3f51b5",
|
||||
"dark": "#303f9f",
|
||||
"contrastText": "#fff"
|
||||
},
|
||||
"secondary": {
|
||||
"light": "#ff4081",
|
||||
"main": "#f50057",
|
||||
"dark": "#c51162",
|
||||
"contrastText": "#fff"
|
||||
},
|
||||
"error": {
|
||||
"light": "#e57373",
|
||||
"main": "#f44336",
|
||||
"dark": "#d32f2f",
|
||||
"contrastText": "#fff"
|
||||
},
|
||||
"text": {
|
||||
"primary": "rgba(0, 0, 0, 0.87)",
|
||||
"secondary": "rgba(0, 0, 0, 0.54)",
|
||||
"disabled": "rgba(0, 0, 0, 0.38)",
|
||||
"hint": "rgba(0, 0, 0, 0.38)"
|
||||
},
|
||||
"explorer": {
|
||||
"filename": "#474849",
|
||||
"icon": "#8f8f8f",
|
||||
"bgSelected": "#D5DAF0",
|
||||
"emptyIcon": "#e8e8e8",
|
||||
}
|
||||
}
|
||||
};
|
||||
colorTheme = {:json_encode($options["themeConfig"])};
|
||||
isHomePage = false;
|
||||
isSharePage = true;
|
||||
pageId="";
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<meta charset="utf-8">
|
||||
<link rel="shortcut icon" href="/favicon.ico">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="theme-color" content="{$options.themeColor}" />
|
||||
<!--
|
||||
manifest.json provides metadata used when your web app is added to the
|
||||
homescreen on Android. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||
|
@ -21,48 +22,7 @@
|
|||
-->
|
||||
<title>{$fileData.orign_name} - {$options.siteName}</title>
|
||||
<script type="text/javascript">
|
||||
colorTheme = {
|
||||
"palette": {
|
||||
"common": {
|
||||
"black": "#000",
|
||||
"white": "#fff"
|
||||
},
|
||||
"background": {
|
||||
"paper": "#fff",
|
||||
"default": "#fafafa"
|
||||
},
|
||||
"primary": {
|
||||
"light": "#7986cb",
|
||||
"main": "#3f51b5",
|
||||
"dark": "#303f9f",
|
||||
"contrastText": "#fff"
|
||||
},
|
||||
"secondary": {
|
||||
"light": "#ff4081",
|
||||
"main": "#f50057",
|
||||
"dark": "#c51162",
|
||||
"contrastText": "#fff"
|
||||
},
|
||||
"error": {
|
||||
"light": "#e57373",
|
||||
"main": "#f44336",
|
||||
"dark": "#d32f2f",
|
||||
"contrastText": "#fff"
|
||||
},
|
||||
"text": {
|
||||
"primary": "rgba(0, 0, 0, 0.87)",
|
||||
"secondary": "rgba(0, 0, 0, 0.54)",
|
||||
"disabled": "rgba(0, 0, 0, 0.38)",
|
||||
"hint": "rgba(0, 0, 0, 0.38)"
|
||||
},
|
||||
"explorer": {
|
||||
"filename": "#474849",
|
||||
"icon": "#8f8f8f",
|
||||
"bgSelected": "#D5DAF0",
|
||||
"emptyIcon": "#e8e8e8",
|
||||
}
|
||||
}
|
||||
};
|
||||
colorTheme = {:json_encode($options["themeConfig"])};
|
||||
isHomePage = false;
|
||||
isSharePage = true;
|
||||
pageId="fileShare";
|
||||
|
|
|
@ -1,148 +0,0 @@
|
|||
{extend name="header_public" /}
|
||||
{block name="title"}{$fileData.orign_name} - {$options.siteName}{/block}
|
||||
{block name="content"}
|
||||
<link rel="stylesheet" href="/static/css/share.css" />
|
||||
<link rel="stylesheet" href="/static/css/photoswipe.css">
|
||||
<link rel="stylesheet" href="/static/css/default-skin/default-skin.css">
|
||||
<script src="/static/js/jquery.color.js"></script>
|
||||
</head>
|
||||
<body data-ma-header="teal">
|
||||
<div class="modal fade" id="previewModal" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" onclick="audioPause()" data-dismiss="modal">
|
||||
<span aria-hidden="true">×</span>
|
||||
<span class="sr-only ng-binding">关闭</span>
|
||||
</button>
|
||||
<h4 class="modal-title">视频预览</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="text-center previewContent">
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<!-- Background of PhotoSwipe.
|
||||
It's a separate element, as animating opacity is faster than rgba(). -->
|
||||
<div class="pswp__bg"></div>
|
||||
<!-- Slides wrapper with overflow:hidden. -->
|
||||
<div class="pswp__scroll-wrap">
|
||||
<!-- Container that holds slides. PhotoSwipe keeps only 3 slides in DOM to save memory. -->
|
||||
<div class="pswp__container">
|
||||
<!-- don't modify these 3 pswp__item elements, data is added later on -->
|
||||
<div class="pswp__item"></div>
|
||||
<div class="pswp__item"></div>
|
||||
<div class="pswp__item"></div>
|
||||
</div>
|
||||
<!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
|
||||
<div class="pswp__ui pswp__ui--hidden">
|
||||
<div class="pswp__top-bar">
|
||||
<!-- Controls are self-explanatory. Order can be changed. -->
|
||||
<div class="pswp__counter"></div>
|
||||
<button class="pswp__button pswp__button--close" title="Close (Esc)"></button>
|
||||
<button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>
|
||||
<button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>
|
||||
<!-- Preloader demo https://codepen.io/dimsemenov/pen/yyBWoR -->
|
||||
<!-- element will get class pswp__preloader--active when preloader is running -->
|
||||
<div class="pswp__preloader">
|
||||
<div class="pswp__preloader__icn">
|
||||
<div class="pswp__preloader__cut">
|
||||
<div class="pswp__preloader__donut"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
|
||||
<div class="pswp__share-tooltip"></div>
|
||||
</div>
|
||||
<button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
|
||||
</button>
|
||||
<button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
|
||||
</button>
|
||||
<div class="pswp__caption">
|
||||
<div class="pswp__caption__center"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<nav class="navbar navbar-inverse" >
|
||||
<div class="container-fluid">
|
||||
<div class="container" >
|
||||
{include file="navbar_public" /}
|
||||
<div class="header-panel shadow-z-2">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container main" >
|
||||
<div class="col-md-3"></div>
|
||||
<div class="col-md-6">
|
||||
<div class="jumbotron" >
|
||||
<div class="card_top">
|
||||
<div class="row top-color">
|
||||
<div class="card-top-row">
|
||||
<div class="file-sign col-xs-2">
|
||||
<i class="fa fa-file-image-o" aria-hidden="true"></i>
|
||||
</div>
|
||||
<div class="file_title col-xs-10">
|
||||
<div class="file_title_inside str_wrap">
|
||||
{$fileData.orign_name|htmlspecialchars=ENT_NOQUOTES}
|
||||
</div>
|
||||
<div class="file_info"><span id="size"></span> <span><i class="fa fa-cloud-download" aria-hidden="true"></i> <span id="down_num"></span></span> <span><i class="fa fa-eye" aria-hidden="true"></i> <span id="view_num"></span></span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-middle">
|
||||
<button class="btn btn-info btn-fab" id="previewButton"><i class="material-icons fa fa-eye"></i><div class="ripple-container"></div></button>
|
||||
<button class="btn btn-primary btn-fab" id="download"><i class="material-icons fa fa-download"></i><div class="ripple-container"></div></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card_botom">
|
||||
<div class="row bottom-width">
|
||||
<div class="avatar ">
|
||||
<img src="/Member/Avatar/{$userInfo.id}/s" class="img-circle animated rotateIn">
|
||||
<div class="nick">
|
||||
<span class="nickname"><a class="notWave" href="/Profile/{$userInfo.id}">{$userInfo.user_nick}</a></span>
|
||||
<br>
|
||||
<span class="share_time">分享于<span id="share_time"></span></span>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div></div>
|
||||
<div class="col-md-3"></div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<script src="/static/js/jquery.liMarquee.js"></script>
|
||||
<script type="text/javascript">
|
||||
shareInfo={
|
||||
fileSize : "{$fileData.size}",
|
||||
shareDate : "{$shareData.share_time}",
|
||||
ownerUid:"{$userInfo.id}",
|
||||
ownerNick:"{$userInfo.user_nick}",
|
||||
downloadNum:"{$shareData.download_num}",
|
||||
ViewNum:"{$shareData.view_num}",
|
||||
shareId:"{$shareData.share_key}",
|
||||
fileName:"{$fileData.orign_name}",
|
||||
picSize:"{$fileData.pic_info}",
|
||||
{eq name="$loginStatus" value="1"}
|
||||
allowPreview:true,
|
||||
{else/}
|
||||
allowPreview:{$allowPreview},
|
||||
{/eq}
|
||||
};
|
||||
</script>
|
||||
<script src="/static/js/share_single.js"> </script>
|
||||
{$options.js_code}
|
||||
{/block}
|
|
@ -5,6 +5,7 @@
|
|||
<link rel="shortcut icon" href="/favicon.ico">
|
||||
<link rel="stylesheet" href="/static/css/mdeditor/editormd.min.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="theme-color" content="{$options.themeColor}" />
|
||||
<!--
|
||||
manifest.json provides metadata used when your web app is added to the
|
||||
homescreen on Android. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||
|
@ -21,48 +22,7 @@
|
|||
-->
|
||||
<title>{$fileName} - {$options.siteName}</title>
|
||||
<script type="text/javascript">
|
||||
colorTheme = {
|
||||
"palette": {
|
||||
"common": {
|
||||
"black": "#000",
|
||||
"white": "#fff"
|
||||
},
|
||||
"background": {
|
||||
"paper": "#fff",
|
||||
"default": "#fafafa"
|
||||
},
|
||||
"primary": {
|
||||
"light": "#7986cb",
|
||||
"main": "#3f51b5",
|
||||
"dark": "#303f9f",
|
||||
"contrastText": "#fff"
|
||||
},
|
||||
"secondary": {
|
||||
"light": "#ff4081",
|
||||
"main": "#f50057",
|
||||
"dark": "#c51162",
|
||||
"contrastText": "#fff"
|
||||
},
|
||||
"error": {
|
||||
"light": "#e57373",
|
||||
"main": "#f44336",
|
||||
"dark": "#d32f2f",
|
||||
"contrastText": "#fff"
|
||||
},
|
||||
"text": {
|
||||
"primary": "rgba(0, 0, 0, 0.87)",
|
||||
"secondary": "rgba(0, 0, 0, 0.54)",
|
||||
"disabled": "rgba(0, 0, 0, 0.38)",
|
||||
"hint": "rgba(0, 0, 0, 0.38)"
|
||||
},
|
||||
"explorer": {
|
||||
"filename": "#474849",
|
||||
"icon": "#8f8f8f",
|
||||
"bgSelected": "#D5DAF0",
|
||||
"emptyIcon": "#e8e8e8",
|
||||
}
|
||||
}
|
||||
};
|
||||
colorTheme = {:json_encode($options["themeConfig"])};
|
||||
isHomePage = false;
|
||||
isSharePage = false;
|
||||
pageId="";
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
<meta charset="utf-8">
|
||||
<link rel="shortcut icon" href="/favicon.ico">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="theme-color" content="{$options.themeColor}" />
|
||||
<!--
|
||||
manifest.json provides metadata used when your web app is added to the
|
||||
homescreen on Android. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||
|
@ -20,48 +21,7 @@
|
|||
-->
|
||||
<title>{$fileName} - {$options.siteName}</title>
|
||||
<script type="text/javascript">
|
||||
colorTheme = {
|
||||
"palette": {
|
||||
"common": {
|
||||
"black": "#000",
|
||||
"white": "#fff"
|
||||
},
|
||||
"background": {
|
||||
"paper": "#fff",
|
||||
"default": "#fafafa"
|
||||
},
|
||||
"primary": {
|
||||
"light": "#7986cb",
|
||||
"main": "#3f51b5",
|
||||
"dark": "#303f9f",
|
||||
"contrastText": "#fff"
|
||||
},
|
||||
"secondary": {
|
||||
"light": "#ff4081",
|
||||
"main": "#f50057",
|
||||
"dark": "#c51162",
|
||||
"contrastText": "#fff"
|
||||
},
|
||||
"error": {
|
||||
"light": "#e57373",
|
||||
"main": "#f44336",
|
||||
"dark": "#d32f2f",
|
||||
"contrastText": "#fff"
|
||||
},
|
||||
"text": {
|
||||
"primary": "rgba(0, 0, 0, 0.87)",
|
||||
"secondary": "rgba(0, 0, 0, 0.54)",
|
||||
"disabled": "rgba(0, 0, 0, 0.38)",
|
||||
"hint": "rgba(0, 0, 0, 0.38)"
|
||||
},
|
||||
"explorer": {
|
||||
"filename": "#474849",
|
||||
"icon": "#8f8f8f",
|
||||
"bgSelected": "#D5DAF0",
|
||||
"emptyIcon": "#e8e8e8",
|
||||
}
|
||||
}
|
||||
};
|
||||
colorTheme = {:json_encode($options["themeConfig"])};
|
||||
isHomePage = false;
|
||||
isSharePage = false;
|
||||
pageId="";
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"type":"","version":"1.1.1","version_id":6,"db_version":4}
|
||||
{"type":"","version":"1.1.1","version_id":6,"db_version":5}
|
File diff suppressed because one or more lines are too long
Loading…
Add table
Reference in a new issue