diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..13566b8
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/TimeManager.iml b/.idea/TimeManager.iml
new file mode 100644
index 0000000..f628796
--- /dev/null
+++ b/.idea/TimeManager.iml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Dart_Packages.xml b/.idea/libraries/Dart_Packages.xml
new file mode 100644
index 0000000..7e0364e
--- /dev/null
+++ b/.idea/libraries/Dart_Packages.xml
@@ -0,0 +1,204 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Dart_SDK.xml b/.idea/libraries/Dart_SDK.xml
new file mode 100644
index 0000000..ea9768b
--- /dev/null
+++ b/.idea/libraries/Dart_SDK.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..639900d
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..41f3c04
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/timemanagerapp/lib/entity/Clock.dart b/src/timemanagerapp/lib/entity/Clock.dart
new file mode 100644
index 0000000..604ee4b
--- /dev/null
+++ b/src/timemanagerapp/lib/entity/Clock.dart
@@ -0,0 +1,17 @@
+class Clock {
+ int id;
+ int userId;
+ String text;
+ String img;
+ String music;
+ DateTime continueTime;
+
+ Clock({
+ required this.id,
+ required this.userId,
+ required this.text,
+ required this.img,
+ required this.music,
+ required this.continueTime,
+ });
+}
\ No newline at end of file
diff --git a/src/timemanagerapp/production/timemanagerapp/database/新建文本文档.txt b/src/timemanagerapp/production/timemanagerapp/database/新建文本文档.txt
new file mode 100644
index 0000000..e69de29
diff --git a/src/timemanagerapp/production/timemanagerapp/entity/Course.dart b/src/timemanagerapp/production/timemanagerapp/entity/Course.dart
new file mode 100644
index 0000000..e47277e
--- /dev/null
+++ b/src/timemanagerapp/production/timemanagerapp/entity/Course.dart
@@ -0,0 +1,9 @@
+class Course {
+ int id = -1;
+ String name = "";
+ double credit = -1;
+ String teacher = "";
+ String location = "";
+ DateTime start = DateTime.now();
+ DateTime end = DateTime.now();
+}
diff --git a/src/timemanagerapp/production/timemanagerapp/entity/Task.dart b/src/timemanagerapp/production/timemanagerapp/entity/Task.dart
new file mode 100644
index 0000000..e69de29
diff --git a/src/timemanagerapp/production/timemanagerapp/entity/Team.dart b/src/timemanagerapp/production/timemanagerapp/entity/Team.dart
new file mode 100644
index 0000000..e69de29
diff --git a/src/timemanagerapp/production/timemanagerapp/entity/User.dart b/src/timemanagerapp/production/timemanagerapp/entity/User.dart
new file mode 100644
index 0000000..e69de29
diff --git a/src/timemanagerapp/production/timemanagerapp/entity/Work.dart b/src/timemanagerapp/production/timemanagerapp/entity/Work.dart
new file mode 100644
index 0000000..e69de29
diff --git a/src/timemanagerapp/production/timemanagerapp/main.dart b/src/timemanagerapp/production/timemanagerapp/main.dart
new file mode 100644
index 0000000..54376c1
--- /dev/null
+++ b/src/timemanagerapp/production/timemanagerapp/main.dart
@@ -0,0 +1,20 @@
+import 'package:flutter/material.dart';
+import 'package:timemanagerapp/wighets/AddCourseFormWidget.dart';
+
+void main() {
+ runApp(MyApp());
+}
+
+class MyApp extends StatelessWidget {
+ @override
+ Widget build(BuildContext context) {
+ return MaterialApp(
+ home: Scaffold(
+ appBar: AppBar(
+ title: Text('添加课程'),
+ ),
+ body: AddCourseFormWidget(),
+ ),
+ );
+ }
+}
diff --git a/src/timemanagerapp/production/timemanagerapp/ruters/新建文本文档.txt b/src/timemanagerapp/production/timemanagerapp/ruters/新建文本文档.txt
new file mode 100644
index 0000000..e69de29
diff --git a/src/timemanagerapp/production/timemanagerapp/util/GetCourseByLogin.dart b/src/timemanagerapp/production/timemanagerapp/util/GetCourseByLogin.dart
new file mode 100644
index 0000000..2fa1820
--- /dev/null
+++ b/src/timemanagerapp/production/timemanagerapp/util/GetCourseByLogin.dart
@@ -0,0 +1,55 @@
+import 'dart:io';
+import 'dart:convert';
+import 'package:timemanagerapp/entity/Course.dart';
+
+class GetCourseByLogin {
+ String id = ""; //学号
+ String passwd = ""; //密码
+ String year = "2023"; //学年
+ String term = "1"; //学期
+ var courses = List; //获取的所有课程
+ var pythonScriptPath =
+ r'D:\Myprogramfile\Flutter\TimeManager\src\timemanagerapp\lib\util\GetCourseByLogin.dart'; //Python脚本的路径;
+
+ Future getRawString() async {
+ final file = File(pythonScriptPath);
+ String res = "";
+ if (!file.existsSync()) {
+ print('Python脚本文件不存在: $pythonScriptPath');
+ return "";
+ }
+
+ final process = await Process.start('python', [pythonScriptPath]);
+
+ process.stdin.writeln('$id');
+ process.stdin.writeln('$passwd');
+ process.stdin.writeln('$year');
+ process.stdin.writeln('$term');
+
+ process.stdout.transform(utf8.decoder).listen((data) {
+ print('Python Output: $data');
+ res += data;
+ });
+
+ process.stderr.transform(utf8.decoder).listen((data) {
+ // print('Python Error: $data');
+ res += data;
+ });
+
+ final exitCode = await process.exitCode;
+ return res;
+ }
+
+ dealRawString(String rawStr) {}
+
+ run() {
+ getRawString().then((value) {
+ dealRawString(value);
+ });
+ return courses;
+ }
+}
+
+void main() {
+ GetCourseByLogin().run();
+}
diff --git a/src/timemanagerapp/production/timemanagerapp/util/getschedule.py b/src/timemanagerapp/production/timemanagerapp/util/getschedule.py
new file mode 100644
index 0000000..6e4a470
--- /dev/null
+++ b/src/timemanagerapp/production/timemanagerapp/util/getschedule.py
@@ -0,0 +1,14 @@
+import zfnew
+import sys
+from zfnew import GetInfo, Login
+
+sys.stdout.reconfigure(encoding='utf-8')
+
+base_url = 'http://jwgl.cauc.edu.cn/xtgl/login_slogin.html'
+
+lgn = Login(base_url=base_url)
+lgn.login(input(), input())
+cookies = lgn.cookies # cookies获取方法
+person = GetInfo(base_url=base_url, cookies=cookies)
+schedule = person.get_schedule(input(), input()) # eg. 2022年、第1学期(1 or 2)
+print(schedule)
\ No newline at end of file
diff --git a/src/timemanagerapp/production/timemanagerapp/wighets/AddCourseFormWidget.dart b/src/timemanagerapp/production/timemanagerapp/wighets/AddCourseFormWidget.dart
new file mode 100644
index 0000000..474bdfa
--- /dev/null
+++ b/src/timemanagerapp/production/timemanagerapp/wighets/AddCourseFormWidget.dart
@@ -0,0 +1,195 @@
+import 'package:flutter/material.dart';
+
+class AddCourseFormWidget extends StatefulWidget {
+ @override
+ _AddCourseFormWidgetState createState() => _AddCourseFormWidgetState();
+}
+
+class _AddCourseFormWidgetState extends State {
+ final GlobalKey _formKey = GlobalKey();
+ String course = '';
+ String credit = '';
+ String note = '';
+ String day = '周一';
+ String startWeek = '1';
+ String endWeek = '12';
+ String startTime = '1';
+ String endTime = '2';
+ String teacher = '';
+ String location = '';
+
+ @override
+ Widget build(BuildContext context) {
+ return SingleChildScrollView(
+ child: Padding(
+ padding: const EdgeInsets.all(16.0),
+ child: Form(
+ key: _formKey,
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ TextFormField(
+ decoration: InputDecoration(labelText: '课程*'),
+ onSaved: (value) => course = value ?? '',
+ validator: (value) {
+ if (value == null || value.isEmpty) {
+ return '课程为必填项';
+ }
+ return null;
+ },
+ ),
+ SizedBox(height: 16.0),
+ TextFormField(
+ decoration: InputDecoration(labelText: '学分'),
+ onSaved: (value) => credit = value ?? '',
+ ),
+ SizedBox(height: 16.0),
+ TextFormField(
+ decoration: InputDecoration(labelText: '备注'),
+ onSaved: (value) => note = value ?? '',
+ ),
+ SizedBox(height: 16.0),
+ DropdownButtonFormField(
+ value: day,
+ onChanged: (newValue) {
+ setState(() {
+ day = newValue ?? '';
+ });
+ },
+ items: ['周一', '周二', '周三', '周四', '周五']
+ .map((d) => DropdownMenuItem(
+ value: d,
+ child: Text(d),
+ ))
+ .toList(),
+ decoration: InputDecoration(labelText: '上课日*'),
+ validator: (value) {
+ if (value == null || value.isEmpty) {
+ return '上课日为必填项';
+ }
+ return null;
+ },
+ ),
+ SizedBox(height: 16.0),
+ TextFormField(
+ decoration: InputDecoration(labelText: '开始周*'),
+ onSaved: (value) => startWeek = value ?? '',
+ validator: (value) {
+ if (value == null || value.isEmpty) {
+ return '开始周为必填项';
+ }
+ return null;
+ },
+ ),
+ SizedBox(height: 16.0),
+ TextFormField(
+ decoration: InputDecoration(labelText: '结束周*'),
+ onSaved: (value) => endWeek = value ?? '',
+ validator: (value) {
+ if (value == null || value.isEmpty) {
+ return '结束周为必填项';
+ }
+ return null;
+ },
+ ),
+ SizedBox(height: 16.0),
+ DropdownButtonFormField(
+ value: startTime,
+ onChanged: (newValue) {
+ setState(() {
+ startTime = newValue ?? '';
+ });
+ },
+ items: List.generate(12, (index) => (index + 1).toString())
+ .map((time) => DropdownMenuItem(
+ value: time,
+ child: Text(time),
+ ))
+ .toList(),
+ decoration: InputDecoration(labelText: '上课时间*'),
+ validator: (value) {
+ if (value == null || value.isEmpty) {
+ return '上课时间为必填项';
+ }
+ return null;
+ },
+ ),
+ SizedBox(height: 16.0),
+ DropdownButtonFormField(
+ value: endTime,
+ onChanged: (newValue) {
+ setState(() {
+ endTime = newValue ?? '';
+ });
+ },
+ items: List.generate(12, (index) => (index + 1).toString())
+ .map((time) => DropdownMenuItem(
+ value: time,
+ child: Text(time),
+ ))
+ .toList(),
+ decoration: InputDecoration(labelText: '下课时间*'),
+ validator: (value) {
+ if (value == null || value.isEmpty) {
+ return '下课时间为必填项';
+ }
+ return null;
+ },
+ ),
+ SizedBox(height: 16.0),
+ TextFormField(
+ decoration: InputDecoration(labelText: '老师'),
+ onSaved: (value) => teacher = value ?? '',
+ ),
+ SizedBox(height: 16.0),
+ TextFormField(
+ decoration: InputDecoration(labelText: '地点*'),
+ onSaved: (value) => location = value ?? '',
+ validator: (value) {
+ if (value == null || value.isEmpty) {
+ return '地点为必填项';
+ }
+ return null;
+ },
+ ),
+ SizedBox(height: 24.0),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.spaceAround,
+ children: [
+ ElevatedButton(
+ onPressed: () {
+ // 点击取消按钮后的操作
+ Navigator.pop(context); // 关闭当前界面
+ },
+ child: Text('取消'),
+ ),
+ ElevatedButton(
+ onPressed: () {
+ // 点击确定按钮后的操作
+ if (_formKey.currentState!.validate()) {
+ _formKey.currentState!.save();
+ // 在这里执行表单提交操作
+ // 你可以访问各个字段的值,如 course, credit, note, 等
+ print('课程: $course');
+ print('学分: $credit');
+ print('备注: $note');
+ print('上课日: $day');
+ print('开始周: $startWeek');
+ print('结束周: $endWeek');
+ print('上课时间: $startTime');
+ print('下课时间: $endTime');
+ print('老师: $teacher');
+ print('地点: $location');
+ }
+ },
+ child: Text('确定'),
+ ),
+ ],
+ ),
+ ],
+ ),
+ ),
+ ),
+ );
+ }
+}
diff --git a/src/timemanagerapp/production/timemanagerapp/wighets/LoginWidget.dart b/src/timemanagerapp/production/timemanagerapp/wighets/LoginWidget.dart
new file mode 100644
index 0000000..c6e0054
--- /dev/null
+++ b/src/timemanagerapp/production/timemanagerapp/wighets/LoginWidget.dart
@@ -0,0 +1,42 @@
+import 'package:flutter/material.dart';
+
+class LoginWidget extends StatelessWidget {
+ @override
+ Widget build(BuildContext context) {
+ return Scaffold(
+ appBar: AppBar(
+ title: Text('登录'),
+ ),
+ body: Center(
+ child: Padding(
+ padding: const EdgeInsets.all(16.0),
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ TextFormField(
+ decoration: InputDecoration(
+ labelText: '用户名',
+ ),
+ ),
+ SizedBox(height: 16.0),
+ TextFormField(
+ obscureText: true, // 密码输入框,隐藏文本
+ decoration: InputDecoration(
+ labelText: '密码',
+ ),
+ ),
+ SizedBox(height: 24.0),
+ ElevatedButton(
+ onPressed: () {
+ // 在这里添加处理登录按钮点击事件的代码
+ // 通常会验证用户名和密码,并执行相应的登录逻辑
+ },
+ child: Text('登录'),
+ ),
+ ],
+ ),
+ ),
+ ),
+ );
+ }
+}
diff --git a/src/timemanagerapp/production/timemanagerapp/wighets/RegisterWidget.dart b/src/timemanagerapp/production/timemanagerapp/wighets/RegisterWidget.dart
new file mode 100644
index 0000000..263b1bd
--- /dev/null
+++ b/src/timemanagerapp/production/timemanagerapp/wighets/RegisterWidget.dart
@@ -0,0 +1,49 @@
+import 'package:flutter/material.dart';
+
+class RegisterWidget extends StatelessWidget {
+ @override
+ Widget build(BuildContext context) {
+ return Scaffold(
+ appBar: AppBar(
+ title: Text('注册'),
+ ),
+ body: Center(
+ child: Padding(
+ padding: const EdgeInsets.all(16.0),
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ TextFormField(
+ decoration: InputDecoration(
+ labelText: '用户名',
+ ),
+ ),
+ SizedBox(height: 16.0),
+ TextFormField(
+ obscureText: true, // 密码输入框,隐藏文本
+ decoration: InputDecoration(
+ labelText: '密码',
+ ),
+ ),
+ SizedBox(height: 16.0),
+ TextFormField(
+ obscureText: true, // 密码输入框,隐藏文本
+ decoration: InputDecoration(
+ labelText: '确认密码',
+ ),
+ ),
+ SizedBox(height: 24.0),
+ ElevatedButton(
+ onPressed: () {
+ // 在这里添加处理注册按钮点击事件的代码
+ // 通常会验证输入的用户名和密码,然后执行注册逻辑
+ },
+ child: Text('注册'),
+ ),
+ ],
+ ),
+ ),
+ ),
+ );
+ }
+}
diff --git a/src/timemanagerapp/production/timemanagerapp/wighets/TimetableWighet.dart b/src/timemanagerapp/production/timemanagerapp/wighets/TimetableWighet.dart
new file mode 100644
index 0000000..e69de29
diff --git a/src/timemanagerapp/test/timemanagerapp/GetCourseByLogin_test.dart b/src/timemanagerapp/test/timemanagerapp/GetCourseByLogin_test.dart
new file mode 100644
index 0000000..1e993f3
--- /dev/null
+++ b/src/timemanagerapp/test/timemanagerapp/GetCourseByLogin_test.dart
@@ -0,0 +1,55 @@
+import 'dart:io';
+import 'dart:convert';
+import 'package:timemanagerapp/entity/Course.dart';
+
+class GetCourseByLogin {
+ String id = ""; //学号
+ String passwd = ""; //密码
+ String year = "2023"; //学年
+ String term = "1"; //学期
+ var courses = List; //获取的所有课程
+ var pythonScriptPath =
+ r'D:\Myprogramfile\Flutter\timemanagerapp\lib\util\getschedule.py'; //Python脚本的路径;
+
+ Future getRawString() async {
+ final file = File(pythonScriptPath);
+ String res = "";
+ if (!file.existsSync()) {
+ print('Python脚本文件不存在: $pythonScriptPath');
+ return "";
+ }
+
+ final process = await Process.start('python', [pythonScriptPath]);
+
+ process.stdin.writeln('$id');
+ process.stdin.writeln('$passwd');
+ process.stdin.writeln('$year');
+ process.stdin.writeln('$term');
+
+ process.stdout.transform(utf8.decoder).listen((data) {
+ print('Python Output: $data');
+ res += data;
+ });
+
+ process.stderr.transform(utf8.decoder).listen((data) {
+ // print('Python Error: $data');
+ res += data;
+ });
+
+ final exitCode = await process.exitCode;
+ return res;
+ }
+
+ dealRawString(String rawStr) {}
+
+ run() {
+ getRawString().then((value) {
+ dealRawString(value);
+ });
+ return courses;
+ }
+}
+
+void main() {
+ GetCourseByLogin().run();
+}
diff --git a/src/timemanagerapp/test/timemanagerapp/widget_test.dart b/src/timemanagerapp/test/timemanagerapp/widget_test.dart
new file mode 100644
index 0000000..27d8aed
--- /dev/null
+++ b/src/timemanagerapp/test/timemanagerapp/widget_test.dart
@@ -0,0 +1,30 @@
+// This is a basic Flutter widget test.
+//
+// To perform an interaction with a widget in your test, use the WidgetTester
+// utility in the flutter_test package. For example, you can send tap and scroll
+// gestures. You can also use WidgetTester to find child widgets in the widget
+// tree, read text, and verify that the values of widget properties are correct.
+
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+
+import 'package:timemanagerapp/main.dart';
+
+void main() {
+ testWidgets('Counter increments smoke test', (WidgetTester tester) async {
+ // Build our app and trigger a frame.
+ await tester.pumpWidget(MyApp());
+
+ // Verify that our counter starts at 0.
+ expect(find.text('0'), findsOneWidget);
+ expect(find.text('1'), findsNothing);
+
+ // Tap the '+' icon and trigger a frame.
+ await tester.tap(find.byIcon(Icons.add));
+ await tester.pump();
+
+ // Verify that our counter has incremented.
+ expect(find.text('0'), findsNothing);
+ expect(find.text('1'), findsOneWidget);
+ });
+}