169 lines
3.2 KiB
Vue
169 lines
3.2 KiB
Vue
<template>
|
|
<view class="select-event-page">
|
|
<view class="project-list">
|
|
<view
|
|
class="project-item"
|
|
v-for="(item, index) in projectList"
|
|
:key="index"
|
|
@click="toggleProject(item)"
|
|
>
|
|
<view class="project-info">
|
|
<view class="project-name">{{ item.name }}</view>
|
|
<view class="project-price">¥ {{ item.price }}</view>
|
|
</view>
|
|
<view class="checkbox">
|
|
<text v-if="item.selected" class="checked">✓</text>
|
|
<text v-else class="unchecked">○</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 立即报名按钮 -->
|
|
<view class="register-btn-wrapper">
|
|
<view class="register-btn" @click="handleRegister">立即报名</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
eventId: '',
|
|
type: '',
|
|
projectList: [
|
|
{
|
|
id: 1,
|
|
name: '男子组剑术',
|
|
price: 199,
|
|
selected: true
|
|
},
|
|
{
|
|
id: 2,
|
|
name: '女子组太极拳',
|
|
price: 99,
|
|
selected: false
|
|
},
|
|
{
|
|
id: 3,
|
|
name: '女子组单鞭',
|
|
price: 1299,
|
|
selected: false
|
|
},
|
|
{
|
|
id: 4,
|
|
name: '男子组太极拳',
|
|
price: 299,
|
|
selected: true
|
|
}
|
|
]
|
|
};
|
|
},
|
|
onLoad(options) {
|
|
if (options.eventId) {
|
|
this.eventId = options.eventId;
|
|
}
|
|
if (options.type) {
|
|
this.type = options.type;
|
|
}
|
|
},
|
|
methods: {
|
|
toggleProject(item) {
|
|
item.selected = !item.selected;
|
|
this.$forceUpdate();
|
|
},
|
|
handleRegister() {
|
|
const selectedProjects = this.projectList.filter(item => item.selected);
|
|
if (selectedProjects.length === 0) {
|
|
uni.showToast({
|
|
title: '请选择报名项目',
|
|
icon: 'none'
|
|
});
|
|
return;
|
|
}
|
|
|
|
uni.navigateTo({
|
|
url: `/pages/event-register/event-register?eventId=${this.eventId}&projects=${JSON.stringify(selectedProjects)}`
|
|
});
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.select-event-page {
|
|
min-height: 100vh;
|
|
background-color: #f5f5f5;
|
|
padding-bottom: 180rpx;
|
|
}
|
|
|
|
.project-list {
|
|
padding: 30rpx;
|
|
}
|
|
|
|
.project-item {
|
|
background-color: #fff;
|
|
border-radius: 16rpx;
|
|
padding: 40rpx 30rpx;
|
|
margin-bottom: 20rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
}
|
|
|
|
.project-info {
|
|
flex: 1;
|
|
}
|
|
|
|
.project-name {
|
|
font-size: 32rpx;
|
|
color: #333333;
|
|
margin-bottom: 10rpx;
|
|
}
|
|
|
|
.project-price {
|
|
font-size: 28rpx;
|
|
color: #C93639;
|
|
font-weight: bold;
|
|
}
|
|
|
|
.checkbox {
|
|
width: 50rpx;
|
|
height: 50rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
margin-left: 30rpx;
|
|
}
|
|
|
|
.checked {
|
|
font-size: 40rpx;
|
|
color: #C93639;
|
|
}
|
|
|
|
.unchecked {
|
|
font-size: 40rpx;
|
|
color: #cccccc;
|
|
}
|
|
|
|
.register-btn-wrapper {
|
|
position: fixed;
|
|
bottom: 0;
|
|
left: 0;
|
|
right: 0;
|
|
padding: 30rpx;
|
|
background-color: #fff;
|
|
box-shadow: 0 -4rpx 20rpx rgba(0, 0, 0, 0.05);
|
|
}
|
|
|
|
.register-btn {
|
|
background-color: #C93639;
|
|
color: #fff;
|
|
text-align: center;
|
|
padding: 30rpx;
|
|
border-radius: 12rpx;
|
|
font-size: 32rpx;
|
|
font-weight: bold;
|
|
}
|
|
</style>
|