wangguoyu пре 3 месеци
родитељ
комит
28d68b0892
2 измењених фајлова са 40 додато и 20 уклоњено
  1. 5 3
      pages/my/learnRecord.vue
  2. 35 17
      pages/newEnglish/index.vue

+ 5 - 3
pages/my/learnRecord.vue

@@ -187,8 +187,10 @@
 	})
 
 
-	function goLearn() {
-		console.log('data', 123123);
+	function goLearn(data) {
+		uni.redirectTo({
+			url: `/pages/newEnglish/index?jieId=0&wordId=${data.id}&isLearnStatus=${xxjlData.current}`
+		})
 	}
 
 	function onChangeTab(e) {
@@ -414,7 +416,7 @@
 	}
 
 	onLoad((options) => {
-		xxjlData.current = xxjlData.current
+		xxjlData.current = Number(options.isLearnStatus) || xxjlData.current
 		getMore(xxjlData.current);
 	})
 </script>

+ 35 - 17
pages/newEnglish/index.vue

@@ -7,21 +7,21 @@
 		<view class="ezy-tab-border">
 			<view class="ezy-border-body">
 				<template v-for="item in data.wordList">
-					<mainCardVue :active-word="data.activeWord"  :pageData="data" :active-words="activeWords"
-            @play-audio="handlePlayAudio"
-						v-if="item.id == data.activeId" :key="item.id">
+					<mainCardVue :active-word="data.activeWord" :pageData="data" :active-words="activeWords"
+						@play-audio="handlePlayAudio" v-if="item.id == data.activeId" :key="item.id">
 					</mainCardVue>
 				</template>
 			</view>
 		</view>
 		<view class="word-view-bottom">
 			<view class="collect-btn" v-if="userCode != 'Visitor'" @click="handleShouCang">
-				<icon :class="{active: data.collectFlag}"></icon><view>收藏</view>
+				<icon :class="{active: data.collectFlag}"></icon>
+				<view>收藏</view>
 			</view>
 			<view class="bottom-btn-box">
-				<view class="word-view-btn" @click="prevWord" v-if="!isFirst">上一词</view>
-				<view class="word-view-btn" @click="nextWord" v-if="!isLast">下一词</view>
-				<view class="word-view-btn" v-if="isLast" @click="handleComplete">完成</view>
+				<view class="word-view-btn" @click="prevWord" v-if="!isFirst&&isLearnRecord!=0">上一词</view>
+				<view class="word-view-btn" @click="nextWord" v-if="!isLast&&isLearnRecord!=0">下一词</view>
+				<view class="word-view-btn" v-if="isLast&&isLearnRecord!=0" @click="handleComplete">完成</view>
 			</view>
 		</view>
 	</view>
@@ -41,13 +41,21 @@
 	import {
 		getUserIdentity,
 	} from "@/utils/common.js"
-	import {useAudioCache,audioPlayer } from "./components/useAudio.js"
+	import {
+		useAudioCache,
+		audioPlayer
+	} from "./components/useAudio.js"
 
 	const userCode = getUserIdentity();
 
-	const {cacheAudio,clearAudioCache} = useAudioCache();
+	const {
+		cacheAudio,
+		clearAudioCache
+	} = useAudioCache();
 
 	const AudioP = new audioPlayer();
+	const isLearnRecord = ref(null)
+	const isLearnStatus = ref(null)
 
 	function courseBjFun() {
 		return 'static/images/course/course-cjdc-bj.png'
@@ -73,6 +81,7 @@
 		typeId: null, // 类型
 		tipFlag: null, // 提示
 		zhangId: null, // 章ID
+		isLearnStatus: null, // 学习记录状态
 	})
 
 	onLoad(({
@@ -82,17 +91,18 @@
 		levelId,
 		typeId,
 		tipFlag,
+		isLearnStatus,
 		zhangId
 	}) => {
 		data.jieId = jieId;
+		isLearnRecord.value = jieId;
 		data.activeId = wordId;
-
+		data.isLearnStatus = isLearnStatus;
 		data.subjectId = subjectId;
 		data.levelId = levelId;
 		data.typeId = typeId;
 		data.tipFlag = tipFlag;
 		data.zhangId = zhangId;
-
 		// 获取单词列表数据
 		initWordInfo();
 		// 清理过期文件
@@ -141,9 +151,15 @@
 	function handleBack() {
 		// 返回单词列表
 		if (userCode !== 'Visitor') {
-			uni.redirectTo({
-				url: `/pages/wordList/wordList?jieId=${data.jieId}`
-			})
+			if (data.jieId == 0) {
+				uni.redirectTo({
+					url: `/pages/my/learnRecord?jieId=${data.jieId}&isLearnStatus=${data.isLearnStatus}`
+				})
+			} else {
+				uni.redirectTo({
+					url: `/pages/wordList/wordList?jieId=${data.jieId}`
+				})
+			}
 		} else {
 			const youkePageData = JSON.stringify({
 				subjectId: data.subjectId,
@@ -191,7 +207,7 @@
 	}
 
 	function initWordInfo() {
-		
+
 		if (userCode !== 'Visitor') {
 			httpApi.getWordInfo({
 				jieId: data.jieId,
@@ -242,7 +258,10 @@
 		// console.log('arr',arr)
 	}
 
-	async function handlePlayAudio({url,code}) {
+	async function handlePlayAudio({
+		url,
+		code
+	}) {
 		// console.log('播放', url)
 		const cachedPath = await cacheAudio(url);
 		if (cachedPath.includes('.mp3')) {
@@ -255,7 +274,6 @@
 			});
 		}
 	}
-
 </script>
 
 <style>