From fea713785b646017f1303263aec0fcbc1a2f0d8b Mon Sep 17 00:00:00 2001 From: Karson Date: Tue, 20 May 2025 15:24:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=B3=A8=E5=86=8C=E9=A1=B5?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=8D=8F=E8=AE=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/config.php | 2 ++ application/index/controller/User.php | 8 +++++++- application/index/lang/zh-cn/user.php | 3 +++ application/index/view/user/agreement.html | 7 +++++++ application/index/view/user/register.html | 8 ++++++++ public/assets/css/frontend.css | 4 ++++ public/assets/less/frontend.less | 4 ++++ 7 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 application/index/view/user/agreement.html diff --git a/application/config.php b/application/config.php index 90bdc3dc..a2be26e0 100755 --- a/application/config.php +++ b/application/config.php @@ -277,6 +277,8 @@ return [ 'user_api_captcha' => false, //会员登录默认类型,支持mobile和account 'user_login_type' => 'account', + //用户注册协议 + 'user_register_agreement' => true, //会员主页URL规则,{uid}表示用户的ID 'user_home_url' => '/u/{uid}', //是否启用会员字母头像 diff --git a/application/index/controller/User.php b/application/index/controller/User.php index 45043e95..dc7e6d1d 100644 --- a/application/index/controller/User.php +++ b/application/index/controller/User.php @@ -20,7 +20,7 @@ use think\Validate; class User extends Frontend { protected $layout = 'default'; - protected $noNeedLogin = ['login', 'mobilelogin', 'register', 'third']; + protected $noNeedLogin = ['login', 'mobilelogin', 'register', 'third', 'agreement']; protected $noNeedRight = ['*']; public function _initialize() @@ -387,4 +387,10 @@ class User extends Frontend $this->view->assign("mimetypeList", \app\common\model\Attachment::getMimetypeList()); return $this->view->fetch(); } + + public function agreement() + { + $this->view->assign('title', __('User agreement')); + return $this->view->fetch(); + } } diff --git a/application/index/lang/zh-cn/user.php b/application/index/lang/zh-cn/user.php index 41ef37bd..8c9763b5 100755 --- a/application/index/lang/zh-cn/user.php +++ b/application/index/lang/zh-cn/user.php @@ -48,6 +48,9 @@ return [ 'Account not exist' => '账户不存在', 'Account can not be empty' => '账户不能为空', 'Username or password is incorrect' => '用户名或密码不正确', + 'User agreement' => '用户协议', + 'Please read and agree to the agreement' => '请阅读并勾选同意用户协议', + 'Have read and agree to the agreement' => '已阅读并同意以下用户协议', 'You are not logged in' => '你当前还未登录', 'You\'ve logged in, do not login again' => '你已经登录,请不要重复登录', 'This guy hasn\'t written anything yet' => '这个人很懒,啥也没写', diff --git a/application/index/view/user/agreement.html b/application/index/view/user/agreement.html new file mode 100644 index 00000000..0f944ea2 --- /dev/null +++ b/application/index/view/user/agreement.html @@ -0,0 +1,7 @@ +
+
+

用户协议

+
+

用户协议内容

+
+
diff --git a/application/index/view/user/register.html b/application/index/view/user/register.html index d426ed85..afd138c2 100644 --- a/application/index/view/user/register.html +++ b/application/index/view/user/register.html @@ -50,6 +50,14 @@ {/if} + {if config('fastadmin.user_register_agreement')} +
+
+ +
+
+ {/if} +
{:__('Already have an account? Sign in')} diff --git a/public/assets/css/frontend.css b/public/assets/css/frontend.css index 0954533f..09e49143 100644 --- a/public/assets/css/frontend.css +++ b/public/assets/css/frontend.css @@ -865,6 +865,10 @@ footer.footer .copyright a:hover { .form-section .n-bootstrap .n-right .msg-wrap { position: relative; } +.login-section .n-bootstrap .n-right[for="agreement"], +.form-section .n-bootstrap .n-right[for="agreement"] { + top: -12px; +} main.content { width: 100%; overflow: auto; diff --git a/public/assets/less/frontend.less b/public/assets/less/frontend.less index 5474d94e..cd51b59e 100644 --- a/public/assets/less/frontend.less +++ b/public/assets/less/frontend.less @@ -688,6 +688,10 @@ footer.footer { .msg-wrap { position: relative; } + + &[for="agreement"] { + top: -12px; + } } } }