修改首页

This commit is contained in:
cc 2025-04-08 17:13:20 +08:00
parent b6df80f859
commit e996d46b79
9 changed files with 12924 additions and 38 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -18,21 +18,23 @@
"IS_HVIGORFILE_TYPE_CHECK": false, "IS_HVIGORFILE_TYPE_CHECK": false,
"TASK_TIME": { "TASK_TIME": {
"1043bfc77febe75fafec0c4309faccf1": { "1043bfc77febe75fafec0c4309faccf1": {
"ConfigureCmake": 476000, "ConfigureCmake": 355750,
"PreCheckSyscap": 312875, "PreCheckSyscap": 214708,
"ProcessIntegratedHsp": 1175500, "ProcessIntegratedHsp": 765750,
"BuildNativeWithCmake": 241625, "BuildNativeWithCmake": 174583,
"SyscapTransform": 25131375, "SyscapTransform": 1237833,
"BuildNativeWithNinja": 1007250, "BuildNativeWithNinja": 610541,
"BuildJS": 2504875, "CompileResource": 175070708,
"CompileArkTS": 10385196500, "BuildJS": 2112083,
"PackageHap": 760888875, "CompileArkTS": 1188633208,
"SignHap": 3445292, "GeneratePkgModuleJson": 960291,
"CollectDebugSymbol": 2780708, "PackageHap": 374414708,
"assembleHap": 271000 "SignHap": 988750,
"CollectDebugSymbol": 1472583,
"assembleHap": 118708
} }
}, },
"BUILD_ID": "202504072349221450", "TOTAL_TIME": 1949278125,
"TOTAL_TIME": 12663371125 "BUILD_ID": "202504081711360890"
} }
} }

View File

@ -158,7 +158,8 @@ export class LogManager {
new VersionLogItem("1.1.7","2025-4-1",["添加测试按钮","修复已知问题"]), new VersionLogItem("1.1.7","2025-4-1",["添加测试按钮","修复已知问题"]),
new VersionLogItem("1.2.0","2025-4-2",["添加课堂功能","修改上课页面逻辑"]), new VersionLogItem("1.2.0","2025-4-2",["添加课堂功能","修改上课页面逻辑"]),
new VersionLogItem("1.2.0 beta1.0","2025-4-3",["测试消息发送","修复已知问题"]), new VersionLogItem("1.2.0 beta1.0","2025-4-3",["测试消息发送","修复已知问题"]),
new VersionLogItem("1.2.0 beta1.1","2025-4-4",["更新说明文档","添加日志输出"]) new VersionLogItem("1.2.0 beta1.1","2025-4-4",["更新说明文档","添加日志输出"]),
new VersionLogItem("1.2.0 beta1.2","2025-4-8修改首页",["修改首页"]),
]; ];
} }

View File

