|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <custom-dialog :visible.sync="dialogVisible" title="商店" @close="onClose">
|
|
|
+ <custom-dialog :visible.sync="dialogVisible" title="商城" @close="onClose">
|
|
|
<view class="shop-content">
|
|
|
<view class="shop-tabs">
|
|
|
<view
|
|
@@ -14,14 +14,27 @@
|
|
|
</view>
|
|
|
<view class="shop-items">
|
|
|
<view class="shop-item" v-for="(item, index) in currentItems" :key="index" @click="onItemClick(item)">
|
|
|
- <image class="item-icon" :src="item.icon" mode="aspectFit"></image>
|
|
|
- <view class="item-info">
|
|
|
- <text class="item-name">{{item.name}}</text>
|
|
|
- <text class="item-desc">{{item.description}}</text>
|
|
|
- </view>
|
|
|
- <view class="item-price">
|
|
|
- <image class="currency-icon" src="/static/currency/coin.png" mode="aspectFit"></image>
|
|
|
- <text>{{item.price}}</text>
|
|
|
+ <view class="item-card">
|
|
|
+ <view class="new-tag" v-if="item.isNew">新品</view>
|
|
|
+ <view class="item-left">
|
|
|
+ <image class="item-icon" :src="item.icon" mode="aspectFit"></image>
|
|
|
+ <text class="owned-text">已持有: {{item.owned}}</text>
|
|
|
+ </view>
|
|
|
+ <view class="item-info">
|
|
|
+ <text class="item-name">{{item.name}}</text>
|
|
|
+ <view class="item-details">
|
|
|
+ <text class="detail-text">收获期: {{item.harvestTime}}</text>
|
|
|
+ <text class="detail-text">成长期: {{item.growthTime}}</text>
|
|
|
+ <text class="detail-text">产量: {{item.yield}}</text>
|
|
|
+ </view>
|
|
|
+ <view class="item-bottom">
|
|
|
+ <view class="item-price">
|
|
|
+ <image class="currency-icon" src="/static/currency/coin.png" mode="aspectFit"></image>
|
|
|
+ <text>{{item.price}}</text>
|
|
|
+ </view>
|
|
|
+ <button class="buy-btn">购买</button>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -31,6 +44,7 @@
|
|
|
|
|
|
<script>
|
|
|
import CustomDialog from '../CustomDialog/CustomDialog.vue'
|
|
|
+import './ShopDialog.scss'
|
|
|
|
|
|
export default {
|
|
|
name: 'ShopDialog',
|
|
@@ -47,21 +61,42 @@ export default {
|
|
|
return {
|
|
|
dialogVisible: false,
|
|
|
currentTab: 0,
|
|
|
- tabs: ['道具', '装备', '材料'],
|
|
|
+ tabs: ['种子', '道具', '钻石'],
|
|
|
items: {
|
|
|
0: [
|
|
|
- { icon: '/static/items/potion1.png', name: '生命药水', description: '恢复100点生命值', price: 100 },
|
|
|
- { icon: '/static/items/potion2.png', name: '魔法药水', description: '恢复50点魔法值', price: 150 },
|
|
|
- { icon: '/static/items/potion3.png', name: '体力药水', description: '恢复50点体力值', price: 120 }
|
|
|
- ],
|
|
|
- 1: [
|
|
|
- { icon: '/static/items/weapon1.png', name: '铁剑', description: '攻击力+10', price: 500 },
|
|
|
- { icon: '/static/items/armor1.png', name: '皮甲', description: '防御力+5', price: 300 }
|
|
|
+ {
|
|
|
+ icon: '/static/items/seed1.png',
|
|
|
+ name: '草莓种子',
|
|
|
+ harvestTime: '160时',
|
|
|
+ growthTime: '60时',
|
|
|
+ yield: '10',
|
|
|
+ price: 100,
|
|
|
+ owned: 3,
|
|
|
+ isNew: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ icon: '/static/items/seed1.png',
|
|
|
+ name: '草莓种子',
|
|
|
+ harvestTime: '160时',
|
|
|
+ growthTime: '60时',
|
|
|
+ yield: '10',
|
|
|
+ price: 100,
|
|
|
+ owned: 3,
|
|
|
+ isNew: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ icon: '/static/items/seed1.png',
|
|
|
+ name: '草莓种子',
|
|
|
+ harvestTime: '160时',
|
|
|
+ growthTime: '60时',
|
|
|
+ yield: '10',
|
|
|
+ price: 100,
|
|
|
+ owned: 3,
|
|
|
+ isNew: true
|
|
|
+ }
|
|
|
],
|
|
|
- 2: [
|
|
|
- { icon: '/static/items/material1.png', name: '木材', description: '基础材料', price: 50 },
|
|
|
- { icon: '/static/items/material2.png', name: '铁矿', description: '基础材料', price: 80 }
|
|
|
- ]
|
|
|
+ 1: [],
|
|
|
+ 2: []
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -83,7 +118,6 @@ export default {
|
|
|
this.dialogVisible = false
|
|
|
},
|
|
|
onItemClick(item) {
|
|
|
- // 处理购买逻辑
|
|
|
this.$emit('buy', item)
|
|
|
}
|
|
|
}
|
|
@@ -91,84 +125,5 @@ export default {
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
-.shop-content {
|
|
|
- .shop-tabs {
|
|
|
- display: flex;
|
|
|
- border-bottom: 2rpx solid #eee;
|
|
|
- margin-bottom: 20rpx;
|
|
|
-
|
|
|
- .tab-item {
|
|
|
- flex: 1;
|
|
|
- text-align: center;
|
|
|
- padding: 20rpx 0;
|
|
|
- font-size: 28rpx;
|
|
|
- color: #666;
|
|
|
- position: relative;
|
|
|
-
|
|
|
- &.active {
|
|
|
- color: #007AFF;
|
|
|
- font-weight: 500;
|
|
|
-
|
|
|
- &::after {
|
|
|
- content: '';
|
|
|
- position: absolute;
|
|
|
- bottom: 0;
|
|
|
- left: 50%;
|
|
|
- transform: translateX(-50%);
|
|
|
- width: 40rpx;
|
|
|
- height: 4rpx;
|
|
|
- background: #007AFF;
|
|
|
- border-radius: 2rpx;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .shop-items {
|
|
|
- .shop-item {
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- padding: 20rpx;
|
|
|
- border-bottom: 2rpx solid #f5f5f5;
|
|
|
-
|
|
|
- .item-icon {
|
|
|
- width: 80rpx;
|
|
|
- height: 80rpx;
|
|
|
- margin-right: 20rpx;
|
|
|
- }
|
|
|
-
|
|
|
- .item-info {
|
|
|
- flex: 1;
|
|
|
-
|
|
|
- .item-name {
|
|
|
- font-size: 28rpx;
|
|
|
- color: #333;
|
|
|
- margin-bottom: 4rpx;
|
|
|
- }
|
|
|
-
|
|
|
- .item-desc {
|
|
|
- font-size: 24rpx;
|
|
|
- color: #999;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .item-price {
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- gap: 8rpx;
|
|
|
-
|
|
|
- .currency-icon {
|
|
|
- width: 32rpx;
|
|
|
- height: 32rpx;
|
|
|
- }
|
|
|
-
|
|
|
- text {
|
|
|
- font-size: 28rpx;
|
|
|
- color: #FF9500;
|
|
|
- font-weight: 500;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
+@import './ShopDialog.scss';
|
|
|
</style>
|