智慧教务系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

308 lines
6.9 KiB

<!--孩子详情页面-->
<template>
<view class="main_box">
<!-- 孩子基本信息 -->
<view class="child_info_card" v-if="childInfo">
<view class="child_header">
<view class="child_avatar">
<image :src="childInfo.avatar" mode="aspectFill"></image>
</view>
<view class="child_basic">
<view class="child_name">{{ childInfo.name }}</view>
<view class="child_tags">
<view class="tag gender">{{ childInfo.gender === 1 ? '男' : '女' }}</view>
<view class="tag age">{{ Math.floor(childInfo.age) }}</view>
<view class="tag label">{{ childInfo.member_label }}</view>
</view>
</view>
</view>
<view class="child_details">
<view class="detail_section">
<view class="section_title">基本信息</view>
<view class="detail_item">
<view class="detail_label">生日</view>
<view class="detail_value">{{ childInfo.birthday }}</view>
</view>
<view class="detail_item">
<view class="detail_label">年龄</view>
<view class="detail_value">{{ childInfo.age }}</view>
</view>
<view class="detail_item">
<view class="detail_label">紧急联系人</view>
<view class="detail_value">{{ childInfo.emergency_contact }}</view>
</view>
<view class="detail_item">
<view class="detail_label">联系电话</view>
<view class="detail_value">{{ childInfo.contact_phone }}</view>
</view>
</view>
<view class="detail_section">
<view class="section_title">校区信息</view>
<view class="detail_item">
<view class="detail_label">所属校区</view>
<view class="detail_value">{{ childInfo.campus_name || '未分配' }}</view>
</view>
<view class="detail_item">
<view class="detail_label">班级</view>
<view class="detail_value">{{ childInfo.class_name || '未分配' }}</view>
</view>
<view class="detail_item">
<view class="detail_label">教练</view>
<view class="detail_value">{{ childInfo.coach_name || '未分配' }}</view>
</view>
</view>
<view class="detail_section">
<view class="section_title">学习情况</view>
<view class="detail_item">
<view class="detail_label">总课程数</view>
<view class="detail_value">{{ childInfo.total_courses }}</view>
</view>
<view class="detail_item">
<view class="detail_label">已完成</view>
<view class="detail_value">{{ childInfo.completed_courses }}</view>
</view>
<view class="detail_item">
<view class="detail_label">剩余课时</view>
<view class="detail_value">{{ childInfo.remaining_courses }}</view>
</view>
<view class="detail_item">
<view class="detail_label">出勤率</view>
<view class="detail_value">{{ childInfo.attendance_rate }}%</view>
</view>
</view>
<view class="detail_section" v-if="childInfo.note">
<view class="section_title">备注信息</view>
<view class="note_content">{{ childInfo.note }}</view>
</view>
</view>
</view>
<!-- 空状态 -->
<view class="empty_state" v-if="!loading && !childInfo">
<image :src="$util.img('/static/icon-img/empty.png')" class="empty_icon"></image>
<view class="empty_text">暂无孩子信息</view>
</view>
<!-- 加载状态 -->
<view class="loading_state" v-if="loading">
<view class="loading_text">加载中...</view>
</view>
</view>
</template>
<script>
import { mapState } from 'vuex'
import apiRoute from '@/api/apiRoute.js'
export default {
data() {
return {
childInfo: null,
loading: false,
childId: null
}
},
computed: {
...mapState(['selectedChild'])
},
onLoad(options) {
this.childId = options.childId
this.loadChildInfo()
},
methods: {
async loadChildInfo() {
if (!this.childId) {
// 如果没有传入childId,使用当前选中的孩子
if (this.selectedChild) {
this.childInfo = this.selectedChild
} else {
uni.showToast({
title: '缺少孩子ID参数',
icon: 'none'
})
}
return
}
this.loading = true
try {
const response = await apiRoute.parent_getChildInfo({
child_id: this.childId
})
if (response.code === 1) {
this.childInfo = response.data
} else {
uni.showToast({
title: response.msg || '获取孩子信息失败',
icon: 'none'
})
}
} catch (error) {
console.error('获取孩子信息失败:', error)
uni.showToast({
title: '获取孩子信息失败',
icon: 'none'
})
} finally {
this.loading = false
}
}
}
}
</script>
<style lang="less" scoped>
.main_box {
background: #f8f9fa;
min-height: 100vh;
padding: 20rpx;
}
.child_info_card {
background: #fff;
border-radius: 16rpx;
padding: 32rpx;
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.1);
.child_header {
display: flex;
align-items: center;
gap: 24rpx;
padding-bottom: 32rpx;
border-bottom: 1px solid #f0f0f0;
margin-bottom: 32rpx;
.child_avatar {
width: 120rpx;
height: 120rpx;
border-radius: 50%;
overflow: hidden;
image {
width: 100%;
height: 100%;
}
}
.child_basic {
flex: 1;
.child_name {
font-size: 36rpx;
font-weight: 600;
color: #333;
margin-bottom: 16rpx;
}
.child_tags {
display: flex;
gap: 12rpx;
flex-wrap: wrap;
.tag {
font-size: 22rpx;
padding: 6rpx 12rpx;
border-radius: 12rpx;
&.gender {
background: rgba(41, 211, 180, 0.1);
color: #29d3b4;
}
&.age {
background: rgba(52, 152, 219, 0.1);
color: #3498db;
}
&.label {
background: rgba(230, 126, 34, 0.1);
color: #e67e22;
}
}
}
}
}
.child_details {
.detail_section {
margin-bottom: 32rpx;
.section_title {
font-size: 28rpx;
font-weight: 600;
color: #333;
margin-bottom: 20rpx;
padding-bottom: 12rpx;
border-bottom: 2rpx solid #29d3b4;
}
.detail_item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 16rpx 0;
border-bottom: 1px solid #f8f9fa;
.detail_label {
font-size: 26rpx;
color: #666;
min-width: 160rpx;
}
.detail_value {
font-size: 26rpx;
color: #333;
flex: 1;
text-align: right;
}
}
.note_content {
font-size: 26rpx;
color: #666;
line-height: 1.6;
padding: 16rpx;
background: #f8f9fa;
border-radius: 8rpx;
}
}
}
}
.empty_state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 120rpx 0;
.empty_icon {
width: 160rpx;
height: 160rpx;
margin-bottom: 32rpx;
opacity: 0.3;
}
.empty_text {
font-size: 28rpx;
color: #999;
}
}
.loading_state {
display: flex;
justify-content: center;
align-items: center;
padding: 60rpx 0;
.loading_text {
font-size: 28rpx;
color: #666;
}
}
</style>