Browse Source

岛页面区分数学缓存和英语缓存

tanxue 4 months ago
parent
commit
e218670bb5
2 changed files with 51 additions and 5 deletions
  1. 11 3
      pages/study/daoTipDialog.vue
  2. 40 2
      pages/study/index.vue

+ 11 - 3
pages/study/daoTipDialog.vue

@@ -1,21 +1,29 @@
 <template>
 	<uni-popup ref="daoTipPopup" type="bottom">
 		<view class="game-popup-box">
-			
-			<view style="background-color: #fff;">123123</view>
-			
+			{{productTip}}
+			<view style="background-color: #fff;" :style="{backgroundImage: 'url(' + productTip + ')'}">123123</view>
+			<view @click="handleClose">我知道了</view>
 		</view>
 	</uni-popup>
 </template>
 
 <script setup>
 	import {ref} from "vue";
+	const props = defineProps({
+	  productTip: {
+	    type: String,
+	    default: ''
+	  },
+	});
 	const daoTipPopup = ref(null);
+	const $emit = defineEmits(['dao-tip-close'])
 	function handleShow() {
 		daoTipPopup.value.open();
 	}
 	function handleClose() {
 		daoTipPopup.value.close();
+		$emit('dao-tip-close');
 	}
 	
 	defineExpose({

+ 40 - 2
pages/study/index.vue

@@ -17,8 +17,10 @@
 	<CustomTabBar :cardId="cardId" :currentTabNumber="0" :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>
+	<dao-tip-dialog ref="daoTipDialogRef" v-if="showDaoTip" :productTip="productTipImg" @dao-tip-close="daoTipClose"></dao-tip-dialog>
 </template>
 <script setup>
+	import daoTipDialog from './daoTipDialog.vue';
 	import {
 		userZhangInfo,
 		userLocate,
@@ -94,10 +96,46 @@
 		1: ' 数学',
 		2: ' 英语'
 	};
+	
+	const daoTipDialogRef = ref(null);
+	const showDaoTip = ref(true);
+	const productTipImg = ref('');
+		
 	onLoad((options) => {
-		init(options)
+		init(options);
+		getProjectImg();
 	})
-
+	function getProjectImg(){
+		if(currentProduct.value ==1){
+			// 数学
+			productTipImg.value = 'static/images/study/shuxue/study-wrap-bj.png';
+			getBj('shuxue')
+		}else if(currentProduct.value ==2){
+			// 英语
+			productTipImg.value = 'static/images/study/yingyu/test-item-active.png'
+			getBj('yingyu');
+		}
+	}
+	function getBj(data){
+		let bjType =cacheManager.get('dao-tip')[data];
+		if(bjType!=='has'){
+			nextTick(() => {
+				daoTipDialogRef.value.handleShow();
+			})
+		}
+	}
+	function daoTipClose(){
+		if(cacheManager.get('auth')){
+			// 非游客 记缓存
+			if(currentProduct.value ==1){
+				// 数学
+				cacheManager.updateObject('dao-tip',{shuxue:'has'})
+			}else if(currentProduct.value ==2){
+				// 英语
+				cacheManager.updateObject('dao-tip',{yingyu:'has'})
+			}
+		}
+	}
 	function onChangeTab(e) {
 		console.log('e',e);	
 		console.log(e.detail.current);