<template>
  <uni-popup ref="popupRef" :animation="false" :is-mask-click="false"
             mask-background-color="rgba(51, 137, 217, 0.95);">
    <view :class="data.image">
    </view>
  </uni-popup>
</template>

<script setup>
	import {
		onLoad
	} from "@dcloudio/uni-app"
	import {
		ref,
		reactive
	} from "vue"
	import {
		resultAudioPlayer,
		resultImageList
	} from "./useAudioRightWrong.js"

  const popupRef = ref(null)

	const data = reactive({
		result: '',
		image: '',
		showImage: false,
	})

	onLoad(() => {
		pageInit()
	})

	function pageInit() {
		uni.$on('result-audio-play', (code) => {
			const {
				codeT
			} = code;
			data.result = codeT;
			data.image = resultImageList[code]
			data.showImage = true;
      popupRef.value.open();
		})
		uni.$on('result-audio-ended', (code) => {
			const {
				codeT
			} = code;
			data.result = codeT;
			data.image = resultImageList[code];
			data.showImage = false;
      popupRef.value.close();

    })
	}
</script>

<style scoped>

</style>