提交 7005cb0e 编写于 作者: R root

appfront customer register account

上级 85e290c7
<?php
/**
* FecShop file.
*
* @link http://www.fecshop.com/
* @copyright Copyright (c) 2016 FecShop Software LLC
* @license http://www.fecshop.com/license/
*/
return [
'customer' => [
'class' => '\fecshop\app\appfront\modules\Checkout\Module',
'params'=> [
],
],
];
<?php
/**
* FecShop file.
*
* @link http://www.fecshop.com/
* @copyright Copyright (c) 2016 FecShop Software LLC
* @license http://www.fecshop.com/license/
*/
return [
'customer' => [
'class' => '\fecshop\app\appfront\modules\Customer\Module',
'params'=> [
],
],
];
......@@ -11,7 +11,6 @@ use Yii;
use fec\helpers\CModule;
use fec\helpers\CRequest;
use fecshop\app\appfront\modules\AppfrontController;
use fecshop\models\xunsearch\Search;
/**
* @author Terry Zhao <2358269014@qq.com>
* @since 1.0
......@@ -21,7 +20,7 @@ class IndexController extends AppfrontController
public function init(){
parent::init();
}
# 网站信息管理
#
public function actionIndex()
{
......
<?php
/**
* FecShop file.
*
* @link http://www.fecshop.com/
* @copyright Copyright (c) 2016 FecShop Software LLC
* @license http://www.fecshop.com/license/
*/
namespace fecshop\app\appfront\modules\Checkout;
use Yii;
use fecshop\app\appfront\modules\AppfrontModule;
/**
* @author Terry Zhao <2358269014@qq.com>
* @since 1.0
*/
class Module extends AppfrontModule
{
public $blockNamespace;
public function init()
{
# 以下代码必须指定
$nameSpace = __NAMESPACE__;
# web controller
if (Yii::$app instanceof \yii\web\Application) {
$this->controllerNamespace = $nameSpace . '\\controllers';
$this->blockNamespace = $nameSpace . '\\block';
# console controller
//} elseif (Yii::$app instanceof \yii\console\Application) {
// $this->controllerNamespace = $nameSpace . '\\console\\controllers';
// $this->blockNamespace = $nameSpace . '\\console\\block';
}
//$this->_currentDir = __DIR__ ;
//$this->_currentNameSpace = __NAMESPACE__;
# 指定默认的man文件
//$this->layout = "home.php";
Yii::$service->page->theme->layoutFile = 'main.php';
parent::init();
}
}
<?php
/**
* FecShop file.
*
* @link http://www.fecshop.com/
* @copyright Copyright (c) 2016 FecShop Software LLC
* @license http://www.fecshop.com/license/
*/
namespace fecshop\app\appfront\modules\Customer;
use Yii;
use fecshop\app\appfront\modules\AppfrontModule;
/**
* @author Terry Zhao <2358269014@qq.com>
* @since 1.0
*/
class Module extends AppfrontModule
{
public $blockNamespace;
public function init()
{
# 以下代码必须指定
$nameSpace = __NAMESPACE__;
# web controller
if (Yii::$app instanceof \yii\web\Application) {
$this->controllerNamespace = $nameSpace . '\\controllers';
$this->blockNamespace = $nameSpace . '\\block';
# console controller
//} elseif (Yii::$app instanceof \yii\console\Application) {
// $this->controllerNamespace = $nameSpace . '\\console\\controllers';
// $this->blockNamespace = $nameSpace . '\\console\\block';
}
//$this->_currentDir = __DIR__ ;
//$this->_currentNameSpace = __NAMESPACE__;
# 指定默认的man文件
//$this->layout = "home.php";
Yii::$service->page->theme->layoutFile = 'main.php';
parent::init();
}
}
<?php
/**
* FecShop file.
*
* @link http://www.fecshop.com/
* @copyright Copyright (c) 2016 FecShop Software LLC
* @license http://www.fecshop.com/license/
*/
namespace fecshop\app\appfront\modules\Customer\block\account;
use Yii;
use fec\helpers\CModule;
use fec\helpers\CRequest;
use yii\base\InvalidValueException;
/**
* @author Terry Zhao <2358269014@qq.com>
* @since 1.0
*/
class Login {
public function getLastData(){
return [
];
}
}
\ No newline at end of file
<?php
/**
* FecShop file.
*
* @link http://www.fecshop.com/
* @copyright Copyright (c) 2016 FecShop Software LLC
* @license http://www.fecshop.com/license/
*/
namespace fecshop\app\appfront\modules\Customer\block\account;
use Yii;
use fec\helpers\CModule;
use fec\helpers\CRequest;
use yii\base\InvalidValueException;
/**
* @author Terry Zhao <2358269014@qq.com>
* @since 1.0
*/
class Register {
public function getLastData(){
return [
];
}
}
\ No newline at end of file
<?php
/**
* FecShop file.
*
* @link http://www.fecshop.com/
* @copyright Copyright (c) 2016 FecShop Software LLC
* @license http://www.fecshop.com/license/
*/
namespace fecshop\app\appfront\modules\Customer\controllers;
use Yii;
use fec\helpers\CModule;
use fec\helpers\CRequest;
use fecshop\app\appfront\modules\AppfrontController;
/**
* @author Terry Zhao <2358269014@qq.com>
* @since 1.0
*/
class AccountController extends AppfrontController
{
public function init(){
parent::init();
}
#
public function actionLogin()
{
$data = $this->getBlock()->getLastData();
return $this->render($this->action->id,$data);
}
public function actionRegister()
{
$data = $this->getBlock()->getLastData();
return $this->render($this->action->id,$data);
}
}
......@@ -4,6 +4,13 @@ body {color: #333;font: 1em/1.55 Verdana,Arial,Helvetica,sans-serif;}
a{color: #666;text-decoration: none;}
ol, ul {list-style: outside none none;}
h1, h2, h3, h4, h5, h6 {
color: #444;
font-family: Bitter,Myriad Pro,Verdana,serif;
font-weight: normal;
line-height: 1;
padding-bottom: 23px;
}
#top_nav {background-color: #000;font-size: 0.75em;height: 40px;line-height: 40px;width: 100%;}
.top_nav_inner {height: 100%;width:1200px;}
......@@ -49,7 +56,7 @@ ol, ul {list-style: outside none none;}
height: 40px;
width: 50px;
}
.top_nav_right .t_r.login-text{width:120px;}
.top_nav_right .t_r.login-text{width:150px;}
.top_account .mycoount {
background: rgba(0, 0, 0, 0) url("../images/toptip.png") no-repeat scroll left top;
......@@ -611,7 +618,7 @@ input.input-text {
#footer ul li{height:22px;}
.top_currency .currency_list ul li{cursor:pointer;}
.one-column{}
.two-columns-left .col-main{width:980px;float:right}
.two-columns-left .col-left {width:200px;float:left}
.col-main h1{font-size:15px;font-weight:100;}
......@@ -741,8 +748,246 @@ font-family: Arial;
width: 285px;
}
.page-title h1{font-weight:100;font-size:1.5em;}
.account-login h1{ border-bottom: 1px solid #ddd;
font-size: 22px;
margin: 15px;
padding-bottom: 20px;
}
.account-login .col2-set .col-1 {
display: inline;
float: left;
margin: 12px 12px 12px 50px;
min-height: 1px;
width: 480px;
}
.account-login .col2-set .col-2 {
display: inline;
float: left;
margin-left: 12px;
width: 480px;
}
.account-login .col2-set {
clear: both;
}
.col2-set {
overflow: hidden;
}
.account-login .new-users .content {
display: inline;
float: left;
margin: 42px 12px 0 0;
width: 480px;
}
.account-login .new-users p {
margin-bottom: 30px !important;
}
.main p {
margin: 0 0 20px;
}
.account-login .registered-users .content {
border: 1px solid #e0e0e0;
border-radius: 2px;
display: inline;
float: left;
margin: 22px 12px 0 0;
padding: 19px;
width: 440px;
}
.account-login .registered-users .content .form-list {
margin: 0;
padding: 0 0 50px;
}
form label.required::after {
color: #c3293a;
content: "*";
display: inline-block;
font: 12px/12px Segoeui,Arial,Verdana,serif;
margin: 0 3px;
}
.account-login .registered-users .content .form-list input {
margin: 5px 0 13px;
width: 255px;
}
button{
background: rgba(0, 0, 0, 0) none repeat scroll 0 0;
border: medium none;
color: #fff;
cursor: pointer;
font-weight: 700;
white-space: nowrap;
}
button.redBtn {
font-family: Arial;
font-size: 0.875em;
margin-left: -3px;
padding: 0;
}
.account-create button.redBtn{
margin-top:5px;
}
button.redBtn em {
border: 3px solid #59b7c2;
display: block;
margin: 0;
padding: 0;
}
button.redBtn span {
background-color: #59b7c2;
border: 1px solid #fff;
color: #fff;
cursor: pointer;
display: block;
font-weight: 700;
line-height: 30px;
padding: 0 40px;
white-space: nowrap;
font-style: normal;
}
button.pinkBtn span {
background-color: #59b7c2;
border: 1px solid #fff;
color: #fff;
cursor: pointer;
display: block;
font-weight: 700;
line-height: 30px;
padding: 0 40px;
white-space: nowrap;
font-style: normal;
}
.account-login .registered-users .buttons-set button {
font: bold 14px/35px Segoeui-Bold,Myriad Pro,Verdana,serif;
margin: -55px 0 0 20px;
position: absolute;
}
.account-login .registered-users .buttons-set a.f-left {
color: #777;
font-size: 12px;
line-height: 35px;
margin: -115px 0 0 320px;
position: absolute;
}
.account-create h1 {
border-bottom: 1px solid #ddd;
font-size: 22px;
margin: 15px;
padding-bottom: 20px;
}
.account-create #form-validate {
border: 1px solid #e0e0e0;
border-radius: 2px;
margin: 0 auto;
padding: 20px;
width: 640px;
}
.account-create #form-validate .fieldset {
float: left;
width: 285px;
}
.account-create #form-validate .fieldset:nth-child(2), .account-create #form-validate .buttons-set {
clear: none;
float: right;
width: 276px;
}
.account-create #form-validate .fieldset:nth-child(2) , .account-create #form-validate .buttons-set {
clear: none;
float: right;
width: 276px;
}
form label.required::after {
color: #c3293a;
content: "*";
display: inline-block;
font: 12px/12px Segoeui,Arial,Verdana,serif;
margin: 0 3px;
}
form label {
color: #707070;
font: bold 13px/13px Segoeui-Bold,Myriad Pro,Verdana,serif;
}
form label.required em {
display: none;
}
.account-create form input {
margin: 5px 0 13px;
width: 255px;
}
#is_subscribed {
float: left;
margin-right: 3px;
text-align: left;
width: auto;
}
.account-create #form-validate .buttons-set p.back-link {
margin: 50px 0 0;
position: absolute;
}
.account-create #form-validate .buttons-set p.required {
float: right;
line-height: 50px;
}
form p.required {
color: #c3293a;
font: 12px/35px Segoeui,Arial,Verdana,serif;
margin-bottom: 0;
}
.validation-advice {
color: #c3293a;
font: 12px/12px Segoeui,Arial,Verdana,serif;
margin: 0 0 20px;
}
button.dataUp i {
background: rgba(0, 0, 0, 0) url("../images/signloading.gif") no-repeat scroll center center;
display: inline-block;
height: 16px;
margin-right: 5px;
vertical-align: -2px;
width: 16px;
}
button.redBtn:hover span{
background-color: #fff;
color: #35aac9;
}
<div class="main container one-column">
<div class="account-login">
<div class="page-title">
<h1>Login or Create an Account</h1>
</div>
<form action="<?= Yii::$service->url->getUrl("customer/account/login"); ?>" method="post" id="login-form">
<div class="col2-set">
<div class="col-1 new-users">
<div class="content">
<h2>New Customers</h2>
<p>By creating an account with our store, you will be able to move through the checkout process faster, store multiple shipping addresses, view and track your orders in your account and more.</p>
</div>
<button onclick="window.location='<?= Yii::$service->url->getUrl('customer/account/register') ?>';" type="button" title="Create an Account" class="redBtn"><em><span><i></i>REGISTER</span></em></button>
</div>
<div class="col-2 registered-users">
<div class="content">
<h2>Registered Customers</h2>
<p>If you have an account with us, please log in.</p>
<ul class="form-list">
<li>
<label for="email" class="required"><em>*</em>Email Address</label>
<div class="input-box">
<input name="login[username]" value="" id="email" class="input-text required-entry validate-email" title="Email Address" type="text">
</div>
</li>
<li>
<label for="pass" class="required"><em>*</em>Password</label>
<div class="input-box">
<input name="login[password]" class="input-text required-entry validate-password" id="pass" title="Password" type="password">
</div>
</li>
</div>
</div>
</div>
<div class="col2-set">
<div class="col-1 new-users">
<div class="buttons-set">
</div>
</div>
<div class="col-2 registered-users">
<div class="buttons-set">
<a href="<?= Yii::$service->url->getUrl('customer/account/forgotpassword'); ?>" class="f-left">Forgot Your Password?</a>
<button type="submit" id="js_registBtn" class="redBtn"><em><span><i></i>SIGN IN</span></em></button>
</div>
</div>
</div>
</form>
</div>
</div>
\ No newline at end of file
<div class="main container one-column">
<div class="account-create">
<div class="page-title">
<h1>Create an Account</h1>
</div>
<form action="<?= Yii::$service->url->getUrl('customer/account/register'); ?>" method="post" id="form-validate">
<div class="fieldset">
<h2 class="legend">Personal Information</h2>
<ul class="form-list">
<li class="fields">
<div class="customer-name">
<div class="field name-firstname">
<label for="firstname" class="required"><em>*</em>First Name</label>
<div class="input-box">
<input id="firstname" name="firstname" value="" title="First Name" maxlength="255" class="input-text required-entry" type="text">
</div>
</div>
<div class="field name-lastname">
<label for="lastname" class="required"><em>*</em>Last Name</label>
<div class="input-box">
<input id="lastname" name="lastname" value="" title="Last Name" maxlength="255" class="input-text required-entry" type="text">
</div>
</div>
</div>
</li>
<li>
<label for="email_address" class="required"><em>*</em>Email Address</label>
<div class="input-box">
<input name="email" id="email_address" value="" title="Email Address" class="input-text validate-email required-entry" type="text">
</div>
</li>
<li class="control">
<div class="input-box">
<input name="is_subscribed" title="Sign Up for Newsletter" value="1" id="is_subscribed" class="checkbox" type="checkbox">
</div>
<label for="is_subscribed">Sign Up for Newsletter</label>
</li>
</ul>
</div>
<div class="fieldset">
<h2 class="legend">Login Information</h2>
<ul class="form-list">
<li class="fields">
<div class="field">
<label for="password" class="required"><em>*</em>Password</label>
<div class="input-box">
<input name="password" id="password" title="Password" class="input-text required-entry validate-password" type="password">
</div>
</div>
<div class="field">
<label for="confirmation" class="required"><em>*</em>Confirm Password</label>
<div class="input-box">
<input name="confirmation" title="Confirm Password" id="confirmation" class="input-text required-entry validate-cpassword" type="password">
</div>
</div>
</li>
</ul>
</div>
<div class="buttons-set">
<p class="required">* Required Fields</p>
<p class="back-link"><a href="<?= Yii::$service->url->getUrl('customer/account/login'); ?>" class="back-link"><small>« </small>Back</a></p>
<button type="button" id="js_registBtn" class="redBtn"><em><span><i></i>Submit</span></em></button>
</div>
<div class="clear"></div>
</form>
</div>
</div>
<?php
$requiredValidate = 'This is a required field.';
$emailFormatValidate = 'Please enter a valid email address. For example johndoe@domain.com.';
$firstNameLenghtValidate = 'first name length must between';
$lastNameLenghtValidate = 'last name length must between';
$passwordLenghtValidate = 'Please enter 6 or more characters. Leading or trailing spaces will be ignored.';
$passwordMatchValidate = 'Please make sure your passwords match. ';
$minNameLength = 2;
$maxNameLength = 20;
$minPassLength = 6;
$maxPassLength = 30;
?>
<script>
<?php $this->beginBlock('customer_account_register') ?>
$(document).ready(function(){
$("#js_registBtn").click(function(){
validate = 1;
$(".validation-advice").remove();
$(".validation-failed").removeClass("validation-failed");
var myreg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
// empty check
$(".account-create .required-entry").each(function(){
val = $(this).val();
if(!val){
$(this).addClass("validation-failed");
$(this).parent().append('<div class="validation-advice" id="advice-required-entry-firstname" style=""><?= $requiredValidate; ?></div>');
validate = 0;
}
});
// email check
$(".account-create .validate-email").each(function(){
email = $(this).val();
if(email){
if(!$(this).hasClass("validation-failed")){
if(!myreg.test(email)){
$(this).parent().append('<div class="validation-advice" id="advice-validate-email-email_address" style=""><?= $emailFormatValidate; ?></div>');
$(this).addClass("validation-failed");
validate = 0;
}
}
}else{
validate = 0;
}
});
//first name lenght check;
firstname = $("#firstname").val();
lastname = $("#lastname").val();
password = $("#password").val();
confirmation= $("#confirmation").val();
minNameLength = <?= $minNameLength ?>;
maxNameLength = <?= $maxNameLength ?>;
minPassLength = <?= $minPassLength ?>;
maxPassLength = <?= $maxPassLength ?>;
firstNameLength = firstname.length;
lastNameLength = lastname.length;
passwordLength = password.length;
//firstname length validate
if(firstNameLength < minNameLength || firstNameLength > maxNameLength){
if(!$("#firstname").hasClass("validation-failed")){
//alert(111);
$("#firstname").parent().append('<div class="validation-advice" id="min_lenght" style=""><?= $firstNameLenghtValidate; ?> '+minNameLength+' , '+maxNameLength+'</div>');
$("#firstname").addClass("validation-failed");
validate = 0;
}
}
//lastname length validate
if(lastNameLength < minNameLength || lastNameLength > maxNameLength){
if(!$("#lastname").hasClass("validation-failed")){
//alert(111);
$("#lastname").parent().append('<div class="validation-advice" id="min_lenght" style=""><?= $lastNameLenghtValidate; ?> '+minNameLength+' , '+maxNameLength+'</div>');
$("#lastname").addClass("validation-failed");
validate = 0;
}
}
//password length validate
if(passwordLength < minPassLength || passwordLength > maxPassLength){
if(!$("#password").hasClass("validation-failed")){
//alert(111);
$("#password").parent().append('<div class="validation-advice" id="min_lenght" style=""><?= $passwordLenghtValidate; ?> </div>');
$("#password").addClass("validation-failed");
validate = 0;
}
}
//password validate
if(confirmation != password){
if(!$("#confirmation").hasClass("validation-failed")){
//alert(111);
$("#confirmation").parent().append('<div class="validation-advice" id="min_lenght" style=""><?= $passwordMatchValidate; ?></div>');
$("#confirmation").addClass("validation-failed");
validate = 0;
}
}
if(validate){
// alert("validate success");
$(this).addClass("dataUp");
}
});
});
<?php $this->endBlock(); ?>
</script>
<?php $this->registerJs($this->blocks['customer_account_register'],\yii\web\View::POS_END);//将编写的js代码注册到页面底部 ?>
......@@ -39,11 +39,9 @@
<div class="top_nav_right">
<div class="login-text t_r">
<span id="js_isNotLogin">
<a href="" rel="nofollow">Sign in</a>
</span>
<span class="join">
<a href="">/ Join</a>
<a href="<?= Yii::$service->url->getUrl('customer/account/login') ?>" rel="nofollow">Sign In / Join Free</a>
</span>
</div>
<dl class="top_account t_r">
<dt>
......@@ -51,22 +49,21 @@
</dt>
<dd style="">
<ul>
<li><a href="" rel="nofollow">My S Points</a></li>
<li><a href="" rel="nofollow">My Orders</a></li>
<li><a href="" rel="nofollow">My Favorites</a></li>
<li><a href="" rel="nofollow">Personal Data</a></li>
<li><a href="" rel="nofollow">Order Review</a></li>
<li><a href="<?= Yii::$service->url->getUrl('customer/point') ?>" rel="nofollow">My S Points</a></li>
<li><a href="<?= Yii::$service->url->getUrl('customer/order') ?>" rel="nofollow">My Orders</a></li>
<li><a href="<?= Yii::$service->url->getUrl('customer/wishlist') ?>" rel="nofollow">My Favorites</a></li>
<li><a href="<?= Yii::$service->url->getUrl('customer/product/review') ?>" rel="nofollow">Product Review</a></li>
</ul>
</dd>
</dl>
<div class="mywish t_r">
<a href="">
<a href="<?= Yii::$service->url->getUrl('customer/wishlist') ?>">
<span class="mywishbg"></span>
</a>
<span class="mywish-text" id="js_favour_num">0</span>
</div>
<div class="mycart t_r">
<a href="">
<a href="<?= Yii::$service->url->getUrl('checkout/cart') ?>">
<span class="mycartbg" id="js_topBagWarp"></span>
</a>
<span class="mycart-text" id="js_cart_items">0</span>
......
<?php
/**
* FecShop file.
*
* @link http://www.fecshop.com/
* @copyright Copyright (c) 2016 FecShop Software LLC
* @license http://www.fecshop.com/license/
*/
namespace fecshop\models\mysqldb;
use Yii;
use yii\db\ActiveRecord;
/**
* @author Terry Zhao <2358269014@qq.com>
* @since 1.0
*/
class Customer extends ActiveRecord
{
public static function tableName()
{
return 'customer';
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册