完成登陆界面
This commit is contained in:
parent
bb54981f81
commit
f1fe08948c
|
|
@ -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);
|
||||
// }
|
||||
// );
|
||||
// }
|
||||
|
||||
}]);
|
||||
|
|
|
|||
|
|
@ -1,3 +1,28 @@
|
|||
<p>
|
||||
这是登陆界面
|
||||
</p>
|
||||
<form class="ui form segment" ng-class={error:showErr}>
|
||||
<div class="ui error message">
|
||||
<div class="header">错误提示</div>
|
||||
<p>
|
||||
{{ errInfo }}</p>
|
||||
</div>
|
||||
<div class="required field">
|
||||
<label>用户名</label>
|
||||
<div class="ui icon input">
|
||||
<input type="text" ng-model="userName">
|
||||
<i class="user icon"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="required field">
|
||||
<label>密码</label>
|
||||
<div class="ui icon input">
|
||||
<input type="password" ng-model="pwd">
|
||||
<i class="lock icon"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<div class="ui checkbox js-auto-login">
|
||||
<input type="checkbox" name="auto-login" checked="true">
|
||||
<label>30天内自动登陆</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui submit button" ng-click="login()">登陆</div>
|
||||
</form>
|
||||
|
|
|
|||
Loading…
Reference in New Issue