智慧教务系统
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.
 
 
 
 
 
 

279 lines
5.4 KiB

<!--家长端服务管理页面-->
<template>
<view class="main_box">
<!-- 选中孩子信息 -->
<view class="child_info_bar" v-if="selectedChild">
<view class="child_avatar">
<image :src="selectedChild.avatar" mode="aspectFill"></image>
</view>
<view class="child_details">
<view class="child_name">{{ selectedChild.name }}</view>
<view class="child_class">{{ selectedChild.class_name || '未分配班级' }}</view>
</view>
</view>
<!-- 服务列表 -->
<view class="services_list">
<view class="section_title">服务记录</view>
<view class="services_items">
<view
v-for="service in servicesList"
:key="service.id"
class="service_item"
@click="viewServiceDetail(service)"
>
<view class="service_main">
<view class="service_header">
<view class="service_title">{{ service.title }}</view>
<view class="service_status" :class="service.status">{{ service.status_text }}</view>
</view>
<view class="service_details">
<view class="detail_row">
<text class="detail_label">服务时间:</text>
<text class="detail_value">{{ service.service_time }}</text>
</view>
<view class="detail_row">
<text class="detail_label">服务内容:</text>
<text class="detail_value">{{ service.content }}</text>
</view>
</view>
</view>
<view class="service_arrow">
<image :src="$util.img('/uniapp_src/static/images/index/right_arrow.png')" class="arrow-icon"></image>
</view>
</view>
</view>
</view>
<!-- 空状态 -->
<view class="empty_state" v-if="!loading && servicesList.length === 0">
<image :src="$util.img('/uniapp_src/static/images/common/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 {
servicesList: [],
loading: false,
childId: null
}
},
computed: {
...mapState(['selectedChild'])
},
onLoad(options) {
this.childId = options.childId
this.loadServicesList()
},
methods: {
async loadServicesList() {
if (!this.childId) {
uni.showToast({
title: '缺少孩子ID参数',
icon: 'none'
})
return
}
this.loading = true
try {
const response = await apiRoute.parent_getChildServices({
child_id: this.childId
})
if (response.code === 1) {
this.servicesList = response.data.data || []
} else {
uni.showToast({
title: response.msg || '获取服务记录失败',
icon: 'none'
})
}
} catch (error) {
console.error('获取服务记录失败:', error)
uni.showToast({
title: '获取服务记录失败',
icon: 'none'
})
} finally {
this.loading = false
}
},
viewServiceDetail(service) {
this.$navigateTo({
url: `/pages/parent/services/service-detail?serviceId=${service.id}&childId=${this.childId}`
})
}
}
}
</script>
<style lang="less" scoped>
.main_box {
background: #f8f9fa;
min-height: 100vh;
padding: 20rpx;
}
.child_info_bar {
background: #fff;
border-radius: 16rpx;
padding: 24rpx;
margin-bottom: 20rpx;
display: flex;
align-items: center;
gap: 20rpx;
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.1);
.child_avatar {
width: 80rpx;
height: 80rpx;
border-radius: 50%;
overflow: hidden;
image {
width: 100%;
height: 100%;
}
}
.child_details {
flex: 1;
.child_name {
font-size: 28rpx;
font-weight: 600;
color: #333;
margin-bottom: 8rpx;
}
.child_class {
font-size: 24rpx;
color: #666;
}
}
}
.services_list {
.section_title {
font-size: 32rpx;
font-weight: 600;
color: #333;
margin-bottom: 24rpx;
padding-left: 8rpx;
}
.services_items {
display: flex;
flex-direction: column;
gap: 16rpx;
}
}
.service_item {
background: #fff;
border-radius: 16rpx;
padding: 28rpx;
display: flex;
align-items: center;
gap: 20rpx;
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.1);
.service_main {
flex: 1;
.service_header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16rpx;
.service_title {
font-size: 30rpx;
font-weight: 600;
color: #333;
}
.service_status {
font-size: 22rpx;
padding: 4rpx 12rpx;
border-radius: 12rpx;
background: rgba(41, 211, 180, 0.1);
color: #29d3b4;
}
}
.service_details {
.detail_row {
display: flex;
margin-bottom: 8rpx;
.detail_label {
font-size: 24rpx;
color: #666;
min-width: 160rpx;
}
.detail_value {
font-size: 24rpx;
color: #333;
flex: 1;
}
}
}
}
.service_arrow {
.arrow-icon {
width: 24rpx;
height: 24rpx;
opacity: 0.4;
}
}
}
.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>