Browse Source

增加弹窗

wangxy 4 months ago
parent
commit
64b39c1f09
2 changed files with 15 additions and 7 deletions
  1. 11 3
      components/catalogue/catalogue.vue
  2. 4 4
      pages/study/index.vue

+ 11 - 3
components/catalogue/catalogue.vue

@@ -1,7 +1,7 @@
 <template>
 	<uni-popup ref="popupRef" :animation="false" :is-mask-click="false"
 	 mask-background-color="rgba(255, 255, 255, 0.6);" :is-shadow="false">
-		<view class="ezy-catalogue-dialog">
+		<scroll-view scroll-y="true" :scroll-top="scrollTop"  class="ezy-catalogue-dialog">
 			<uni-icons @click="handleClose" class="catalogue-close-btn"></uni-icons>
 			<!-- 目录区域 -->
 			<uni-collapse v-model="activeCollapse" class="ezy-catalogue-collapse" :class="{ 'ezy-catalogue-collapse-vip': AuthCode === 'VIP'}" accordion>
@@ -28,7 +28,7 @@
 			</uni-collapse>
 			<tip-small-dialog ref="confirmDialogRef" @confirm-btn="handleConfirmPay" :content="Message"></tip-small-dialog>
 			<tip-middle-dialog ref="youkeDialogRef" @confirm-btn="ykConfirm" :content="MESSAGE_VISITER_TO_LOGIN"></tip-middle-dialog>
-		</view>
+		</scroll-view>
 	</uni-popup>
 </template>
 
@@ -51,6 +51,8 @@
 	} from '@dcloudio/uni-app';
 	const growthType = ref(null);
 	const AuthCode = ref(null);
+	const scrollTop = ref(0)
+	
 	onShow(() => AuthCode.value = getUserIdentity()); // 用户身份
 
 	const $emit = defineEmits(['change-zhang'])
@@ -78,7 +80,13 @@
 	/**
 	 * @summary 展示弹窗 暴露函数
 	 */
-	async function showPopup() {
+	async function showPopup(data) {
+		if (data) {
+			const index = props.list.findIndex(item => item.zhangId == data.zhangId);
+			// 滚动高度
+			scrollTop.value = 50 * index;
+			activeCollapse.value = index+'';
+		}
 		handleShow();
 	}
 

+ 4 - 4
pages/study/index.vue

@@ -3,11 +3,11 @@
 		:current="current" class="ezy-study-swiper" :class="'ezy-study-swiper'+ currentProduct" >
 		<swiper-item v-for="(item,index) in zhangList" :key="index">
 			<shuxueZhangjie v-if="currentProduct ==1" @clickGradeTerm="clickGradeTerm"
-				@handleCheckCatalogue="handleCheckCatalogue" @listClick="listClick" :gradeTerm='gradeTerm'
+				@handleCheckCatalogue="handleCheckCatalogue(item)" @listClick="listClick" :gradeTerm='gradeTerm'
 				:options="item">
 			</shuxueZhangjie>
 			<yingyuZhangjie v-if="currentProduct ==2" @clickGradeTerm="clickGradeTerm"
-				@handleCheckCatalogue="handleCheckCatalogue" @listClick="listClick" :gradeTerm='gradeTerm' :options="item">
+				@handleCheckCatalogue="handleCheckCatalogue(item)" @listClick="listClick" :gradeTerm='gradeTerm' :options="item">
 			</yingyuZhangjie>
 		</swiper-item>
 	</swiper>
@@ -289,8 +289,8 @@
 		}
 	}
 
-	function handleCheckCatalogue() {
-		catalogueRef.value.showPopup();
+	function handleCheckCatalogue(item) {
+		catalogueRef.value.showPopup(item);
 	}
 
 	function clickGradeTerm() {