",{"class":"sliphover-overlay"});return h.css({width:"100%",height:c.settings.height,position:"absolute",left:g,bottom:f,display:c.settings.verticalMiddle?"table":"inline",textAlign:c.settings.textAlign,color:c.settings.fontColor,backgroundColor:c.settings.backgroundColor}).html(i),h},slideIn:function(a,b){b.stop().animate({left:0,bottom:0},a.settings.duration)},removeOverlay:function(a,c,d){var e,f=c.find(".sliphover-overlay");switch(d){case 0:e={bottom:"100%",left:0};break;case 1:e={bottom:0,left:"100%"};break;case 2:e={bottom:"-100%",left:0};break;case 3:e={bottom:0,left:"-100%"};break;default:b.console.error("error when get direction of the mouse")}f.stop().animate(e,a.settings.duration,function(){c.remove()})},getDirection:function(a,b){var c=a.width(),d=a.height(),e=(b.pageX-a.offset().left-c/2)*(c>d?d/c:1),f=(b.pageY-a.offset().top-d/2)*(d>c?c/d:1),g=Math.round((Math.atan2(f,e)*(180/Math.PI)+180)/90+3)%4;return g}},a.fn[e]=function(b){return this.each(function(){a.data(this,"plugin_"+e)||a.data(this,"plugin_"+e,new g(this,b))}),this}}(jQuery,window,document);
\ No newline at end of file
diff --git a/public/js/login.js b/public/js/login.js
index 5a4cad6..c22d9fb 100644
--- a/public/js/login.js
+++ b/public/js/login.js
@@ -2,41 +2,38 @@
* Created by Zhou Canzhen
* 2016/03/28
*/
-yinjiApp.controller('loginController',
+yinjiApp.controller('authController',
function loginController($scope,$http,$rootScope){
- //check name and pwd
- //$scope.errMsg = 'test';
+ //验证用户名密码是否正确
+ if ($scope.remember == null)
+ $scope.remember = false;
$scope.login = function(){
- $http({
- method: 'POST',
- url:'/login',
- params:{
- 'username':$scope.username,
- 'password':$scope.pwd,
- //'remember':$scope.remember
- }
- })
- .success(function(data) {
- console.log(data);
- if (data==1) {
- $scope.errMsg = '登录成功,自动跳转页面...';
- window.setTimeout("window.location='intended'",1000);
- } else {
- $scope.errMsg = '登录失败,用户名或密码错误...';
- }
- });
- };
+ if ($scope.username == null){
+ $scope.errMsg = "请输入用户名";
+ }else if ($scope.pwd == null){
+ $scope.errMsg = "请输入密码";
+ }else{
+ $http({
+ method: 'POST',
+ url:'/login',
+ params:{
+ 'username':$scope.username,
+ 'password':$scope.pwd,
+ 'remember':$scope.remember
+ }
+ })
+ .success(function(data) {
+ console.log(data);
+ if (data==1) {
+ $scope.errMsgColor = "green";//登录成功,为绿色
+ $scope.errMsg = '登录成功,自动跳转页面...';
+ window.setTimeout("window.location='intended'",1000);
+ } else {
+ $scope.errMsgColor = "red";//登录失败,错误消息为红色
+ $scope.errMsg = '登录失败,用户名或密码错误...';
+ }
+ });
+ }
- $scope.addUser = function(){
- $http({
- method:'GET',
- url:"/db/addUser",
- params:{
- 'username':$scope.username,
- 'email':'scx@163.com',
- 'password':$scope.pwd,
- 'privilege':'user'
- }
- })
};
});
\ No newline at end of file
diff --git a/public/js/register.js b/public/js/register.js
new file mode 100644
index 0000000..db8bdde
--- /dev/null
+++ b/public/js/register.js
@@ -0,0 +1,82 @@
+/**
+ * Created by Zhou Canzhen
+ * 2016/04/10
+ */
+yinjiApp.controller('authController',
+ function loginController($scope,$http,$rootScope){
+ $scope.errMsgColor = 'red';//设置错误消息为红色
+ $userChecked = false;//先设置为未验证用户名
+ //当用户输完用户名,立即验证用户名是否已存在
+ $scope.checkUserExist = function(){
+ if ($scope.username != null){
+ $http({
+ method: 'GET',//注意,这里必须要用GET方法
+ url:'/db/checkUser',
+ params:{
+ 'username':$scope.username,
+ }
+ }).success(function(data) {
+ if (data == 0) {
+ $scope.errMsgColor = "red";//登录失败,错误消息为红色
+ $scope.errMsg = '对不起,该用户名已存在';
+ } else {
+ $scope.errMsgColor = "green";//登录成功,为绿色
+ $userChecked = true;//将userChecked设置为true
+ $scope.errMsg = '该用户名未被注册';
+ }
+ });
+ }
+ }
+
+ //验证用户名密码
+ $scope.register = function(){
+ console.log('pwd:',$scope.pwd);
+ console.log('repwd',$scope.repwd);
+ if ($scope.username == null){
+ $scope.errMsgColor = "red";//错误消息为红色
+ $scope.errMsg = "请输入用户名";
+ }else if ($scope.pwd == null) {
+ $scope.errMsgColor = "red";//错误消息为红色
+ $scope.errMsg = "请输入密码";
+ }else if($scope.repwd == null){
+ $scope.errMsgColor = "red";//错误消息为红色
+ $scope.errMsg = "请再次输入密码进行确认";
+ }else if ($scope.pwd != $scope.repwd ) {
+ $scope.errMsgColor = "red";//错误消息为红色
+ $scope.errMsg = "对不起,两次密码输入不一致,请重新输入";
+ }else if($userChecked == true){
+ $http({
+ method: 'GET',//注意,这里必须要用GET方法
+ url:'/db/addUser',
+ params:{
+ 'username':$scope.username,
+ 'password':$scope.pwd
+ }
+ })
+ .success(function(data) {//返回新增用户的id
+ console.log(data);
+ if (data != null) {
+ $scope.errMsgColor = "green";//登录成功,为绿色
+ $scope.errMsg = '注册成功,自动登录...';
+ $http({
+ method: 'POST',
+ url:'/login',
+ params:{
+ 'username':$scope.username,
+ 'password':$scope.pwd,
+ 'remember':$scope.remember
+ }
+ });
+ window.setTimeout("window.location='intended'",1000);
+ } else {
+ $scope.errMsgColor = "red";//错误消息为红色
+ $scope.errMsg = 'oops,注册失败...猿猿正在努力查找错误原因中...';
+ }
+ });
+ }else if ($userChecked == false){
+ $scope.errMsgColor = "red";//错误消息为红色
+ $scope.errMsg = '对不起,该用户名已存在';
+ }
+
+ };
+ });
\ No newline at end of file
diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php
new file mode 100644
index 0000000..b33f9d9
--- /dev/null
+++ b/resources/views/auth/login.blade.php
@@ -0,0 +1,43 @@
+@extends('layouts.auth')
+
+@section('header')
+ @parent
+
+@show
+
+@section('footer')
+ @parent
+
+
+@stop
+
+@section('auth')
+
+
+
+
+
+@stop
\ No newline at end of file
diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.php
new file mode 100644
index 0000000..22b669d
--- /dev/null
+++ b/resources/views/auth/register.blade.php
@@ -0,0 +1,36 @@
+@extends('layouts.auth')
+
+@section('title','注册')
+
+@section('header')
+ @parent
+
+@show
+
+@section('footer')
+ @parent
+
+@stop
+
+@section('auth')
+
+
+@stop
\ No newline at end of file
diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php
new file mode 100644
index 0000000..357f563
--- /dev/null
+++ b/resources/views/home.blade.php
@@ -0,0 +1,71 @@
+@extends('layouts.content')
+
+@section('title','首页')
+
+@section('header')
+ @parent
+
+@stop
+
+@section('footer')
+ @parent
+
+
+
+
+@stop
+
+@section('content')
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+@stop
\ No newline at end of file
diff --git a/resources/views/index.blade.php b/resources/views/index.blade.php
new file mode 100644
index 0000000..1287ef9
--- /dev/null
+++ b/resources/views/index.blade.php
@@ -0,0 +1,42 @@
+@extends('layouts.content')
+
+@section('title','首页')
+
+@section('header')
+ @parent
+
+
+@show
+
+@section('footer')
+ @parent
+
+
+@show
+
+
+@section('content')
+
+
+
+
+
+
+
+@stop
\ No newline at end of file
diff --git a/resources/views/layouts/auth.blade.php b/resources/views/layouts/auth.blade.php
new file mode 100644
index 0000000..50a8bf9
--- /dev/null
+++ b/resources/views/layouts/auth.blade.php
@@ -0,0 +1,36 @@
+@extends('layouts.header')
+
+@section('title','登录')
+
+@section('header')
+ @parent
+
+
+@show
+
+@section('body')
+
+
+
印迹
+
+
+
+
+
+
+
+ Copyright ©
+ 2016. ZCZ All rights reserved.
+
+
+
+@stop
\ No newline at end of file
diff --git a/resources/views/layouts/content.blade.php b/resources/views/layouts/content.blade.php
new file mode 100644
index 0000000..3da213e
--- /dev/null
+++ b/resources/views/layouts/content.blade.php
@@ -0,0 +1,60 @@
+@extends('layouts.header')
+
+@section('body')
+
+
+
+
+ @section('content')
+ @show
+
+
+
+
+
+@stop
\ No newline at end of file
diff --git a/resources/views/layouts/content.blade.php.rej b/resources/views/layouts/content.blade.php.rej
new file mode 100644
index 0000000..3413faf
--- /dev/null
+++ b/resources/views/layouts/content.blade.php.rej
@@ -0,0 +1,14 @@
+diff a/resources/views/layouts/content.blade.php b/resources/views/layouts/content.blade.php (rejected hunks)
+@@ -38,9 +38,9 @@
+ @show
+
+
+-