mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-25 20:17:23 +08:00
Merge branch 'koogua/v1.5.9' into demo
This commit is contained in:
commit
d3425af586
@ -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)
|
||||
{
|
||||
|
@ -13,6 +13,18 @@
|
||||
<input type="radio" name="register_with_email" value="0" title="否" {% if local_auth.register_with_email == "0" %}checked="checked"{% endif %}>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" style="margin-bottom:20px;">
|
||||
<label class="layui-form-label">用户协议</label>
|
||||
<div class="layui-input-block">
|
||||
<a class="layui-btn layui-btn-normal" href="{{ url({'for':'admin.page.edit','id':'terms'}) }}">前往设置</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" style="margin-bottom:20px;">
|
||||
<label class="layui-form-label">隐私政策</label>
|
||||
<div class="layui-input-block">
|
||||
<a class="layui-btn layui-btn-normal" href="{{ url({'for':'admin.page.edit','id':'privacy'}) }}">前往设置</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"></label>
|
||||
<div class="layui-input-block">
|
||||
|
@ -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'}) %}
|
||||
|
||||
<div class="layui-breadcrumb breadcrumb">
|
||||
@ -38,6 +40,7 @@
|
||||
{% block include_js %}
|
||||
|
||||
{{ js_include('https://ssl.captcha.qq.com/TCaptcha.js',false) }}
|
||||
{{ js_include('home/js/account.register.js') }}
|
||||
{{ js_include('home/js/captcha.verify.phone.js') }}
|
||||
{{ js_include('home/js/captcha.verify.email.js') }}
|
||||
|
||||
|
@ -17,6 +17,14 @@
|
||||
<button id="cv-email-emit-btn" class="layui-btn layui-btn-disabled" type="button" disabled="disabled">获取验证码</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-block">
|
||||
<div class="agree">
|
||||
<div class="left"><input id="cv-email-agree" type="checkbox" name="agree" lay-skin="primary"></div>
|
||||
<div class="right">我已阅读并同意<a href="{{ terms_url }}" target="_blank">《用户协议》</a>和<a href="{{ privacy_url }}" target="_blank">《隐私政策》</a></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-block">
|
||||
<button id="cv-email-submit-btn" class="layui-btn layui-btn-fluid layui-btn-disabled" disabled="disabled" lay-submit="true" lay-filter="go">注册帐号</button>
|
||||
|
@ -17,6 +17,14 @@
|
||||
<button id="cv-phone-emit-btn" class="layui-btn layui-btn-disabled" type="button" disabled="disabled">获取验证码</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-block">
|
||||
<div class="agree">
|
||||
<div class="left"><input id="cv-phone-agree" type="checkbox" name="agree" lay-skin="primary"></div>
|
||||
<div class="right">我已阅读并同意<a href="{{ terms_url }}" target="_blank">《用户协议》</a>和<a href="{{ privacy_url }}" target="_blank">《隐私政策》</a></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-block">
|
||||
<button id="cv-phone-submit-btn" class="layui-btn layui-btn-fluid layui-btn-disabled" disabled="disabled" lay-submit="true" lay-filter="go">注册帐号</button>
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
34
db/migrations/PageTrait.php
Normal file
34
db/migrations/PageTrait.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2022 深圳市酷瓜软件有限公司
|
||||
* @license https://opensource.org/licenses/GPL-2.0
|
||||
* @link https://www.koogua.com
|
||||
*/
|
||||
|
||||
trait PageTrait
|
||||
{
|
||||
|
||||
protected function insertPages(array $rows)
|
||||
{
|
||||
foreach ($rows as $key => $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;
|
||||
}
|
||||
|
||||
}
|
@ -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%;
|
||||
|
24
public/static/home/js/account.register.js
Normal file
24
public/static/home/js/account.register.js
Normal file
@ -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;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user