|
@@ -72,6 +72,13 @@ export function useAudio (grouthType) {
|
|
|
onHide(() => {
|
|
|
innerAudioContext.stop();
|
|
|
})
|
|
|
+
|
|
|
+ // 展开食物停止播放
|
|
|
+ uni.$on('food-select-open', () => {
|
|
|
+ innerAudioContext.stop();
|
|
|
+ audioIndex.value = 0;
|
|
|
+ })
|
|
|
+
|
|
|
|
|
|
watch(grouthType, () => {
|
|
|
if (defaultGrouthType.value != grouthType.value) {
|
|
@@ -106,13 +113,19 @@ export function useHuDong(props) {
|
|
|
myAudio.play();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ // 播放开始切换动画
|
|
|
uni.$on('play-audio', () => {
|
|
|
imgUrl.value = imageList[props.growthType][1]
|
|
|
})
|
|
|
+ // 播放结束恢复默认
|
|
|
uni.$on('play-audio-ended', () => {
|
|
|
imgUrl.value = imageList[props.growthType][0]
|
|
|
})
|
|
|
+ // 展开食物恢复默认
|
|
|
+ uni.$on('food-select-open', () => {
|
|
|
+ imgUrl.value = imageList[props.growthType][0]
|
|
|
+ })
|
|
|
+
|
|
|
return {
|
|
|
init,
|
|
|
doTouch,
|