wangguoyu 1 month ago
parent
commit
d662bd44dd
3 changed files with 25 additions and 12 deletions
  1. 2 2
      App.vue
  2. 22 9
      pages/chanpinneirong/index.vue
  3. 1 1
      pages/login/login.vue

+ 2 - 2
App.vue

@@ -22,10 +22,10 @@
 			if (cacheManager.get('auth')) {
 			if (cacheManager.get('auth')) {
 				banbenImpinfo({}).then(res => {
 				banbenImpinfo({}).then(res => {
 					if (res.code == 0) {
 					if (res.code == 0) {
-						//学过
+						//学过 增加customType  = 1 是App级别的
 						if (res.data.typeId != 0) {
 						if (res.data.typeId != 0) {
 							uni.reLaunch({
 							uni.reLaunch({
-								url: `/pages/chanpinneirong/index?banbenId=${res.data.banbenId}&danyuanId=${res.data.danyuanId}&typeId=${res.data.typeId}`,
+								url: `/pages/chanpinneirong/index?banbenId=${res.data.banbenId}&danyuanId=${res.data.danyuanId}&typeId=${res.data.typeId}&customType=1`,
 								success() {
 								success() {
 									plus.navigator.closeSplashscreen();
 									plus.navigator.closeSplashscreen();
 								}
 								}

+ 22 - 9
pages/chanpinneirong/index.vue

@@ -54,7 +54,7 @@
 			</view>
 			</view>
 
 
 		</view>
 		</view>
-		
+
 
 
 		<!-- <scroll-view scroll-y class="scroll-view" :scroll-top="scrollTop" @scroll="onScroll"> </scroll-view> -->
 		<!-- <scroll-view scroll-y class="scroll-view" :scroll-top="scrollTop" @scroll="onScroll"> </scroll-view> -->
 
 
@@ -84,7 +84,9 @@
 				danyuanId: '',
 				danyuanId: '',
 				typeId: '',
 				typeId: '',
 				fontDanyuanId: '',
 				fontDanyuanId: '',
-				nextDanyuanId: ''
+				nextDanyuanId: '',
+				customType: '',
+				cacheManagerLocal:null
 
 
 
 
 
 
@@ -104,10 +106,21 @@
 
 
 		onLoad(options) {
 		onLoad(options) {
 			console.log('options', options);
 			console.log('options', options);
-			this.typeId = options.typeId
-			this.danyuanId = options.danyuanId
-			this.banbenId = options.banbenId
-			this.loadDataFromApi()
+			this.customType = options.customType
+			if (this.customType) {
+				this.typeId = options.typeId
+				this.danyuanId = options.danyuanId
+				this.banbenId = options.banbenId
+				this.loadDataFromApi()
+			} else {
+				this.typeId  = cacheManager.get('auth').typeId
+				this.cacheManagerLocal =  cacheManager.get('xuexi-'+this.typeId)
+				// 使用缓存
+				this.danyuanInfo = this.cacheManagerLocal.data
+				this.fontDanyuanId = this.cacheManagerLocal.data.fontDanyuanId
+				this.nextDanyuanId = this.cacheManagerLocal.data.nextDanyuanId
+				this.dagangList = this.cacheManagerLocal.data.dagangList || []
+			}
 		},
 		},
 
 
 		methods: {
 		methods: {
@@ -126,9 +139,9 @@
 					cacheManager.set('xuexi-' + this.typeId, res.data)
 					cacheManager.set('xuexi-' + this.typeId, res.data)
 					cacheManager.updateObject('auth', {
 					cacheManager.updateObject('auth', {
 						typeId: this.typeId,
 						typeId: this.typeId,
-						banbenId:this.banbenId,
-						danyuanId:this.danyuanId
-						
+						banbenId: this.banbenId,
+						danyuanId: this.danyuanId
+
 					})
 					})
 					// 初始化当前单元
 					// 初始化当前单元
 					// if (this.danyuanList.length > 0) {
 					// if (this.danyuanList.length > 0) {

+ 1 - 1
pages/login/login.vue

@@ -136,7 +136,7 @@
 									}else{
 									}else{
 										// 学过直接到学习页面
 										// 学过直接到学习页面
 										uni.redirectTo({
 										uni.redirectTo({
-											url: `/pages/chanpinneirong/index?banbenId=${res.data.banbenId}&danyuanId=${res.data.danyuanId}&typeId=${res.data.typeId}`,
+											url: `/pages/chanpinneirong/index?banbenId=${res.data.banbenId}&danyuanId=${res.data.danyuanId}&typeId=${res.data.typeId}&customType=2`,
 										})
 										})
 									}
 									}
 								}
 								}