wangguoyu 5 mesiacov pred
rodič
commit
1f3c12887d
2 zmenil súbory, kde vykonal 94 pridanie a 23 odobranie
  1. 3 2
      pages/study/index.vue
  2. 91 21
      pages/study/product/yingyu.vue

+ 3 - 2
pages/study/index.vue

@@ -231,13 +231,14 @@
 		})
 	}
 	function listClick(data, index) {
-		if (!cacheManager.get('auth')) {
+		if (!cacheManager.get('auth')&&data.number != 1) {
 			toast("当前为游客模式请登录!")
 			uni.redirectTo({
 				url: '/pages/login/index'
 			})
 			return;
-		}
+		}
+		debugger
 		const authCode = getUserIdentity();
 		if (!(authCode=='VIP' || data.number == 1)) {
 			goPayDialogRef.value.handleShow();

+ 91 - 21
pages/study/product/yingyu.vue

@@ -1,26 +1,37 @@
 <template>
-	<view>
-		英语	英语	英语	英语	英语
+	<view class="ezy-shuxue-study-page">
 		<view class="study-school-year" @click="clickGradeTerm">{{gradeTerm}}</view>
 		<view class="ezy-study-wrap" @touchstart="onTouchStart" @touchend="onTouchEnd">
 			<view class="chapter-box" @click="handleCheckCatalogue">{{options.numberStr}}</view>
-			<view class="chapter-title-box">{{options.zhangName}}</view>
+			<view @click="handleCheckCatalogue" :class="getTitleClass(options.zhangName)">{{getZhangName(options.zhangName)}}</view>
 			<view>
+				<!-- 小岛 -->
 				<view class="brand-item" v-for="(item, index) in options.jieList" :key="item.jieId"
-					@click="listClick(item, index)" :class="{ 'brand-active': index === 0 }">
-					<view class="brand-icon">
-						{{ item.number }}
+					@click="listClick(item, index)" :class="getClass(options.jieList,index,isVip)">
+					<view v-if="isVip === 'VIP'">
+						<!-- 序号 -->
+						<view class="brand-icon" v-if="item.studyFlag===0">{{ item.number }}</view>
+						<!-- 星星 -->
+						<view class="brand-finish-icon" v-if="item.studyFlag===1"></view>
+						<!-- 动物类型 -->
+						<view v-if="item.daeFlag && growthType ==0" class="animal-img dan-img"></view>
+						<view v-if="item.daeFlag && growthType ==1" class="animal-img xiao-e-img"></view>
+						<view v-if="item.daeFlag && growthType ==2" class="animal-img zhong-e-img"></view>
+						<view v-if="item.daeFlag && growthType ==3" class="animal-img da-e-img"></view>
+						<!-- 节名称 -->
+						<view class="brand-content">{{ item.jieName }}</view>
 					</view>
-					<view v-if="item.daeFlag">
-					<template v-if="growthType ==0">蛋</template>
-					<template v-if="growthType ==1">小鹅</template>
-					<template v-if="growthType ==2">中鹅</template>
-					<template v-if="growthType ==3">大鹅</template>
-					</view>
-					<!-- 如果用户不是 VIP 且不是第一项,则添加 brand-lock 类 -->
-					<view v-if="!(isVip=='VIP' || item.number == 'Lesson 1')" class="brand-lock"></view>
-					<view class="brand-content">
-						{{ item.jieName }}
+					<view v-if="isVip !== 'VIP'">
+						<!-- 序号或锁 -->
+						<view v-if="item.number ==1" class="brand-icon">{{ item.number }}</view>
+						<view v-if="item.number !=1" class="brand-lock"></view>
+						<!-- 动物类型 -->
+						<view v-if="item.daeFlag && growthType ==0" class="animal-img dan-img"></view>
+						<view v-if="item.daeFlag && growthType ==1" class="animal-img xiao-e-img"></view>
+						<view v-if="item.daeFlag && growthType ==2" class="animal-img zhong-e-img"></view>
+						<view v-if="item.daeFlag && growthType ==3" class="animal-img da-e-img"></view>
+						<!-- 节名称 -->
+						<view class="brand-content"> {{ item.jieName }} </view>
 					</view>
 				</view>
 			</view>
@@ -75,7 +86,68 @@
 	function listClick(data) {
 		$emit('listClick', data);
 	}
-
+	// 获取章name
+	function getZhangName(data){
+		if(data.length <=9){
+			return data
+		}else{
+			return getZhangContent(data);
+		}
+	}
+	
+	// 章换行显示
+	function getZhangContent(data){
+		console.log(data.length,'data.length');
+		let length = data.length;
+		// 初始将字符串平分成两半
+		let halfLength = Math.floor(length / 2); 
+		
+		// 插入换行符
+		let firstLine = data.slice(0, halfLength);
+		let secondLine = data.slice(halfLength);
+		console.log(firstLine + '\n' + secondLine,'firstLine + + secondLine');
+		return firstLine + '\n' + secondLine;
+	}
+	
+	// 章class
+	function getTitleClass(data){
+		console.log(data.length,'getTitleClass');
+		if(data.length <=5){
+			return 'chapter-title-box chapter-small-title-box'
+		}else if(data.length <=9){
+			return 'chapter-title-box chapter-middle-title-box'
+		}else if(data.length >9){
+			return 'chapter-title-box chapter-big-title-box'
+		}
+	}
+	
+	// 获取节class
+	function getClass (data,index,isVip){
+		console.log(data,index,isVip,'data,index,isVip');
+		let brandActive = '';
+		if(isVip==='VIP'){
+			brandActive = 'brand-active';
+		}else{
+			brandActive = '';
+		}
+		let indexLast = data.length -1;
+		// 判断最后一个为名称是否为单元测试,是单元测试则返回ceshi-jie
+		if(index===indexLast && data[data.length -1].jieName =='单元测试'){
+			return 'ceshi-brand-item' +' '+ brandActive;
+		}else{
+			return getJieClass(data,index,brandActive)
+		}
+	}
+	// 根据获取节字数获取class
+	function getJieClass(data,index,active){
+		let itemJieName = data[index].jieName.length;
+		if(itemJieName > 7){
+			return 'big-brand-item' +' '+ active;
+		}else{
+			return 'small-brand-item' +' '+ active;
+		}
+	}
+	
 	function translateData(data) {
 		return gradeMapping[data.nianji] + termMapping[data.cardId]
 	}
@@ -135,12 +207,10 @@
 			    return false;
 			});
 		}
-		console.log(data);
-		console.log("1111");
 	}
 	watch(() => props.options, (newVal, oldVal) => {
-		console.log('New options:', newVal);
-		console.log('Old options:', oldVal);
+	//	console.log('New options:', newVal);
+	//	console.log('Old options:', oldVal);
 		// 在这里可以根据新的 options 做一些操作,比如发起请求等
 		gradeTerm.value = translateData(newVal);
 		dataRecom(newVal)