Browse Source

update 分类滚动与返回问题

wangxy 3 months ago
parent
commit
607f6284d3
1 changed files with 16 additions and 11 deletions
  1. 16 11
      pages/selectGradesTerms/index.vue

+ 16 - 11
pages/selectGradesTerms/index.vue

@@ -1,5 +1,5 @@
 <template>
-	<view class="grades-terms-page">
+	<view class="grades-terms-page" @touchmove.stop.prevent>
 		<view class="icon-title-navBar-box">
 			<!-- 返回按钮↓ -->
 			<view class="nav-bar-icon" @click="handleBack"></view>
@@ -106,11 +106,11 @@
 					data.activeProduct = null;
 					data.activeXueke = 1
 				}
-				
-				nextTick(() => {
-					// 滚动到某个元素显示
-					data.scrollTop = `s_${data.activeProduct}`
-				})
+
+        setTimeout(() => {
+          // 滚动到某个元素显示
+          data.scrollTop = `s_${data.activeProduct}`
+        }, 100)
 			})
 		}
 
@@ -177,11 +177,16 @@
 
 		function handleBack() {
 			if (userCode !== 'Visitor') {
-				
-				if (!data.activeProduct) {
-					return;
-				}
-				
+
+        const auth = cacheManager.get('auth');
+
+        if (!data.activeProduct && !auth.levelId) {
+          uni.showToast({
+            title:'请选择内容'
+          })
+          return;
+        }
+
 				uni.redirectTo({
 					url: `/pages/study/index`
 				})