From 79cc6b9c9eaf94b1dddcbaf8d8f7421b1f1a5d93 Mon Sep 17 00:00:00 2001 From: koogua Date: Mon, 19 Sep 2022 17:58:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=94=A8=E6=88=B7=E5=8D=8F?= =?UTF-8?q?=E8=AE=AE=E5=92=8C=E9=9A=90=E7=A7=81=E6=94=BF=E7=AD=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Admin/Controllers/PageController.php | 2 +- app/Http/Admin/Views/setting/oauth_local.volt | 12 +++++++ app/Http/Home/Views/account/register.volt | 3 ++ .../Home/Views/account/register_by_email.volt | 8 +++++ .../Home/Views/account/register_by_phone.volt | 8 +++++ db/migrations/20220915084746.php | 27 +++++++++++++++ db/migrations/PageTrait.php | 34 +++++++++++++++++++ public/static/home/css/common.css | 9 +++++ public/static/home/js/account.register.js | 24 +++++++++++++ 9 files changed, 126 insertions(+), 1 deletion(-) create mode 100644 db/migrations/PageTrait.php create mode 100644 public/static/home/js/account.register.js diff --git a/app/Http/Admin/Controllers/PageController.php b/app/Http/Admin/Controllers/PageController.php index da9c63c0..5c992574 100644 --- a/app/Http/Admin/Controllers/PageController.php +++ b/app/Http/Admin/Controllers/PageController.php @@ -55,7 +55,7 @@ class PageController extends Controller } /** - * @Get("/{id:[0-9]+}/edit", name="admin.page.edit") + * @Get("/{id}/edit", name="admin.page.edit") */ public function editAction($id) { diff --git a/app/Http/Admin/Views/setting/oauth_local.volt b/app/Http/Admin/Views/setting/oauth_local.volt index 28cf337d..abf2b312 100644 --- a/app/Http/Admin/Views/setting/oauth_local.volt +++ b/app/Http/Admin/Views/setting/oauth_local.volt @@ -13,6 +13,18 @@ +
+ + +
+
+ + +
diff --git a/app/Http/Home/Views/account/register.volt b/app/Http/Home/Views/account/register.volt index ab4329cc..390ab9b4 100644 --- a/app/Http/Home/Views/account/register.volt +++ b/app/Http/Home/Views/account/register.volt @@ -4,6 +4,8 @@ {% set register_with_phone = local_oauth.register_with_phone == 1 %} {% set register_with_email = local_oauth.register_with_email == 1 %} + {% set terms_url = url({'for':'home.page.show','id':'terms'}) %} + {% set privacy_url = url({'for':'home.page.show','id':'privacy'}) %} {% set action_url = url({'for':'home.account.do_register'}) %}
+
+
+
+
+
我已阅读并同意《用户协议》《隐私政策》
+
+
+
diff --git a/app/Http/Home/Views/account/register_by_phone.volt b/app/Http/Home/Views/account/register_by_phone.volt index e08f494a..16012efb 100644 --- a/app/Http/Home/Views/account/register_by_phone.volt +++ b/app/Http/Home/Views/account/register_by_phone.volt @@ -17,6 +17,14 @@
+
+
+
+
+
我已阅读并同意《用户协议》《隐私政策》
+
+
+
diff --git a/db/migrations/20220915084746.php b/db/migrations/20220915084746.php index b65b34c8..d7e42ac8 100644 --- a/db/migrations/20220915084746.php +++ b/db/migrations/20220915084746.php @@ -5,11 +5,15 @@ * @link https://www.koogua.com */ +require_once 'PageTrait.php'; + use Phinx\Migration\AbstractMigration; final class V20220915084746 extends AbstractMigration { + use PageTrait; + public function up() { $this->alterArticleTable(); @@ -18,6 +22,7 @@ final class V20220915084746 extends AbstractMigration $this->alterPageTable(); $this->alterHelpTable(); $this->handleTopics(); + $this->handleProtocolPages(); } protected function alterArticleTable() @@ -124,4 +129,26 @@ final class V20220915084746 extends AbstractMigration ->execute(); } + protected function handleProtocolPages() + { + $rows = [ + [ + 'title' => '用户协议', + 'alias' => 'terms', + 'content' => '', + 'published' => 1, + 'create_time' => time(), + ], + [ + 'title' => '隐私政策', + 'alias' => 'privacy', + 'content' => '', + 'published' => 1, + 'create_time' => time(), + ], + ]; + + $this->insertPages($rows); + } + } diff --git a/db/migrations/PageTrait.php b/db/migrations/PageTrait.php new file mode 100644 index 00000000..db651abd --- /dev/null +++ b/db/migrations/PageTrait.php @@ -0,0 +1,34 @@ + $row) { + $exists = $this->pageExits($row['alias']); + if ($exists) unset($rows[$key]); + } + + if (count($rows) == 0) return; + + $this->table('kg_page')->insert($rows)->save(); + } + + protected function pageExits($alias) + { + $row = $this->getQueryBuilder() + ->select('*') + ->from('kg_page') + ->where(['alias' => $alias]) + ->execute()->fetch(); + + return $row ? true : false; + } + +} \ No newline at end of file diff --git a/public/static/home/css/common.css b/public/static/home/css/common.css index c03b67b8..e5e6fb4f 100644 --- a/public/static/home/css/common.css +++ b/public/static/home/css/common.css @@ -1605,6 +1605,15 @@ margin-right: 0; } +.account-form .agree { + display: flex; +} + +.account-form .agree .right { + padding-top: 8px; + color: #999; +} + .verify-btn-inline button { min-width: 100px; width: 100%; diff --git a/public/static/home/js/account.register.js b/public/static/home/js/account.register.js new file mode 100644 index 00000000..e4208ecc --- /dev/null +++ b/public/static/home/js/account.register.js @@ -0,0 +1,24 @@ +layui.use(['jquery', 'layer'], function () { + + var $ = layui.jquery; + var layer = layui.layer; + var $phoneAgree = $('#cv-phone-agree'); + var $emailAgree = $('#cv-email-agree'); + var $phoneSubmit = $('#cv-phone-submit-btn'); + var $emailSubmit = $('#cv-email-submit-btn'); + + $phoneSubmit.on('click', function () { + if ($phoneAgree.prop('checked') === false) { + layer.msg('请同意《用户协议》和《隐私政策》', {icon: 2}); + return false; + } + }); + + $emailSubmit.on('click', function () { + if ($emailAgree.prop('checked') === false) { + layer.msg('请同意《用户协议》和《隐私政策》', {icon: 2}); + return false; + } + }); + +}); \ No newline at end of file