完善预警和积分接口接入

This commit is contained in:
tanxin
2026-11-06 15:07:51 +08:00
parent af73453035
commit 267ef98616
5 changed files with 172 additions and 388 deletions
+7 -5
View File
@@ -4,8 +4,8 @@
<scroll-view class="content-scroll" direction="vertical" scroll-y="true">
<view v-if="isLoading" class="status-panel"><text class="status-text">预警信息加载中</text></view>
<view v-else-if="alerts.length === 0" class="status-panel"><text class="status-text">暂无预警信息</text></view>
<view v-else v-for="alert in alerts" :key="alert.id" class="alert-card">
<view class="alert-card-top"><view class="alert-level-dot" :class="levelDotClass(alert.level)"></view><text class="alert-title">{{ alert.title }}</text><text v-if="!alert.isRead" class="unread-mark">未读</text></view>
<view v-else v-for="alert in alerts" :key="alert.id" class="alert-card">
<view class="alert-card-top"><view class="alert-level-dot" :class="levelDotClass(alert.level)"></view><text class="alert-title">{{ alert.title }}</text><text class="alert-status" :class="alert.isRead ? 'alert-status-normal' : 'alert-status-triggered'">{{ alert.statusName }}</text></view>
<text class="alert-content">{{ alert.content }}</text>
<text class="alert-time">{{ formatTime(alert.occurredAt) }}</text>
</view>
@@ -14,7 +14,7 @@
</template>
<script setup lang="ts">
import { apiGetStudentAlerts, type StudentAlert, type StudentAlertLevel } from '../../api/student'
import { apiGetStudentLearningWarnings, type StudentAlert, type StudentAlertLevel } from '../../api/student'
import { homeStudentProfile } from '../../store/home'
const alerts = ref<StudentAlert[]>([])
@@ -31,7 +31,7 @@
isLoading.value = false
return
}
const res = await apiGetStudentAlerts(studentId, 1, 20)
const res = await apiGetStudentLearningWarnings(studentId, true, false)
if (res && res.data) {
alerts.value = res.data.list
}
@@ -62,7 +62,9 @@
.alert-level-medium { background-color: #e8a129; }
.alert-level-low { background-color: #4d87cf; }
.alert-title { flex: 1; font-size: 15px; font-weight: 700; color: #30384a; }
.unread-mark { padding: 3px 7px; border-radius: 8px; font-size: 10px; color: #554be9; background-color: #eeefff; }
.alert-status { padding: 3px 7px; border-radius: 8px; font-size: 10px; }
.alert-status-triggered { color: #e25a5a; background-color: #fff0f1; }
.alert-status-normal { color: #16a979; background-color: #e8fbf3; }
.alert-content { margin-top: 10px; font-size: 13px; line-height: 20px; color: #626c7e; }
.alert-time { margin-top: 10px; font-size: 11px; color: #9aa2b1; }
</style>