|
@@ -8,6 +8,13 @@
|
|
|
:treeImage="currentVillage.treeImage"
|
|
:treeImage="currentVillage.treeImage"
|
|
|
:treeName="currentVillage.treeName"
|
|
:treeName="currentVillage.treeName"
|
|
|
:treeAnimProps="currentVillage.treeImageAnimProps"
|
|
:treeAnimProps="currentVillage.treeImageAnimProps"
|
|
|
|
|
+ :fruitImage="appConfiguration.tree.fruitImage"
|
|
|
|
|
+ :backgroundImage="appConfiguration.tree.backgroundImage"
|
|
|
|
|
+ :animFertilize="appConfiguration.tree.animFertilize"
|
|
|
|
|
+ :animFertilizeAnimProps="appConfiguration.tree.animFertilizeAnimProps"
|
|
|
|
|
+ :animWater="appConfiguration.tree.animWater"
|
|
|
|
|
+ :animWaterAnimProps="appConfiguration.tree.animWaterAnimProps"
|
|
|
|
|
+ :enable="true"
|
|
|
@fruitPick="handlePick"
|
|
@fruitPick="handlePick"
|
|
|
@waterEnd="handleWaterAnimEnd"
|
|
@waterEnd="handleWaterAnimEnd"
|
|
|
@fertilizeEnd="handleFertilizeAnimEnd"
|
|
@fertilizeEnd="handleFertilizeAnimEnd"
|
|
@@ -34,7 +41,17 @@
|
|
|
</FlexRow>
|
|
</FlexRow>
|
|
|
<Height height="space.lg" />
|
|
<Height height="space.lg" />
|
|
|
<FlexRow position="relative" center gap="gap.md" overflow="visible">
|
|
<FlexRow position="relative" center gap="gap.md" overflow="visible">
|
|
|
- <PopTextAnim :show="Boolean(popAnimText)" :text="popAnimText" @end="popAnimText = ''" />
|
|
|
|
|
|
|
+ <PopTextAnim :show="Boolean(popAnimText)" @end="popAnimText = ''">
|
|
|
|
|
+ <FlexRow
|
|
|
|
|
+ center
|
|
|
|
|
+ borderColor="border.secondary" borderWidth="1px" borderStyle="solid"
|
|
|
|
|
+ gap="gap.md" padding="padding.md" radius="radius.md"
|
|
|
|
|
+ backgroundColor="background.tertiary"
|
|
|
|
|
+ >
|
|
|
|
|
+ <Icon icon="https://xy.wenlvti.net/app_static/images/village/IconLight.png" :size="50" />
|
|
|
|
|
+ <Text :text="popAnimText" fontConfig="contentText" fontSize="30rpx" color="#E79412" />
|
|
|
|
|
+ </FlexRow>
|
|
|
|
|
+ </PopTextAnim>
|
|
|
<Icon icon="https://xy.wenlvti.net/app_static/images/village/IconLight.png" :size="50" />
|
|
<Icon icon="https://xy.wenlvti.net/app_static/images/village/IconLight.png" :size="50" />
|
|
|
<Text :text="`乡源光 ${currentVillage?.lightTotal || 0} ${currentVillage.treeName}`" fontConfig="contentText" fontSize="30rpx" color="#E79412" />
|
|
<Text :text="`乡源光 ${currentVillage?.lightTotal || 0} ${currentVillage.treeName}`" fontConfig="contentText" fontSize="30rpx" color="#E79412" />
|
|
|
</FlexRow>
|
|
</FlexRow>
|
|
@@ -48,14 +65,14 @@
|
|
|
<Image src="https://xy.wenlvti.net/app_static/images/village/IconCollect.png" :width="130" mode="widthFix" />
|
|
<Image src="https://xy.wenlvti.net/app_static/images/village/IconCollect.png" :width="130" mode="widthFix" />
|
|
|
<Text text="拾果" fontConfig="contentText" />
|
|
<Text text="拾果" fontConfig="contentText" />
|
|
|
</Touchable>
|
|
</Touchable>
|
|
|
- <Touchable center direction="column" flexBasis="22%" @click="handleFertilize">
|
|
|
|
|
- <Image src="https://xy.wenlvti.net/app_static/images/village/IconFertilization.png" :width="130" mode="widthFix" />
|
|
|
|
|
- <Text text="施肥" fontConfig="contentText" />
|
|
|
|
|
- </Touchable>
|
|
|
|
|
<Touchable center direction="column" flexBasis="22%" @click="handleWater">
|
|
<Touchable center direction="column" flexBasis="22%" @click="handleWater">
|
|
|
<Image src="https://xy.wenlvti.net/app_static/images/village/IconWatering.png" :width="130" mode="widthFix" />
|
|
<Image src="https://xy.wenlvti.net/app_static/images/village/IconWatering.png" :width="130" mode="widthFix" />
|
|
|
<Text text="浇水" fontConfig="contentText" textAlign="center" />
|
|
<Text text="浇水" fontConfig="contentText" textAlign="center" />
|
|
|
</Touchable>
|
|
</Touchable>
|
|
|
|
|
+ <Touchable center direction="column" flexBasis="22%" @click="handleFertilize">
|
|
|
|
|
+ <Image src="https://xy.wenlvti.net/app_static/images/village/IconFertilization.png" :width="130" mode="widthFix" />
|
|
|
|
|
+ <Text text="施肥" fontConfig="contentText" />
|
|
|
|
|
+ </Touchable>
|
|
|
<Touchable center direction="column" flexBasis="22%" @click="handleGoBless">
|
|
<Touchable center direction="column" flexBasis="22%" @click="handleGoBless">
|
|
|
<Image src="https://xy.wenlvti.net/app_static/images/village/IconBlessing.png" :width="130" mode="widthFix" />
|
|
<Image src="https://xy.wenlvti.net/app_static/images/village/IconBlessing.png" :width="130" mode="widthFix" />
|
|
|
<Text text="赐福" fontConfig="contentText" textAlign="center" />
|
|
<Text text="赐福" fontConfig="contentText" textAlign="center" />
|
|
@@ -139,6 +156,11 @@
|
|
|
/>
|
|
/>
|
|
|
<BlessSuccessDialog
|
|
<BlessSuccessDialog
|
|
|
ref="blessSuccessDialogRef"
|
|
ref="blessSuccessDialogRef"
|
|
|
|
|
+ @close="handleBlessDone"
|
|
|
|
|
+ />
|
|
|
|
|
+ <TreeLevelUpDialog
|
|
|
|
|
+ ref="treeLevelUpDialogRef"
|
|
|
|
|
+ :treeLevel="lastLevelUp"
|
|
|
/>
|
|
/>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
@@ -150,8 +172,9 @@ import { useRequireLogin } from '@/common/composeabe/RequireLogin';
|
|
|
import { showError } from '@/common/composeabe/ErrorDisplay';
|
|
import { showError } from '@/common/composeabe/ErrorDisplay';
|
|
|
import { toast } from '@/components/utils/DialogAction';
|
|
import { toast } from '@/components/utils/DialogAction';
|
|
|
import { navTo } from '@/components/utils/PageAction';
|
|
import { navTo } from '@/components/utils/PageAction';
|
|
|
-import { RequestApiError, SimpleTimer, waitTimeOut } from '@imengyu/imengyu-utils';
|
|
|
|
|
|
|
+import { RequestApiError, requireNotNull, SimpleTimer, waitTimeOut } from '@imengyu/imengyu-utils';
|
|
|
import { useAuthStore } from '@/store/auth';
|
|
import { useAuthStore } from '@/store/auth';
|
|
|
|
|
+import { injectAppConfiguration } from '@/api/system/useAppConfiguration';
|
|
|
import HomeTitle from '@/common/components/parts/HomeTitle.vue';
|
|
import HomeTitle from '@/common/components/parts/HomeTitle.vue';
|
|
|
import Text from '@/components/basic/Text.vue';
|
|
import Text from '@/components/basic/Text.vue';
|
|
|
import FlexCol from '@/components/layout/FlexCol.vue';
|
|
import FlexCol from '@/components/layout/FlexCol.vue';
|
|
@@ -168,6 +191,7 @@ import TreeApi, { type BlessPackageItem, type GrowthLogFeedItem } from '@/api/li
|
|
|
import SimplePageContentLoader from '@/components/loader/SimplePageContentLoader.vue';
|
|
import SimplePageContentLoader from '@/components/loader/SimplePageContentLoader.vue';
|
|
|
import BlessBuyDialog from '../dialogs/BlessBuyDialog.vue';
|
|
import BlessBuyDialog from '../dialogs/BlessBuyDialog.vue';
|
|
|
import BlessSuccessDialog from '../dialogs/BlessSuccessDialog.vue';
|
|
import BlessSuccessDialog from '../dialogs/BlessSuccessDialog.vue';
|
|
|
|
|
+import TreeLevelUpDialog from '../dialogs/TreeLevelUpDialog.vue';
|
|
|
import PopTextAnim from './components/PopTextAnim.vue';
|
|
import PopTextAnim from './components/PopTextAnim.vue';
|
|
|
|
|
|
|
|
const GROWTH_FEED_COUNT = 6;
|
|
const GROWTH_FEED_COUNT = 6;
|
|
@@ -176,8 +200,11 @@ const DEFAULT_AVATAR = 'https://xy.wenlvti.net/app_static/images/village/Placeho
|
|
|
const villageStore = useVillageStore();
|
|
const villageStore = useVillageStore();
|
|
|
const authStore = useAuthStore();
|
|
const authStore = useAuthStore();
|
|
|
const { requireLoginAsync } = useRequireLogin();
|
|
const { requireLoginAsync } = useRequireLogin();
|
|
|
|
|
+const appConfiguration = injectAppConfiguration();
|
|
|
|
|
|
|
|
const blessBuyDialogRef = ref<InstanceType<typeof BlessBuyDialog>>();
|
|
const blessBuyDialogRef = ref<InstanceType<typeof BlessBuyDialog>>();
|
|
|
|
|
+const blessSuccessDialogRef = ref<InstanceType<typeof BlessSuccessDialog>>();
|
|
|
|
|
+const treeLevelUpDialogRef = ref<InstanceType<typeof TreeLevelUpDialog>>();
|
|
|
const villageTreeRef = ref<InstanceType<typeof VillageTree>>();
|
|
const villageTreeRef = ref<InstanceType<typeof VillageTree>>();
|
|
|
const currentBless = ref<BlessPackageItem>();
|
|
const currentBless = ref<BlessPackageItem>();
|
|
|
|
|
|
|
@@ -330,16 +357,14 @@ async function handlePickOrWaterOrFertilize(action: 'pick' | 'water' | 'fertiliz
|
|
|
break;
|
|
break;
|
|
|
case 'water': {
|
|
case 'water': {
|
|
|
await TreeApi.water(villageStore.currentVillage.id);
|
|
await TreeApi.water(villageStore.currentVillage.id);
|
|
|
- const addLight = 3;
|
|
|
|
|
villageTreeRef.value?.playStateAnimation('water');
|
|
villageTreeRef.value?.playStateAnimation('water');
|
|
|
- toast(`浇水成功!又获得乡源光啦`, 4000);
|
|
|
|
|
|
|
+ lastRefreshAction.value = 'water';
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
case 'fertilize': {
|
|
case 'fertilize': {
|
|
|
await TreeApi.fertilize(villageStore.currentVillage.id);
|
|
await TreeApi.fertilize(villageStore.currentVillage.id);
|
|
|
- const addLight = 3;
|
|
|
|
|
villageTreeRef.value?.playStateAnimation('fertilize');
|
|
villageTreeRef.value?.playStateAnimation('fertilize');
|
|
|
- toast(`浇水成功!又获得乡源光啦`, 4000);
|
|
|
|
|
|
|
+ lastRefreshAction.value = 'fertilize';
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -348,18 +373,52 @@ async function handlePickOrWaterOrFertilize(action: 'pick' | 'water' | 'fertiliz
|
|
|
} catch (e) {
|
|
} catch (e) {
|
|
|
uni.hideLoading();
|
|
uni.hideLoading();
|
|
|
if (e instanceof RequestApiError && typeof e.data === 'string') {
|
|
if (e instanceof RequestApiError && typeof e.data === 'string') {
|
|
|
- toast(e.data);
|
|
|
|
|
|
|
+ toast(e.data, 4000);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
showError(e);
|
|
showError(e);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+const lastRefreshAction = ref<'water' | 'fertilize' | 'bless' | null>(null);
|
|
|
|
|
+const lastAddLight = ref(0);
|
|
|
|
|
+const lastLevelUp = ref('');
|
|
|
|
|
+
|
|
|
function handleWaterAnimEnd() {
|
|
function handleWaterAnimEnd() {
|
|
|
- popAnimText.value = popAnimTextNext.value;
|
|
|
|
|
|
|
+ handleShowActionTip();
|
|
|
}
|
|
}
|
|
|
function handleFertilizeAnimEnd() {
|
|
function handleFertilizeAnimEnd() {
|
|
|
- popAnimText.value = popAnimTextNext.value;
|
|
|
|
|
|
|
+ handleShowActionTip();
|
|
|
|
|
+}
|
|
|
|
|
+async function handleBlessDone() {
|
|
|
|
|
+ uni.pageScrollTo({ scrollTop: 0 });
|
|
|
|
|
+ lastRefreshAction.value = 'bless';
|
|
|
|
|
+ await handleBlessPaySuccessRefresh();
|
|
|
|
|
+ handleShowActionTip();
|
|
|
|
|
+}
|
|
|
|
|
+async function handleShowActionTip() {
|
|
|
|
|
+ let text = '', addLightText = '';
|
|
|
|
|
+ if (lastAddLight.value > 0)
|
|
|
|
|
+ addLightText = `乡源光 +${lastAddLight.value}`;
|
|
|
|
|
+ switch (lastRefreshAction.value) {
|
|
|
|
|
+ case 'water':
|
|
|
|
|
+ text = '谢谢您的浇水!';
|
|
|
|
|
+ popAnimText.value = `${text} ${addLightText}`;
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 'fertilize':
|
|
|
|
|
+ text = '谢谢您的施肥!';
|
|
|
|
|
+ popAnimText.value = `${text} ${addLightText}`;
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 'bless':
|
|
|
|
|
+ text = '感谢您的赐福!';
|
|
|
|
|
+ popAnimText.value = `${text} ${addLightText}`;
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ await waitTimeOut(2000);
|
|
|
|
|
+ if (lastLevelUp.value) {
|
|
|
|
|
+ treeLevelUpDialogRef.value?.show();
|
|
|
|
|
+ }
|
|
|
|
|
+ lastRefreshAction.value = null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async function getFruits() {
|
|
async function getFruits() {
|
|
@@ -371,7 +430,17 @@ async function getFruits() {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
async function refreshVillageTreeInfo() {
|
|
async function refreshVillageTreeInfo() {
|
|
|
- await villageStore.reloadVillageInfo();
|
|
|
|
|
|
|
+ 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, oldLight - newVillage.lightTotal);
|
|
|
|
|
+ lastLevelUp.value = oldTreeName !== newVillage.treeName ? newVillage.treeName : '';
|
|
|
|
|
+ } else {
|
|
|
|
|
+ lastAddLight.value = 0;
|
|
|
|
|
+ lastLevelUp.value = '';
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const refreshFruitTimer = new SimpleTimer(undefined, () => getFruits(), 15000);
|
|
const refreshFruitTimer = new SimpleTimer(undefined, () => getFruits(), 15000);
|
|
@@ -385,7 +454,7 @@ onBeforeMount(() => {
|
|
|
defineExpose({
|
|
defineExpose({
|
|
|
onPageBack: (name: string, data: Record<string, unknown>) => {
|
|
onPageBack: (name: string, data: Record<string, unknown>) => {
|
|
|
if (name === 'blessPaySuccessRefresh') {
|
|
if (name === 'blessPaySuccessRefresh') {
|
|
|
- handleBlessPaySuccessRefresh();
|
|
|
|
|
|
|
+ blessSuccessDialogRef.value?.show();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
},
|
|
},
|