|
|
@@ -13,6 +13,7 @@ define(['app/app'], function (app) {
|
|
|
$scope.addingUser = status;
|
|
|
$scope.adding = false;
|
|
|
$scope.newUser = {};
|
|
|
+ $scope.newUser.userName = '';
|
|
|
$scope.newUser.userTel = '';
|
|
|
$scope.newUser.userEmail = '';
|
|
|
};
|
|
|
@@ -247,7 +248,7 @@ define(['app/app'], function (app) {
|
|
|
toaster.pop('error', '请输入用户名信息');
|
|
|
return;
|
|
|
}
|
|
|
- if (!$scope.userTelSuccess) {
|
|
|
+ if (!$scope.userTelSuccess && !$scope.userEmailSuccess) {
|
|
|
toaster.pop('error', '请输入正确的信息后提交');
|
|
|
return;
|
|
|
}
|
|
|
@@ -367,33 +368,39 @@ define(['app/app'], function (app) {
|
|
|
* 验证邮箱是否可用
|
|
|
*/
|
|
|
$scope.emailValid = function (email) {
|
|
|
+ var reg = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/
|
|
|
if (email) {
|
|
|
- $http.get('basic/user/emailEnable', {
|
|
|
- params: {
|
|
|
- email: email
|
|
|
- }
|
|
|
- }).success(function (data) {
|
|
|
- data = eval(data);
|
|
|
- if (data == true) {
|
|
|
- // $scope.newUserForm.newUserEmail.$setValidity('available',
|
|
|
- // true);
|
|
|
- $scope.userEmailSuccess = true;
|
|
|
- $scope.userEmailError = false;
|
|
|
- } else {
|
|
|
- // $scope.newUserForm.newUserEmail.$setValidity('available',
|
|
|
- // false);
|
|
|
- $scope.userEmailError = true;
|
|
|
- $scope.userEmailSuccess = false;
|
|
|
- toaster.pop('error', '错误', '邮箱 ' + email + ' 已被注册');
|
|
|
- }
|
|
|
- }).error(function () {
|
|
|
- $scope.userEmailError = true;
|
|
|
- $scope.userEmailSuccess = false;
|
|
|
- });
|
|
|
+ reg.test(email) ? $scope.userEmailSuccess = true : $scope.userEmailSuccess = false;
|
|
|
} else {
|
|
|
- $scope.userEmailError = false;
|
|
|
- $scope.userEmailSuccess = false;
|
|
|
+ $scope.userEmailSuccess = true;
|
|
|
}
|
|
|
+ // if (email) {
|
|
|
+ // $http.get('basic/user/emailEnable', {
|
|
|
+ // params: {
|
|
|
+ // email: email
|
|
|
+ // }
|
|
|
+ // }).success(function (data) {
|
|
|
+ // data = eval(data);
|
|
|
+ // if (data == true) {
|
|
|
+ // // $scope.newUserForm.newUserEmail.$setValidity('available',
|
|
|
+ // // true);
|
|
|
+ // $scope.userEmailSuccess = true;
|
|
|
+ // $scope.userEmailError = false;
|
|
|
+ // } else {
|
|
|
+ // // $scope.newUserForm.newUserEmail.$setValidity('available',
|
|
|
+ // // false);
|
|
|
+ // $scope.userEmailError = true;
|
|
|
+ // $scope.userEmailSuccess = false;
|
|
|
+ // toaster.pop('error', '错误', '邮箱 ' + email + ' 已被注册');
|
|
|
+ // }
|
|
|
+ // }).error(function () {
|
|
|
+ // $scope.userEmailError = true;
|
|
|
+ // $scope.userEmailSuccess = false;
|
|
|
+ // });
|
|
|
+ // } else {
|
|
|
+ // $scope.userEmailError = false;
|
|
|
+ // $scope.userEmailSuccess = false;
|
|
|
+ // }
|
|
|
};
|
|
|
|
|
|
/**
|