163 lines
2.9 KiB
Vue
163 lines
2.9 KiB
Vue
<template>
|
|
<view v-show="visible" class="modal-overlay" :class="{ 'modal-visible': visible }" @tap="handleCancel">
|
|
<view class="modal-box" @tap.stop>
|
|
<!-- 标题 -->
|
|
<view class="modal-title">
|
|
<text>使用道具</text>
|
|
</view>
|
|
|
|
<!-- 内容:道具名 + 钻石消耗 -->
|
|
<view class="modal-body">
|
|
<text class="modal-desc">使用 <text class="highlight">{{ itemLabel }}</text> 将消耗</text>
|
|
<view class="cost-row">
|
|
<image src="/static/icon/crystal.png" class="diamond-icon" mode="aspectFit" lazy-load />
|
|
<text class="cost-num">{{ itemCost }}</text>
|
|
<text class="cost-unit"> 钻石</text>
|
|
</view>
|
|
<text class="modal-desc">确认继续?</text>
|
|
</view>
|
|
|
|
<!-- 按钮区:取消在左,确认在右 -->
|
|
<view class="modal-actions">
|
|
<view class="btn btn-cancel" @tap="handleCancel">
|
|
<text>取消</text>
|
|
</view>
|
|
<view class="btn btn-confirm" @tap="handleConfirm">
|
|
<text>确认</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script setup>
|
|
const props = defineProps({
|
|
visible: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
itemLabel: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
itemCost: {
|
|
type: Number,
|
|
default: 0
|
|
}
|
|
})
|
|
|
|
const emit = defineEmits(['confirm', 'cancel'])
|
|
|
|
function handleConfirm() {
|
|
emit('confirm')
|
|
}
|
|
|
|
function handleCancel() {
|
|
emit('cancel')
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.modal-overlay {
|
|
position: fixed;
|
|
top: 0; left: 0; right: 0; bottom: 0;
|
|
background: rgba(0, 0, 0, 0.5);
|
|
z-index: 999;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
opacity: 0;
|
|
transition: opacity 0.25s ease;
|
|
pointer-events: none;
|
|
}
|
|
|
|
.modal-overlay.modal-visible {
|
|
opacity: 1;
|
|
pointer-events: auto;
|
|
}
|
|
|
|
.modal-box {
|
|
width: 560rpx;
|
|
background: #fff;
|
|
border-radius: 24rpx;
|
|
overflow: hidden;
|
|
padding: 48rpx 40rpx 32rpx;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
}
|
|
|
|
.modal-title {
|
|
font-size: 34rpx;
|
|
font-weight: bold;
|
|
color: #333;
|
|
margin-bottom: 32rpx;
|
|
}
|
|
|
|
.modal-body {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
gap: 12rpx;
|
|
margin-bottom: 40rpx;
|
|
}
|
|
|
|
.modal-desc {
|
|
font-size: 28rpx;
|
|
color: #555;
|
|
}
|
|
|
|
.highlight {
|
|
color: #B94E73;
|
|
font-weight: bold;
|
|
}
|
|
|
|
.cost-row {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8rpx;
|
|
}
|
|
|
|
.diamond-icon {
|
|
width: 44rpx;
|
|
height: 44rpx;
|
|
}
|
|
|
|
.cost-num {
|
|
font-size: 48rpx;
|
|
font-weight: bold;
|
|
color: #FFA500;
|
|
}
|
|
|
|
.cost-unit {
|
|
font-size: 28rpx;
|
|
color: #555;
|
|
}
|
|
|
|
.modal-actions {
|
|
width: 100%;
|
|
display: flex;
|
|
gap: 24rpx;
|
|
}
|
|
|
|
.btn {
|
|
flex: 1;
|
|
height: 80rpx;
|
|
border-radius: 40rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-size: 30rpx;
|
|
}
|
|
|
|
.btn-cancel {
|
|
background: #f0f0f0;
|
|
color: #666;
|
|
}
|
|
|
|
.btn-confirm {
|
|
background: linear-gradient(to right, #F08399, #B94E73);
|
|
color: #fff;
|
|
}
|
|
</style>
|