Sfoglia il codice sorgente

选择课程调整

wangxy 4 mesi fa
parent
commit
bddd1bebe1
3 ha cambiato i file con 75 aggiunte e 10 eliminazioni
  1. 29 5
      components/catalogue/catalogue.vue
  2. 24 3
      pages/pay/svip.vue
  3. 22 2
      pages/study/index.vue

+ 29 - 5
components/catalogue/catalogue.vue

@@ -19,10 +19,10 @@
 							</view>
 					</template>
 					<view class="collapse-content-box">
-						<view v-for="(jie,cindex) in item.jieList" class="collapse-content-item">
-							<text class="jie-index">{{`${index+1}.${cindex+1}`}}</text>
-							<text class="text">{{jie.jieName}}</text>
-						</view>
+							<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>
 			</uni-collapse>
@@ -70,12 +70,35 @@
 	const activeCollapse = ref('');
 	const Message = MESSAGE_BEFORE_PAY;
 	const youkeDialogRef = ref(null);
+	const selectZhang = ref(null);
 
 	const props = defineProps({
 		list: {
 			type: Array,
 		}
 	})
+	
+	function handleJieClick(item,jie,index,cindex) {
+		selectZhang.value = item;
+		if (index == 0 && cindex == 0 ) {
+			// 全员可访问 第一章 第一节
+			this.$emit('listSelectJieClick', item,jie);
+			return;
+		}
+		if (AuthCode.value == 'Visitor') {
+			// 游客
+			youkeDialogRef.value.handleShow();
+			return;
+		}
+		if (AuthCode.value == 'Not-Vip') {
+			// 非VIP
+			confirmDialogRef.value.handleShow();
+			return;
+		}
+		
+		// Vip
+		this.$emit('listSelectJieClick', item,jie);
+	}
 
 	function catalogueBjFun(){
 		if(cardId.value ==1){
@@ -125,6 +148,7 @@
 	 * @param({zhangId:string}) data
 	 */
 	function handleSelectZhang(data,index) {
+		selectZhang.value = data;
 		if(index !=0 && AuthCode.value == 'Visitor'){
 			// 游客
 			youkeDialogRef.value.handleShow();
@@ -140,7 +164,7 @@
 		handleClose();
 	}
 	function handleConfirmPay() {
-    const url = `/pages/pay/svip?cardId=${cardId.value}`
+		const url = `/pages/pay/svip?cardId=${cardId.value}&formPage=studyWithCatalgue&selectZhangId=${selectZhang.value.zhangId}`
 		uni.redirectTo({ url })
 	}
 	defineExpose({

+ 24 - 3
pages/pay/svip.vue

@@ -72,6 +72,7 @@
 	let formPage = ref('')
 	const daoPokeRef = ref(null);
 	const daoPokeAllRef = ref(null);
+	const selectZhangId = ref(null);//来自岛目录选择的章Id,支付后需要修改章id缓存记录,方便返回时定位到选中章的岛
 	const isVip = getUserIdentity();
 	const svipArr = [{
 			iconPath: 'static/images/pay/svip-list-icon1.png',
@@ -97,6 +98,7 @@
 	onLoad((options) => {
 		cardId.value = options.cardId
 		formPage.value = options.formPage
+		selectZhangId.value = options.selectZhangId||''
 	})
 
 	function radioChange(data) {
@@ -105,8 +107,6 @@
 
 	function creatOrder(data) {
 
-
-
 		let req = {
 			cardId: cardId.value
 		}
@@ -127,7 +127,19 @@
 					uni.redirectTo({
 						url: '/pages/my/index'
 					})
-				}else{
+				} else if (formPage.value =='studyWithCatalgue'&& selectZhangId.value ) {
+					// 来自目录并且支付成功有章Id,更新缓存然后返回新岛
+					if( cacheManager.get('auth')){
+						const zhangList = cacheManager.get('zhangInfo').zhangList;
+						cacheManager.updateObject('auth', {
+							currentZhang: zhangList.findIndex(citem => citem.zhangId == +selectZhangId.value),
+							zhangId: +selectZhangId.value
+						})
+					}
+					uni.redirectTo({
+						url: '/pages/study/index'
+					})
+				} else{
 					uni.redirectTo({
 						url: '/pages/study/index'
 					})
@@ -137,6 +149,15 @@
 	}
 
 	function goBack(data) {
+		
+		if (formPage.value == 'studyWithCatalgue' ) {
+			// 返回到需要展示弹窗 studyWithCatalgue=1
+			uni.redirectTo({
+				url: '/pages/study/index?studyWithCatalgue=1'
+			})
+			return;
+		}
+		
 		uni.redirectTo({
 			url: '/pages/study/index'
 		})

+ 22 - 2
pages/study/index.vue

@@ -1,4 +1,5 @@
 <template>
+	<view>
 	<swiper :circular="true"  @change="onChangeTab" :duration="currentDuration"
 		:current="current" class="ezy-study-swiper" :class="'ezy-study-swiper'+ currentProduct" >
 		<swiper-item v-for="(item,index) in zhangList" :key="index">
@@ -13,11 +14,12 @@
 	</swiper>
 	<!-- 蛋 -->
 	<egg-dialog ref="eggDialogRef" @eggBtn="eggBtn"></egg-dialog>
-	<catalogue ref="catalogueRef" :list=zhangList @change-zhang="handleChangeZhang"></catalogue>
+	<catalogue ref="catalogueRef" :list=zhangList @change-zhang="handleChangeZhang" @listSelectJieClick="listSelectJieClick"></catalogue>
 	<CustomTabBar :cardId="cardId" :currentTabNumber="0" :nianji="nianji" :zhangId="zhangId" :tipFlag="tipFlag"></CustomTabBar>
 	<tip-small-dialog ref="goPayDialogRef" @confirm-btn="goPayPage" :content="tipContent"></tip-small-dialog>
 	<tip-middle-dialog ref="youkeDialogRef" @confirm-btn="ykConfirm" :content="YouKeContent"></tip-middle-dialog>
 	<dao-tip-dialog ref="daoTipDialogRef" v-if="showDaoTip" :productTip="productTipImg" @dao-tip-close="daoTipClose"></dao-tip-dialog>
+	</view>
 </template>
 <script setup>
 	import daoTipDialog from './daoTipDialog.vue';
@@ -105,6 +107,17 @@
 	onLoad((options) => {
 		init(options);
 	})
+	
+	function listSelectJieClick(item,jie) {
+		if( cacheManager.get('auth')){
+			cacheManager.updateObject('auth', {
+				currentZhang: zhangList.value.findIndex(citem => citem.zhangId == item.zhangId),
+				zhangId: item.zhangId
+			})
+		}
+		listClick(jie);
+	}
+	
 	function getProjectImg(){
 		if(currentProduct.value ==1){
 			// 数学
@@ -186,6 +199,14 @@
 					infoData.zhangId = cacheManager.get('zhangInfo').zhangList[current.value].zhangId
 					recordZhangJie()	
 			}
+			
+			// 已登录付费未支付选择返回 -> 恢复弹窗
+			if (options.studyWithCatalgue) {
+				// 展开弹窗
+				nextTick(() => {
+					catalogueRef.value.showPopup({zhangId: infoData.zhangId});
+				}) 
+			}
 		} else {
 			zhangId.value = options.zhangId
 			nianji.value = options.nianji
@@ -318,7 +339,6 @@
 	}
 
 	function listClick(data) {
-		console.log('data', data);
 		if (!cacheManager.get('auth') && data.firstFlag != 1) {
 			youkeDialogRef.value.handleShow();
 			return;