Browse Source

样式修改

tanxue 1 month ago
parent
commit
dfc8f4685d
3 changed files with 632 additions and 28 deletions
  1. 1 1
      common/styles/global/components.scss
  2. 204 27
      common/styles/global/pages.scss
  3. 427 0
      pages/chanpinneirong/index3.vue

+ 1 - 1
common/styles/global/components.scss

@@ -197,7 +197,7 @@ $titleBar-tabBar-page: calc(100vh - var(--status-bar-height));
 		width: 231rpx;height: 63rpx;
 		background-image: url("@/static/images/exam/tiankong-title.png");@include ezy-no-repeat-cover;
 	}
-	.tiankong-input {width: 50px;height: 32rpx;border: 1px solid #999;}
+	.tiankong-input {width: 116rpx!important;height: 52rpx;border: 1px solid #999;border-radius: 8rpx;}
 	.tk-input-box{display: inline-block;position: relative;font-size: 0;margin: 0 4rpx;}
 	.tiankong-input{text-align: center;}
 	.tiankong-input.showError{color: #ff5757;}

+ 204 - 27
common/styles/global/pages.scss

@@ -2006,9 +2006,37 @@
 // 学习
 .ezy-xuexi-page{
 	width: 100%;height: 100vh;background-color: #fff;display: flex;flex-direction: column;
-	.xuexi-page-body{padding:0 0 100rpx;overflow-y: auto;}
+	.xuexi-page-body{padding:0 0 100rpx;overflow-y: auto;border-radius: 0;position: relative;}
 	.xxjl-card-box-padding{padding-top: 64rpx;}
 	.xx-scroll-view{position: relative;}
+	
+	.item-dy-box{
+		display: flex;align-items: center;justify-content: center;
+		color: #fff;margin-bottom: 24rpx;
+		.dy-left-box{
+			width: 174rpx;height: 127rpx;@include ezy-no-repeat-cover;font-size: 64rpx;
+			display: flex;align-items: center;box-sizing: border-box;padding:0 24rpx;
+			background-image: url("@/static/images/xuexi/xx-ml-left.png");
+		}
+		.dy-left-box::after{
+			content: '';width: 32rpx;height: 34rpx;@include ezy-no-repeat-cover;margin-left: auto;
+			background-image: url("@/static/images/xuexi/xx-ml-jt.png");display: block;
+		}
+		.dy-right-box{
+			width: 518rpx;height: 127rpx;@include ezy-no-repeat-cover;
+			display: flex;align-items: flex-start;flex-direction: column;justify-content: center;
+			box-sizing: border-box;padding:0 24rpx;font-size: 28rpx;
+			background-image: url("@/static/images/xuexi/xx-ml-right.png");
+			.right-content{width: 100%;height: 90rpx;overflow: hidden;}
+			.dy-name{font-size: 34rpx;margin-bottom: 6rpx;}
+		}
+	}
+	.item-fixed{
+		width: 100%;padding: 24rpx 0;transition: opacity 0.2s ease-in-out;
+		position:sticky;position:-webkit-sticky;margin-bottom: 0;
+		top: 0;z-index: 10;background-color: #fff;border-radius: 16rpx 16rpx 0 0;
+	}
+	
 	// 切换单元
 	/* .change-dy-box{
 		width: 100%;position: relative;display: flex;margin-bottom: 12rpx;
@@ -2105,32 +2133,7 @@
 			width: 630rpx;height: 89rpx;@include ezy-no-repeat-cover;margin: 0 auto 32rpx;
 			background-image: url("@/static/images/xuexi/more-btn.png");
 		}
-		.item-dy-box{
-			display: flex;align-items: center;justify-content: center;
-			color: #fff;margin-bottom: 24rpx;
-			.dy-left-box{
-				width: 174rpx;height: 127rpx;@include ezy-no-repeat-cover;font-size: 64rpx;
-				display: flex;align-items: center;box-sizing: border-box;padding:0 24rpx;
-				background-image: url("@/static/images/xuexi/xx-ml-left.png");
-			}
-			.dy-left-box::after{
-				content: '';width: 32rpx;height: 34rpx;@include ezy-no-repeat-cover;margin-left: auto;
-				background-image: url("@/static/images/xuexi/xx-ml-jt.png");display: block;
-			}
-			.dy-right-box{
-				width: 518rpx;height: 127rpx;@include ezy-no-repeat-cover;
-				display: flex;align-items: flex-start;flex-direction: column;justify-content: center;
-				box-sizing: border-box;padding:0 24rpx;font-size: 28rpx;
-				background-image: url("@/static/images/xuexi/xx-ml-right.png");
-				.right-content{width: 100%;height: 90rpx;overflow: hidden;}
-				.dy-name{font-size: 34rpx;margin-bottom: 6rpx;}
-			}
-		}
-		.item-fixed{
-			width: 100%;padding: 24rpx 0;
-			position:sticky;position:-webkit-sticky;
-			top: 0;z-index: 10;background-color: #fff;
-		}
+		
 		/* 动画类 */
 		/* .item-dy-box.item-active {
 			animation: scalePulse 1s ease-in-out;
@@ -2201,6 +2204,180 @@
 	}
 }
 
+.ezy-xuexi-page3{
+	width: 100%;height: 100vh;background-color: #fff;display: flex;flex-direction: column;
+	.xuexi-page-body{padding:0 0 100rpx;overflow-y: auto;border-radius: 0;position: relative;}
+	// 4
+	// .xxjl-card-box-padding{padding-top: 46rpx;}
+	.xxjl-card-box-padding{padding-top: 64rpx;}
+	.xx-scroll-view{position: relative;}
+	
+	.item-dy-box{
+		display: flex;align-items: center;justify-content: center;
+		color: #fff;margin-bottom: 24rpx;
+		.dy-left-box{
+			width: 174rpx;height: 127rpx;@include ezy-no-repeat-cover;font-size: 64rpx;
+			display: flex;align-items: center;box-sizing: border-box;padding:0 24rpx;
+			background-image: url("@/static/images/xuexi/xx-ml-left.png");
+		}
+		.dy-left-box::after{
+			content: '';width: 32rpx;height: 34rpx;@include ezy-no-repeat-cover;margin-left: auto;
+			background-image: url("@/static/images/xuexi/xx-ml-jt.png");display: block;
+		}
+		.dy-right-box{
+			width: 518rpx;height: 127rpx;@include ezy-no-repeat-cover;
+			display: flex;align-items: flex-start;flex-direction: column;justify-content: center;
+			box-sizing: border-box;padding:0 24rpx;font-size: 28rpx;
+			background-image: url("@/static/images/xuexi/xx-ml-right.png");
+			.right-content{width: 100%;height: 90rpx;overflow: hidden;}
+			.right-default{width: 100%;height: 90rpx;line-height: 90rpx;font-size: 36rpx;}
+			.dy-name{font-size: 34rpx;margin-bottom: 6rpx;}
+		}
+	}
+	.item-fixed{
+		width: 100%;padding: 24rpx 0;transition: opacity 0.2s ease-in-out;
+		position:sticky;position:-webkit-sticky;margin-bottom: 0;
+		top: 0;z-index: 10;background-color: #fff;border-radius: 16rpx 16rpx 0 0;
+	}
+	
+	// 学习记录
+	.xxjl-card-box{
+		width: 95%;margin: 0 auto 0;padding: 72rpx 24rpx 24rpx 24rpx;box-sizing: border-box;
+		background-color: #5795f6;border-radius: 16rpx;position: relative;
+		.card-body-box{
+			display: flex;
+			img{width: 190rpx;height: 242rpx;border-radius: 16rpx;border: 1rpx solid #a8c3e9;}
+			.body-right{
+				color: #c8e4f8;margin-left: 24rpx;font-size: 30rpx;
+				view{margin: 8rpx 0;}
+				.right-name{font-size: 34rpx;color: #fff;}
+				}
+		}
+		.card-progress-box{
+			display: flex;align-items: center;
+			.xx-progress-box{flex: 1;margin-right: 64rpx;color: #fff;font-size: 28rpx;}
+			.xx-progress{border-radius: 40rpx;overflow: hidden;margin-top: 10rpx;}
+			.jxxx-btn{
+				width: 177rpx;height: 89rpx;@include ezy-no-repeat-cover;margin-right: 24rpx;
+				background-image: url("@/static/images/xuexi/jx-xx-btn.png");
+			}
+		}
+	}
+	.xxjl-card-box::before{
+		content: '学习记录';width: 289rpx;height: 77rpx;line-height: 77rpx;@include ezy-no-repeat-cover;
+		background-image: url("@/static/images/xuexi/xx-jl-bj.png");display: block;
+		position: absolute;top: -28rpx;text-align: center;color: #fff;font-size: 34rpx;
+	}
+	
+	// 学习进度
+	.xx-jd-box{
+		border-radius: 16rpx;margin: 0 24rpx 32rpx;padding: 32rpx;
+		box-shadow: 0 0rpx 6rpx rgba(100, 159, 241, 0.3);
+		.xx-progress-btn-box{
+			width: 100%;
+			display: flex;align-items: center;justify-content: space-between;
+		}
+		.xx-progress-box{
+			flex: 1;font-size: 32rpx;color: #333;margin-right: 42rpx;
+			.xx-progress{border-radius: 20rpx;overflow: hidden;margin-top: 16rpx;}
+		}
+		.jxxx-btn{
+			width: 217rpx;height: 85rpx;display: block;@include ezy-no-repeat-cover;
+			background-image: url("@/static/images/xuexi/jxxx-icon.png");flex-shrink: 0;
+		}
+		
+		//学习进度按钮
+		.jd-item-box{
+			display: flex;border-top: 1rpx dashed #97dbf8;margin-top: 32rpx;padding-top: 32rpx;
+			icon{width:54rpx;height: 54rpx;@include ezy-no-repeat-cover;
+			position: relative;margin-right: 52rpx;}
+			icon::before{
+				content: '';width: 1rpx;height: 70rpx;background-color: #fff;display: block;
+				position: absolute;right: -24rpx;top: -10rpx;
+				}
+			.dydg-icon{background-image: url("@/static/images/xuexi/dy-dg-icon.png");}
+			.dyml-icon{background-image: url("@/static/images/xuexi/kc-ml-icon.png");}
+			.jd-item-btn{
+				background-color: #ddf7ff;border-radius: 16rpx;flex: 1;text-align: center;
+				box-sizing: border-box;padding: 24rpx;display: flex;align-items: center;}
+			.jd-item-btn:first-child{margin-right: 24rpx;}
+		}
+		
+	}
+	
+	// 学习目录
+	.xx-item-list{
+		// 4
+		// padding-bottom: 24rpx;
+		.xx-item-title{text-align: center;margin: 32rpx 0;font-size: 32rpx;color: #444;}
+		.xx-more-btn{
+			width: 630rpx;height: 89rpx;@include ezy-no-repeat-cover;margin: 0 auto 32rpx;
+			background-image: url("@/static/images/xuexi/more-btn.png");
+		}
+		
+		/* 定义放大动画 */
+		@keyframes scalePulse {
+		  0% {
+		    transform: scale(1);
+		  }
+		  50% {
+		    transform: scale(1.05);
+		  }
+		  100% {
+		    transform: scale(1);
+		  }
+		}
+		
+		/* 定义显隐动画 */
+		@keyframes opacityPulse {
+		  0% {
+		    opacity: 1;
+		  }
+		  90% {
+		    opacity: 0.2;
+		  }
+		  100% {
+		    opacity: 1;
+		  }
+		}
+
+		.xx-item-box{
+			width: 691rpx;height: 172rpx;
+			display: flex;align-items: center;justify-content: space-between;color: #4b4b4b;;
+			margin: 0 auto 24rpx;box-sizing: border-box;padding: 20rpx;border-radius: 12rpx;
+			line-height: 1.5;font-size: 32rpx;position: relative;@include ezy-no-repeat-cover;
+			background-image: url("@/static/images/xuexi/xx-ml-bj.png");
+			img{width: 120rpx;height: 120rpx;border-radius: 12rpx;margin-right: 24rpx;}
+			.xx-item-status{
+				width: 89rpx;height: 87rpx;@include ezy-no-repeat-cover;
+				position: absolute;top:2rpx;left: 0;
+			}
+			.completed-status{background-image: url("@/static/images/xuexi/xw-status.png");}
+			.xx-text-box{flex: 1;}
+			.xx-item-btn{
+				width: 77rpx;height: 77rpx;@include ezy-no-repeat-cover;
+				background-image: url("@/static/images/xuexi/xx-ml-play-icon.png");
+			}
+		}
+		.xx-disabled-item-box{
+			background-image: url("@/static/images/xuexi/xx-ml-disabled-bj.png");
+		}
+	}
+	
+	.xx-next-btn{
+		width: 655rpx;height: 92rpx;line-height: 92rpx;margin: 32rpx auto;
+		font-size: 32rpx;color: #fff;text-align: center;@include ezy-no-repeat-cover;
+		background-image: url("@/static/images/login/login-btn-bj.png");
+	}
+	.xx-xw-text{text-align: center;font-size: 32rpx;color: #666;margin: 32rpx auto;}
+	// 回到顶部
+	.go-top-btn{
+		width: 77rpx;height: 77rpx;@include ezy-no-repeat-cover;
+		background-image: url("@/static/images/xuexi/go-top-btn.png");
+		position: fixed;z-index: 9;bottom: 300rpx;right:10rpx;
+	}
+}
+
 // 单元目录
 .xuexi-dyml-page{
 	width: 100%;height: 92vh;border-radius: 16rpx 16rpx 0 0;

+ 427 - 0
pages/chanpinneirong/index3.vue

@@ -0,0 +1,427 @@
+<template>
+	<view class="ezy-xuexi-page3">
+		<view class="icon-title-navBar-box">
+			<text class="nav-bar-title">学习</text>
+		</view>
+		<!-- 吸顶单元标题 -->
+		<view
+			v-if="currentStickyTitle"
+			class="item-dy-box item-fixed"
+		>
+			<view class="dy-left-box">L{{ currentStickyDengjiId }}</view>
+			<view class="dy-right-box">
+				<view class="right-content">
+					<view class="dy-name">{{ currentStickyTitle }}</view>
+					<view>{{ currentStickyIntro }}</view>
+				</view>
+			</view>
+		</view>
+
+		<!-- 滚动区域 -->
+		<scroll-view
+			v-if="existData"
+			class="ezy-page-body xuexi-page-body"
+			scroll-y
+			:scroll-top="scrollTop"
+			@scroll="handleScroll"
+		>
+			<view class="xxjl-card-box-padding">
+				<view class="xxjl-card-box">
+					<!-- 显示内容 -->
+					<view class="card-body-box">
+						<img :src="banbenInfo.cover" />
+						<view class="body-right">
+							<view class="right-name">{{ banbenInfo.chanpinName }}</view>
+							<view>等级:{{banbenInfo.dengjiName}}</view>
+							<view>版本:{{banbenInfo.name}}</view>
+							<view>单元:{{banbenInfo.curDanyuanName}}</view>
+							<view>课程:{{banbenInfo.curKechengName}}</view>
+						</view>
+					</view>
+					<view class="card-progress-box">
+						<view class="xx-progress-box">
+							<view>学习进度</view>
+							<progress :percent="curProcess" class="xx-progress" stroke-width="20"
+								backgroundColor="#3c7dfd" activeColor="#ffd11c" />
+						</view>
+						<ezyActiveVue class="ezy-btn-active jxxx-btn" @aclick="handlePlay(banbenInfo,'jixu')"></ezyActiveVue>
+					</view>
+				</view>
+			</view>
+
+			<view class="xx-item-list">
+				<!-- <view class="xx-item-title">— 以下为当前等级课程目录 —</view> -->
+
+				<view v-for="(danyuanItem, index) in danyuanList" :key="danyuanItem.danyuanId">
+
+					<!-- 单元标题(带唯一ID,用于位置查询) -->
+					<view class="xx-item-title" :id="`title-${danyuanItem.danyuanId}`">
+						— {{ danyuanItem.danyuanName }} {{ danyuanItem.danyuanIntro }} —
+					</view>
+
+					<!-- 节列表 -->
+					<ezyActiveVue
+						class="ezy-list-item-active xx-item-box"
+						v-for="jieItem in danyuanItem.jieList"
+						:key="jieItem.jieId"
+						@aclick="handlePlay(jieItem,'play')"
+					>
+						<view
+							class="xx-item-status"
+							:class="jieItem.wanchengFlag == 1 ? 'completed-status' : 'uncompleted-status'"
+						></view>
+						<img :src="jieItem.cover" />
+						<view class="xx-text-box">
+							<view>{{ jieItem.jieName }}</view>
+							<view>{{ jieItem.jieIntro }}</view>
+						</view>
+						<view class="xx-item-btn"></view>
+					</ezyActiveVue>
+				</view>
+
+				<view class="xx-item-title">本级别最后一单元啦~</view>
+				<view class="xx-more-btn" @click="moreBtn"></view>
+			</view>
+		</scroll-view>
+		<!-- 回到顶部 -->
+		<view class="go-top-btn" @click="goTopBtn"></view>
+
+		<!-- 无数据占位 -->
+		<view v-if="!existData" class="ezy-page-body xuexi-page-body"></view>
+
+		<!-- 弹窗组件 -->
+		<danyuanInfoVue ref="dyRef" v-if="isShow" @close="isShow = false"></danyuanInfoVue>
+
+		<!-- 底部 tabBar -->
+		<custom-tab-bar :show="true" :current-index="currentTabIndex" />
+	</view>
+</template>
+
+<script>
+	import ezyActiveVue from "@/components/ezyActive/ezyActive.vue";
+	import CustomTabBar from '@/components/custom-tabbar/index.vue';
+	import cacheManager from "@/utils/cacheManager.js";
+	import {
+		shuxueChanpinBanbenInfo,
+		shuxueSave
+	} from "@/api/chanpinneirong.js"
+	import {
+		onLoad,
+		onShow,
+		onHide,
+		onUnload
+	} from "@dcloudio/uni-app"
+	import danyuanInfoVue from '@/pages/xinshuxue/components/danyuanInfo.vue';
+	import {
+		toast
+	} from '../../utils/common';
+  import {updateXuexiProcess} from "./useNeirongShuxue"
+	export default {
+		data() {
+			return {
+				canExitApp: false,
+
+				danyuanList: [],
+				banbenInfo: {},
+				banbenId: '',
+				danyuanId: '',
+				chanpinId: '',
+				dengjiId: '',
+				curProcess: '',
+				currentTabIndex: 1,
+				existData: true,
+				isShow: false,
+
+				stickyHeight: 0, // 吸顶栏高度(px)
+				currentStickyTitle: '', // 初始为空,不显示吸顶
+				currentStickyIntro: '',
+				currentStickyDengjiId: '',
+				titlePositions: [],
+				scrollTop: 0,
+			}
+		},
+		components: {
+			CustomTabBar,
+			danyuanInfoVue,
+			ezyActiveVue
+		},
+		onLoad(options) {
+			uni.hideTabBar()
+		},
+		onShow() {
+			this.currentTabIndex = 1
+			const cacheData = cacheManager.get('xuexi-shuxue');
+
+			if (cacheData) {
+				console.log('使用缓存数据');
+				this.updateFromCache();
+			} else {
+				console.log('重新请求数据');
+				const cacheDataAuth = cacheManager.get('auth');
+				this.initFromOptions(cacheDataAuth);
+			}
+		},
+		onHide() {
+			console.log('学习页面隐藏')
+		},
+		onUnload() {
+			// 页面卸载无需特殊处理
+		},
+		methods: {
+			goTopBtn() {
+				this.scrollTop = -1; // 先设一个无效值(确保变化)
+				this.$nextTick(() => {
+					this.scrollTop = 0; // 再滚到顶部
+				});
+			},
+			moreBtn() {
+				uni.switchTab({
+					url: '/pages/chanpinXuanze/index'
+				})
+			},
+
+			initFromOptions(options) {
+				console.log('options', options);
+				this.chanpinId = options.chanpinId;
+				this.danyuanId = options.danyuanId;
+				this.banbenId = options.banbenId;
+				this.dengjiId = options.dengjiId;
+				this.loadDataFromApi();
+			},
+			// 从缓存更新数据方法
+			updateFromCache() {
+				updateXuexiProcess()
+				const cacheData = cacheManager.get('xuexi-shuxue');
+				console.log('cacheData 从缓存更新数据方法', cacheData);
+				if (cacheData) {
+					this.banbenInfo = { ...cacheData };
+					this.curProcess = cacheData.curProcess;
+					this.danyuanList = [...(cacheData.danyuanList || [])];
+
+					this.$nextTick(() => {
+						this.updateTitlePositions();
+					});
+				}
+			},
+
+			loadDataFromApi() {
+				this.banbenInfo = {}
+				this.curProcess = ''
+				this.danyuanList = []
+				const req = {
+					banbenId: this.banbenId
+				}
+				shuxueChanpinBanbenInfo(req).then(res => {
+					if (res.code === 0) {
+						this.banbenInfo = res.data;
+						this.curProcess =res.data.curProcess * 100;
+						this.danyuanList = res.data.danyuanList || [];
+
+						if (!this.danyuanList.length) {
+							this.existData = false
+						}
+						// 保存到缓存(新增了参数保存)
+						const cacheData = {
+							...res.data,
+							banbenId: this.banbenId,
+							chanpinId: this.chanpinId,
+							danyuanId: this.danyuanId,
+							dengjiId: this.dengjiId
+						};
+						cacheManager.set('xuexi-shuxue', cacheData);
+
+						// 更新全局auth信息
+						cacheManager.updateObject('auth', {
+							chanpinId: res.data.chanpinId,
+							banbenId: this.banbenId,
+							danyuanId: res.data.curDanyuanId,
+							dengjiId: res.data.dengjiId
+						});
+						this.danyuanId = res.data.curDanyuanId
+						this.dengjiId = res.data.dengjiId
+						this.chanpinId = res.data.chanpinId
+						// 数据加载完成后初始化观察器
+						this.$nextTick(() => {
+							this.updateTitlePositions();
+						});
+					}
+				}).catch(res => {
+					cacheManager.remove("xuexi-shuxue");
+					toast("加载失败,请重试");
+				});
+			},
+
+			updateStickyHeight() {
+					const query = uni.createSelectorQuery().in(this);
+					query.select('.item-fixed').boundingClientRect(res => {
+						if (res) {
+							this.stickyHeight = res.height; // 单位 px
+						} else {
+							this.stickyHeight = 100; // 默认 fallback(约 200rpx = 100px)
+						}
+					}).exec();
+				},
+
+			// 获取所有标题在 scroll-view 中的绝对位置
+			updateTitlePositions() {
+				this.titlePositions = [];
+				this.danyuanTitleRefs = [];
+
+				if (!this.danyuanList.length) return;
+
+				const query = uni.createSelectorQuery().in(this);
+				this.danyuanList.forEach(item => {
+					query.select(`#title-${item.danyuanId}`).boundingClientRect();
+					this.danyuanTitleRefs.push(item);
+				});
+
+				query.exec((rects) => {
+					rects.forEach((rect, index) => {
+						if (rect) {
+							// 在 scroll-view 初始未滚动时,rect.top 就是内容中的绝对 top
+							this.titlePositions.push({
+								danyuanId: this.danyuanTitleRefs[index].danyuanId,
+								name: this.danyuanTitleRefs[index].danyuanName,
+								intro: this.danyuanTitleRefs[index].danyuanIntro,
+								top: rect.top
+							});
+						}
+					});
+					this.titlePositions.sort((a, b) => a.top - b.top);
+					// 👇 新增:更新吸顶栏高度
+								this.updateStickyHeight();
+				});
+			},
+
+			handleScroll(e) {
+				const scrollTop = e.detail.scrollTop;
+				const firstTitle = this.titlePositions[0];
+
+				if (!firstTitle) {
+					this.currentStickyTitle = '';
+					return;
+				}
+
+				// 👇 关键修改:提前触发吸顶
+				const triggerOffset = scrollTop + this.stickyHeightPx;
+
+				// 如果还没滚到第一个标题的顶部(考虑吸顶高度),则隐藏
+				if (triggerOffset < firstTitle.top) {
+					this.currentStickyTitle = '';
+					return;
+				}
+
+				// 找出最后一个 top <= triggerOffset 的标题(即刚进入吸顶区的单元)
+				let matched = null;
+				for (let i = this.titlePositions.length - 1; i >= 0; i--) {
+					if (this.titlePositions[i].top <= triggerOffset) {
+						matched = this.titlePositions[i];
+						break;
+					}
+				}
+
+				if (matched) {
+					this.currentStickyTitle = matched.name;
+					this.currentStickyIntro = matched.intro;
+					this.currentStickyDengjiId = this.banbenInfo.dengjiId || 1;
+				} else {
+					this.currentStickyTitle = '';
+				}
+			},
+
+			getJieAndDanyuan(data, jieId) {
+				for (let danyuan of data.danyuanList) {
+					for (let jie of danyuan.jieList) {
+						if (jie.jieId == jieId) {
+							return { danyuan, jie }
+						}
+					}
+				}
+				return null;
+			},
+
+			async saveAndNavigate(jieId, type, da, code) {
+				if (code == 'jixu') {
+					if (!this.banbenId || !this.danyuanId) {
+						toast("banbenId或者danyuanId 丢失")
+						return false
+					}
+				}
+
+				let req = {
+					"banbenId": this.banbenId,
+					"danyuanId": da.danyuanId,
+					"jieId": jieId
+				}
+
+				try {
+					const res = await shuxueSave(req);
+					if (res.code == 0 && res.data) {
+						let curJieAndDanyuan = this.getJieAndDanyuan(this.banbenInfo, jieId);
+						if (!curJieAndDanyuan) {
+							toast("未找到课程信息");
+							return false;
+						}
+
+						const cacheData = cacheManager.get('xuexi-shuxue') || {};
+						cacheData.curDanyuanName = curJieAndDanyuan.danyuan.danyuanName;
+						cacheData.curKechengName = curJieAndDanyuan.jie.jieIntro;
+						cacheData.curJieId = jieId;
+						cacheData.type = curJieAndDanyuan.jie.type;
+						cacheManager.set('xuexi-shuxue', cacheData);
+
+						if (type == 1) {
+							uni.navigateTo({ url: `/pages/xinshuxue/lookShipin?jieId=${jieId}` })
+						} else {
+							uni.navigateTo({ url: `/pages/xinshuxue/unitTest?jieId=${jieId}` })
+						}
+					} else {
+						toast("保存位置出错");
+						return false;
+					}
+				} catch (error) {
+					toast("保存失败");
+					return false;
+				}
+			},
+			handlePlay(da, code) {
+				let jieId = code === 'jixu' ? da.curJieId : da.jieId;
+				if (!jieId) {
+					toast("无课程ID");
+					return;
+				}
+				this.saveAndNavigate(jieId, da.type, da, code);
+			},
+			handleClickDanyuan(item) {
+				if (!item.danyuanId) {
+					toast("danyuanId丢失")
+					return false
+				}
+				this.isShow = true;
+				setTimeout(() => {
+					// 更新为点击的动态单元Id [临时]
+					this.$refs.dyRef.handleShow(item.danyuanId)
+				}, 100)
+			},
+			handleBack() {
+				uni.navigateTo({
+					url: `/pages/chanpinXuanze/banben?dengjiId=` + this.dengjiId
+				})
+			},
+		},
+
+		// 计算吸顶栏下方的偏移(确保内容不被遮挡)
+		computed: {
+			stickyHeightPx() {
+					// 175rpx ≈ 87.5px,取整 90px 足够安全
+					return 90;
+				},
+			topOffset() {
+					// 只有当吸顶栏显示时,才增加上边距避免内容被遮挡
+					return this.currentStickyTitle ? '80rpx' : '0rpx';
+				}
+
+		}
+	}
+</script>
+