index.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <!-- 游戏页面 -->
  2. <template>
  3. <view class="ezy-game-page">
  4. <!-- 返回按钮 -->
  5. <view class="ezy-nav-bar-icon"></view>
  6. <!-- 积分 -->
  7. <view class="ezy-jf-box game-jf-box">
  8. <icon class="jf-icon"></icon>
  9. <text class="jf-text" >{{credit}}</text>
  10. </view>
  11. <!-- 桌面食物 -->
  12. <foodVue :shiwuId="shiwuId" class="food-img-box" :class="'food-img'+shiwuId"></foodVue>
  13. <!-- 大鹅 4阶段 -->
  14. <gooseVue :growth="growth" :growthType="growthType" :progress="progress"
  15. class="game-goose-box" :class="'game-goose-box'+ growthType"></gooseVue>
  16. <!-- 食物选择 -->
  17. <foodSelectVue :credit="credit" ref="foodSelectRef" :shiwuId="shiwuId" @weishi="onWeiShi"></foodSelectVue>
  18. <!-- 游戏说明 -->
  19. <view class="yxsm-btn" @click="showTishi"></view>
  20. <!-- 游戏说明 -->
  21. <commonDialogVue ref="dlRef">
  22. <view>
  23. <text>这是内容区域</text>
  24. <button @click="handleClose">关闭</button>
  25. </view>
  26. </commonDialogVue>
  27. </view>
  28. </template>
  29. <script setup>
  30. import {ref} from "vue";
  31. import foodVue from "./components/food.vue";
  32. import gooseVue from "./components/goose.vue";
  33. import foodSelectVue from "./components/foodSelect.vue";
  34. import commonDialogVue from "@/components/dialog/commonDialog.vue";
  35. import { useGame } from "./useGame";
  36. const { credit,growth,growthType,progress,shiwuId ,handleWeishi } = useGame();
  37. const foodSelectRef = ref(null);
  38. const dlRef = ref(null);
  39. function handleClose() {
  40. dlRef.value.handleClose();
  41. }
  42. function showTishi() {
  43. dlRef.value.handleShow();
  44. }
  45. function onWeiShi(data) {
  46. handleWeishi(data.id, () => {
  47. foodSelectRef.value.handleClose();
  48. })
  49. }
  50. </script>
  51. <style>
  52. </style>