Browse Source

update 目录调整

wangxy 3 months ago
parent
commit
15f6a09488
2 changed files with 75 additions and 56 deletions
  1. 72 56
      components/catalogue/catalogue.vue
  2. 3 0
      pages/newEnglish/components/beiPage.vue

+ 72 - 56
components/catalogue/catalogue.vue

@@ -12,7 +12,8 @@
 				<template v-for="(item,index) in list">
 					<!-- 当前上下册只针对数学 -->
 					<view v-if="subjectId == 1 && index == shuxueShangxia" class="catalogue-nianji-title catalogue-mt">
-						{{jieTexts ? jieTexts[1]: ''}}</view>
+						{{jieTexts ? jieTexts[1]: ''}}
+					</view>
 					<uni-collapse-item title-border="none" :border="false" :name="index+''" class="collapse-item-box"
 						:class="{ 'collapse-active': activeCollapse === index+''}">
 						<template v-slot:title>
@@ -66,7 +67,7 @@
 		onLoad
 	} from '@dcloudio/uni-app';
 
-  // 旧道,上下分册 LevelId
+	// 旧道,上下分册 LevelId
 	const ShuxueObj = {
 		7: 6,
 		8: 6,
@@ -83,13 +84,16 @@
 	const subjectId = ref(null)
 	const shuxueShangxia = ref(0);
 	const levelId = ref(null);
+	const typeId = ref(null);
 
 	onShow(() => AuthCode.value = getUserIdentity()); // 用户身份
 	onLoad((options) => {
 		if (cacheManager.get('auth')) {
 			subjectId.value = cacheManager.get('auth').subjectId;
+			typeId.value = cacheManager.get('auth').typeId;
 		} else {
 			subjectId.value = options.subjectId;
+			typeId.value = options.typeId;
 		}
 		if (subjectId.value == 1) {
 			if (cacheManager.get('auth')) {
@@ -114,8 +118,8 @@
 	const Message = MESSAGE_BEFORE_PAY;
 	const youkeDialogRef = ref(null);
 	const selectZhang = ref(null);
-  const list = ref([])
-  const jieTexts = ref([])
+	const list = ref([])
+	const jieTexts = ref([])
 
 	function handleJieClick(item, jie, index, cindex) {
 		selectZhang.value = item;
@@ -125,11 +129,17 @@
 	}
 
 	function catalogueBjFun() {
-		if (subjectId.value == 1) {
-			// 数学
+		if (subjectId.value == 1 && typeId.value == 1) {
+			// 数学 新
+			return 'static/images/catalog/catalog-shuxue-bj.png'
+		} else if (subjectId.value == 1 && typeId.value == 2) {
+			// 英语 旧
 			return 'static/images/catalog/catalog-shuxue-bj.png'
-		} else if (subjectId.value == 2) {
-			// 英语
+		} else if (subjectId.value == 2 && typeId.value == 2) {
+			// 英语 旧
+			return 'static/images/catalog/catalog-yingyu-bj.png'
+		} else if (subjectId.value == 2 && typeId.value == 1) {
+			// 英语 新
 			return 'static/images/catalog/catalog-yingyu-bj.png'
 		}
 	}
@@ -147,62 +157,68 @@
 		handleShow(data);
 	}
 
-  function getFormatZhangListByArray(data) {
+	function getFormatZhangListByArray(data) {
 
-    const myList = data.reduce((acc, curr) => acc.concat(curr.zhangList || []), [])
+		const myList = data.reduce((acc, curr) => acc.concat(curr.zhangList || []), [])
 
-    const jiedian = data[0].zhangList.length;
+		const jiedian = data[0].zhangList.length;
 
-    return {
-      myList,
-      jiedian,
-      jieText: data.map(item => item.lable)
-    }
-  }
+		return {
+			myList,
+			jiedian,
+			jieText: data.map(item => item.lable)
+		}
+	}
 
 	/**
 	 * @summary 展示目录弹窗
 	 */
 	function handleShow(data) {
-    getCatalogue().then(([err, wlist]) => {
-      if (err) {
-        return;
-      }
-      const {myList,jiedian, jieText} = getFormatZhangListByArray(wlist)
-      list.value = myList;
-      if (list.value) {
-        jieTexts.value = jieText;
-        shuxueShangxia.value = jiedian;
-        if (data) {
-          let callback = null;
-          const index = myList.findIndex(item => item.zhangId == data.zhangId);
-          scrollTop.value = 0;
-          activeCollapse.value = '';
-          // 滚动高度
-          callback = () => {
-            console.log('uni.getTopWindowStyle()', uni.getSystemInfoSync().screenWidth)
-            if (subjectId.value == 2) {
-              // 英语
-              activeCollapse.value = index + '';
-              scrollTop.value = (uni.getSystemInfoSync().screenWidth / 750) * 50 * index;
-            } else {
-              // 数学
-              if (index < shuxueShangxia.value) {
-                activeCollapse.value = index + '';
-                scrollTop.value = (uni.getSystemInfoSync().screenWidth / 750) * 50 * index + (uni
-                    .getSystemInfoSync().screenWidth / 750) * 50;
-              } else {
-                activeCollapse.value = index + '';
-                scrollTop.value = (uni.getSystemInfoSync().screenWidth / 750) * 50 * index + (uni
-                    .getSystemInfoSync().screenWidth / 750) * 50 * 2;
-              }
-            }
-          }
-          setTimeout(() => callback(), 50)
-        }
-      }
-      popupRef.value.open('center');
-    })
+		getCatalogue().then(([err, wlist]) => {
+			if (err) {
+				return;
+			}
+			const {
+				myList,
+				jiedian,
+				jieText
+			} = getFormatZhangListByArray(wlist)
+			list.value = myList;
+			if (list.value) {
+				jieTexts.value = jieText;
+				shuxueShangxia.value = jiedian;
+				if (data) {
+					let callback = null;
+					const index = myList.findIndex(item => item.zhangId == data.zhangId);
+					scrollTop.value = 0;
+					activeCollapse.value = '';
+					// 滚动高度
+					callback = () => {
+						console.log('uni.getTopWindowStyle()', uni.getSystemInfoSync().screenWidth)
+						if (subjectId.value == 2) {
+							// 英语
+							activeCollapse.value = index + '';
+							scrollTop.value = (uni.getSystemInfoSync().screenWidth / 750) * 50 * index;
+						} else {
+							// 数学
+							if (index < shuxueShangxia.value) {
+								activeCollapse.value = index + '';
+								scrollTop.value = (uni.getSystemInfoSync().screenWidth / 750) * 50 * index + (
+									uni
+									.getSystemInfoSync().screenWidth / 750) * 50;
+							} else {
+								activeCollapse.value = index + '';
+								scrollTop.value = (uni.getSystemInfoSync().screenWidth / 750) * 50 * index + (
+									uni
+									.getSystemInfoSync().screenWidth / 750) * 50 * 2;
+							}
+						}
+					}
+					setTimeout(() => callback(), 50)
+				}
+			}
+			popupRef.value.open('center');
+		})
 	}
 
 	/**

+ 3 - 0
pages/newEnglish/components/beiPage.vue

@@ -75,6 +75,7 @@
 	import {
 		onLoad
 	} from "@dcloudio/uni-app"
+	import cacheManager from '@/utils/cacheManager';
 
 	const userCode = getUserIdentity();
 	
@@ -137,6 +138,8 @@
 		httpApi.getWordZhangwo({
 			type: 3,
 			wordId: props.activeWord.id
+		}).then(res => {
+			const { wanchangflag } = res.data;
 		})
 	}