浏览代码

修改新版英语

wangxy 2 周之前
父节点
当前提交
e0d20039b0
共有 6 个文件被更改,包括 263 次插入21 次删除
  1. 37 1
      api/word.js
  2. 7 0
      pages.json
  3. 69 0
      pages/newEnglish/components/mainCard.vue
  4. 138 0
      pages/newEnglish/index.vue
  5. 10 19
      pages/selectGradesTerms/index.vue
  6. 2 1
      pages/selectVersion/selectVersion.vue

+ 37 - 1
api/word.js

@@ -21,4 +21,40 @@ export function getWordListYk(data = {}) {
     data,
     timeout: 20000
   })
-}
+}
+
+export function getWordInfo(data = {}) {
+  return request({
+    'url': '/app/word/info',
+    headers: {
+      isToken: true
+    },
+    method: 'post',
+    data,
+    timeout: 20000
+  })
+}
+
+export function getWordWancheng(data = {}) {
+  return request({
+    'url': '/app/word/wancheng',
+    headers: {
+      isToken: true
+    },
+    method: 'post',
+    data,
+    timeout: 20000
+  })
+}
+
+export function getWordZhangwo(data = {}) {
+  return request({
+    'url': '/app/word/zhangwo',
+    headers: {
+      isToken: true
+    },
+    method: 'post',
+    data,
+    timeout: 20000
+  })
+}

+ 7 - 0
pages.json

@@ -140,6 +140,13 @@
 			{
 				"navigationStyle": "custom"
 			}
+		},
+		{
+			"path" : "pages/newEnglish/index",
+			"style" : 
+			{
+				"navigationStyle": "custom"
+			}
 		}
 	],
 	 "tabBar": {

+ 69 - 0
pages/newEnglish/components/mainCard.vue

@@ -0,0 +1,69 @@
+<template>
+	<view>
+		<swiper class="swiper" :indicator-dots="false" :autoplay="false" :circular="false">
+			<swiper-item>
+				<view class="swiper-item uni-bg-red">
+					学 
+					<hr />{{data.wordInfo}}
+				</view>
+			</swiper-item>
+			<swiper-item>
+				<view class="swiper-item uni-bg-red">
+					拼<hr />{{data.wordInfo}}
+				</view>
+			</swiper-item>
+			<swiper-item>
+				<view class="swiper-item uni-bg-blue">
+					读<hr />{{data.wordInfo}}
+				</view>
+			</swiper-item>
+			<swiper-item>
+				<view class="swiper-item uni-bg-blue">
+					选<hr />{{data.wordInfo}}
+				</view>
+			</swiper-item>
+			<swiper-item>
+				<view class="swiper-item uni-bg-blue">
+					背<hr />{{data.wordInfo}}
+				</view>
+			</swiper-item>
+		</swiper>
+	</view>
+</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
+	})
+
+	function updateWordInfo() {
+		httpApi.getWordInfo({
+			wordId: props.activeWord.id
+		}).then(res => {
+			data.wordInfo = res.data;
+		})
+	}
+
+	onMounted(() => {
+		updateWordInfo();
+	})
+</script>
+
+<style>
+</style>

+ 138 - 0
pages/newEnglish/index.vue

