浏览代码

调整序号对应

wangxy 4 月之前
父节点
当前提交
41fcecb490
共有 3 个文件被更改,包括 30 次插入5 次删除
  1. 4 0
      pages/game/components/constantConfig.js
  2. 7 3
      pages/game/components/foodSelect.vue
  3. 19 2
      pages/game/index.vue

+ 4 - 0
pages/game/components/constantConfig.js

@@ -20,17 +20,21 @@ export const foodSpeciesList = [{
 export const gooseGrowthTypeList = [{
 		id: 0,
 		imgUrl: '/static/images/game/game-img1.gif',
+		range: [0,1000]
 	},
 	{
 		id: 1,
 		imgUrl: '/static/images/game/game-img2.gif',
+		range: [1000,3000]
 	},
 	{
 		id: 2,
 		imgUrl: '/static/images/game/game-img3.gif',
+		range: [3000,7000]
 	},
 	{
 		id: 3,
 		imgUrl: '/static/images/game/game-img4.gif',
+		range: [7000]
 	}
 ]

+ 7 - 3
pages/game/components/foodSelect.vue

@@ -9,15 +9,15 @@
 					<!-- 积分 -->
 					<view class="ezy-jf-box game-popup-jf">
 						<icon class="jf-icon"></icon>
-						<text class="jf-text" >积分</text>
+						<text class="jf-text" >{{credit}}</text>
 					</view>
 					<!-- 关闭按钮 -->
-					<icon class="popup-close-btn"></icon>
+					<icon class="popup-close-btn" @click="handleClose"></icon>
 				</view>
 			</view>
 			<view class="food-list-box">
 				<view v-for="item in foodSpeciesList" :key="item.id" @click="handleSelectFood(item)" class="food-item-box">
-					<img :src="item.imgUrl">
+					<image :src="item.imgUrl" />
 					<view class="food-item-jf">
 						<icon class="jf-icon"></icon>
 						<text class="jf-text" >{{item.credit}}</text>
@@ -36,6 +36,9 @@
 	const props = defineProps({
 		shiwuId: {
 			type: [String,Number]
+		},
+		credit: {
+			type: [String,Number]
 		}
 	})
 	
@@ -44,6 +47,7 @@
 		popupRef.value.open();
 	}
 	function handleClose() {
+		console.log(123)
 		popupRef.value.close();
 	}
 	function handleSelectFood(shiwu) {

+ 19 - 2
pages/game/index.vue

@@ -14,9 +14,16 @@
 		<gooseVue :growth="growth" :growthType="growthType" :progress="progress"
 		class="game-goose-box" :class="'game-goose-box'+ growthType"></gooseVue>
 		<!-- 食物选择 -->
-		<foodSelectVue ref="foodSelectRef" :shiwuId="shiwuId" @weishi="onWeiShi"></foodSelectVue>
+		<foodSelectVue :credit="credit" ref="foodSelectRef" :shiwuId="shiwuId" @weishi="onWeiShi"></foodSelectVue>
 		<!-- 游戏说明 -->
-		<view class="yxsm-btn"></view>
+		<view class="yxsm-btn" @click="showTishi"></view>
+		<!-- 游戏说明 -->
+		<commonDialogVue ref="dlRef">
+			<view>
+				<text>这是内容区域</text>
+				<button @click="handleClose">关闭</button>
+			</view>
+		</commonDialogVue>
 	</view>
 </template>
 
@@ -25,10 +32,20 @@
 	import foodVue from "./components/food.vue";
 	import gooseVue from "./components/goose.vue";
 	import foodSelectVue from "./components/foodSelect.vue";
+	import commonDialogVue from "@/components/dialog/commonDialog.vue";
 	import { useGame } from "./useGame";
 	const {	credit,growth,growthType,progress,shiwuId ,handleWeishi } = useGame();
 	
 	const foodSelectRef = ref(null);
+	const dlRef = ref(null);
+	
+	function handleClose() {
+		dlRef.value.handleClose();
+	}
+	
+	function showTishi() {
+		dlRef.value.handleShow();
+	}
 	
 	function onWeiShi(data) {
 		handleWeishi(data.id, () => {