@ -7,18 +7,18 @@ import settingsService, { SettingsModel, TextResources } from '../common/Setting
struct HomePage { struct HomePage {
@State message: string = '智慧教室管理系统'; @State message: string = '智慧教室管理系统';
@State classroomMonitorData: MonitorDataType = { @State classroomMonitorData: MonitorDataType = {
roomId: '', roomId: 'A301',
temperature: 0, temperature: 25.5,
humidity: 0, humidity: 60,
occupancy: 0, occupancy: 32,
status: '' status: '正常'
}; };
@State comprehensiveClassData: ClassDataType = { @State comprehensiveClassData: ClassDataType = {
classId: '', classId: 'CS101',
subjectName: '', subjectName: '高等数学',
teacherName: '', teacherName: '张教授',
duration: 0, duration: 95,
studentCount: 0 studentCount: 45
}; };
// 从设置服务获取设置 // 从设置服务获取设置
@ -204,17 +204,13 @@ struct Card {
.padding({ top: 8, bottom: 16 }) .padding({ top: 8, bottom: 16 })
// 图表内容 // 图表内容
Column() { if (this.isMonitorData()) {
Text('图表内容1') // 教室监控数据显示
.fontSize(16) this.MonitorDataChart()
.fontColor('#999') } else {
.height(150) // 综合上课数据显示
.width('100%') this.ClassDataChart()
.textAlign(TextAlign.Center)
} }
.backgroundColor('#f5f5f5')
.borderRadius(8)
.width('100%')
} }
.width('100%') .width('100%')
.backgroundColor(Color.White) .backgroundColor(Color.White)
@ -222,6 +218,201 @@ struct Card {
.padding(16) .padding(16)
.shadow({ radius: 6, color: '#eeeeee' }) .shadow({ radius: 6, color: '#eeeeee' })
} }
// 判断是否为监控数据类型
private isMonitorData(): boolean {
// 使用特有属性进行区分
return (this.data as MonitorDataType).temperature !== undefined;
}
// 教室监控数据图表
@Builder
MonitorDataChart() {
Column() {
Row() {
// 温度展示
Column() {
Text('温度')
.fontSize(14)
.fontColor('#666')
Row() {
Text((this.data as MonitorDataType).temperature.toString())
.fontSize(26)
.fontWeight(FontWeight.Bold)
.fontColor(this.themeColor)
Text('°C')
.fontSize(16)
.fontColor('#666')
.margin({ left: 4 })
}
}
.layoutWeight(1)
.alignItems(HorizontalAlign.Center)
// 湿度展示
Column() {
Text('湿度')
.fontSize(14)
.fontColor('#666')
Row() {
Text((this.data as MonitorDataType).humidity.toString())
.fontSize(26)
.fontWeight(FontWeight.Bold)
.fontColor(this.themeColor)
Text('%')
.fontSize(16)
.fontColor('#666')
.margin({ left: 4 })
}
}
.layoutWeight(1)
.alignItems(HorizontalAlign.Center)
}
.width('100%')
.margin({ bottom: 20 })
Row() {
// 人数展示
Column() {
Text('人数')
.fontSize(14)
.fontColor('#666')
Text((this.data as MonitorDataType).occupancy.toString())
.fontSize(26)
.fontWeight(FontWeight.Bold)
.fontColor(this.themeColor)
}
.layoutWeight(1)
.alignItems(HorizontalAlign.Center)
// 状态展示
Column() {
Text('状态')
.fontSize(14)
.fontColor('#666')
Text((this.data as MonitorDataType).status || '正常')
.fontSize(18)
.fontWeight(FontWeight.Medium)
.fontColor(this.getStatusColor((this.data as MonitorDataType).status))
}
.layoutWeight(1)
.alignItems(HorizontalAlign.Center)
}
.width('100%')
}
.backgroundColor('#f5f5f5')
.borderRadius(8)
.width('100%')
.padding(16)
}
// 综合上课数据图表
@Builder
ClassDataChart() {
Column() {
// 课程信息
Row() {
Column() {
Text('课程')
.fontSize(14)
.fontColor('#666')
Text((this.data as ClassDataType).subjectName || '未指定')
.fontSize(18)
.fontWeight(FontWeight.Medium)
.fontColor('#333')
}
.layoutWeight(1)
.alignItems(HorizontalAlign.Start)
Column() {
Text('教师')
.fontSize(14)
.fontColor('#666')
Text((this.data as ClassDataType).teacherName || '未指定')
.fontSize(18)
.fontWeight(FontWeight.Medium)
.fontColor('#333')
}
.layoutWeight(1)
.alignItems(HorizontalAlign.Start)
}
.width('100%')
.margin({ bottom: 20 })
// 课堂数据
Row() {
// 课堂时长
Column() {
Text('时长')
.fontSize(14)
.fontColor('#666')
Row() {
Text(this.formatDuration((this.data as ClassDataType).duration))
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor(this.themeColor)
}
}
.layoutWeight(1)
.alignItems(HorizontalAlign.Center)
// 学生人数
Column() {
Text('学生人数')
.fontSize(14)
.fontColor('#666')
Row() {
Text((this.data as ClassDataType).studentCount.toString())
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor(this.themeColor)
Text('人')
.fontSize(14)
.fontColor('#666')
.margin({ left: 4 })
}
}
.layoutWeight(1)
.alignItems(HorizontalAlign.Center)
}
.width('100%')
}
.backgroundColor('#f5f5f5')
.borderRadius(8)
.width('100%')
.padding(16)
}
// 获取状态对应的颜色
private getStatusColor(status: string): string {
switch (status) {
case '警告':
return '#E6A23C';
case '危险':
return '#F56C6C';
case '正常':
default:
return '#67C23A';
}
}
// 格式化时长(分钟转为小时和分钟)
private formatDuration(minutes: number): string {
if (!minutes) return '0分钟';
if (minutes < 60) {
return `${minutes}分钟`;
}
const hours = Math.floor(minutes / 60);
const remainingMinutes = minutes % 60;
if (remainingMinutes === 0) {
return `${hours}小时`;
}
return `${hours}小时${remainingMinutes}分钟`;
}
} }
// 底部导航栏组件 // 底部导航栏组件

View File

@ -49,7 +49,9 @@ struct Login {
// 跳转到过渡页面 // 跳转到过渡页面
router.replaceUrl({ router.replaceUrl({
url: 'pages/TransitionPage' //url: 'pages/TransitionPage'
//取消过渡动画
url: 'pages/HomePage'
}); });
} else { } else {
this.errorMessage = '账号或密码错误'; this.errorMessage = '账号或密码错误';

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB