From f1fe08948c8b753d5d4f9f328afb7c119d410d88 Mon Sep 17 00:00:00 2001 From: luchenqun Date: Tue, 1 Nov 2016 23:22:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E7=99=BB=E9=99=86=E7=95=8C?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scripts/controllers/login-controller.js | 64 ++++++++++++------- public/views/login.html | 31 ++++++++- 2 files changed, 69 insertions(+), 26 deletions(-) diff --git a/public/scripts/controllers/login-controller.js b/public/scripts/controllers/login-controller.js index 8feab48..c40d9d2 100644 --- a/public/scripts/controllers/login-controller.js +++ b/public/scripts/controllers/login-controller.js @@ -1,29 +1,47 @@ app.controller('loginCtr', ['$scope', '$filter', '$state', 'bookmarkService', 'pubSubService', function($scope, $filter, $state, bookmarkService, pubSubService) { console.log("Hello loginCtr..."); - login({ - userName: 'luchenqun', - pwd: '123456', - }); - function login(params) { - bookmarkService.login(params).then( - function(data) { - console.log(data); - if (data.logined) { - pubSubService.publish('loginCtr.login', { - 'login': data.logined, - }); - $state.go('bookmarks', { - showStyle: 'navigate', - }) - } else { - console.log('login failed......................') - } - }, - function(errorMsg) { - console.log(errorMsg); - } - ); + $scope.userName = ""; + $scope.pwd = ""; + $scope.showErr = false; + $scope.errInfo = ''; + + $scope.login = function() { + var atuoLogin = $('.ui.checkbox.js-auto-login').checkbox('is checked'); + if (!$scope.userName || !$scope.pwd) { + $scope.showErr = true; + $scope.errInfo = '用户明或者密码不能为空!'; + } else { + $scope.showErr = false; + $scope.errInfo = ''; + console.log($scope.userName, $scope.pwd, atuoLogin); + } } + // login({ + // userName: 'luchenqun', + // pwd: '123456', + // }); + // + // function login(params) { + // bookmarkService.login(params).then( + // function(data) { + // console.log(data); + // if (data.logined) { + // pubSubService.publish('loginCtr.login', { + // 'login': data.logined, + // }); + // $state.go('bookmarks', { + // showStyle: 'navigate', + // }) + // } else { + // console.log('login failed......................') + // } + // }, + // function(errorMsg) { + // console.log(errorMsg); + // } + // ); + // } + }]); diff --git a/public/views/login.html b/public/views/login.html index 433a032..b5e6cc0 100644 --- a/public/views/login.html +++ b/public/views/login.html @@ -1,3 +1,28 @@ -

- 这是登陆界面 -

+
+
+
错误提示
+

+ {{ errInfo }}

+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ +
+
登陆
+