chenxiong 3 anni fa
parent
commit
a3d88fc9ec
1 ha cambiato i file con 16 aggiunte e 12 eliminazioni
  1. 16 12
      pages2/class/questionBank.vue

+ 16 - 12
pages2/class/questionBank.vue

@@ -519,7 +519,7 @@ export default {
 			needPhoto:false //是否需要拍照
 		};
 	},
-	onLoad(option) {
+	async onLoad(option) {
 		this.id = option.id;
 		this.goodsId = option.goodsid;
 		this.chapterId = option.chapterId;
@@ -571,9 +571,9 @@ export default {
 				}
 			}
 		} else {
+			await this.getGoodsDetail()
 			this.goodsQuestionList();
 			this.bankExam();
-			this.getGoodsDetail()
 		}
 	},
 	onUnload() {
@@ -597,17 +597,21 @@ export default {
 	},
 	methods: {
 		getGoodsDetail() {
-			let self = this
-			this.$api.goodsDetail(this.goodsId).then(res => {
-				self.goodsDetail = res.data.data;
-				if (self.goodsDetail.goodsPhotoExamConfig) {
-					let goodsPhotoExamConfig = JSON.parse(self.goodsDetail.goodsPhotoExamConfig);
-					if (goodsPhotoExamConfig.photograph > 0) {
-						self.needPhoto = true;
-					}
-				}
+			return new Promise((resolve) => {
 				
-			});
+				let self = this
+				this.$api.goodsDetail(this.goodsId).then(res => {
+					self.goodsDetail = res.data.data;
+					if (self.goodsDetail.goodsPhotoExamConfig) {
+						let goodsPhotoExamConfig = JSON.parse(self.goodsDetail.goodsPhotoExamConfig);
+						if (goodsPhotoExamConfig.photograph > 0) {
+							self.needPhoto = true;
+						}
+					}
+					
+					resolve()
+				});
+			})
 		},
 		postStudyRecord() {
 			let self = this