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