| 
					
				 | 
			
			
				@@ -15,6 +15,7 @@ import cacheManager from "@/utils/cacheManager.js" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 export function useGame() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	const UserCode = getUserIdentity(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	const auth = cacheManager.get('auth'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	const data = reactive({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			credit: 0, // 当前积分 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			growth: 0, // 成长值 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -22,9 +23,13 @@ export function useGame() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			progress:0, // 当前进度 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			shiwuId:null // 上一次食物 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	}) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	if (auth) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		data.growthType = auth.growthType; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	async function getGameInfo() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		const [err, info] = await catchError(getYouxiInfo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if (err) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			toast("请求异常,请稍后尝试"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -39,14 +44,14 @@ export function useGame() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		data.shiwuId = shiwuId; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	async function handleWeishi(cShiwuId, doFinish) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		const [err, info] = await catchError(getYouxiWeishi({shiwuId:cShiwuId})); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	async function handleWeishi({id:cShiwuId,credit:cCredit}, doFinish) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		const [err, info] = await catchError(getYouxiWeishi({shiwuId:cShiwuId,credit:cCredit })); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if (err) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			toast("请求异常,请稍后尝试"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		const { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			credit,growth,growthType,progress,shiwuId,changeFlag 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			credit,growth,growthType,progress,shiwuId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} = info; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		data.credit = credit; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -54,10 +59,8 @@ export function useGame() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		data.progress = progress; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		data.shiwuId = shiwuId; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		if (changeFlag) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			// 更新成长状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			updateCachegrowthType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		// 更新成长状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		updateCachegrowthType(growthType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		doFinish && doFinish(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 |