Просмотр исходного кода

买卖中心 安全设置 密保问题校验修改

529010777@qq.com 8 лет назад
Родитель
Сommit
9c7e4b0d7a

+ 16 - 32
src/main/webapp/resources/js/usercenter/controllers/forstore/account_manager_ctrl.js

@@ -1359,7 +1359,7 @@ define(['app/app'], function (app) {
           $scope.checkSuccess2 = false;
           $scope.checkFailed2 = false;
           $scope.choose = function () {
-            if ($scope.uq[0].question != "") {
+            if ($scope.uq[0]!=undefined && $scope.uq[0].question != undefined && $scope.uq[0].question!="") {
               $scope.checkSuccess = true;
               $scope.checkFailed = false;
             } else {
@@ -1369,7 +1369,7 @@ define(['app/app'], function (app) {
           }
 
           $scope.choose1 = function () {
-            if ($scope.uq[1].question != "") {
+            if ($scope.uq[1]!=undefined && $scope.uq[1].question != undefined && $scope.uq[1].question!="") {
               $scope.checkSuccess2 = true;
               $scope.checkFailed2 = false;
             } else {
@@ -1386,17 +1386,17 @@ define(['app/app'], function (app) {
           $scope.checkFailed3 = false;
           $scope.checkFailed3_1 = false;
           $scope.inputAnswer = function () {
-            if ($scope.uq[0].answer == null) {
+            if ($scope.uq[0]==undefined || $scope.uq[0].answer == undefined || $scope.uq[0].answer=="") {
               $scope.checkSuccess1 = false;
               $scope.checkFailed1 = true;
               $scope.checkFailed1_1 = false;
-              return;
+              return false;
             }
             if ($scope.uq[0].answer.length > 30) {
               $scope.checkSuccess1 = false;
               $scope.checkFailed1 = false;
               $scope.checkFailed1_1 = true;
-              return;
+              return false;
             }
             $scope.checkSuccess1 = true;
             $scope.checkFailed1 = false;
@@ -1404,17 +1404,17 @@ define(['app/app'], function (app) {
           }
 
           $scope.inputAnswer1 = function () {
-            if ($scope.uq[1].answer == null) {
+            if ($scope.uq[1]==undefined || $scope.uq[1].answer == undefined || $scope.uq[1].answer=="") {
               $scope.checkSuccess3 = false;
               $scope.checkFailed3 = true;
               $scope.checkFailed3_1 = false;
-              return;
+              return false;
             }
             if ($scope.uq[1].answer.length > 30) {
               $scope.checkSuccess3 = false;
               $scope.checkFailed3 = false;
               $scope.checkFailed3_1 = true;
-              return;
+              return false;
             }
             $scope.checkSuccess3 = true;
             $scope.checkFailed3 = false;
@@ -1423,35 +1423,19 @@ define(['app/app'], function (app) {
 
           //保存密保
           $scope.ok = function () {
+            //问题1校验
+            $scope.choose();
+            $scope.inputAnswer();
+            $scope.choose1();
+            $scope.inputAnswer1();
+            if(!$scope.checkSuccess || !$scope.checkSuccess1 || !$scope.checkSuccess2 || !$scope.checkSuccess3){
+              return;
+            }
             var arr = [];
             for (var key in $scope.uq) {
               $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();

+ 16 - 32
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_account_management_ctrl.js

@@ -1281,7 +1281,7 @@ define(['app/app'], function(app) {
           $scope.checkSuccess2 = false;
           $scope.checkFailed2 = false;
           $scope.choose = function () {
-            if ($scope.uq[0].question != "") {
+            if ($scope.uq[0]!=undefined && $scope.uq[0].question != undefined && $scope.uq[0].question!="") {
               $scope.checkSuccess = true;
               $scope.checkFailed = false;
             } else {
@@ -1291,7 +1291,7 @@ define(['app/app'], function(app) {
           }
 
           $scope.choose1 = function () {
-            if ($scope.uq[1].question != "") {
+            if ($scope.uq[1]!=undefined && $scope.uq[1].question != undefined && $scope.uq[1].question!="") {
               $scope.checkSuccess2 = true;
               $scope.checkFailed2 = false;
             } else {
@@ -1308,17 +1308,17 @@ define(['app/app'], function(app) {
           $scope.checkFailed3 = false;
           $scope.checkFailed3_1 = false;
           $scope.inputAnswer = function () {
-            if ($scope.uq[0].answer == null) {
+            if ($scope.uq[0]==undefined || $scope.uq[0].answer == undefined || $scope.uq[0].answer=="") {
               $scope.checkSuccess1 = false;
               $scope.checkFailed1 = true;
               $scope.checkFailed1_1 = false;
-              return;
+              return false;
             }
             if ($scope.uq[0].answer.length > 30) {
               $scope.checkSuccess1 = false;
               $scope.checkFailed1 = false;
               $scope.checkFailed1_1 = true;
-              return;
+              return false;
             }
             $scope.checkSuccess1 = true;
             $scope.checkFailed1 = false;
@@ -1326,17 +1326,17 @@ define(['app/app'], function(app) {
           }
 
           $scope.inputAnswer1 = function () {
-            if ($scope.uq[1].answer == null) {
+            if ($scope.uq[1]==undefined || $scope.uq[1].answer == undefined || $scope.uq[1].answer=="") {
               $scope.checkSuccess3 = false;
               $scope.checkFailed3 = true;
               $scope.checkFailed3_1 = false;
-              return;
+              return false;
             }
             if ($scope.uq[1].answer.length > 30) {
               $scope.checkSuccess3 = false;
               $scope.checkFailed3 = false;
               $scope.checkFailed3_1 = true;
-              return;
+              return false;
             }
             $scope.checkSuccess3 = true;
             $scope.checkFailed3 = false;
@@ -1345,35 +1345,19 @@ define(['app/app'], function(app) {
 
           //保存密保
           $scope.ok = function () {
+            //问题1校验
+            $scope.choose();
+            $scope.inputAnswer();
+            $scope.choose1();
+            $scope.inputAnswer1();
+            if(!$scope.checkSuccess || !$scope.checkSuccess1 || !$scope.checkSuccess2 || !$scope.checkSuccess3){
+              return;
+            }
             var arr = [];
             for (var key in $scope.uq) {
               $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();