Browse Source

修改新版英语

wangxy 3 months ago
parent
commit
61bec76b88
2 changed files with 14 additions and 31 deletions
  1. 4 23
      pages/newEnglish/components/mainCard.vue
  2. 10 8
      pages/newEnglish/index.vue

+ 4 - 23
pages/newEnglish/components/mainCard.vue

@@ -32,37 +32,18 @@
 </template>
 
 <script setup>
-	import {
-		reactive
-	} from "vue";
-	import * as httpApi from "@/api/word.js"
-	import {
-		onMounted
-	} from 'vue';
 	const props = defineProps({
 		activeWord: {
 			type: Object,
 		},
 		activeWords: {
 			type: Array
-		}
-	})
-
-	const data = reactive({
-		wordInfo: null
+		},
+    wordInfo: {
+      type: Object,
+    }
 	})
 
-	function updateWordInfo() {
-		httpApi.getWordInfo({
-			wordId: props.activeWord.id
-		}).then(res => {
-			data.wordInfo = res.data;
-		})
-	}
-
-	onMounted(() => {
-		updateWordInfo();
-	})
 </script>
 
 <style>

+ 10 - 8
pages/newEnglish/index.vue

@@ -58,14 +58,16 @@
 		studyCount: 0, // 已学习总数
 		wordList: [], // 单词列表
 		arrayList: [], // 整合数据
+    wordInfo: null, // 单词详情数据
 	})
 
 	onLoad(({
-		jieId
+		jieId,wordId
 	}) => {
-		data.jieId = jieId
+		data.jieId = jieId;
+    data.activeId = wordId;
 		// 获取单词列表数据
-		initWordList();
+    initWordInfo();
 	})
 
 	// 当前单词
@@ -100,7 +102,6 @@
 	function nextWord() {
 		const index = data.wordList.findIndex(item => item.id == data.activeId);
 		if (index < data.count - 1) {
-			console.log(333)
 			data.activeId = data.wordList[index + 1].id;
 		}
 	}
@@ -113,11 +114,13 @@
 	}
 
 
-	function initWordList() {
-		/*httpApi.getWordList({
-			jieId: data.jieId
+	function initWordInfo() {
+		/*httpApi.getWordInfo({
+			jieId: data.jieId,
+			wordId: data.activeId
 		}).then(res => {
 			// data.count = res.data.count;
+			data.wordInfo = res.data;
 			data.count = res.data.wordList.length; // 数据异常暂时用length 替代
 			data.jieName = res.data.jieName;
 			data.levelId = res.data.levelId;
@@ -126,7 +129,6 @@
 			data.title = res.data.title;
 			data.wordList = res.data.wordList;
 			if (data.wordList.length) {
-				data.activeId = data.wordList[0].id;
 				data.arrayList = chunkArray(data.wordList, 2); // 将1维单词数组转换为2维数组
 			}
 		})*/