@@ -0,0 +1,138 @@
+<template>
+	<view class="ezy-exam-page" :style="{backgroundImage: 'url(' + courseBjFun() + ')'}">
+		<view class="ezy-navBar-box">
+			<view @click="handleBack" class="nav-bar-icon"></view>
+			<text class="nav-bar-title">学习</text>
+		</view>
+		<view>
+			<template v-for="item in data.wordList">
+				<mainCardVue :active-word="activeWord" :active-words="activeWords" v-if="item.id == data.activeId"
+					:key="item.id">
+				</mainCardVue>
+			</template>
+		</view>
+		<view>
+			底部
+			<view>收藏</view>
+			<view @click="prevWord" v-if="!isFirst">上一词</view>
+			<view @click="nextWord" v-if="!isLast">下一词</view>
+			<view v-if="isLast">完成</view>
+		</view>
+	</view>
+</template>
+
+<script setup>
+	import mainCardVue from "./components/mainCard.vue";
+	import {
+		ref,
+		reactive,
+		computed
+	} from "vue";
+	import {
+		onLoad
+	} from "@dcloudio/uni-app";
+	import * as httpApi from "@/api/word.js"
+
+	function courseBjFun() {
+		return 'static/images/course/couse-shuxue-bj.png'
+	}
+
+	function chunkArray(arr, chunkSize) {
+		const result = [];
+		for (let i = 0; i < arr.length; i += chunkSize) {
+			result.push(arr.slice(i, i + chunkSize));
+		}
+		return result;
+	}
+
+	function handleBack() {}
+
+	const data = reactive({
+		jieId: null, // 节/单元ID
+		activeId: null, // 当前单词
+		subjectId: null, // 学科ID
+		levelId: null, // 等级
+		jieName: '', // 节/单元名称
+		count: 0, // 单词总数
+		title: '', // 版本+年级+学期
+		studyCount: 0, // 已学习总数
+		wordList: [], // 单词列表
+		arrayList: [], // 整合数据
+	})
+
+	onLoad(({
+		jieId
+	}) => {
+		data.jieId = jieId
+		// 获取单词列表数据
+		initWordList();
+	})
+
+	// 当前单词
+	const activeWord = computed(() => {
+		if (!data.activeId) {
+			return null
+		}
+		return data.wordList.find(item => item.id == data.activeId)
+	})
+
+	// 是否是最后一题
+	const isLast = computed(() => {
+		if (!data.wordList.length) {
+			return false
+		}
+		return data.activeId == data.wordList[data.count - 1].id;
+	})
+	const isFirst = computed(() => {
+		if (!data.wordList.length) {
+			return false
+		}
+		return data.activeId == data.wordList[0].id;
+	})
+
+	const activeWords = computed(() => {
+		if (!data.activeId) {
+			return null
+		}
+		return data.arrayList.find(item => item.some(cit => cit.id == data.activeId))
+	})
+
+	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;
+		}
+	}
+
+	function prevWord() {
+		const index = data.wordList.findIndex(item => item.id == data.activeId);
+		if (index > 0) {
+			data.activeId = data.wordList[index - 1].id;
+		}
+	}
+
+
+	function initWordList() {
+		/*httpApi.getWordList({
+			jieId: data.jieId
+		}).then(res => {
+			// data.count = res.data.count;
+			data.count = res.data.wordList.length; // 数据异常暂时用length 替代
+			data.jieName = res.data.jieName;
+			data.levelId = res.data.levelId;
+			data.studyCount = res.data.studyCount;
+			data.subjectId = res.data.subjectId;
+			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维数组
+			}
+		})*/
+	}
+</script>
+
+<style>
+
+</style>

+ 10 - 19
pages/selectGradesTerms/index.vue

@@ -145,30 +145,21 @@
 
 			if (userCode !== 'Visitor') {
 				const auth = cacheManager.get('auth');
+				cacheManager.updateObject('auth', {
+					typeId: typeId,
+					levelId: levelId,
+					subjectId: subjectId,
+					zhangId: data.activeProduct == auth.levelId && data.activeXueke == auth.cardId ? auth.zhangId :
+						0,
+				})
+				// 通知岛重新调用接口
+				cacheManager.remove('daoPageCache')
 				if (subjectId == 2) {
-					// 新版英语 需要选择上下册 ---- 上下册更新章数据
-					cacheManager.updateObject('auth', {
-						typeId: typeId,
-						levelId: levelId,
-						subjectId: subjectId,
-					})
-					// 通知岛重新调用接口
-					cacheManager.remove('daoPageCache')
+					// 新版英语跳转版本章选择页面
 					uni.redirectTo({
 						url: `/pages/selectVersion/selectVersion`
 					})
-					return;
 				} else {
-					cacheManager.updateObject('auth', {
-						typeId: typeId,
-						levelId: levelId,
-						subjectId: subjectId,
-						zhangId: data.activeProduct == auth.levelId && data.activeXueke == auth.cardId ? auth.zhangId :
-							0,
-						currentZhang: 0
-					})
-					// 通知岛重新调用接口
-					cacheManager.remove('daoPageCache')
 					uni.redirectTo({
 						url: `/pages/study/index`
 					})

+ 2 - 1
pages/selectVersion/selectVersion.vue

@@ -147,6 +147,7 @@
 			const auth = cacheManager.get('auth');
 			cacheManager.updateObject('auth', {
 				// 修改上下册+版本字段
+				zhangId: data.shangxiaVersionId,
 			})
 			// 通知岛重新调用接口
 			cacheManager.remove('daoPageCache')
@@ -156,7 +157,7 @@
 		} else {
 			// 新英语岛
 			uni.redirectTo({
-				url: `/pages/study/index?levelId=${data.levelId}&typeId=${data.typeId}&subjectId=${data.subjectId}&tipFlag=${data.activeTipFlag}`
+				url: `/pages/study/index?levelId=${data.levelId}&typeId=${data.typeId}&subjectId=${data.subjectId}&tipFlag=${data.activeTipFlag}&zhangId=${data.shangxiaVersionId}`
 			})
 		}