瀏覽代碼

突破调整

wangxy 4 月之前
父節點
當前提交
e537a65052

+ 3 - 3
pages/game/components/constantConfig.js

@@ -2,17 +2,17 @@
 export const foodSpeciesList = [{
 		id: 100,
 		imgUrl: '/static/images/game/food-img1.png',
-		credit: 100
+		credit: 30
 	},
 	{
 		id: 300,
 		imgUrl: '/static/images/game/food-img2.png',
-		credit: 300
+		credit: 100
 	},
 	{
 		id: 600,
 		imgUrl: '/static/images/game/food-img3.png',
-		credit: 600
+		credit: 300
 	}
 ]
 

+ 0 - 1
pages/game/components/foodSelect.vue

@@ -47,7 +47,6 @@
 		popupRef.value.open();
 	}
 	function handleClose() {
-		console.log(123)
 		popupRef.value.close();
 	}
 	function handleSelectFood(shiwu) {

+ 2 - 2
pages/game/components/goose.vue

@@ -1,7 +1,7 @@
 <template>
 	<view>
-    <up-line-progress v-if="growthType!==3" :percentage="20" activeColor="#54e1fe" class="game-progress-box">
-      <text class="u-percentage-slot">20</text>
+    <up-line-progress v-if="growthType!==3" :percentage="progress" activeColor="#54e1fe" class="game-progress-box">
+      <!-- <text class="u-percentage-slot">{{progress}}</text> -->
     </up-line-progress>
 		<image :src="imgUrl" class="goose-img-box"></image>
 	</view>

+ 1 - 1
pages/game/index.vue

@@ -74,7 +74,7 @@
 	}
 	
 	function onWeiShi(data) {
-		handleWeishi(data.id, () => {
+		handleWeishi(data, () => {
 			foodSelectRef.value.handleClose();
 		})
 	}

+ 10 - 7
pages/game/useGame.js

@@ -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();
 	}