Browse Source

安全设置 样式处理

liusw 8 years ago
parent
commit
a1f36e3766

+ 48 - 20
src/main/java/com/uas/platform/b2c/common/account/controller/UserController.java

@@ -1,14 +1,15 @@
 package com.uas.platform.b2c.common.account.controller;
 
-import com.uas.account.util.AccountUtils;
 import com.uas.message.mail.service.MailService;
 import com.uas.message.sms.service.SmsService;
-import com.uas.platform.b2c.common.account.model.*;
+import com.uas.platform.b2c.common.account.model.Enterprise;
+import com.uas.platform.b2c.common.account.model.User;
+import com.uas.platform.b2c.common.account.model.UserInfo;
+import com.uas.platform.b2c.common.account.model.UserQuestion;
 import com.uas.platform.b2c.common.account.service.UserQuestionService;
 import com.uas.platform.b2c.common.account.service.UserService;
 import com.uas.platform.b2c.core.support.SystemSession;
 import com.uas.platform.b2c.core.support.log.UsageBufferedLogger;
-import com.uas.platform.b2c.fa.payment.model.BankInfo;
 import com.uas.platform.core.exception.IllegalOperatorException;
 import com.uas.platform.core.logging.BufferedLoggerManager;
 import com.uas.platform.core.model.PageInfo;
@@ -18,8 +19,12 @@ import com.uas.platform.core.util.encry.Md5Utils;
 import com.uas.platform.core.util.serializer.FlexJsonUtils;
 import com.wordnik.swagger.annotations.ApiOperation;
 import com.wordnik.swagger.annotations.ApiParam;
-import org.apache.http.protocol.HTTP;
-import org.jboss.logging.annotations.Param;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
 import org.springframework.http.HttpHeaders;
@@ -27,11 +32,12 @@ import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 import org.springframework.ui.ModelMap;
 import org.springframework.util.StringUtils;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-import java.util.*;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
 
 /**
  * 用户信息的请求
@@ -176,6 +182,7 @@ public class UserController {
 				mailService.send("a4c45a22-436a-430c-9667-4edfd7d04a27", newUserEmail, data);
 				session.setAttribute("checkCode", checkCode);
 				session.setAttribute("checkTime", new Date().getTime());
+				session.setAttribute("newUserEmail",newUserEmail);
 				return new ResponseEntity<>(HttpStatus.OK);
 			} catch (Exception e) {
 				e.printStackTrace();
@@ -193,12 +200,14 @@ public class UserController {
 	 * @return
 	 */
 	@RequestMapping(value = "/validCheckCode", method = RequestMethod.GET)
