wangguoyu 5 dienas atpakaļ
vecāks
revīzija
2e9452dffd
5 mainītis faili ar 57 papildinājumiem un 62 dzēšanām
  1. 2 2
      config.js
  2. 1 1
      pages/login/login.vue
  3. 47 51
      pages/study/index.vue
  4. 4 5
      pages/study/product/shuxue.vue
  5. 3 3
      utils/common.js

+ 2 - 2
config.js

@@ -1,7 +1,7 @@
 // 应用全局配置
 export default   {
-  baseUrl: 'https://goosechampion.com/api',
-  // baseUrl: 'http://localhost:8080',
+ // baseUrl: 'https://goosechampion.com/api',
+   baseUrl: 'https://kf1.mtavip.com/api',
   // 应用信息
   appInfo: {
     // 应用名称

+ 1 - 1
pages/login/login.vue

@@ -117,7 +117,7 @@
 				login(req).then(res => {
 					if (res.code == 0) {
 						cacheManager.set('auth', res.data)
-						if (res.data.cardId == 0) {
+						if (res.data.levelId == 0) {
 							uni.redirectTo({
 								url: `/pages/selectGradesTerms/index`
 							})

+ 47 - 51
pages/study/index.vue

@@ -74,7 +74,9 @@
 	const catalogueRef = ref(null);
 	const youkeZhangInfoData = ref(null);
 	const currentProduct = ref(null);
-	const selectZhang = ref(null);
+	const localAuth = ref(null);
+	const levelId = ref(null);
+	const typeId = ref(null);
 	const zhangList = ref(null);
 	const gradeTerm = ref(null);
 	let infoData = reactive({
@@ -87,14 +89,6 @@
 		zhangName: '',
 		numberStr: '',
 	});
-	const gradeMapping = {
-		1: 'L1',
-		2: 'L2',
-		3: 'L3',
-		4: 'L4',
-		5: 'L5',
-		6: 'L6'
-	};
 
 	const termMapping = {
 		1: ' 数学',
@@ -177,39 +171,42 @@
 		}
 	}
 
-	function init(options) {
+	function init(options) {
+		// FIXME   待修改 部分字段写死
 		if (cacheManager.get('auth')) {
-			//会员 取auth
-			selectZhang.value = cacheManager.get('auth');
-			currentProduct.value = cacheManager.get('auth').cardId;
+			levelId.value = options.levelId
+			typeId.value = options.typeId //1新2旧
+			localAuth.value = cacheManager.get('auth');
+		//	currentProduct.value = cacheManager.get('auth').subjectId;
+			currentProduct.value = 1;
 			//let currentObject = this.cacheZhangInfo.jieList.find(item => item.jieId == this.jieId);
-			console.log(selectZhang.value);
+			console.log(localAuth.value);
 			// 已登录
-			if (selectZhang.value.firstLogin) {
+			if (localAuth.value.firstLogin) {
 				nextTick(() => {
 					eggDialogRef.value.eggShow();
 				})
 			}
-			// cacheManager.set('daoPageCache',{isCache:true})
-			if(!cacheManager.get('daoPageCache').isCache){
-					getZhangInfo()
-				
-			}else{
-					console.log('shiyonghuancun');
-					translateData(cacheManager.get('auth'))
-					zhangList.value = cacheManager.get('zhangInfo').zhangList
-					current.value = cacheManager.get('auth').currentZhang
-					infoData.zhangId = cacheManager.get('zhangInfo').zhangList[current.value].zhangId
-					recordZhangJie()	
-			}
+			getZhangInfo()
+			// if(!cacheManager.get('daoPageCache').isCache){
+			// 		console.log('不实用换葱');
+			// 		getZhangInfo()
+			// }else{
+			// 		console.log('shiyonghuancun');
+			// 		translateData(cacheManager.get('auth'))
+			// 		zhangList.value = cacheManager.get('zhangInfo').zhangList
+			// 		current.value = cacheManager.get('auth').currentZhang
+			// 		infoData.zhangId = cacheManager.get('zhangInfo').zhangList[current.value].zhangId
+			// 		recordZhangJie()	
+			// }
 			
-			// 已登录付费未支付选择返回 -> 恢复弹窗
-			if (options.studyWithCatalgue) {
-				// 展开弹窗
-				nextTick(() => {
-					catalogueRef.value.showPopup({zhangId: infoData.zhangId});
-				}) 
-			}
+			// // 已登录付费未支付选择返回 -> 恢复弹窗
+			// if (options.studyWithCatalgue) {
+			// 	// 展开弹窗
+			// 	nextTick(() => {
+			// 		catalogueRef.value.showPopup({zhangId: infoData.zhangId});
+			// 	}) 
+			// }
 		} else {
 			zhangId.value = options.zhangId
 			nianji.value = options.nianji
@@ -223,15 +220,14 @@
 	}
 
 	function getZhangInfo(data) {
-		let req = {
-			nianji: selectZhang.value.nianji,
-			cardId: selectZhang.value.cardId,
-			zhangId: selectZhang.value.zhangId,
+		let req = {
+			levelId:7
 		}
 		userZhangInfo(req).then(res => {
 			cacheManager.set('zhangInfo', res.data)
-			let zhang = cacheManager.get('zhangInfo').zhangList.findIndex(zhang => zhang.zhangId == selectZhang
-				.value.zhangId);
+			let zhang = cacheManager.get('zhangInfo').zhangList.findIndex(zhang => zhang.zhangId == localAuth
+				.value.zhangId);
+				console.log('zhang',zhang);
 			if (zhang != -1) {
 				cacheManager.updateObject('auth', {
 					currentZhang: zhang
@@ -271,10 +267,10 @@
 
 	function recordZhangJie() {
 		let req = {
-			nianji: selectZhang.value.nianji,
+			levelId: levelId.value,
 			userId: cacheManager.get('auth').userId,
 			zhangId: infoData.zhangId,
-			cardId: selectZhang.value.cardId,
+			subjectId: currentProduct.value
 
 		}
 		userLocate(req).then(res => {
@@ -290,7 +286,6 @@
 
 	function handleChangeZhang(data) {
 		console.log(data);
-		selectZhang.value = data;
 		const authCode = getUserIdentity();
 		if (authCode !== 'Visitor') {
 			cacheManager.updateObject('auth', {
@@ -333,30 +328,31 @@
 			})
 		} else {
 			uni.redirectTo({
-				url: '/pages/study/lookShipin?jieId=' + data.jieId
+			url: '/pages/study/lookShipin?jieId=' + data.jieId + '&levelId=' + 7 + '&typeId=' + 2 + '&subjectId=' + 1
 			})
 		}
 	}
 
 	function translateData(data) {
-		gradeTerm.value = termMapping[data.cardId] +' · '+ gradeMapping[data.nianji]
+	//	gradeTerm.value = termMapping[data.subjectId] +' · '+ data.levelName
+		gradeTerm.value = data.levelName
 	}
 
 	function listClick(data,data2,index) {
-		//debugger
-		console.log('data',data);
-		console.log('data2',data2);
-		if ((!cacheManager.get('auth') && data2.number != 1)||(!cacheManager.get('auth') && data.type == 2) ) {
+		console.log('data',data);// 节内容
+		console.log('data2',data2); //章内容
+		if (!cacheManager.get('auth') ) {
 			youkeDialogRef.value.handleShow();
 			return;
 		}
 		const authCode = getUserIdentity();
 		console.log('authCode', authCode);
-		if (!(authCode == 'VIP' || data2.number == 1)) {
+		if (!(authCode == 'VIP' || data.firstFlag == 1)) {
 		//	debugger
 			goPayDialogRef.value.handleShow();
 			return false
-		}
+		}
+		return
 		if (data.type == 2) {
 			// 最后一项
 			goKaoshi(data,index)

+ 4 - 5
pages/study/product/shuxue.vue

@@ -24,10 +24,9 @@
 					</view>
 					<view v-if="isVip == 'Not-Vip'">
 						<!-- 序号或锁 -->
-						<view   class="brand-icon">{{ item.number }}
+						<view v-if="options.number ==1 && item.firstFlag ==1" class="brand-icon">{{ item.number }}
 						</view>
-						<!-- 锁 -->
-						<view   v-if="options.number !='1'" class="brand-lock"></view>
+						<view v-else class="brand-lock"></view>
 						<!-- 箭头 -->
 						<view v-if="item.daeFlag  &&  animalNum == index &&isVip != 'Visitor'" class="brand-arrow">
 						</view>
@@ -173,9 +172,9 @@
 		let brandActive = '';
 		if (isVip === 'VIP') {
 			brandActive = 'brand-active';
-		} else if (data.number == 1 && isVip =='Not-Vip') {
+		} else if (data.number == 1&&item.firstFlag==1 && isVip =='Not-Vip') {
 			brandActive = 'brand-active';
-		} else if (data.number == 1 && isVip =='Visitor' &&item.type ==1) {
+		} else if (data.number == 1&&item.firstFlag==1 && isVip =='Visitor' &&item.type ==1) {
 			brandActive = 'brand-active';
 		} else {
 			brandActive = '';

+ 3 - 3
utils/common.js

@@ -57,11 +57,11 @@ export function catchError(promise) {
 export function getUserIdentity() {
 	const auth = cacheManager.get('auth');
 	if (auth) {
-		if (auth.cardList.some(item => item == auth.cardId)) {
-			// VIP
+		if ((auth.levelIdList || []).some(item => item == auth.levelId)) {
+			// 购买此levelId
 			return 'VIP'
 		}
-		// 非VIP
+		// 无购买此levelId
 		return 'Not-Vip';
 	} else {
 		// 游客