wangguoyu 5 달 전
부모
커밋
b74f9b616b
1개의 변경된 파일81개의 추가작업 그리고 68개의 파일을 삭제
  1. 81 68
      pages/study/index.vue

+ 81 - 68
pages/study/index.vue

@@ -1,15 +1,16 @@
 <template>
-		<shuxueZhangjie v-if="currentProduct ==1" @clickGradeTerm="clickGradeTerm" @onLeft="onLeft" @onRight="onRight"
-			@handleCheckCatalogue="handleCheckCatalogue" @listClick="listClick" :options="infoData">
-		</shuxueZhangjie>
-		<yingyuZhangjie v-if="currentProduct ==2" @clickGradeTerm="clickGradeTerm" @onLeft="onLeft" @onRight="onRight"
-			@handleCheckCatalogue="handleCheckCatalogue" @listClick="listClick" :options="infoData">
-		</yingyuZhangjie>
-		<!-- 蛋 -->
-		<egg-dialog ref="eggDialogRef" @eggBtn="eggBtn"></egg-dialog>
-		<catalogue ref="catalogueRef" @change-zhang="handleChangeZhang"></catalogue>
-		<CustomTabBar :cardId="cardId" :nianji="nianji" :zhangId="zhangId"></CustomTabBar>
-		<tip-small-dialog ref="goPayDialogRef" @confirm-btn="goPayPage" :content="tipContent"></tip-small-dialog>
+	<shuxueZhangjie v-if="currentProduct ==1" @clickGradeTerm="clickGradeTerm" @onLeft="onLeft" @onRight="onRight"
+		@handleCheckCatalogue="handleCheckCatalogue" @listClick="listClick" :options="infoData">
+	</shuxueZhangjie>
+	<yingyuZhangjie v-if="currentProduct ==2" @clickGradeTerm="clickGradeTerm" @onLeft="onLeft" @onRight="onRight"
+		@handleCheckCatalogue="handleCheckCatalogue" @listClick="listClick" :options="infoData">
+	</yingyuZhangjie>
+	<!-- 蛋 -->
+	<egg-dialog ref="eggDialogRef" @eggBtn="eggBtn"></egg-dialog>
+	<catalogue ref="catalogueRef" @change-zhang="handleChangeZhang"></catalogue>
+	<CustomTabBar :cardId="cardId" :nianji="nianji" :zhangId="zhangId"></CustomTabBar>
+	<tip-small-dialog ref="goPayDialogRef" @confirm-btn="goPayPage" :content="tipContent"></tip-small-dialog>
+	<tip-middle-dialog ref="youkeDialogRef" @confirm-btn="ykConfirm" :content="YouKeContent"></tip-middle-dialog>
 </template>
 <script setup>
 	import {
@@ -29,27 +30,31 @@
 		onLoad
 	} from '@dcloudio/uni-app';
 	import catalogue from "@/components/catalogue/catalogue.vue";
-	import CustomTabBar from '@/components/custom-tabbar/custom-tabbar.vue';
-		import tipSmallDialog from '@/components/dialog/tipSmallDialog.vue'
-		
-	import shuxueZhangjie from './product/shuxue.vue';
-	import yingyuZhangjie from './product/yingyu.vue';
-	
+	import CustomTabBar from '@/components/custom-tabbar/custom-tabbar.vue';
+	import tipSmallDialog from '@/components/dialog/tipSmallDialog.vue'
+	import tipMiddleDialog from '@/components/dialog/tipMiddleDialog.vue';
+
+	import shuxueZhangjie from './product/shuxue.vue';
+	import yingyuZhangjie from './product/yingyu.vue';
+
 	import {
 		useTabBarHistory
 	} from '@/utils/emitEvents.js';
 	import eggDialog from './eggDialog.vue'
 	import {
-		toast,getUserIdentity
+		toast,
+		getUserIdentity
 	} from "@/utils/common";
 	import cacheManager from "@/utils/cacheManager.js";
-	const tipContent = '付费章节,是否前往开通付费?';  //当前产品
-	const goPayDialogRef = ref(null);
-	const eggDialogRef = ref(null);
-	const zhangId = ref(null); //游客使用
-	const nianji = ref(null);//游客使用
-	const cardId = ref(null);//游客使用
-	const catalogueRef = ref(null);
+	const tipContent = '付费章节,是否前往开通付费?'; //当前产品
+	const goPayDialogRef = ref(null);
+	const youkeDialogRef = ref(null);
+	const eggDialogRef = ref(null);
+	const YouKeContent = '您当前是游客身份,登录后才能浏览内容,现在去登录?';
+	const zhangId = ref(null); //游客使用
+	const nianji = ref(null); //游客使用
+	const cardId = ref(null); //游客使用
+	const catalogueRef = ref(null);
 	const currentProduct = ref(null);
 	const selectZhang = ref(null);
 	let infoData = reactive({
@@ -66,8 +71,8 @@
 		init(options)
 	})
 