-	public Map<String, Object> validCheckCode(final String checkCode, final HttpServletRequest request) {
+	public Map<String, Object> validCheckCode(final String checkCode, final String newUserEmail,final HttpServletRequest request) {
 		HttpSession session = request.getSession();
 		Map<String,Object> result = new HashMap<String,Object>();
-		if (checkCode != null) {
+		if (!StringUtils.isEmpty(checkCode) && !StringUtils.isEmpty(newUserEmail)) {
 			Long checkTime = (Long) session.getAttribute("checkTime");
-			Long nowTime = new Date().getTime();			String _checkCode = (String) session.getAttribute("checkCode");
+			Long nowTime = new Date().getTime();
+			String _checkCode = (String) session.getAttribute("checkCode");
+			String _newUserEmail = (String) session.getAttribute("newUserEmail");
 			//验证码失效
 			if((nowTime-checkTime)>10 * 60 * 1000 || _checkCode == null) {
 				result.put("status", 2);
@@ -206,7 +215,7 @@ public class UserController {
 				return result;
 			}
 			//验证码错误
-			if (!_checkCode.equals(checkCode)) {
+			if (!_checkCode.equals(checkCode) || !_newUserEmail.equals(newUserEmail)) {
 				result.put("status", 0);
 				result.put("message", "验证码错误");
 				return result;
@@ -231,10 +240,18 @@ public class UserController {
 	 * @return
 	 */
 	@RequestMapping(value = "/updateUserEmail", method = RequestMethod.POST)
-	public ResponseEntity<String> updateUserEmail(final HttpSession session, final String userEmail, final String newUserEmail) {
+	public ResponseEntity<String> updateUserEmail(final HttpSession session, final String userEmail, final String newUserEmail,final String checkCode) {
 		if (userEmail!=null && userEmail.equals(newUserEmail)) {
 			throw new IllegalOperatorException("新邮箱地址与旧邮箱地址相同");
 		}
+		String _checkCode = (String) session.getAttribute("checkCode");
+		if(!_checkCode.equals(checkCode)){
+			throw new IllegalOperatorException("验证码错误");
+		}
+		String _newUserEmail = (String) session.getAttribute("newUserEmail");
+		if(!_newUserEmail.equals(newUserEmail)){
+			throw new IllegalOperatorException("邮箱地址错误");
+		}
 		User sysUser = SystemSession.getUser();
 		User user = userService.findUserPwdByUserUU(sysUser.getUserUU());
 		if (!StringUtils.isEmpty(newUserEmail)) {
@@ -292,9 +309,10 @@ public class UserController {
 			}
 			String checkCode = String.valueOf((int) ((Math.random() * 9 + 1) * 100000));
 			try {
-				smsService.send("1eba04ae-f3d9-4105-ad32-0196309fabb3", newUserTel, new Object[] {checkCode});
+				//smsService.send("1eba04ae-f3d9-4105-ad32-0196309fabb3", newUserTel, new Object[] {checkCode});
 				session.setAttribute("telCheckCode", checkCode);
 				session.setAttribute("telCheckTime", new Date().getTime());
+				session.setAttribute("newUserTel", newUserTel);
 				return new ResponseEntity<>(HttpStatus.OK);
 			} catch (Exception e) {
 				e.printStackTrace();
@@ -312,12 +330,13 @@ public class UserController {
 	 * @return
 	 */
 	@RequestMapping(value = "/validTelCheckCode", method = RequestMethod.GET)
-	public Map<String, Object> validTelCheckCode(final String telCheckCode, final HttpSession session) {
+	public Map<String, Object> validTelCheckCode(final String telCheckCode, final String newUserTel,final HttpSession session) {
 		Map<String, Object> result = new HashMap<String, Object>();
-		if (!StringUtils.isEmpty(telCheckCode)) {
+		if (!StringUtils.isEmpty(telCheckCode) && !StringUtils.isEmpty(newUserTel)) {
 			Long checkTime = (Long) session.getAttribute("telCheckTime");
 			Long nowTime = new Date().getTime();
 			String _checkCode = (String) session.getAttribute("telCheckCode");
+			String _newUserTel = (String) session.getAttribute("newUserTel");
 			//验证码失效
 			if ((nowTime - checkTime) > 10 * 60 * 1000 || _checkCode == null) {
 				result.put("status", 2);
@@ -325,7 +344,7 @@ public class UserController {
 				return result;
 			}
 			//验证码错误
-			if (!_checkCode.equals(telCheckCode)) {
+			if (!_checkCode.equals(telCheckCode) || !_newUserTel.equals(newUserTel)) {
 				result.put("status",0);
 				result.put("message", "验证码错误");
 				return result;
@@ -350,10 +369,19 @@ public class UserController {
 	 * @return
 	 */
 	@RequestMapping(value = "/updateUserTel", method = RequestMethod.POST)
-	public ResponseEntity<String> updateUserTel(final HttpSession session, final String userTel, final String newUserTel) {
+	public ResponseEntity<String> updateUserTel(final HttpSession session, final String userTel, final String newUserTel,final String telCheckCode) {
 		if (userTel.equals(newUserTel)) {
 			throw new IllegalOperatorException("新手机号与旧手机号相同");
 		}
+		//防止用户非法操作
+		String _checkCode = (String) session.getAttribute("telCheckCode");
+		if(!_checkCode.equals(telCheckCode)){
+			throw new IllegalOperatorException("验证码错误");
+		}
+		String _newUserTel = (String) session.getAttribute("newUserTel");
+		if(!_newUserTel.equals(newUserTel)){
+			throw new IllegalOperatorException("手机号错误");
+		}
 		User sysUser = SystemSession.getUser();
 		User user = userService.findUserPwdByUserUU(sysUser.getUserUU());
 		if (!StringUtils.isEmpty(newUserTel)) {

+ 22 - 18
src/main/java/com/uas/platform/b2c/common/account/service/impl/UserServiceImpl.java

@@ -12,35 +12,33 @@ import com.uas.platform.b2c.common.account.service.UserService;
 import com.uas.platform.b2c.common.base.dao.CommonDao;
 import com.uas.platform.b2c.core.config.MessageConf;
 import com.uas.platform.b2c.core.support.SystemSession;
-import com.uas.platform.b2c.fa.payment.model.BankInfo;
 import com.uas.platform.core.exception.IllegalOperatorException;
 import com.uas.platform.core.exception.SystemException;
-import com.uas.platform.core.model.Constant;
 import com.uas.platform.core.model.PageInfo;
 import com.uas.platform.core.model.PageParams;
 import com.uas.platform.core.model.Status;
-import com.uas.platform.core.model.Token;
-import com.uas.platform.core.persistence.criteria.CriterionExpression;
-import com.uas.platform.core.persistence.criteria.LogicalExpression;
-import com.uas.platform.core.persistence.criteria.SimpleExpression;
 import com.uas.platform.core.util.AgentUtils;
 import com.uas.platform.core.util.encry.Md5Utils;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.Predicate;
+import javax.persistence.criteria.Root;
+import javax.servlet.http.HttpServletRequest;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
 import org.springframework.data.jpa.domain.Specification;
 import org.springframework.security.core.userdetails.UsernameNotFoundException;
 import org.springframework.stereotype.Service;
-import org.springframework.ui.ModelMap;
 import org.springframework.util.CollectionUtils;
-import org.springframework.util.StringUtils;
-
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
-import javax.servlet.http.HttpServletRequest;
-import java.text.SimpleDateFormat;
-import java.util.*;
 
 @Service
 public class UserServiceImpl implements UserService {
@@ -271,6 +269,7 @@ public class UserServiceImpl implements UserService {
 		if (result) {
 			User user1 = userDao.findOne(user.getUserUU());
 			user1.setUserPwd(Md5Utils.encode(newPassword, user1.getUserUU()));
+			user1.setPwdSecLevel(user.getPwdSecLevel());
 			if (user1.getEnterprise() == null)
 				user1.setCurrentEnterprise();// 随便绑定一个用户所属企业
 			Enterprise enterprise = user1.getEnterprise();
@@ -281,7 +280,7 @@ public class UserServiceImpl implements UserService {
 					}else {
 							AccountUtils.resetPassword(user1.getUserUU(), enterprise.getUu(), newPassword);
 					}
-				//user1 = userDao.save(user1);
+				user1 = userDao.save(user1);
 			} catch (Exception e) {
 				throw new SystemException(e.getMessage());
 			}
@@ -350,7 +349,12 @@ public class UserServiceImpl implements UserService {
 		detail.setMobile(user.getUserTel());
 		detail.setName(user.getUserName());
 		detail.setSex(user.getUserSex());
-		AccountUtils.saveUser(user.getUserUU(), SystemSession.getUser().getEnterprise().getUu(), detail);
+		//判断是否个人用户
+		if(SystemSession.getUser().getEnterprise()==null){
+			AccountUtils.saveUser(user.getUserUU(), null, detail);
+		}else{
+			AccountUtils.saveUser(user.getUserUU(), SystemSession.getUser().getEnterprise().getUu(), detail);
+		}
 	}
 	@Override
 	public void removeUser(Long uu) {

+ 3 - 3
src/main/java/com/uas/platform/b2c/common/account/v2/service/impl/UserServiceImpl.java

@@ -5,15 +5,15 @@ import com.uas.platform.b2c.common.account.dao.EnterpriseDao;
 import com.uas.platform.b2c.common.account.dao.UserDao;
 import com.uas.platform.b2c.common.account.model.Enterprise;
 import com.uas.platform.b2c.common.account.v2.service.UserService;
+import com.uas.platform.b2c.core.support.SystemSession;
 import com.uas.platform.b2c.core.support.log.UsageBufferedLogger;
 import com.uas.platform.core.logging.BufferedLoggerManager;
 import com.uas.platform.core.model.Status;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.List;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
 
 
 @Service("v2.UserService")

+ 3 - 0
src/main/webapp/WEB-INF/views/normal/vendor_center.html

@@ -18,6 +18,7 @@
 <link rel="stylesheet" href="static/css/vendor/base.css" />
 <link rel="stylesheet" href="static/lib/calendar/calendar.css">
 <link rel="stylesheet" href="static/lib/angular/ng-table.css">
+<link rel="stylesheet" type="text/css" href="static/lib/keyboard/css/softkeys-0.0.1.css">
 </head>
 <body>
 	<!-- 消息提示框  Start-->
@@ -120,5 +121,7 @@
 //		}
 	</script>
 	<!-- 产品图片插入modal End -->
+	<script src="static/lib/jquery/jquery.min.js"></script>
+	<script src="static/lib/keyboard/js/softkeys-0.0.1.js"></script>
 </body>
 </html>

+ 4 - 0
src/main/webapp/resources/css/common.css

@@ -939,4 +939,8 @@ input::-webkit-outer-spin-button,
 input::-webkit-inner-spin-button {
 	-webkit-appearance: none !important;
 	margin: 0;
+}
+/*去掉搜狗小键盘样式*/
+input::-webkit-input-safebox-button{
+	display: none;
 }

File diff suppressed because it is too large
+ 1361 - 1215
src/main/webapp/resources/js/usercenter/controllers/forstore/account_manager_ctrl.js


+ 289 - 48
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_account_management_ctrl.js

@@ -14,9 +14,17 @@ define(['app/app'], function (app) {
           $scope.userInfo = $rootScope.userInfo;
           $scope.updateState = false;
           //手机号和邮箱号的部分隐藏
-          $scope.userInfo.userTel = $scope.userInfo.userTel.substr(0, 3) + '****' + $scope.userInfo.userTel.substr(7);
-          var userEmailTemp = $scope.userInfo.userEmail.indexOf("@");
-          $scope.userInfo.userEmail = $scope.userInfo.userEmail.substr(0,userEmailTemp-2)+"***"+$scope.userInfo.userEmail.substr(userEmailTemp);
+          if($scope.userInfo.userTel){
+            $scope.userInfo.userTel = $scope.userInfo.userTel.substr(0, 3)
+                + '****' + $scope.userInfo.userTel.substr(7);
+          }
+          var userEmailTemp = $scope.userInfo.userEmail
+              ? $scope.userInfo.userEmail.indexOf("@") : '';
+          if (userEmailTemp != '') {
+            $scope.userInfo.userEmail = $scope.userInfo.userEmail.substr(
+                0, userEmailTemp - 2) + "***"
+                + $scope.userInfo.userEmail.substr(userEmailTemp);
+          }
           // 获取企业信息
           Enterprise.getEnterpriseInfo({enuu: $scope.userInfo.enterprise.uu},
               function (data) {
@@ -467,16 +475,95 @@ define(['app/app'], function (app) {
           };
         }]);
 
+  // 修改密码Controller
   app.register.controller('PasswordCtrl',
-      ['$scope', '$modalInstance', 'user', 'User', 'toaster',
-        function ($scope, $modalInstance, user, User, toaster) {
+      ['$scope', '$modalInstance', 'user', 'User', 'toaster','$state',
+        function ($scope, $modalInstance, user, User, toaster,$state) {
           $scope.user = user;
           $scope.checking = false;
+          $scope.showPassword = false;
+          $scope.showNewPassword = false;
+          $scope.showPassword1 = false;
+          $scope.reloadKeyboard = function (type, $event) {
+            $event.stopPropagation();
+            if (type === 'showPassword') {
+              $scope.showPassword = !$scope.showPassword;
+              if (!$scope.showPassword) {
+                $scope.checkPassword($scope.user.password);
+              } else {
+                $scope.closeOtherKeyboard('showPassword');
+              }
+            } else if (type === 'showNewPassword') {
+              $scope.showNewPassword = !$scope.showNewPassword;
+              if (!$scope.showNewPassword) {
+                $scope.checkNewPassword($scope.user.newPassword);
+              } else {
+                $scope.closeOtherKeyboard('showNewPassword');
+              }
+            } else if (type === 'showPassword1') {
+              $scope.showPassword1 = !$scope.showPassword1;
+              if (!$scope.showNewPassword1) {
+                $scope.checkNewPassword1($scope.user.newPassword1);
+              } else {
+                $scope.closeOtherKeyboard('showPassword1');
+              }
+            }
+          }
+
+          function resetPassword() {
+            $scope.showPassword = false;
+            $scope.checkPassword($scope.user.password);
+          }
+
+          function resetNewPassword() {
+            $scope.showNewPassword = false;
+            $scope.checkNewPassword($scope.user.newPassword);
+          }
+
+          function resetPassword1() {
+            $scope.showPassword1 = false;
+            $scope.checkNewPassword1($scope.user.newPassword1);
+          }
+
+          $scope.closeOtherKeyboard = function (type) {
+            if (type == 'showPassword') {
+              if ($scope.showNewPassword) {
+                resetNewPassword();
+              } else if ($scope.showPassword1) {
+                resetPassword1();
+              }
+            } else if (type == 'showNewPassword') {
+              if ($scope.showPassword) {
+                resetPassword();
+              } else if ($scope.showPassword1) {
+                resetPassword1();
+              }
+            } else if (type == 'showPassword1') {
+              if ($scope.showPassword) {
+                resetPassword();
+              } else if ($scope.showNewPassword) {
+                resetNewPassword();
+              }
+            }
+          }
+          $scope.closeKeyboard = function () {
+            if ($scope.showPassword) {
+              $scope.showPassword = false;
+              $scope.checkPassword($scope.user.password);
+            } else if ($scope.showNewPassword) {
+              $scope.showNewPassword = false;
+              $scope.checkNewPassword($scope.user.newPassword);
+            } else if ($scope.showPassword1) {
+              $scope.showPassword1 = false;
+              $scope.checkNewPassword1($scope.user.newPassword1);
+            }
+          }
           //输入原密码后验证原密码是否正确
           $scope.checkPassword = function (password) {
             $scope.checking = true;
             $scope.checkSuccess = false;
             $scope.checkFailed = false;
+            //判断点击的是否在小键盘区域
             User.checkPassword({password: password}, function () {
               $scope.checkSuccess = true;
               $scope.checking = false;
@@ -504,6 +591,10 @@ define(['app/app'], function (app) {
             }
           }
 
+          $scope.$watch('user.newPassword', function (newValue, oldValue) {
+            $scope.checkPasswordLevel(newValue);
+          });
+
           //密码强度校验
           $scope.secLevel = 0;
           $scope.checkPasswordLevel = function (newPassword) {
@@ -584,11 +675,16 @@ define(['app/app'], function (app) {
           $scope.cancel = function () {
             $modalInstance.close();
           };
+          $scope.hideKeyboard = function () {
+            $scope.closeKeyboard();
+            console.log(1);
+          }
         }]);
+
   // 修改邮箱Controller
   app.register.controller('UserEmailCtrl',
-      ['$scope', '$modalInstance', 'user', 'User', 'toaster', '$interval',
-        function ($scope, $modalInstance, user, User, toaster, $interval) {
+      ['$scope', '$modalInstance', 'user', 'User', 'toaster', '$interval','$location',
+        function ($scope, $modalInstance, user, User, toaster, $interval,$location) {
           $scope.user = user;
           $scope.user.userEmail = null;
           $scope.user.newUserEmail = null;
@@ -613,28 +709,35 @@ define(['app/app'], function (app) {
           //验证用户新输入的邮箱是否可用
           $scope.checkSuccess1 = false;
           $scope.checkFailed1 = false;
+          $scope.checkFailed1_1 = false;
           $scope.emailEnable = function (newUserEmail) {
+            //邮箱不可用
             if ((newUserEmail == null || newUserEmail.length > 30)
-                && !/^(\w)+(\.\w+)*@(\w)+((\.\w{2,3}){1,3})$/.test(
+                || !/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/.test(
                     newUserEmail)) {
               $scope.checkSuccess1 = false;
               $scope.checkFailed1 = true;
               $scope.sendSuccess = false;
+              $scope.checkFailed1_1 = false;
+              return;
             }
             User.emailEnable({email: newUserEmail}, function (data) {
               if (data.data == "true") {//邮箱可用
                 $scope.checkSuccess1 = true;
                 $scope.checkFailed1 = false;
                 $scope.sendSuccess = true;
+                $scope.checkFailed1_1 = false;
               } else {//邮箱不可用
                 $scope.checkSuccess1 = false;
-                $scope.checkFailed1 = true;
+                $scope.checkFailed1 = false;
                 $scope.sendSuccess = false;
+                $scope.checkFailed1_1 = true;
               }
             }, function () {
               $scope.checkSuccess1 = false;
               $scope.checkFailed1 = true;
               $scope.sendSuccess = false;
+              $scope.checkFailed1_1 = false;
             });
           };
 
@@ -664,16 +767,22 @@ define(['app/app'], function (app) {
             });
           };
 
-          $scope.validSuccess = false;
+          $scope.checkSuccess2 = false;
+          $scope.checkFailed2 = false;
           //校验验证码
           $scope.validCheckCode = function (checkCode) {
-            User.validCheckCode({checkCode: checkCode}, function (data) {
+            if(!checkCode){
+              return;
+            }
+            User.validCheckCode({checkCode: checkCode,newUserEmail:$scope.user.newUserEmail}, function (data) {
               var status = data.status;
               var message = data.message;
               if (status == 1) {
-                $scope.validSuccess = true;
+                $scope.checkSuccess2 = true;
+                $scope.checkFailed2 = false;
               } else {
-                toaster.pop('error', '错误', message);
+                $scope.checkSuccess2 = false;
+                $scope.checkFailed2 = true;
               }
             });
           };
@@ -686,9 +795,14 @@ define(['app/app'], function (app) {
             }
             User.updateUserEmail({
               userEmail: $scope.user.userEmail,
-              newUserEmail: $scope.user.newUserEmail
+              newUserEmail: $scope.user.newUserEmail,
+              checkCode:$scope.checkCode
             }, {}, function () {
               toaster.pop('success', '成功', '修改邮箱成功。');
+              //修改userInfo里面的userEmail
+              $scope.userInfo.userEmail =$scope.user.newUserEmail.substr(
+                  0, $scope.userInfo.userEmail.indexOf("@") - 2) + "***"
+                  + $scope.user.newUserEmail.substr($scope.userInfo.userEmail.indexOf("@"));
               $scope.user.userEmail = null;
               $scope.user.newUserEmail = null;
               $scope.checking = false;
@@ -702,7 +816,7 @@ define(['app/app'], function (app) {
               $modalInstance.close();
             }, function (response) {
               toaster.pop('error', '错误', response.data);
-              $modalInstance.close();
+              //$modalInstance.close();
             });
           };
 
@@ -739,12 +853,14 @@ define(['app/app'], function (app) {
           //新手机号是否可用
           $scope.sendSuccess = false;
           $scope.checkFailed1 = false;
+          $scope.checkFailed1_1 = false;
           $scope.checkSuccess1 = false;
           $scope.telEnable = function (newUserTel) {
             if (newUserTel == null || !/^[0-9]{8,11}$/.test(newUserTel)) {
               $scope.checkFailed1 = true;
               $scope.checkSuccess1 = false;
               $scope.sendSuccess = false;
+              $scope.checkFailed1_1 = false;
               return;
             }
             $scope.checking1 = true;
@@ -755,8 +871,9 @@ define(['app/app'], function (app) {
                 $scope.checkSuccess1 = true;
                 $scope.checkFailed1 = false;
                 $scope.sendSuccess = true;
+                $scope.checkFailed1_1 = false;
               } else {//手机不可用
-                $scope.checkFailed1 = true;
+                $scope.checkFailed1_1 = true;
                 $scope.checking1 = false;
                 $scope.checkSuccess1 = false;
                 $scope.sendSuccess = false;
@@ -765,6 +882,7 @@ define(['app/app'], function (app) {
               $scope.checkFailed1 = true;
               $scope.checking1 = false;
               $scope.checkSuccess1 = false;
+              $scope.checkFailed1_1 = false;
             });
           };
 
@@ -795,20 +913,23 @@ define(['app/app'], function (app) {
             });
           };
 
-          $scope.validSuccess = false;
-          $scope.validFailed = false;
+          $scope.checkSuccess2 = false;
+          $scope.checkFailed2 = false;
           //校验验证码
           $scope.validTelCheckCode = function (telCheckCode) {
-            User.validTelCheckCode({telCheckCode: telCheckCode},
+            if(!telCheckCode){
+              return;
+            }
+            User.validTelCheckCode({telCheckCode: telCheckCode,newUserTel:$scope.user.newUserTel},
                 function (data) {
                   var status = data.status;
                   var message = data.message;
                   if (status == 1) {
-                    $scope.validSuccess = true;
-                    $scope.validFailed = false;
+                    $scope.checkSuccess2 = true;
+                    $scope.checkFailed2 = false;
                   } else {
-                    $scope.validSuccess = false;
-                    $scope.validFailed = true;
+                    $scope.checkSuccess2 = false;
+                    $scope.checkFailed2 = true;
                   }
                 });
           };
@@ -821,9 +942,12 @@ define(['app/app'], function (app) {
             }
             User.updateUserTel({
               newUserTel: $scope.user.newUserTel,
-              userTel: $scope.user.userTel
+              userTel: $scope.user.userTel,
+              telCheckCode:$scope.telCheckCode
             }, {}, function () {
               toaster.pop('success', '成功', '手机修改成功。');
+              $scope.userInfo.userTel = $scope.user.userTel.substr(0, 3)
+                  + '****' + $scope.user.userTel.substr(7);
               $scope.user.userTel = null;
               $scope.user.newUserTel = null;
               $scope.checking = false;
@@ -838,7 +962,7 @@ define(['app/app'], function (app) {
               $modalInstance.close();
             }, function (response) {
               toaster.pop('error', '错误', response.data);
-              $modalInstance.close();
+              //$modalInstance.close();
             });
           };
 
@@ -852,7 +976,85 @@ define(['app/app'], function (app) {
       ['$scope', '$modalInstance', 'user', 'User', 'toaster',
         function ($scope, $modalInstance, user, User, toaster) {
           //原密码框是否显示
+          $scope.user = angular.copy(user);
           $scope.checking = true;
+          $scope.showNewUserPay = false;
+          $scope.showUserPay = false;
+          $scope.showNewUserPay1 = false;
+          $scope.reloadKeyboard = function (type, $event) {
+            $event.stopPropagation();
+            if (type === 'showNewUserPay') {
+              $scope.showNewUserPay = !$scope.showNewUserPay;
+              if (!$scope.showNewUserPay) {
+                $scope.checkNewUserPay($scope.user.newUserPay);
+              } else {
+                $scope.closeOtherKeyboard('showNewUserPay');
+              }
+            } else if (type === 'showUserPay') {
+              $scope.showUserPay = !$scope.showUserPay;
+              if (!$scope.showUserPay) {
+                $scope.checkUserPay($scope.user.userPay);
+              } else {
+                $scope.closeOtherKeyboard('showUserPay');
+              }
+            } else if (type === 'showNewUserPay1') {
+              $scope.showNewUserPay1 = !$scope.showNewUserPay1;
+              if (!$scope.showNewUserPay1) {
+                $scope.checkNewUserPay1($scope.user.newUserPay1);
+              } else {
+                $scope.closeOtherKeyboard('showNewUserPay1');
+              }
+            }
+          }
+
+          function resetNewUserPay() {
+            $scope.showNewUserPay = false;
+            $scope.checkNewUserPay($scope.user.newUserPay);
+          }
+
+          function resetUserPay() {
+            $scope.showUserPay = false;
+            $scope.checkUserPay($scope.user.userPay);
+          }
+
+          function resetNewUserPay1() {
+            $scope.showNewUserPay1 = false;
+            $scope.checkNewUserPay1($scope.user.newUserPay1);
+          }
+
+          $scope.closeOtherKeyboard = function (type) {
+            if (type == 'showNewUserPay') {
+              if ($scope.showUserPay) {
+                resetUserPay();
+              } else if ($scope.showNewUserPay1) {
+                resetNewUserPay1();
+              }
+            } else if (type == 'showUserPay') {
+              if ($scope.showNewUserPay) {
+                resetNewUserPay();
+              } else if ($scope.showNewUserPay1) {
+                resetNewUserPay1();
+              }
+            } else if (type == 'showNewUserPay1') {
+              if ($scope.showNewUserPay) {
+                resetNewUserPay();
+              } else if ($scope.showUserPay) {
+                resetUserPay();
+              }
+            }
+          }
+          $scope.closeKeyboard = function () {
+            if ($scope.showNewUserPay) {
+              $scope.showNewUserPay = false;
+              $scope.checkNewUserPay($scope.user.newUserPay);
+            } else if ($scope.showUserPay) {
+              $scope.showUserPay = false;
+              $scope.checkUserPay($scope.user.userPay);
+            } else if ($scope.showNewUserPay1) {
+              $scope.showNewUserPay1 = false;
+              $scope.checkNewUserPay1($scope.user.newUserPay1);
+            }
+          }
           //验证是否设置密码
           $scope.checkHaveUserPay = function () {
             $scope.userPayHidden = false;
@@ -916,14 +1118,17 @@ define(['app/app'], function (app) {
           $scope.checkSuccess2 = false;
           $scope.checkFailed2 = false;
           $scope.checkNewUserPay1 = function () {
-            if ($scope.checkSuccess1 == true && ($scope.user.newUserPay
-                    == $scope.user.newUserPay1)) {
-              $scope.checkSuccess2 = true;
-              $scope.checkFailed2 = false;
-              return;
+            if ($scope.user.newUserPay1 != null) {
+              //如果输入密码正确,并且输入密码=重新输入密码
+              if ($scope.checkSuccess1 && ($scope.user.newUserPay
+                      == $scope.user.newUserPay1)) {
+                $scope.checkSuccess2 = true;
+                $scope.checkFailed2 = false;
+                return;
+              }
+              $scope.checkSuccess2 = false;
+              $scope.checkFailed2 = true;
             }
-            $scope.checkSuccess2 = false;
-            $scope.checkFailed2 = true;
           }
 
           //支付密码
@@ -964,16 +1169,15 @@ define(['app/app'], function (app) {
       ['$scope', '$modalInstance', 'user', 'User', 'toaster',
         function ($scope, $modalInstance, user, User, toaster) {
           //查询所有的密保问题
-          $scope.pageInfo = {page: 1, size: 100};
-          User.getAllSecQuestion({pageInfo: $scope.pageInfo}, {},
-              function (data) {
-                $scope.secQuestions = data.content;
-                //查询当前用户密保问题
-                User.getUserQuestion(function (data) {
-                  $scope.uq[0] = data[0];
-                  $scope.uq[1] = data[1];
-                });
-              });
+          $scope.pageInfo = {page: 1, count: 20};
+          User.getAllSecQuestion($scope.pageInfo, function (data) {
+            $scope.secQuestions = data.content;
+            //查询当前用户密保问题
+            User.getUserQuestion(function (data) {
+              $scope.uq[0] = data[0];
+              $scope.uq[1] = data[1];
+            });
+          });
           //选择问题 校验
           $scope.checkSuccess = false;
           $scope.checkFailed = false;
@@ -1049,6 +1253,30 @@ define(['app/app'], function (app) {
               $scope.uq[key].sort = Number(key) + 1;
               arr[key] = $scope.uq[key];
             }
+            if(!arr[0].question){
+              $scope.checkFailed = true;
+              return;
+            }
+            if(!arr[0].answer){
+              $scope.checkFailed1 = true;
+              return;
+            }
+            if((arr[0].answer).length>30){
+              $scope.checkFailed1_1 = true;
+              return;
+            }
+            if(!arr[1].question){
+              $scope.checkFailed2 = true;
+              return;
+            }
+            if(!arr[1].answer){
+              $scope.checkFailed3 = true;
+              return;
+            }
+            if((arr[1].answer).length>30){
+              $scope.checkFailed3_1 = true;
+              return;
+            }
             User.updateUserQuestion({}, arr, function () {
               toaster.pop('success', '成功', '密保问题设置成功。');
               $modalInstance.close();
@@ -1131,13 +1359,26 @@ define(['app/app'], function (app) {
             $scope.checkSuccess2 = true;
           };
 
+          $scope.deleteImg =function () {
+            $scope.user.idImgUrl = '';
+            $scope.checkSuccess2=false;
+          };
+
+          // 查看范例
+          $scope.showImg = function(imgUrl) {
+            var src = imgUrl, box = $('#image-box'), modal = $('.modal-content');
+            box.show();
+            box.find('img').attr('src', src);
+            box.find('a').click(function(){
+              box.hide();
+            });
+            box.dblclick(function(){
+              box.hide();
+            });
+          };
           //保存
           $scope.ok = function () {
-            User.updateRealAuth({
-              userName: $scope.user.userName,
-              userIdcode: $scope.user.userIdcode,
-              idImgUrl: $scope.user.idImgUrl
-            }, {}, function () {
+            User.updateRealAuth({userName:$scope.user.userName,userIdcode:$scope.user.userIdcode,idImgUrl:$scope.user.idImgUrl},{},function(){
               toaster.pop('success', '成功', '身份信息提交成功。');
               $modalInstance.close();
               $scope.checkSuccess2 = false;
@@ -1146,7 +1387,7 @@ define(['app/app'], function (app) {
               $scope.checkSuccess = false;
               $scope.checkFailed = false;
               location.reload();
-            }, function (response) {
+            }, function(response){
               toaster.pop('error', '错误', response.data);
               $modalInstance.close();
             });

+ 2 - 2
src/main/webapp/resources/view/usercenter/forstore/account_manager.html

@@ -228,7 +228,7 @@
 				<span>
 					<h5><img class="ok-icon" src="static/img/user/images/ok-account.png"/></h5>
 					<font>手机验证:</font>
-					<span>您绑定的手机:{{userInfo.userTel}}。若已丢失或停用,请立即更换,避免账户被盗。</span>
+					<span>您绑定的手机:<i ng-modal="userInfo.userTel" style="color:#666;">{{userInfo.userTel}}</i>。若已丢失或停用,请立即更换,避免账户被盗。</span>
 				</span>
 				<a ng-click="updateUserTel()">修改</a>
 			</li>
@@ -237,7 +237,7 @@
 					<h5 ng-show="userInfo.userEmail==null?false:true"><img class="ok-icon" src="static/img/user/images/ok-account.png"/></h5>
 					<h5 ng-hide="userInfo.userEmail==null?false:true"><img src="static/img/user/images/safe.png"/></h5>
 					<font>邮箱认证:</font>
-					<span ng-show="userInfo.userEmail==null?false:true">{{userInfo.userEmail}}</span>
+					<span ng-show="userInfo.userEmail==null?false:true"><i ng-modal="userInfo.userEmail" style="color:#666;">{{userInfo.userEmail}}</i></span>
 					<span ng-hide="userInfo.userEmail==null?false:true">绑定邮箱可帮助您找回登录密码,并可订阅获取最新的订单动态、促销信息。</span>
 				</span>
 				<a ng-show="userInfo.userEmail==null?false:true" ng-click="updateUserEmail()">修改</a>

+ 1 - 0
src/main/webapp/resources/view/vendor/modal/updatePassword.html

@@ -25,6 +25,7 @@
 	}
 	.password .modal-body .row >label {
 		padding: 0;
+		margin-bottom: 5px;
 	}
 	.password .modal-body .row .col-md-8 {
 		padding-left: 0;

+ 9 - 3
src/main/webapp/resources/view/vendor/modal/updateUserEmail.html

@@ -121,18 +121,24 @@
             </div>
         </div>
         <div class="warn-style"  ng-show="checkFailed1">请输入正确的邮箱</div>
+        <div class="warn-style"  ng-show="checkFailed1_1">已注册的邮箱</div>
         <div class="row validate-code">
             <label class="col-md-3 col-sm-3 col text-right">验证码:</label>
             <div class="col-md-8 col-sm-8 col">
                 <input ng-model="checkCode"
-                       class="form-control input-sm" ng-disabled="!codeSuccess" type="checkCode" ng-blur="validCheckCode(checkCode)" required>
+                       class="form-control input-sm"  type="checkCode" ng-blur="validCheckCode(checkCode)" required>
                 <input ng-click="sendCheckCode(user.newUserEmail)" ng-disabled="!sendSuccess" ng-init="paracont='获取验证码'" class="code-btn" ng-model="paracont"/>
             </div>
+            <div class="col">
+                <img ng-show="checkSuccess2" src="static/img/user/images/input-check-yes.png" alt="">
+                <!--<i ng-show="checkSuccess1" class="fa fa-check" style="color:#339933"></i>-->
+                <!--<i ng-show="checkFailed1" class="fa fa-close" style="color:#cc3333;"></i>-->
+            </div>
         </div>
-        <div class="warn-style" ng-show="codeFailed">验证码错误</div>
+        <div class="warn-style" ng-show="checkFailed2">验证码错误</div>
     </div>
     <div class="modal-footer">
         <button ng-click="cancel()" type="button">取消</button>
-        <button ng-disabled="!validSuccess || !checkSuccess || !checkSuccess1" type="submit">确定</button>
+        <button ng-disabled="!checkSuccess2 || !checkSuccess || !checkSuccess1" type="submit">确定</button>
     </div>
 </form>

+ 4 - 4
src/main/webapp/resources/view/vendor/modal/updateUserQuestion.html

@@ -74,7 +74,7 @@
 </div>
 <form class="userQuestion" name="sampleSendForm" ng-submit="ok()">
     <div class="modal-body">
-        <div class="row line">
+        <div class="row line" ng-class="{ 'has-error': checkFailed}">
             <input type="hidden" name="sort" ng-model="uq[0].sort" ng-init="uq[0].sort=1"/>
             <label class="col-md-3 col-sm-3 col text-right">问题1:</label>
             <div class="col-md-8 col-sm-8 col">
@@ -82,7 +82,7 @@
                 <!--
                 <input ng-model="uq[0].question" class="form-control input-sm" name="uq[0].question" required>
                 -->
-                <select class="form-control" ng-blur="choose()"  style="opacity: unset;"  ng-model="uq[0].question">
+                <select class="form-control" style="opacity: unset;"  ng-blur="choose()"   ng-model="uq[0].question">
                     <option value="">请选择一个问题</option>
                     <option value="{{info.question}}" ng-repeat="info in secQuestions" ng-if="info.type==1">{{info.question}}</option>
                 </select>
@@ -107,7 +107,7 @@
         </div>
         <div class="warn-style" ng-show="checkFailed1">请输入您想要设置的答案</div>
         <div class="warn-style" ng-show="checkFailed1_1">请勿超过30个字符</div>
-        <div class="row">
+        <div class="row" ng-class="{'has-error': checkFailed2}">
             <input type="hidden" name="sort" ng-model="uq[1].sort" ng-init="uq[1].sort=2"/>
             <label class="col-md-3 col-sm-3 col text-right">问题2:</label>
             <div class="col-md-8 col-sm-8 col">
@@ -143,6 +143,6 @@
     </div>
     <div class="modal-footer">
         <button ng-click="cancel()" type="button">取消</button>
-        <button ng-disabled="!checkSuccess || !checkSuccess1 || !checkSuccess2 || !checkSuccess3" type="submit">确定</button>
+        <button type="submit">确定</button>
     </div>
 </form>

+ 9 - 8
src/main/webapp/resources/view/vendor/modal/updateUserTel.html

@@ -120,23 +120,24 @@
             </div>
         </div>
         <div class="warn-style" ng-show="checkFailed1">请输入正确的手机号</div>
+        <div class="warn-style" ng-show="checkFailed1_1">该手机号已存在</div>
         <div class="row validate-code">
             <label class="col-md-3 col-sm-3 col text-right">验证码:</label>
             <span class="col-md-8 col-sm-8 col">
                 <input ng-model="telCheckCode"
-                       class="form-control input-sm" ng-disabled="!codeSuccess" type="telCheckCode" ng-blur="validTelCheckCode(telCheckCode)" required>
+                       class="form-control input-sm" placeholder="请输入验证码"  type="telCheckCode" ng-blur="validTelCheckCode(telCheckCode)" required>
                 <input class="code-btn" ng-click="sendTelCheckCode(user.newUserTel)" ng-init="paracont='获取验证码'" ng-disabled="!sendSuccess" ng-model="paracont" />
             </span>
+            <div class="col">
+                <img ng-show="checkSuccess2" src="static/img/user/images/input-check-yes.png" alt="">
+                <!--<i ng-show="checkSuccess1" class="fa fa-check" style="color:#339933"></i>-->
+                <!--<i ng-show="checkFailed1" class="fa fa-close" style="color:#CC3333;"></i>-->
+            </div>
         </div>
+        <div class="warn-style" ng-show="checkFailed2">验证码错误</div>
     </div>
-    <div class="col">
-        <img ng-show="vaildSuccess" src="static/img/user/images/input-check-yes.png" alt="">
-        <!--<i ng-show="checkSuccess1" class="fa fa-check" style="color:#339933"></i>-->
-        <!--<i ng-show="checkFailed1" class="fa fa-close" style="color:#CC3333;"></i>-->
-    </div>
-    <div class="warn-style" ng-show="validFailed">验证码错误</div>
     <div class="modal-footer">
         <button ng-click="cancel()" type="button">取消</button>
-        <button ng-disabled="!validSuccess || !checkSuccess || !checkSuccess1" type="submit">确定</button>
+        <button ng-disabled="!checkSuccess2 || !checkSuccess || !checkSuccess1" type="submit">确定</button>
     </div>
 </form>

Some files were not shown because too many files changed in this diff