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.

233 lines
4.5 KiB

<template>
<view class="content">
<!-- 学生卡片列表 -->
<view class="card-container">
<view v-for="(student, index) in studentList" :key="index" class="student-card highlight">
<view class="card-header">
<view class="school-name">{{ student.school_name }}</view>
<view class="problem-badge">{{ student.cnt }}个问题</view>
</view>
<view class="student-info">
<view class="avatar-container">
<image class="avatar" :src="student.xb_name === '男' ? '/static/boy.png' : '/static/girl.png'">
</image>
</view>
<view class="info-content">
<view class="student-name">{{ student.person_name }}</view>
<view class="student-details">
<text class="detail-item">{{ student.xb_name }}</text>
<text class="separator">|</text>
<text class="detail-item">{{ student.grade_name }}</text>
<text class="separator">|</text>
<text class="detail-item">{{ student.class_name }}</text>
</view>
</view>
</view>
<view class="card-footer">
<u-row justify="space-between">
<u-col span="3">
<view class="demo-layout bg-purple"></view>
</u-col>
<u-col span="3">
<view class="demo-layout bg-purple-light"></view>
</u-col>
<u-col span="3">
<view class="demo-layout bg-purple"></view>
</u-col>
<u-col span="3">
<view class="demo-layout bg-purple-light"><u-button type="primary" :plain="true"
:hairline="true" size="small" shape="circle" text="查看详情"
@click="handleStudent(student)"></u-button></view>
</u-col>
</u-row>
<!-- -->
<!-- <el-button type="primary" size="small" @click="handleStudent(student)">查看详情</el-button> -->
</view>
</view>
</view>
<!-- 无数据时显示 -->
<view class="empty-state" v-if="studentList.length === 0">
<image class="empty-icon" src="/static/images/empty.png"></image>
<text class="empty-text"></text>
</view>
</view>
</template>
<script>
import {
getRiskSummaryListApi
} from '@/api/services/index.js';
export default {
data() {
return {
studentList: []
}
},
onLoad(options) {
uni.setNavigationBarTitle({
title: '风险统计'
})
getRiskSummaryListApi({
risk_flag: '1',
page: '1',
page_size: '100'
}).then((res) => {
if (res.success) {
if (res.data.total > 0) {
this.studentList = res.data.logs
}
}
}).catch((err) => {
console.log(err)
})
},
methods: {
handleStudent(student) {
uni.navigateTo({
url: '/pages/risk/risk?person_id=' + student.person_id
});
// 这里可以添加导航到学生详情页的逻辑
// this.$router.push(`/pages/student/detail?id=${student.id}`);
}
}
}
</script>
<style lang="scss" scoped>
.content {
min-height: 100vh;
display: flex;
flex-direction: column;
background-color: #F4F4F5;
padding: 20rpx;
}
.page-header {
padding: 30rpx 20rpx;
.page-title {
font-size: 36rpx;
font-weight: bold;
color: #333;
}
}
.card-container {
display: flex;
flex-direction: column;
gap: 20rpx;
padding-bottom: 30rpx;
}
.student-card {
background-color: #FFFFFF;
border-radius: 16rpx;
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.05);
padding: 24rpx;
transition: all 0.3s;
&.highlight {
border-left: 8rpx solid #FF6B6B;
}
&:hover {
transform: translateY(-5rpx);
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.08);
}
}
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 30rpx;
.school-name {
font-size: 32rpx;
color: #666;
}
.problem-badge {
background-color: #FEF0F0;
color: #F56C6C;
padding: 12rpx 22rpx;
border-radius: 30rpx;
font-size: 24rpx;
font-weight: bolder;
}
}
.student-info {
display: flex;
align-items: center;
margin-bottom: 10rpx;
}
.avatar-container {
margin-right: 20rpx;
.avatar {
width: 80rpx;
height: 80rpx;
border-radius: 50%;
background-color: #f0f0f0;
}
}
.info-content {
flex: 1;
.student-name {
font-size: 32rpx;
font-weight: bold;
color: #333;
margin-bottom: 8rpx;
}
.student-details {
display: flex;
align-items: center;
font-size: 26rpx;
color: #666;
.separator {
margin: 0 10rpx;
color: #ddd;
}
}
}
.card-footer {
// display: flex;
// justify-content: flex-end;
}
.empty-state {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 100rpx 0;
.empty-icon {
width: 200rpx;
height: 200rpx;
margin-bottom: 20rpx;
}
.empty-text {
color: #999;
font-size: 28rpx;
}
}
</style>