Browse Source

增加个返回弹窗

chenxiong 3 years ago
parent
commit
d821c677be
1 changed files with 41 additions and 2 deletions
  1. 41 2
      pages2/bank/questionBank.vue

+ 41 - 2
pages2/bank/questionBank.vue

@@ -345,7 +345,8 @@ export default {
 			isSubmit:false,
 			lastTime:0,
 			timer :null,
-			wrongList:[]
+			wrongList:[],
+			bankType:0
 		};
 	},
 	onLoad(option){
@@ -362,7 +363,45 @@ export default {
 	methods: {
 		bankExam() {
 			this.$api.bankExam(this.id).then(res => {
-				console.log(res)
+				this.bankType = res.data.data.doType;
+				console.log(res.data)
+				if(this.bankType == 1) { // 练习
+					wx.enableAlertBeforeUnload({
+					
+						message: "返回上页时弹出对话框1212",
+						
+						success: function (res) {
+						
+						console.log("方法注册成功:", res)
+						
+						},
+						
+						fail: function (errMsg) {
+						
+						console.log("方法注册失败:", errMsg);
+						
+						},
+					
+					});
+				} else if(this.bankType == 2){  //考试
+					wx.enableAlertBeforeUnload({
+					
+						message: "返回上页时弹出对话框1212",
+						
+						success: function (res) {
+						
+						console.log("方法注册成功:", res)
+						
+						},
+						
+						fail: function (errMsg) {
+						
+						console.log("方法注册失败:", errMsg);
+						
+						},
+					
+					});
+				}
 			})
 		},
 		/**