Bladeren bron

调整目录跳转

wangxy 2 maanden geleden
bovenliggende
commit
920e12dbd7
4 gewijzigde bestanden met toevoegingen van 16 en 22 verwijderingen
  1. 2 2
      components/catalogue/catalogue.vue
  2. 3 2
      components/catalogue/useCatalogue.js
  3. 10 17
      pages/study/index.vue
  4. 1 1
      utils/common.js

+ 2 - 2
components/catalogue/catalogue.vue

@@ -116,7 +116,6 @@
 
 	function handleJieClick(item, jie, index, cindex) {
 		selectZhang.value = item;
-		// this.$emit('listSelectJieClick', item, jie, cindex);
 		$emit('change-zhang', Object.assign({}, item));
 		handleClose();
 	}
@@ -153,7 +152,6 @@
 	function getFormatZhangListByArray(data) {
 
 		const myList = data.reduce((acc, curr) => acc.concat(curr.zhangList || []), [])
-
 		const jiedian = data[0].zhangList.length;
 
 		return {
@@ -167,7 +165,9 @@
 	 * @summary 展示目录弹窗
 	 */
 	function handleShow(data) {
+    console.log('33333',data)
 		getCatalogue().then(([err, wlist]) => {
+      console.log('wlist',wlist)
 			if (err) {
 				return;
 			}

+ 3 - 2
components/catalogue/useCatalogue.js

@@ -3,7 +3,8 @@ import {
 	toRefs
 } from "vue";
 import {
-	catchError
+	catchError,
+	getDataFromStr
 } from "@/utils/common.js"
 import * as httpCatalogue from "@/api/catalogue.js"
 import cacheManager from "@/utils/cacheManager";
@@ -26,7 +27,7 @@ export function useCatalogue() {
 			const auth = cacheManager.get('auth');
 			const { levelId:levelId, subjectId:subjectId } = auth
 			data.subjectId = subjectId || null;
-			data.levelId = levelId || null;
+			data.levelId = getDataFromStr(levelId)[0] || null;
 		} else {
 			data.subjectId = subjectId || null;
 			data.levelId = levelId || null;

+ 10 - 17
pages/study/index.vue

@@ -28,7 +28,7 @@
 		<!-- 蛋 -->
 		<egg-dialog ref="eggDialogRef" @eggBtn="eggBtn"></egg-dialog>
 		<catalogue ref="catalogueRef" :list=zhangList @change-zhang="handleChangeZhang"
-			@listSelectJieClick="listSelectJieClick"></catalogue>
+			></catalogue>
 		<CustomTabBar :levelId="levelId" :currentTabNumber="0" :subjectId="subjectId" :typeId="typeId"
 			:tipFlag="tipFlag">
 		</CustomTabBar>
@@ -94,6 +94,7 @@
 	} from "@/utils/common";
 	import cacheManager from "@/utils/cacheManager.js";
 	import TipDialog from "../../components/dialog/tipDialog";
+  import {getDataFromStr} from "../../utils/common";
 	const tipContent = '是否前往开通付费?'; //当前产品
 	const goPayDialogRef = ref(null);
 	const youkeDialogRef = ref(null);
@@ -147,17 +148,6 @@
 		getLoginInit()
 	})
 
-	function listSelectJieClick(item, data, index) {
-
-		if (cacheManager.get('auth')) {
-			cacheManager.updateObject('auth', {
-				currentZhang: zhangList.value.findIndex(citem => citem.zhangId == item.zhangId),
-				zhangId: item.zhangId
-			})
-		}
-
-		listClick(data, item, index);
-	}
 
 	function BanbenConfirmBtn() {
 		const systemInfo = uni.getSystemInfoSync();
@@ -496,13 +486,16 @@
 	}
 
 	function handleChangeZhang(data) {
-		console.log(data);
 		const authCode = getUserIdentity();
 		if (authCode !== 'Visitor') {
-			cacheManager.updateObject('auth', {
-				zhangId: data.zhangId,
-				currentZhang: zhangList.value.findIndex(citem => citem.zhangId == data.zhangId),
-			})
+      if (currentProduct.value == 2 && typeId.value == 1) {
+        // 专属与新英语切换版本时需要修改levelId 值,重组版本zhangId
+        const authData = cacheManager.get('auth');
+        const levelIdData = getDataFromStr(authData.levelId)[0];
+        cacheManager.updateObject('auth', {levelId: levelIdData+','+data.zhangId})
+      } else {
+        cacheManager.updateObject('zhangInfo', { curZhangId: data.zhangId })
+      }
 		}
 		currentDuration.value = 0
 		setTimeout(() => {

+ 1 - 1
utils/common.js

@@ -76,7 +76,7 @@ export function getUserIdentity() {
 	const auth = cacheManager.get('auth');
 	if(auth.subjectId == 2 && auth.typeId == 1){
 	if (auth) {
-		const arr = auth.levelId.split(",");
+		const arr = getDataFromStr(auth.levelId);
 		if ((auth.levelIdList || []).some(item => item == arr[0])) {
 			// 购买此levelId
 			return 'VIP'