From 1446120a44c1f4e5fe824bbccdb20f75f8cd1468 Mon Sep 17 00:00:00 2001 From: Chenx221 Date: Sun, 31 Mar 2024 16:37:36 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=EF=BC=8C=E5=89=8D=E7=AB=AF=E6=94=B9=E8=BF=9B=20?= =?UTF-8?q?=E4=B8=8B=E4=B8=80=E6=AD=A5=E6=89=93=E7=AE=97=E5=8A=A0=E5=85=A5?= =?UTF-8?q?google=20analysis=E7=9A=84=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/SiteConfig.php | 19 ++++++++++++++++++- views/admin/system.php | 12 +++++++++++- web/css/admin-system.css | 9 +++++++++ 3 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 web/css/admin-system.css diff --git a/models/SiteConfig.php b/models/SiteConfig.php index 3d24f41..e7275bb 100644 --- a/models/SiteConfig.php +++ b/models/SiteConfig.php @@ -10,6 +10,7 @@ use yii\base\Model; * Class SiteConfig * 配置信息 * 少数配置不在列表中,如数据库配置等 + * TODO: 实现Google analysis、Microsoft Clarity统计 */ class SiteConfig extends Model { @@ -74,7 +75,23 @@ class SiteConfig extends Model 'ipinfoToken' => 'IPinfo Token', ]; } - + public function attributeHelpTexts(): array + { + return [ + 'siteTitle' => '你可以在这里设置网站的标题', + 'registrationEnabled' => '你可以在这里设置是否允许新用户注册
关闭注册后,只有管理员可以添加用户', + 'domain' => '你可以在这里设置网站使用的域名
开头不需要添加 http:// 或 https://
结尾不需要添加 /
本地测试时可以使用 localhost', + 'verifyProvider' => '你可以在这里设置验证码提供商
目前支持reCAPTCHAhCaptchaTurnstile或关闭验证码', + 'recaptchaSiteKey' => '请在这里填入reCAPTCHA Site Key', + 'recaptchaSecret' => '请在这里填入reCAPTCHA Secret', + 'hcaptchaSiteKey' => '请在这里填入hCaptcha Site Key', + 'hcaptchaSecret' => '请在这里填入hCaptcha Secret', + 'turnstileSiteKey' => '请在这里填入Turnstile Site Key', + 'turnstileSecret' => '请在这里填入Turnstile Secret', + 'enableIpinfo' => '是否使用ipinfo.io查询站点上的ip信息', + 'ipinfoToken' => '请在这里填入IPinfo Token', + ]; + } /** * 读取配置信息 * @return bool diff --git a/views/admin/system.php b/views/admin/system.php index 9d52fbe..d3208db 100644 --- a/views/admin/system.php +++ b/views/admin/system.php @@ -1,5 +1,7 @@ registerCssFile('@web/css/admin-system.css', ['depends' => [BootstrapAsset::class]]); $this->title = '系统设置'; ?>
@@ -22,7 +26,7 @@ $this->title = '系统设置'; '; + echo ''; echo '

' . $siteConfig->attributeLabels()[$attribute] . '

'; if ($attribute == 'registrationEnabled' || $attribute == 'enableIpinfo') { echo '' . $form->field($siteConfig, $attribute)->checkbox(['class' => 'form-check-input'], false)->label(false) . ''; @@ -31,6 +35,7 @@ $this->title = '系统设置'; } else { echo '' . $form->field($siteConfig, $attribute)->textInput(['class' => 'form-control form-control-sm', 'style' => 'width:25em'])->label(false) . ''; } + echo ''; echo ''; } ?> @@ -45,4 +50,9 @@ $this->title = '系统设置';
registerJsFile('@web/js/admin-system.js', ['depends' => [JqueryAsset::class], 'position' => View::POS_END]); +$this->registerJs(' + $(function () { + $("[data-bs-toggle=\'popover\']").popover(); + }); +'); ?> \ No newline at end of file diff --git a/web/css/admin-system.css b/web/css/admin-system.css new file mode 100644 index 0000000..3eca672 --- /dev/null +++ b/web/css/admin-system.css @@ -0,0 +1,9 @@ +.custom-popover { + --bs-popover-max-width: 200px; + --bs-popover-border-color: rgb(113,44,249); + --bs-popover-header-bg: rgb(113,44,249); + --bs-popover-header-color: var(--bs-white); + --bs-popover-header-padding-y: .1rem; + --bs-popover-body-padding-x: 1rem; + --bs-popover-body-padding-y: .5rem; +} \ No newline at end of file