浏览代码

手机端添加记住题的索引,修复记住登录状态的bug

sunkuosheng 3 年之前
父节点
当前提交
0039ffadaa

+ 37 - 28
pages/index/index.vue

@@ -316,35 +316,44 @@
 				// 	})
 				// } else
 				console.log(uni.getStorageSync("token"), 'uni.getStorageSync("token")')
-				if (uni.getStorageSync("token")) {
-					let resd = uni.getStorageSync("examFlg") == 1 && uni.getStorageSync("examData").id == uni
-						.getStorageSync("oldExamId") && uni.getStorageSync("user").loginName == uni.getStorageSync(
-							"oldLoginName") && uni.getStorageSync("paper")
-					if (this.isPaper || resd) {
-						uni.showModal({
-							title: '提醒',
-							content: '还有未答完的试卷!',
-							showCancel: false,
-							success: function(res) {
-								if (res.confirm) {
-									uni.navigateTo({
-										url: '/pages/test/test?paper=true'
-									});
-									// alert('用户点击确认');
-								} else if (res.cancel) {
-									// alert('用户点击取消');
-								}
-
-							}
-						})
-					} else {
-						let res = uni.getStorageSync("user");
-						let parmar = await this.getExam(uni.getStorageSync("examData").id, res.loginName, res
-							.password);
-						uni.navigateTo({
-							url: '/pages/test/test'
-						});
+				if (uni.getStorageSync("user")) {
+					let res = uni.getStorageSync("user");
+					let exam=uni.getStorageSync("examData")
+					//考试类型不一样需要登录
+					if(exam.examType!=uni.getStorageSync("oldExamType"))
+					{
+						this.$refs.popup.open();
+					}else{
+						this.phoneLogin({...res,examId:exam.id});
 					}
+					// let resd = uni.getStorageSync("examFlg") == 1 && uni.getStorageSync("examData").id == uni
+					// 	.getStorageSync("oldExamId") && uni.getStorageSync("user").loginName == uni.getStorageSync(
+					// 		"oldLoginName") && uni.getStorageSync("paper")
+					// if (this.isPaper || resd) {
+					// 	uni.showModal({
+					// 		title: '提醒',
+					// 		content: '还有未答完的试卷!',
+					// 		showCancel: false,
+					// 		success: function(res) {
+					// 			if (res.confirm) {
+					// 				uni.navigateTo({
+					// 					url: '/pages/test/test?paper=true'
+					// 				});
+					// 				// alert('用户点击确认');
+					// 			} else if (res.cancel) {
+					// 				// alert('用户点击取消');
+					// 			}
+
+					// 		}
+					// 	})
+					// } else {
+					// 	let res = uni.getStorageSync("user");
+					// 	let parmar = await this.getExam(uni.getStorageSync("examData").id, res.loginName, res
+					// 		.password);
+					// 	uni.navigateTo({
+					// 		url: '/pages/test/test'
+					// 	});
+					// }
 				} else {
 					this.$refs.popup.open();
 				}

+ 9 - 1
pages/test/test.vue

@@ -228,12 +228,19 @@
 			let paperData = uni.getStorageSync("paper");
 			this.studentTestPaperId = paperData.id;
 			this.changePaperData(paperData.paper.testQuestionsList);
+			//存在未答试卷
 			if (option.paper) {
 				let parmar = uni.getStorageSync("testData");
-				this.compareTest(parmar)
+				this.compareTest(parmar);
+				let seIndex=uni.getStorageSync("serialIndex");
+				if(seIndex)
+				{
+					this.serialIndex=seIndex;
+				}
 				
 			}
 			uni.setStorageSync("oldExamId",data.id);
+			uni.setStorageSync("oldExamType",data.examType);
 			uni.setStorageSync("oldLoginName",res.loginName);
 			uni.setStorageSync("examFlg",1);
 			// console.log(data.id,'data');
@@ -616,6 +623,7 @@
 			},
 			saveTest() {
 				uni.setStorageSync("testData", this.testList);
+				uni.setStorageSync("serialIndex", this.serialIndex);
 			}
 		}
 	}

文件差异内容过多而无法显示
+ 1 - 1
unpackage/dist/build/h5/index.html


文件差异内容过多而无法显示
+ 1 - 1
unpackage/dist/build/h5/static/js/chunk-vendors.75b18069.js


文件差异内容过多而无法显示
+ 1 - 1
unpackage/dist/build/h5/static/js/index.30cd9e60.js


文件差异内容过多而无法显示
+ 0 - 1
unpackage/dist/build/h5/static/js/pages-index-index.74542cb4.js


文件差异内容过多而无法显示
+ 1 - 0
unpackage/dist/build/h5/static/js/pages-index-index.debdf2af.js


文件差异内容过多而无法显示
+ 1 - 0
unpackage/dist/build/h5/static/js/pages-index-index~pages-paper-paper~pages-performance-performance~pages-ranking-ranking~pages-test-test.728efe4f.js


文件差异内容过多而无法显示
+ 0 - 1
unpackage/dist/build/h5/static/js/pages-index-index~pages-paper-paper~pages-performance-performance~pages-ranking-ranking~pages-test-test.9473288d.js


文件差异内容过多而无法显示
+ 1 - 0
unpackage/dist/build/h5/static/js/pages-test-test.358418b6.js


文件差异内容过多而无法显示
+ 0 - 1
unpackage/dist/build/h5/static/js/pages-test-test.3691b221.js


+ 7 - 0
utils/api.js

@@ -68,6 +68,7 @@ export const myRequest = (url, data, method, header) => {
 					// 	icon: 'none',
 					// 	duration: 5000
 					// })
+					
 					uni.showModal({
 						title: '提示',
 						content: msg,
@@ -75,6 +76,12 @@ export const myRequest = (url, data, method, header) => {
 						success: function (res) {
 							if (res.confirm) {
 								console.log('用户点击确定');
+								if(url=='/auth/app/phoneLogin')
+								{
+									uni.setStorageSync("token", "");
+									uni.setStorageSync("user", "");
+									location.reload();
+								}
 							} else if (res.cancel) {
 								console.log('用户点击取消');
 							}