Quellcode durchsuchen

题库加锁定状态

xuqiaoying vor 2 Jahren
Ursprung
Commit
54fd2f4af5

+ 0 - 1
pages/index/index.vue

@@ -790,7 +790,6 @@ export default {
 		},
 		initDay() {
 			// d是当前星期一的日期对象
-			console.log('d是当前星期一的日期对象');
 			var d = this.getMonDate();
 			var arr = [];
 			let date = new Date();

+ 28 - 12
pages/questionBank/index.vue

@@ -144,18 +144,34 @@ export default {
 			})
 		},
 		toDailyPractice(item, child) {
-			console.log('item', item);
-			if (child.paperName == '每日一练') {
-				uni.navigateTo({
-					url: '/pages2/dailyPractice/index?goodsId=' + item.goodsId + '&orderGoodsId=' + item.orderGoodsId
-				})
-			} else if (child.paperName == '随机练习') {
-				uni.navigateTo({
-					url: '/pages2/randomPractice/index?goodsId=' + item.goodsId + '&orderGoodsId=' + item.orderGoodsId
-				})
-			} else {
-				this.studyques(item, child)
-			}
+			this.$api.lockLockStatus({
+			  action:'bank',
+			  uuid: this.$method.getUuid()
+			}).then(res => {
+			  if(res.data.code == 200) { //有其他端在操作,不能学习
+				  uni.showToast({
+					  icon: 'none',
+					  title: res.data.msg,
+					  duration: 3000,
+				  })
+			  } else if(res.data.code == 500) { //可以学习
+				  
+				if (child.paperName == '每日一练') {
+					uni.navigateTo({
+						url: '/pages2/dailyPractice/index?goodsId=' + item.goodsId + '&orderGoodsId=' + item.orderGoodsId
+					})
+				} else if (child.paperName == '随机练习') {
+					uni.navigateTo({
+						url: '/pages2/randomPractice/index?goodsId=' + item.goodsId + '&orderGoodsId=' + item.orderGoodsId
+					})
+				} else {
+					this.studyques(item, child)
+				}
+
+			  }
+			})
+			
+			
 		},
 		// 进入练习
 		studyques(item, child){

+ 3 - 1
pages2/bank/question_detail.vue

@@ -139,6 +139,7 @@ export default {
 	onUnload() {
 		clearInterval(this.timer)
 		this.$api.lockDelLock({
+			uuid: this.$method.getUuid(),
 			action:'bank'
 		}).then(res => {
 			
@@ -164,7 +165,8 @@ export default {
 	methods: {
 		getLock() {
 			this.$api.lockLockAction({
-				action:'bank'
+				action:'bank',
+				uuid: this.$method.getUuid()
 			}).then(res => {
 				
 			})

+ 21 - 0
pages2/dailyPractice/index.vue

@@ -103,6 +103,7 @@ export default {
             dayRecordList: [], // 每日一练试卷日历打卡记录
             meassgeModal: false,
             options: {},
+            timer: null,
         }
     },
     onLoad(option) {
@@ -119,8 +120,28 @@ export default {
         console.log('onshow进来了');
         this.initCalendar()
         this.getToDayExam()
+        if (!this.timer) {
+            this.getLock()
+		    this.timer = setInterval(this.getLock, 10000)
+        }
     },
+    onUnload() {
+		clearInterval(this.timer)
+		this.$api.lockDelLock({
+			action: 'bank',
+            uuid: this.$method.getUuid()
+		}).then(res => {
+		})
+	},
     methods: {
+        getLock() {
+			this.$api.lockLockAction({
+				action: 'bank',
+				uuid: this.$method.getUuid()
+			}).then(res => {
+				
+			})
+		},
         // 初始化当月日历
         initCalendar() {
             let date = new Date()

+ 19 - 1
pages2/randomPractice/index.vue

@@ -43,16 +43,27 @@ export default {
             orderGoodsId: '',
             numberLists: [5, 10, 15, 20, 50, 100],
             number: 5,
-            questionNum: {}
+            questionNum: {},
+            timer: null,
         }
     },
     onLoad(option) {
         this.goodsId = option.goodsId
         this.orderGoodsId = option.orderGoodsId
+        this.getLock()
+		this.timer = setInterval(this.getLock, 10000)
     },
     onShow() {
         this.getQuestionTempNum()
     },
+    onUnload() {
+		clearInterval(this.timer)
+		this.$api.lockDelLock({
+			action: 'bank',
+            uuid: this.$method.getUuid()
+		}).then(res => {
+		})
+	},
     computed: {
         accuracy() {
             if (this.questionNum.rightNum >= this.questionNum.totalNum) {
@@ -64,6 +75,13 @@ export default {
         }
     },
     methods: {
+        getLock() {
+			this.$api.lockLockAction({
+				action: 'bank',
+				uuid: this.$method.getUuid()
+			}).then(res => {
+			})
+		},
         changeNum(item) {
             this.number = item
         },

+ 3 - 0
pages2/wd/free_bank.vue

@@ -62,12 +62,14 @@
 		},
 		onLoad(option) {
 			this.$api.lockLockAction({
+				uuid: this.$method.getUuid(),
 				action:'bank'
 			}).then(res => {
 				
 			})
 			this.timer = setInterval(() => {
 				this.$api.lockLockAction({
+					uuid: this.$method.getUuid(),
 					action:'bank'
 				}).then(res => {
 					
@@ -79,6 +81,7 @@
 		onUnload() {
 			clearInterval(this.timer)
 			this.$api.lockDelLock({
+				uuid: this.$method.getUuid(),
 				action:'bank'
 			}).then(res => {
 				uni.hideLoading()

+ 2 - 0
pages2/wd/question_bank.vue

@@ -69,6 +69,7 @@
 		onUnload() {
 			clearInterval(this.timer)
 			this.$api.lockDelLock({
+				uuid: this.$method.getUuid(),
 				action:'bank'
 			}).then(res => {
 				uni.hideLoading()
@@ -81,6 +82,7 @@
 		methods: {
 			getLock() {
 				this.$api.lockLockAction({
+					uuid: this.$method.getUuid(),
 					action:'bank'
 				}).then(res => {
 					

+ 4 - 4
pages3/live/detail.vue

@@ -770,12 +770,10 @@ export default {
     this.orderGoodsId = Number(option.orderGoodsId) || '';
 
     // 公众号模板消息的数据埋点
-    if (option.informId) { // 从公众号消息点击进来上报一次,其他地方进来和没登录需要跳到登录页,登录后返回的不需要上报
+    if (option.informId) {
       this.informId = option.informId
-      this.clickOfficial()
+      // this.clickOfficial()
     }
-    
-    this.$store.getters.dictObj;
 
   },
   onShow() {
@@ -784,6 +782,8 @@ export default {
       return;
     }
     this.courseCourseList();
+    this.informId && this.clickOfficial() // 从公众号消息点击进来上报一次
+    this.$store.getters.dictObj;
     //相机授权
 		// this.userConfirmInfoDetail().then(res => {
 			

+ 5 - 3
pages3/polyv/detail.vue

@@ -785,19 +785,21 @@ export default {
 		this.option = option
 
     // 公众号模板消息的数据埋点
-    if (option.informId) { // 从公众号消息点击进来上报一次,其他地方进来和没登录需要跳到登录页,登录后返回的不需要上报
+    if (option.informId) {
       this.informId = option.informId
-      this.clickOfficial()
+      // this.clickOfficial()
     }
     
-    this.$store.getters.dictObj;
   },
   onShow() {
     console.log('this.option:', this.option);
     if (this.$method.isGoLogin()) { // 从公众号消息进来的没登录需要跳到登录页,登录后返回
       return;
     }
+    console.log('onshow返回之后');
     this.courseCourseList();
+    this.informId && this.clickOfficial() // 从公众号消息点击进来上报一次
+    this.$store.getters.dictObj;
   },
   onUnload() {
     this.originUnload()