添加基本的实体类

aihua
SjvavE 2 years ago
parent b12923fab9
commit 8463ab950c

8
.idea/.gitignore vendored

@ -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

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Dart SDK" level="project" />
<orderEntry type="library" name="Dart Packages" level="project" />
</component>
</module>

@ -0,0 +1,204 @@
<component name="libraryTable">
<library name="Dart Packages" type="DartPackagesLibraryType">
<properties>
<option name="packageNameToDirsMap">
<entry key="async">
<value>
<list>
<option value="C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/async-2.11.0/lib" />
</list>
</value>
</entry>
<entry key="boolean_selector">
<value>
<list>
<option value="C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/boolean_selector-2.1.1/lib" />
</list>
</value>
</entry>
<entry key="characters">
<value>
<list>
<option value="C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/characters-1.3.0/lib" />
</list>
</value>
</entry>
<entry key="clock">
<value>
<list>
<option value="C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/clock-1.1.1/lib" />
</list>
</value>
</entry>
<entry key="collection">
<value>
<list>
<option value="C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/collection-1.17.2/lib" />
</list>
</value>
</entry>
<entry key="cupertino_icons">
<value>
<list>
<option value="C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/cupertino_icons-1.0.6/lib" />
</list>
</value>
</entry>
<entry key="fake_async">
<value>
<list>
<option value="C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/fake_async-1.3.1/lib" />
</list>
</value>
</entry>
<entry key="flutter">
<value>
<list>
<option value="C:/SDKs/Flutter/flutter_windows_3.13.2-stable/flutter/packages/flutter/lib" />
</list>
</value>
</entry>
<entry key="flutter_lints">
<value>
<list>
<option value="C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/flutter_lints-2.0.3/lib" />
</list>
</value>
</entry>
<entry key="flutter_test">
<value>
<list>
<option value="C:/SDKs/Flutter/flutter_windows_3.13.2-stable/flutter/packages/flutter_test/lib" />
</list>
</value>
</entry>
<entry key="lints">
<value>
<list>
<option value="C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/lints-2.1.1/lib" />
</list>
</value>
</entry>
<entry key="matcher">
<value>
<list>
<option value="C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/matcher-0.12.16/lib" />
</list>
</value>
</entry>
<entry key="material_color_utilities">
<value>
<list>
<option value="C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/material_color_utilities-0.5.0/lib" />
</list>
</value>
</entry>
<entry key="meta">
<value>
<list>
<option value="C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/meta-1.9.1/lib" />
</list>
</value>
</entry>
<entry key="path">
<value>
<list>
<option value="C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/path-1.8.3/lib" />
</list>
</value>
</entry>
<entry key="sky_engine">
<value>
<list>
<option value="C:/SDKs/Flutter/flutter_windows_3.13.2-stable/flutter/bin/cache/pkg/sky_engine/lib" />
</list>
</value>
</entry>
<entry key="source_span">
<value>
<list>
<option value="C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/source_span-1.10.0/lib" />
</list>
</value>
</entry>
<entry key="stack_trace">
<value>
<list>
<option value="C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/stack_trace-1.11.0/lib" />
</list>
</value>
</entry>
<entry key="stream_channel">
<value>
<list>
<option value="C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/stream_channel-2.1.1/lib" />
</list>
</value>
</entry>
<entry key="string_scanner">
<value>
<list>
<option value="C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/string_scanner-1.2.0/lib" />
</list>
</value>
</entry>
<entry key="term_glyph">
<value>
<list>
<option value="C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/term_glyph-1.2.1/lib" />
</list>
</value>
</entry>
<entry key="test_api">
<value>
<list>
<option value="C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/test_api-0.6.0/lib" />
</list>
</value>
</entry>
<entry key="vector_math">
<value>
<list>
<option value="C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/vector_math-2.1.4/lib" />
</list>
</value>
</entry>
<entry key="web">
<value>
<list>
<option value="C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/web-0.1.4-beta/lib" />
</list>
</value>
</entry>
</option>
</properties>
<CLASSES>
<root url="file://C:/SDKs/Flutter/flutter_windows_3.13.2-stable/flutter/bin/cache/pkg/sky_engine/lib" />
<root url="file://C:/SDKs/Flutter/flutter_windows_3.13.2-stable/flutter/packages/flutter/lib" />
<root url="file://C:/SDKs/Flutter/flutter_windows_3.13.2-stable/flutter/packages/flutter_test/lib" />
<root url="file://C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/async-2.11.0/lib" />
<root url="file://C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/boolean_selector-2.1.1/lib" />
<root url="file://C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/characters-1.3.0/lib" />
<root url="file://C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/clock-1.1.1/lib" />
<root url="file://C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/collection-1.17.2/lib" />
<root url="file://C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/cupertino_icons-1.0.6/lib" />
<root url="file://C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/fake_async-1.3.1/lib" />
<root url="file://C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/flutter_lints-2.0.3/lib" />
<root url="file://C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/lints-2.1.1/lib" />
<root url="file://C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/matcher-0.12.16/lib" />
<root url="file://C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/material_color_utilities-0.5.0/lib" />
<root url="file://C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/meta-1.9.1/lib" />
<root url="file://C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/path-1.8.3/lib" />
<root url="file://C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/source_span-1.10.0/lib" />
<root url="file://C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/stack_trace-1.11.0/lib" />
<root url="file://C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/stream_channel-2.1.1/lib" />
<root url="file://C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/string_scanner-1.2.0/lib" />
<root url="file://C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/term_glyph-1.2.1/lib" />
<root url="file://C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/test_api-0.6.0/lib" />
<root url="file://C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/vector_math-2.1.4/lib" />
<root url="file://C:/Users/L/AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/web-0.1.4-beta/lib" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

