|
|
@@ -348,12 +348,14 @@ async function handlePickOrWaterOrFertilize(action: 'pick' | 'water' | 'fertiliz
|
|
|
switch (action) {
|
|
|
case 'pick':
|
|
|
const res = await TreeApi.pick(villageStore.currentVillage.id);
|
|
|
+ await refreshVillageTreeInfo();
|
|
|
hideLoading();
|
|
|
villageTreeRef.value?.playStateAnimation('collect');
|
|
|
toast(res, 4000);
|
|
|
break;
|
|
|
case 'water': {
|
|
|
await TreeApi.water(villageStore.currentVillage.id);
|
|
|
+ await refreshVillageTreeInfo();
|
|
|
hideLoading();
|
|
|
villageTreeRef.value?.playStateAnimation('water');
|
|
|
lastRefreshAction.value = 'water';
|
|
|
@@ -361,13 +363,13 @@ async function handlePickOrWaterOrFertilize(action: 'pick' | 'water' | 'fertiliz
|
|
|
}
|
|
|
case 'fertilize': {
|
|
|
await TreeApi.fertilize(villageStore.currentVillage.id);
|
|
|
+ await refreshVillageTreeInfo();
|
|
|
hideLoading();
|
|
|
villageTreeRef.value?.playStateAnimation('fertilize');
|
|
|
lastRefreshAction.value = 'fertilize';
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- refreshVillageTreeInfo();
|
|
|
} catch (e) {
|
|
|
hideLoading();
|
|
|
if (e instanceof RequestApiError && typeof e.data === 'string') {
|
|
|
@@ -428,16 +430,21 @@ async function getFruits() {
|
|
|
}
|
|
|
}
|
|
|
async function refreshVillageTreeInfo() {
|
|
|
+ await waitTimeOut(1000);
|
|
|
const oldVillage = await villageStore.reloadVillageInfo();
|
|
|
if (oldVillage) {
|
|
|
const newVillage = requireNotNull(villageStore.currentVillage);
|
|
|
const oldLight = oldVillage.lightTotal;
|
|
|
const oldTreeName = oldVillage.treeName;
|
|
|
+
|
|
|
lastAddLight.value = Math.max(0, newVillage.lightTotal - oldLight);
|
|
|
lastLevelUp.value = oldTreeName !== newVillage.treeName ? newVillage.treeName : '';
|
|
|
+
|
|
|
+ console.log('操作后刷新村社信息', 'lastAddLight', lastAddLight.value, 'lastLevelUp', lastLevelUp.value);
|
|
|
} else {
|
|
|
lastAddLight.value = 0;
|
|
|
lastLevelUp.value = '';
|
|
|
+ console.log('操作后刷新村社信息', 'no oldVillage');
|
|
|
}
|
|
|
}
|
|
|
|