增加首页公告功能

This commit is contained in:
Wisp X 2022-02-25 15:53:22 +08:00
parent 82a98a3374
commit 4e59097013
12 changed files with 16635 additions and 175 deletions

View File

@ -25,6 +25,9 @@ final class ConfigKey
/** @var string 站点描述 */
const SiteDescription = 'site_description';
/** @var string 站点公告 */
const SiteNotice = 'site_notice';
/** @var string icp备案号 */
const IcpNo = 'icp_no';

View File

@ -8,6 +8,7 @@
"php": "^8.0",
"alibabacloud/green": "^1.8",
"doctrine/dbal": "^3.3",
"erusev/parsedown": "^1.7",
"fruitcake/laravel-cors": "^2.0.5",
"guzzlehttp/guzzle": "^7.2",
"intervention/image": "^2.7",

58
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "afc5333089af01779d6788ca39b281f4",
"content-hash": "2878b5ed6357c0ed4ddd1f6c7f330286",
"packages": [
{
"name": "adbario/php-dot-notation",
@ -1391,6 +1391,62 @@
],
"time": "2021-10-11T09:18:27+00:00"
},
{
"name": "erusev/parsedown",
"version": "1.7.4",
"source": {
"type": "git",
"url": "https://github.com/erusev/parsedown.git",
"reference": "cb17b6477dfff935958ba01325f2e8a2bfa6dab3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/erusev/parsedown/zipball/cb17b6477dfff935958ba01325f2e8a2bfa6dab3",
"reference": "cb17b6477dfff935958ba01325f2e8a2bfa6dab3",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"ext-mbstring": "*",
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35"
},
"type": "library",
"autoload": {
"psr-0": {
"Parsedown": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Emanuil Rusev",
"email": "hello@erusev.com",
"homepage": "http://erusev.com"
}
],
"description": "Parser for Markdown.",
"homepage": "http://parsedown.org",
"keywords": [
"markdown",
"parser"
],
"support": {
"issues": "https://github.com/erusev/parsedown/issues",
"source": "https://github.com/erusev/parsedown/tree/1.7.x"
},
"time": "2019-12-30T22:54:17+00:00"
},
{
"name": "fruitcake/laravel-cors",
"version": "v2.2.0",

View File

@ -12,9 +12,10 @@ use App\Enums\Watermark\ImageOption;
return [
'app' => [
ConfigKey::AppName => 'Lsky Pro',
ConfigKey::AppUrl => '',
ConfigKey::AppUrl => env('APP_URL'),
ConfigKey::SiteKeywords => 'Lsky Pro,lsky,兰空图床',
ConfigKey::SiteDescription => 'Lsky Pro, Your photo album on the cloud.',
ConfigKey::SiteNotice => '',
ConfigKey::IcpNo => '',
ConfigKey::IsEnableRegistration => 1,
ConfigKey::IsEnableGallery => 1,

15576
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -23,6 +23,8 @@
"deepmerge": "^4.2.2",
"dragselect": "^2.3.0",
"echarts": "^5.2.2",
"github-markdown-css": "^5.1.0",
"imagesloaded": "^4.1.4",
"jquery": "^3.6.0",
"jquery.photoswipe": "^1.1.1",
"justifiedGallery": "^3.8.1",
@ -37,7 +39,9 @@
"sweetalert2": "^11.3.3",
"tailwindcss": "^3.0.0",
"toastr": "^2.1.4",
"viewerjs": "^1.10.2",
"imagesloaded": "^4.1.4"
"viewerjs": "^1.10.2"
},
"dependencies": {
"update": "^0.7.4"
}
}

View File

@ -784,12 +784,12 @@ select {
.ml-4 {
margin-left: 1rem;
}
.mt-5 {
margin-top: 1.25rem;
}
.mt-6 {
margin-top: 1.5rem;
}
.mt-5 {
margin-top: 1.25rem;
}
.mb-8 {
margin-bottom: 2rem;
}
@ -859,12 +859,6 @@ select {
.h-10 {
height: 2.5rem;
}
.h-32 {
height: 8rem;
}
.h-6 {
height: 1.5rem;
}
.h-20 {
height: 5rem;
}
@ -892,6 +886,12 @@ select {
.h-4 {
height: 1rem;
}
.h-6 {
height: 1.5rem;
}
.h-32 {
height: 8rem;
}
.h-36 {
height: 9rem;
}
@ -925,12 +925,6 @@ select {
.w-\[80\%\] {
width: 80%;
}
.w-40 {
width: 10rem;
}
.w-6 {
width: 1.5rem;
}
.w-20 {
width: 5rem;
}
@ -952,6 +946,9 @@ select {
.w-4 {
width: 1rem;
}
.w-6 {
width: 1.5rem;
}
.w-24 {
width: 6rem;
}
@ -1159,16 +1156,16 @@ select {
margin-right: calc(0.75rem * var(--tw-space-x-reverse));
margin-left: calc(0.75rem * calc(1 - var(--tw-space-x-reverse)));
}
.space-x-8 > :not([hidden]) ~ :not([hidden]) {
--tw-space-x-reverse: 0;
margin-right: calc(2rem * var(--tw-space-x-reverse));
margin-left: calc(2rem * calc(1 - var(--tw-space-x-reverse)));
}
.space-y-1 > :not([hidden]) ~ :not([hidden]) {
--tw-space-y-reverse: 0;
margin-top: calc(0.25rem * calc(1 - var(--tw-space-y-reverse)));
margin-bottom: calc(0.25rem * var(--tw-space-y-reverse));
}
.space-x-8 > :not([hidden]) ~ :not([hidden]) {
--tw-space-x-reverse: 0;
margin-right: calc(2rem * var(--tw-space-x-reverse));
margin-left: calc(2rem * calc(1 - var(--tw-space-x-reverse)));
}
.divide-y > :not([hidden]) ~ :not([hidden]) {
--tw-divide-y-reverse: 0;
border-top-width: calc(1px * calc(1 - var(--tw-divide-y-reverse)));
@ -1214,9 +1211,6 @@ select {
.break-words {
overflow-wrap: break-word;
}
.break-all {
word-break: break-all;
}
.rounded-md {
border-radius: 0.375rem;
}
@ -1322,6 +1316,10 @@ select {
--tw-bg-opacity: 1;
background-color: rgb(229 231 235 / var(--tw-bg-opacity));
}
.bg-sky-500 {
--tw-bg-opacity: 1;
background-color: rgb(14 165 233 / var(--tw-bg-opacity));
}
.bg-blue-500 {
--tw-bg-opacity: 1;
background-color: rgb(59 130 246 / var(--tw-bg-opacity));
@ -1330,10 +1328,6 @@ select {
--tw-bg-opacity: 1;
background-color: rgb(107 114 128 / var(--tw-bg-opacity));
}
.bg-sky-500 {
--tw-bg-opacity: 1;
background-color: rgb(14 165 233 / var(--tw-bg-opacity));
}
.bg-black {
--tw-bg-opacity: 1;
background-color: rgb(0 0 0 / var(--tw-bg-opacity));
@ -1378,18 +1372,10 @@ select {
--tw-bg-opacity: 1;
background-color: rgb(156 163 175 / var(--tw-bg-opacity));
}
.bg-slate-900 {
--tw-bg-opacity: 1;
background-color: rgb(15 23 42 / var(--tw-bg-opacity));
}
.bg-slate-700 {
--tw-bg-opacity: 1;
background-color: rgb(51 65 85 / var(--tw-bg-opacity));
}
.bg-gray-300 {
--tw-bg-opacity: 1;
background-color: rgb(209 213 219 / var(--tw-bg-opacity));
}
.bg-opacity-75 {
--tw-bg-opacity: 0.75;
}
@ -1465,14 +1451,14 @@ select {
padding-top: 0.75rem;
padding-bottom: 0.75rem;
}
.py-5 {
padding-top: 1.25rem;
padding-bottom: 1.25rem;
}
.px-6 {
padding-left: 1.5rem;
padding-right: 1.5rem;
}
.py-5 {
padding-top: 1.25rem;
padding-bottom: 1.25rem;
}
.px-5 {
padding-left: 1.25rem;
padding-right: 1.25rem;
@ -1591,10 +1577,6 @@ select {
font-size: 1rem;
line-height: 1.5rem;
}
.text-8xl {
font-size: 6rem;
line-height: 1;
}
.font-medium {
font-weight: 500;
}
@ -1666,14 +1648,18 @@ select {
--tw-text-opacity: 1;
color: rgb(255 255 255 / var(--tw-text-opacity));
}
.text-yellow-500 {
--tw-text-opacity: 1;
color: rgb(234 179 8 / var(--tw-text-opacity));
}
.text-indigo-600 {
--tw-text-opacity: 1;
color: rgb(79 70 229 / var(--tw-text-opacity));
}
.text-green-600 {
--tw-text-opacity: 1;
color: rgb(22 163 74 / var(--tw-text-opacity));
}
.text-yellow-500 {
--tw-text-opacity: 1;
color: rgb(234 179 8 / var(--tw-text-opacity));
}
.text-red-700 {
--tw-text-opacity: 1;
color: rgb(185 28 28 / var(--tw-text-opacity));
@ -1726,10 +1712,6 @@ select {
--tw-text-opacity: 1;
color: rgb(229 231 235 / var(--tw-text-opacity));
}
.text-green-600 {
--tw-text-opacity: 1;
color: rgb(22 163 74 / var(--tw-text-opacity));
}
.text-red-400 {
--tw-text-opacity: 1;
color: rgb(248 113 113 / var(--tw-text-opacity));
@ -1758,6 +1740,10 @@ select {
--tw-text-opacity: 1;
color: rgb(244 63 94 / var(--tw-text-opacity));
}
.text-teal-500 {
--tw-text-opacity: 1;
color: rgb(20 184 166 / var(--tw-text-opacity));
}
.text-slate-600 {
--tw-text-opacity: 1;
color: rgb(71 85 105 / var(--tw-text-opacity));
@ -1766,10 +1752,6 @@ select {
--tw-text-opacity: 1;
color: rgb(13 148 136 / var(--tw-text-opacity));
}
.text-teal-500 {
--tw-text-opacity: 1;
color: rgb(20 184 166 / var(--tw-text-opacity));
}
.underline {
-webkit-text-decoration-line: underline;
text-decoration-line: underline;

File diff suppressed because it is too large Load Diff

View File

@ -19,5 +19,6 @@
"/js/context-js/context-js.js": "/js/context-js/context-js.js",
"/js/echarts/echarts.min.js": "/js/echarts/echarts.min.js",
"/js/masonry/masonry.pkgd.min.js": "/js/masonry/masonry.pkgd.min.js",
"/js/imagesloaded/imagesloaded.pkgd.min.js": "/js/imagesloaded/imagesloaded.pkgd.min.js"
"/js/imagesloaded/imagesloaded.pkgd.min.js": "/js/imagesloaded/imagesloaded.pkgd.min.js",
"/css/markdown-css/github-markdown.css": "/css/markdown-css/github-markdown.css"
}

View File

@ -25,6 +25,10 @@
<label for="icp_no" class="block text-sm font-medium text-gray-700">备案号</label>
<x-input type="text" name="icp_no" id="icp_no" value="{{ $configs['icp_no'] }}" placeholder="请输入备案号"/>
</div>
<div>
<label for="site_notice" class="block text-sm font-medium text-gray-700">网站公告</label>
<x-textarea type="text" name="site_notice" id="site_notice" placeholder="首页弹出公告,支持 Markdown不设置请留空。" rows="7">{{ $configs['site_notice'] }}</x-textarea>
</div>
<div class="text-right">
<x-button type="submit">保存更改</x-button>
@ -32,7 +36,6 @@
</div>
</form>
<p class="mb-3 font-semibold text-lg text-gray-700">控制</p>
<form action="{{ route('admin.settings.save') }}">
<div class="relative p-4 rounded-md bg-white mb-8 space-y-4">

View File

@ -1,3 +1,7 @@
@push('styles')
<link rel="stylesheet" href="{{ asset('css/markdown-css/github-markdown.css') }}">
@endpush
<x-guest-layout>
<div class="py-14">
<header class="w-full h-14 bg-gray-700 text-white flex justify-center fixed top-0 z-[9]">
@ -26,4 +30,22 @@
</p>
</footer>
</div>
@if(\App\Utils::config(\App\Enums\ConfigKey::SiteNotice))
<x-modal>
<div class="markdown-body">
{!! (new Parsedown())->parse(\App\Utils::config(\App\Enums\ConfigKey::SiteNotice)) !!}
</div>
</x-modal>
@push('scripts')
<script>
if (! sessionStorage.getItem('noticed')) {
Alpine.store('modal').open = true;
sessionStorage.setItem('noticed', '1');
}
</script>
@endpush
@endif
</x-guest-layout>

View File

@ -51,3 +51,6 @@ mix.copy('node_modules/echarts/dist/echarts.min.js', 'public/js/echarts')
mix.copy('node_modules/masonry-layout/dist/masonry.pkgd.min.js', 'public/js/masonry')
// imagesloaded
mix.copy('node_modules/imagesloaded/imagesloaded.pkgd.min.js', 'public/js/imagesloaded')
// markdown css
mix.copy('node_modules/github-markdown-css/github-markdown.css', 'public/css/markdown-css')