@ -0,0 +1,29 @@
<component name="libraryTable">
<library name="Dart SDK">
<CLASSES>
<root url="file://E:/develop_environment/flutter-sdk/flutter/bin/cache/dart-sdk/lib/async" />
<root url="file://E:/develop_environment/flutter-sdk/flutter/bin/cache/dart-sdk/lib/cli" />
<root url="file://E:/develop_environment/flutter-sdk/flutter/bin/cache/dart-sdk/lib/collection" />
<root url="file://E:/develop_environment/flutter-sdk/flutter/bin/cache/dart-sdk/lib/convert" />
<root url="file://E:/develop_environment/flutter-sdk/flutter/bin/cache/dart-sdk/lib/core" />
<root url="file://E:/develop_environment/flutter-sdk/flutter/bin/cache/dart-sdk/lib/developer" />
<root url="file://E:/develop_environment/flutter-sdk/flutter/bin/cache/dart-sdk/lib/ffi" />
<root url="file://E:/develop_environment/flutter-sdk/flutter/bin/cache/dart-sdk/lib/html" />
<root url="file://E:/develop_environment/flutter-sdk/flutter/bin/cache/dart-sdk/lib/indexed_db" />
<root url="file://E:/develop_environment/flutter-sdk/flutter/bin/cache/dart-sdk/lib/io" />
<root url="file://E:/develop_environment/flutter-sdk/flutter/bin/cache/dart-sdk/lib/isolate" />
<root url="file://E:/develop_environment/flutter-sdk/flutter/bin/cache/dart-sdk/lib/js" />
<root url="file://E:/develop_environment/flutter-sdk/flutter/bin/cache/dart-sdk/lib/js_interop" />
<root url="file://E:/develop_environment/flutter-sdk/flutter/bin/cache/dart-sdk/lib/js_interop_unsafe" />
<root url="file://E:/develop_environment/flutter-sdk/flutter/bin/cache/dart-sdk/lib/js_util" />
<root url="file://E:/develop_environment/flutter-sdk/flutter/bin/cache/dart-sdk/lib/math" />
<root url="file://E:/develop_environment/flutter-sdk/flutter/bin/cache/dart-sdk/lib/mirrors" />
<root url="file://E:/develop_environment/flutter-sdk/flutter/bin/cache/dart-sdk/lib/svg" />
<root url="file://E:/develop_environment/flutter-sdk/flutter/bin/cache/dart-sdk/lib/typed_data" />
<root url="file://E:/develop_environment/flutter-sdk/flutter/bin/cache/dart-sdk/lib/web_audio" />
<root url="file://E:/develop_environment/flutter-sdk/flutter/bin/cache/dart-sdk/lib/web_gl" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/TimeManager.iml" filepath="$PROJECT_DIR$/.idea/TimeManager.iml" />
</modules>
</component>
</project>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

@ -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,
});
}

@ -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();
}

@ -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(),
),
);
}
}

@ -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<Course>; //
var pythonScriptPath =
r'D:\Myprogramfile\Flutter\TimeManager\src\timemanagerapp\lib\util\GetCourseByLogin.dart'; //Python;
Future<String> 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();
}

@ -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)

@ -0,0 +1,195 @@
import 'package:flutter/material.dart';
class AddCourseFormWidget extends StatefulWidget {
@override
_AddCourseFormWidgetState createState() => _AddCourseFormWidgetState();
}
class _AddCourseFormWidgetState extends State<AddCourseFormWidget> {
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
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: <Widget>[
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<String>(
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<String>(
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<String>(
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: <Widget>[
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('确定'),
),
],
),
],
),
),
),
);
}
}

@ -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: <Widget>[
TextFormField(
decoration: InputDecoration(
labelText: '用户名',
),
),
SizedBox(height: 16.0),
TextFormField(
obscureText: true, //
decoration: InputDecoration(
labelText: '密码',
),
),
SizedBox(height: 24.0),
ElevatedButton(
onPressed: () {
//
//
},
child: Text('登录'),
),
],
),
),
),
);
}
}

@ -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: <Widget>[
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('注册'),
),
],
),
),
),
);
}
}

@ -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<Course>; //
var pythonScriptPath =
r'D:\Myprogramfile\Flutter\timemanagerapp\lib\util\getschedule.py'; //Python;
Future<String> 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();
}

@ -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);
});
}
Loading…
Cancel
Save