Bladeren bron

调整目录

wangxy 4 maanden geleden
bovenliggende
commit
ce34038eb2
2 gewijzigde bestanden met toevoegingen van 83 en 29 verwijderingen
  1. 82 28
      components/catalogue/catalogue.vue
  2. 1 1
      pages/study/index.vue

+ 82 - 28
components/catalogue/catalogue.vue

@@ -1,30 +1,37 @@
 <template>
 	<uni-popup ref="popupRef" :animation="false" :is-mask-click="false"
 	 mask-background-color="rgba(255, 255, 255, 0.6);" :is-shadow="false">
-		<scroll-view scroll-y="true" :scroll-top="scrollTop"  class="ezy-catalogue-dialog" :style="{backgroundImage: 'url(' + catalogueBjFun() + ')'}">
+		<scroll-view :scroll-y="true" :scroll-top="scrollTop"  class="ezy-catalogue-dialog" 
+		:style="{backgroundImage: 'url(' + catalogueBjFun() + ')'}">
 			<uni-icons @click="handleClose" class="catalogue-close-btn"></uni-icons>
+			<!-- 当前上下册只针对数学 -->
+			<view v-if="cardId == 1" style="height: 50px;line-height: 50px;">L{{nianji}}上</view>
 			<!-- 目录区域 -->
 			<uni-collapse v-model="activeCollapse" class="ezy-catalogue-collapse" :class="{ 'ezy-catalogue-collapse-vip': AuthCode === 'VIP'}" accordion>
-				<uni-collapse-item title-border="none" :border="false" :name="index+''" v-for="(item,index) in list" 
-				class="collapse-item-box" :class="{ 'collapse-active': activeCollapse === index+''}">
-					<template v-slot:title>
-							<view @click.stop="handleSelectZhang(item,index)" class="collapse-title">
-								<view class="collapse-num-box">{{index+1}}</view>
-								<!-- 章名 -->
-								<text class="collapse-name">{{item.zhangName}}</text>
-								<!-- 锁 -->
-								<template v-if="AuthCode !== 'VIP'">
-									<view class="collapse-lock" v-if="index!=0"></view>
-								</template>
-							</view>
-					</template>
-					<view class="collapse-content-box">
-							<view v-for="(jie,cindex) in item.jieList" class="collapse-content-item" @click="handleJieClick(item,jie,index,cindex)">
-								<text class="jie-index">{{`${index+1}.${cindex+1}`}}</text>
-								<text class="text">{{jie.jieName}}</text>
-							</view>
-					</view>
-				</uni-collapse-item>
+				<template v-for="(item,index) in list">
+					<!-- 当前上下册只针对数学 -->
+					<view v-if="cardId == 1 && index == shuxueShangxia" style="height: 50px;line-height: 50px;">L{{nianji}}下</view>
+					<uni-collapse-item title-border="none" :border="false" :name="index+''" 
+					class="collapse-item-box" :class="{ 'collapse-active': activeCollapse === index+''}">
+						<template v-slot:title>
+								<view @click.stop="handleSelectZhang(item,index)" class="collapse-title">
+									<view class="collapse-num-box">{{index+1}}</view>
+									<!-- 章名 -->
+									<text class="collapse-name">{{item.zhangName}}</text>
+									<!-- 锁 -->
+									<template v-if="AuthCode !== 'VIP'">
+										<view class="collapse-lock" v-if="index!=0"></view>
+									</template>
+								</view>
+						</template>
+						<view class="collapse-content-box">
+								<view v-for="(jie,cindex) in item.jieList" class="collapse-content-item" @click="handleJieClick(item,jie,index,cindex)">
+									<text class="jie-index">{{`${index+1}.${cindex+1}`}}</text>
+									<text class="text">{{jie.jieName}}</text>
+								</view>
+						</view>
+					</uni-collapse-item>
+				</template>
 			</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>
@@ -37,23 +44,38 @@
 		useCatalogue
 	} from './useCatalogue';
 	import {
-		ref
+		ref,nextTick
 	} from "vue";
 	import {
 		toast
 	} from "@/utils/common.js"
 	import {getUserIdentity} from "@/utils/common.js"
 	import {MESSAGE_VISITER_TO_LOGIN,MESSAGE_BEFORE_PAY} from "@/utils/constant.js"
-  import tipSmallDialog from '@/components/dialog/tipSmallDialog.vue'
+	import tipSmallDialog from '@/components/dialog/tipSmallDialog.vue'
 	import tipMiddleDialog from '@/components/dialog/tipMiddleDialog.vue';
-  import cacheManager from "@/utils/cacheManager.js";
+	import cacheManager from "@/utils/cacheManager.js";
 	import {
 	  onShow,onLoad
 	} from '@dcloudio/uni-app';
+	
+	
+	const ShuxueObj = {
+		1: 6,
+		2: 6,
+		3: 11,
+		4: 11,
+		5: 11,
+		6: 12,
+	}
+	
+	
 	const growthType = ref(null);
 	const AuthCode = ref(null);
 	const scrollTop = ref(0)
 	const cardId = ref(null)
+	const shuxueShangxia = ref(0);
+	const nianji = ref(null);
+	
 	onShow(() => AuthCode.value = getUserIdentity()); // 用户身份
 	onLoad((options) => {
 		if (cacheManager.get('auth')) {
@@ -61,6 +83,15 @@
 		} else {
 		  cardId.value = options.cardId;
 		}
+		if (cardId.value == 1) {
+			if (cacheManager.get('auth')) {
+			    nianji.value = cacheManager.get('auth').nianji;
+			} else {
+				nianji.value = options.nianji;
+			}
+			shuxueShangxia.value = ShuxueObj[nianji.value];
+		}
+		
 	})
 
 	const $emit = defineEmits(['change-zhang'])
@@ -122,21 +153,44 @@
 	 * @summary 展示弹窗 暴露函数
 	 */
 	async function showPopup(data) {
+		let callback = null;
 		if (data) {
 			const index = props.list.findIndex(item => item.zhangId == data.zhangId);
+			scrollTop.value = 0;
+			activeCollapse.value = '';
 			// 滚动高度
-			scrollTop.value = 50 * index;
-			activeCollapse.value = index+'';
+			callback = () => {
+				if (cardId.value == 2) {
+					// 英语
+					scrollTop.value = 50 * index;
+					activeCollapse.value = index+'';
+				} else {
+					// 数学
+					if (index<shuxueShangxia.value) {
+						scrollTop.value = 50 * index + 50;
+						activeCollapse.value = index+'';
+					} else {
+						scrollTop.value = 50 * index + 100;
+						activeCollapse.value = index+'';
+					}
+				}
+			}
 		}
-		handleShow();
+		handleShow(callback);
 	}
 
 
 	/**
 	 * @summary 展示目录弹窗
 	 */
-	function handleShow() {
+	function handleShow(callback) {
 		popupRef.value.open('center');
+		if (callback) {
+			
+		}
+		setTimeout(() => {
+			callback();
+		},50)
 	}
 
 	/**

+ 1 - 1
pages/study/index.vue

@@ -292,7 +292,7 @@
 		if (authCode !== 'Visitor') {
 			cacheManager.updateObject('auth', {
 				zhangId: data.zhangId,
-        currentZhang: zhangList.value.findIndex(citem => citem.zhangId == item.zhangId),
+        currentZhang: zhangList.value.findIndex(citem => citem.zhangId == data.zhangId),
 			})
 		}
 		currentDuration.value = 0