Selaa lähdekoodia

做题报错处理

En route 1 vuosi sitten
vanhempi
commit
e85c5a03e8

+ 1 - 2
pages2/bank/questionBank.vue

@@ -1170,7 +1170,7 @@
 				console.log("datas:", datas);
 				datas.forEach((item, index) => {
 					// if (typeof item.jsonStr == 'string') {
-					item.jsonStr = JSON.parse(item.jsonStr);
+					item.jsonStr = JSON.parse(item.jsonStr) || [];
 
 					if (item.type == 2) {
 						//多选
@@ -1220,7 +1220,6 @@
 						item.ques = [];
 						item.current = 0;
 						let ansArr = [];
-						item.jsonStr = item.jsonStr || []
 						item.jsonStr.forEach((json, index) => {
 							if (json.type == 1) {
 								ansArr[index] = json.answerQuestion;

+ 1 - 1
pages2/bank/questionBankExplain.vue

@@ -519,7 +519,7 @@ export default {
     analyseData(datas = []) {
       datas.forEach((item, index) => {
             if (typeof item.jsonStr == "string") {
-              item.jsonStr = JSON.parse(item.jsonStr);
+              item.jsonStr = JSON.parse(item.jsonStr) || [];
 
               if (item.type == 2) {
                 //多选

+ 3 - 3
pages2/bank/questionBankExplainDetail.vue

@@ -851,7 +851,7 @@ export default {
         .then((res) => {
           res.data.rows.forEach((item, index) => {
             if (typeof item.jsonStr == "string") {
-              item.jsonStr = JSON.parse(item.jsonStr);
+              item.jsonStr = JSON.parse(item.jsonStr) || [];
 
               if (item.type == 2) {
                 //多选
@@ -945,7 +945,7 @@ export default {
         .then((res) => {
           res.data.rows.forEach((item, index) => {
             if (typeof item.jsonStr == "string") {
-              item.jsonStr = JSON.parse(item.jsonStr);
+              item.jsonStr = JSON.parse(item.jsonStr) || [];
 
               if (item.type == 2) {
                 //多选
@@ -1086,7 +1086,7 @@ export default {
           .then((res) => {
             res.data.data.forEach((item, index) => {
               if (typeof item.jsonStr == "string") {
-                item.jsonStr = JSON.parse(item.jsonStr);
+                item.jsonStr = JSON.parse(item.jsonStr) || [];
 
                 if (item.type == 2) {
                   //多选

+ 1 - 1
pages2/bank/questionBankTest.vue

@@ -786,7 +786,7 @@ export default {
         .then((res) => {
           res.data.data.forEach((item, index) => {
             // if(typeof item.jsonStr == 'string') {
-            item.jsonStr = JSON.parse(item.jsonStr);
+            item.jsonStr = JSON.parse(item.jsonStr) || [];
 
             if (item.type == 2) {
               //多选

+ 1 - 1
pages2/class/questionBank.vue

@@ -1556,7 +1556,7 @@
 					}
 					data.forEach((item, index) => {
 						if (typeof item.jsonStr == "string") {
-							item.jsonStr = JSON.parse(item.jsonStr);
+							item.jsonStr = JSON.parse(item.jsonStr) || [];
 
 							if (item.type == 2) {
 								//多选

+ 1 - 1
pages2/subject/collectBank.vue

@@ -789,7 +789,7 @@ export default {
     analysteData(rows) {
       rows.forEach((item, index) => {
             if (typeof item.jsonStr == "string") {
-              item.jsonStr = JSON.parse(item.jsonStr);
+              item.jsonStr = JSON.parse(item.jsonStr) || [];
 
               if (item.type == 2) {
                 //多选

+ 1 - 1
pages2/subject/collectTypeBank.vue

@@ -740,7 +740,7 @@ export default {
         .then((res) => {
           res.data.rows.forEach((item, index) => {
             if (typeof item.jsonStr == "string") {
-              item.jsonStr = JSON.parse(item.jsonStr);
+              item.jsonStr = JSON.parse(item.jsonStr) || [];
 
               if (item.type == 2) {
                 //多选

+ 2 - 2
pages2/subject/wrongBank.vue

@@ -758,7 +758,7 @@ export default {
         .then((res) => {
           res.data.rows.forEach((item, index) => {
             if (typeof item.jsonStr == "string") {
-              item.jsonStr = JSON.parse(item.jsonStr);
+              item.jsonStr = JSON.parse(item.jsonStr) || [];
 
               if (item.type == 2) {
                 //多选
@@ -885,7 +885,7 @@ export default {
         .then((res) => {
           res.data.rows.forEach((item, index) => {
             if (typeof item.jsonStr == "string") {
-              item.jsonStr = JSON.parse(item.jsonStr);
+              item.jsonStr = JSON.parse(item.jsonStr) || [];
 
               if (item.type == 2) {
                 //多选

+ 1 - 1
pages2/subject/wrongTypeBank.vue

@@ -739,7 +739,7 @@ export default {
         .then((res) => {
           res.data.rows.forEach((item, index) => {
             if (typeof item.jsonStr == "string") {
-              item.jsonStr = JSON.parse(item.jsonStr);
+              item.jsonStr = JSON.parse(item.jsonStr) || [];
 
               if (item.type == 2) {
                 //多选

+ 1 - 1
pages5/examBank/index.vue

@@ -1087,7 +1087,7 @@
 
 					data.forEach((item, index) => {
 						// if (typeof item.jsonStr == 'string') {
-						item.jsonStr = JSON.parse(item.jsonStr);
+						item.jsonStr = JSON.parse(item.jsonStr) || [];
 
 						if (item.type == 2) {
 							//多选