-	function init(options){
-		if (cacheManager.get('auth')) {
+	function init(options) {
+		if (cacheManager.get('auth')) {
 			currentProduct.value = cacheManager.get('auth').cardId;
 			//会员 取auth
 			selectZhang.value = cacheManager.get('auth');
@@ -78,16 +83,16 @@
 			getZhangInfo()
 			// 蛋
 			// eggDialogRef.value.eggShow();
-		} else {
-			zhangId.value = options.zhangId
-			nianji.value = options.nianji
-			cardId.value = options.cardId
+		} else {
+			zhangId.value = options.zhangId
+			nianji.value = options.nianji
+			cardId.value = options.cardId
 			currentProduct.value = options.cardId
 			// 未登录 游客 
 			getCommonZhang(options)
 		}
 	}
-	
+
 	function getZhangInfo(data) {
 		let req = {
 			nianji: selectZhang.value.nianji,
@@ -116,11 +121,11 @@
 	}
 
 	function getCommonZhang(data) {
-   
+
 		let req = {
 			nianji: data.nianji,
 			cardId: data.cardId,
-			zhangId:data.zhangId,
+			zhangId: data.zhangId,
 		}
 		getCommonZhangInfo(req).then(res => {
 			infoData.jieList = res.data.jieList
@@ -184,11 +189,11 @@
 	function getNewData() {
 		selectZhang.value.zhangId = cacheManager.get('zhangInfo').zhangId;
 		selectZhang.value.cardId = cacheManager.get('zhangInfo').cardId;
-		selectZhang.value.nianji = cacheManager.get('zhangInfo').nianji;
-		cacheManager.updateObject('auth', {
-		  zhangId: selectZhang.value.zhangId,
-		  cardId: selectZhang.value.cardId,
-		  nianji: selectZhang.value.nianji,
+		selectZhang.value.nianji = cacheManager.get('zhangInfo').nianji;
+		cacheManager.updateObject('auth', {
+			zhangId: selectZhang.value.zhangId,
+			cardId: selectZhang.value.cardId,
+			nianji: selectZhang.value.nianji,
 		})
 
 	}
@@ -205,54 +210,56 @@
 
 		})
 	}
-	function goPayPage(){
-		
+
+	function goPayPage() {
+
 	}
+
 	function handleChangeZhang(data) {
 		selectZhang.value = data;
-    const authCode = getUserIdentity();
-    if (authCode !== 'Visitor') {
-      cacheManager.updateObject('auth', {
-        zhangId: data.zhangId
-      })
-    }
+		const authCode = getUserIdentity();
+		if (authCode !== 'Visitor') {
+			cacheManager.updateObject('auth', {
+				zhangId: data.zhangId
+			})
+		}
 		init()
 	}
 
 	function goKaoshi(data) {
 		uni.redirectTo({
-			url: `/pages/unitTest/index?jieNumber=`+data.number
+			url: `/pages/unitTest/index?jieNumber=` + data.number
 		})
 	}
-	function goLookShipin(data) {
-		if (!cacheManager.get('auth') ){
-			
-			uni.redirectTo({
-				url: '/pages/study/lookShipin?jieNumber='+data.number+ '&cardId=' + cardId.value+ '&nianji=' + nianji.value+ '&zhangId=' + zhangId.value+ '&videoId=' + infoData.jieList[0].videoId
-			})
-			return;
-		}else{
-			uni.redirectTo({
-				url: '/pages/study/lookShipin?jieNumber='+data.number
-			})
-		}
-		
 
-	}
-	function listClick(data, index) {
-		if (!cacheManager.get('auth')&&data.number != 1) {
-			toast("当前为游客模式请登录!")
+	function goLookShipin(data) {
+		if (!cacheManager.get('auth')) {
+
 			uni.redirectTo({
-				url: '/pages/login/index'
+				url: '/pages/study/lookShipin?jieNumber=' + data.number + '&cardId=' + cardId.value + '&nianji=' +
+					nianji.value + '&zhangId=' + zhangId.value + '&videoId=' + infoData.jieList[0].videoId
 			})
 			return;
+		} else {
+			uni.redirectTo({
+				url: '/pages/study/lookShipin?jieNumber=' + data.number
+			})
+		}
+
+
+	}
+
+	function listClick(data, index) {
+		if (!cacheManager.get('auth') && data.number != 1) {
+			youkeDialogRef.value.handleShow();
+			return;
 		}
 		const authCode = getUserIdentity();
-		if (!(authCode=='VIP' || data.number == 1)) {
+		if (!(authCode == 'VIP' || data.number == 1)) {
 			goPayDialogRef.value.handleShow();
 			return false
 		}
-		if (data.number == infoData.jieList.length &&data.jieName=='单元测试') {
+		if (data.number == infoData.jieList.length && data.jieName == '单元测试') {
 			// 最后一项
 			goKaoshi(data)
 		} else {
@@ -269,6 +276,12 @@
 			url: `/pages/selectGradesTerms/index`,
 		})
 	}
+	// 游客弹窗---确定
+	function ykConfirm() {
+		uni.redirectTo({
+			url: '/pages/login/index'
+		});
+	}
 
 	function eggBtn() {
 		console.log('点击:开启提分之旅');