完成登陆界面
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) {
|
app.controller('loginCtr', ['$scope', '$filter', '$state', 'bookmarkService', 'pubSubService', function($scope, $filter, $state, bookmarkService, pubSubService) {
|
||||||
console.log("Hello loginCtr...");
|
console.log("Hello loginCtr...");
|
||||||
login({
|
|
||||||
userName: 'luchenqun',
|
|
||||||
pwd: '123456',
|
|
||||||
});
|
|
||||||
|
|
||||||
function login(params) {
|
$scope.userName = "";
|
||||||
bookmarkService.login(params).then(
|
$scope.pwd = "";
|
||||||
function(data) {
|
$scope.showErr = false;
|
||||||
console.log(data);
|
$scope.errInfo = '';
|
||||||
if (data.logined) {
|
|
||||||
pubSubService.publish('loginCtr.login', {
|
$scope.login = function() {
|
||||||
'login': data.logined,
|
var atuoLogin = $('.ui.checkbox.js-auto-login').checkbox('is checked');
|
||||||
});
|
if (!$scope.userName || !$scope.pwd) {
|
||||||
$state.go('bookmarks', {
|
$scope.showErr = true;
|
||||||
showStyle: 'navigate',
|
$scope.errInfo = '用户明或者密码不能为空!';
|
||||||
})
|
} else {
|
||||||
} else {
|
$scope.showErr = false;
|
||||||
console.log('login failed......................')
|
$scope.errInfo = '';
|
||||||
}
|
console.log($scope.userName, $scope.pwd, atuoLogin);
|
||||||
},
|
}
|
||||||
function(errorMsg) {
|
|
||||||
console.log(errorMsg);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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>
|
<form class="ui form segment" ng-class={error:showErr}>
|
||||||
这是登陆界面
|
<div class="ui error message">
|
||||||
</p>
|
<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