Forráskód Böngészése

讲义滚动传参问题,字幕时间展示调整

canghailong 6 hónapja
szülő
commit
b461e9dfb3

+ 6 - 6
src/views/student/classCentre/handouts.vue

@@ -1,5 +1,5 @@
 <template>
-	<div style="height: 100%;overflow-y: auto;">
+	<div style="height: 100%; overflow-y: auto">
 		<div v-if="!showPdf">渲染pdf失败</div>
 		<div class="mb-4" v-if="showPdf">
 			<a-button type="primary" @click="downPdf">下载讲义</a-button>
@@ -9,8 +9,8 @@
 			@error="errorHandler"
 			ref="scrollDiv"
 			@scroll="handleScroll"
-			:options="{width:'100%'}"
-			style="height:calc(100% - 50px);"
+			:options="{ width: '100%' }"
+			style="height: calc(100% - 50px)"
 		/>
 	</div>
 </template>
@@ -65,18 +65,18 @@
 			.classPlanAdd({
 				hourId: props.hourId,
 				type: 2,
-				funcType:2
+				funcType: 2
 			})
 			.then((data) => {})
 	}
 	const addScrollPlan = () => {
 		classCentre
 			.classPlanAdd({
-				progress: maxStr.value,
+				progress: showPdf.value ? (maxStr.value == 0 ? 100 : maxStr.value) : 0,
 				hourId: props.hourId,
 				stayTime: outNowTimesStr.value - nowTimesStr,
 				type: 1,
-				funcType:2
+				funcType: 2
 			})
 			.then((data) => {})
 	}

+ 6 - 1
src/views/student/classCentre/subtitle.vue

@@ -3,7 +3,7 @@
 	<div style="height: 900px; overflow-y: auto" class="mt-2">
 		<div v-if="subtitle">{{ subtitle }}</div>
 		<div v-for="(item, idx) in subtitleList" :key="idx">
-			<div>{{ item.startTime }}~{{ item.endTime }}</div>
+			<div>{{ item.startTimeStr }}~{{ item.endTimeStr }}</div>
 			<div style="cursor: pointer; padding: 10px 0" @click="videoSpeed(item)">{{ item.text }}</div>
 		</div>
 	</div>
@@ -70,6 +70,8 @@
 								text: textItem[2],
 								startTime: ToSeconds(textItem[1].split(' --> ')[0]),
 								endTime: ToSeconds(textItem[1].split(' --> ')[1]),
+								startTimeStr: toStrTime(textItem[1].split(' --> ')[0]),
+								endTimeStr: toStrTime(textItem[1].split(' --> ')[1]),
 								timeLine: textItem[1]
 							}
 						})
@@ -83,6 +85,9 @@
 				console.log(error)
 			})
 	}
+	function toStrTime(t){
+		return t.split(',')[0]
+	}
 	//将时间转化为秒
 	function ToSeconds(t) {
 		var s = 0.0