Skip to content
This repository has been archived by the owner on Dec 30, 2024. It is now read-only.

Commit

Permalink
封装部分功能到前端上
Browse files Browse the repository at this point in the history
  • Loading branch information
TaoEngine committed Dec 28, 2024
1 parent a12636a commit 4a37dbe
Show file tree
Hide file tree
Showing 14 changed files with 198 additions and 80 deletions.
57 changes: 46 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<div style="text-align: center; margin: 0 auto;">

# 没必要签到
一个支持插件签到的通用校园考勤位置签到APP,使用Flutter进行开发

Expand All @@ -8,31 +10,64 @@
![Plugin](https://img.shields.io/badge/基于-TOML-red?logo=toml)
![Contact](https://img.shields.io/badge/交流-3214124547-white?logo=tencent-qq)

</div>

> [!WARNING]
> 此项目含有部分功能作为作者学习研究所用,这些功能可能会违反当地学校的某些规定,因此默认为锁定(无法使用)的状态,强烈建议您不要打开这些功能,打开这些功能所造成的追责与责任划定与作者无关
> 此项目含有部分功能作为作者学习研究所用,这些功能可能会违反当地学校的某些规定[^1],因此暂时被注释掉了,如果你需要这些功能可以自行反注释代码达到目的,但使用这些功能所造成的责任划定与作者无关
> [!IMPORTANT]
> 此项目为通用型位置签到客户端,并不单单适用于某一所学校[^1],因此你们也可以根据自己学校的RESTful格式编写自己的签到插件[^2]
> 此项目为通用型位置签到客户端,并不单单适用于某一所学校,因此你们也可以根据自己学校的RESTful格式编写自己的签到插件[^2]
## 介绍
这是一款能够自定义签到方式的校园考勤位置签到的APP,只因作者实在受不了学校官方弄的签到公众号,又卡又不稳定,有时候还签不上,于是另起炉灶自己按照抓包来的RESTFul格式编写了这款好看又强大的签到APP

## 使用
非常简单
我希望这款APP能让你不必打开多个APP就能完成有关校园的签到活动,你只需要这样做:
- 初次打开APP时先进入设置登录学号和密码
- 然后下一次打开APP就点"开始签到"按钮就行了
- 然后下一次打开APP就点右上角的"签到"按钮就行了

这款APP的下一步规划是后台签到,你只需要设置签到时间范围,并且你在签到位置范围,它就会自动帮你签到并给出简短的提醒,签到失败会给出强提醒

## 许可
- 禁止商用!
- 它是免费的!
#### 禁止商用!
这款APP没有任何盈利行为(捐赠不算),并且我不希望有人拿这个东西去赚钱,搞盈利会很快被学校的人盯上的😥

> [!NOTE]
#### 它是免费的!
如果你是买来的这款应用,你很可能被骗了!你可以把商家发给我,我来在APP首页公布这种行为☝️🤓

#### 记得不要忘了我的贡献
假如你用核心模块制作了属于自己的应用,请务必在关于界面上提一嘴"这款APP的核心是由TaoEngine开发的",我会非常感谢你的🤗

> [!IMPORTANT]
> 如果你不能能做到这些点,那么请你卸载我的软件并选用其他签到方案.这话是给君子说的
## 捐赠
看我确实帮你们解决了签到的问题,不考虑给我点小鼓励嘛!
## 关注&捐赠

<img src="img\donate.png" width=200/>
<table style="text-align: center; margin: 0 auto; width: 500;">
<tr>
<th>
<img src="./img/findme.png" width="200" alt="觉得我做的东西有点意思,要不趁机认识一下我?" style="display: block; margin: 0 auto;"/>
</th>
<th>
<img src="./img/donate.png" width="200" alt="虽然我觉得我的项目很简单,但是如果你能慷慨捐赠我将会更加努力的" style="display: block; margin: 0 auto;"/>
</th>
</tr>
<tr>
<td>
<p>
觉得我做的东西有点意思,<br>
要不趁机认识一下我?
</p>
</td>
<td>
<p>
虽然我觉得项目很简单,<br>
但是如果你能慷慨捐赠<br>
我将会更有动力的
</p>
</td>
</tr>
</table>

[^1]:作者只为本人所在的学校开发了对应的扩展插件签到客户端并非针对此学校进行开发
[^1]:作者只为本人所在的学校开发了对应的扩展插件,签到客户端并非针对此学校进行开发
[^2]:具体扩展开发模板可以去参照此项目的Wiki(正在做)
27 changes: 25 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,33 @@ allprojects {
}

rootProject.buildDir = "../build"
// subprojects {
// project.buildDir = "${rootProject.buildDir}/${project.name}"
// }
// subprojects {
// project.evaluationDependsOn(":app")
// }

//解决Isar的无法编译问题
//https://github.com/isar/isar/issues/1654
subprojects {
afterEvaluate { project ->
if (project.plugins.hasPlugin("com.android.application") ||
project.plugins.hasPlugin("com.android.library")) {
project.android {
compileSdkVersion 35
buildToolsVersion "35.0.0"
}
}
if (project.hasProperty("android")) {
project.android {
if (namespace == null) {
namespace project.group
}
}
}
}
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(":app")
}

Expand Down
Binary file added img/findme.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions lib/controller/dialog.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
part of '../widgets/dialog.dart';

QiandaoPlugin plugin = QiandaoPlugin();

/// 在登录弹窗按下"登录"时执行登录操作
Future<void> loginWithPlugin({
required Function onrun,
required Function oncallback,
required Function(String) onerror,
required String userid,
required String password,
}) async {
onrun();
try {
await plugin.login(
userid: userid,
password: password,
);
oncallback();
} catch (error) {
onerror.call(error.toString());
}
}
3 changes: 3 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:cannot_qiandao/func/plugin.dart';
import 'package:cannot_qiandao/widgets/dialog.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
Expand All @@ -17,6 +18,8 @@ void main() async {
),
);
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
QiandaoPlugin initplugin = QiandaoPlugin();
await initplugin.init();
runApp(const MainAPP());
}

Expand Down
2 changes: 1 addition & 1 deletion lib/pages/qiandao.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class _QiandaoPageState extends State<QiandaoPage> {
return ListView(
children: const [
QiandaoCard(
userid: "229094246",
userid: "22909XXXX",
username: "汪涛",
qiandaoState: QiandaoState.notQiandao,
),
Expand Down
34 changes: 2 additions & 32 deletions lib/pages/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ class SettingsView extends StatefulWidget {
}

class _SettingsViewState extends State<SettingsView> {
bool _ignorelocation = false;

@override
Widget build(BuildContext context) {
return ListView(
Expand All @@ -59,41 +57,13 @@ class _SettingsViewState extends State<SettingsView> {
),
ListTile(
leading: const Icon(Icons.link),
title: const Text("编辑签到插件的URL"),
title: const Text("编辑签到插件URL"),
subtitle: const Text("签到的核心就靠它了!"),
onTap: () => showDialog(
context: context,
barrierDismissible: false,
builder: (builder) => const ErrorDialog(
errorcontent: "抱歉",
),
),
),
const Divider(),
Padding(
padding: const EdgeInsets.only(
left: 20,
top: 8,
bottom: 8,
),
child: Text(
"测试设置",
style: TextStyle(color: Theme.of(context).colorScheme.primary),
),
),
ListTile(
leading: const Icon(Icons.location_off),
title: const Text("忽略位置信息直接签到"),
subtitle: const Text("仅为本人学习研究,打开是需要负责任的"),
trailing: Switch(
value: _ignorelocation,
onChanged: (value) => setState(() {
_ignorelocation = value;
}),
builder: (builder) => const URLDialog(),
),
onTap: () => setState(() {
_ignorelocation = !_ignorelocation;
}),
),
],
);
Expand Down
113 changes: 81 additions & 32 deletions lib/widgets/dialog.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import 'package:cannot_qiandao/func/plugin.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';

part '../controller/dialog.dart';

class URLDialog extends StatefulWidget {
const URLDialog({super.key});

Expand All @@ -10,22 +13,36 @@ class URLDialog extends StatefulWidget {

class _URLDialogState extends State<URLDialog> {
static const String infotext =
'插件和软件主体是分开的,这样可以灵活应对签到系统突发的更改\n插件将在APP启动时更新一次\n插件由TOML编写,有感兴趣的友友们可以和我一起交流哦!';
"插件和软件主体是分开的,这样我就可以灵活应对签到系统突发的更改拉!\n插件将在APP启动时更新一次\n插件由TOML编写,有感兴趣的友友们可以和我一起交流哈!";

String _url = "";

@override
Widget build(BuildContext context) {
return AlertDialog(
icon: const Icon(Icons.link),
title: const Text('编辑插件URL'),
content: const Text(infotext),
actions: [
const TextField(
keyboardType: TextInputType.url,
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: '输入存放规则的URL',
),
content: SizedBox(
height: 180,
child: Column(
children: [
const Text(infotext),
const Divider(),
const SizedBox(height: 6),
TextField(
keyboardType: TextInputType.url,
decoration: const InputDecoration(
border: OutlineInputBorder(),
labelText: '输入存放规则的URL',
),
onChanged: (value) {
_url = value;
},
),
],
),
),
actions: [
const SizedBox(height: 16),
TextButton(
onPressed: () {},
Expand All @@ -45,38 +62,70 @@ class UserDialog extends StatefulWidget {

class _UserDialogState extends State<UserDialog> {
static const String infotext =
"请先登录考勤系统,然后才能签到\n这里的登录信息将被用于本地获取token\n密码验证时会被转换为MD5编码格式被保存\n密码本体是不会被泄露的请你们放心";
"签到的前提是你登录了考勤系统\n这里的登录信息将被用于本地获取token\n密码验证时会被转换为MD5编码格式被保存\n密码本体是不会被泄露的请你们放心";

String _userid = "";

String _password = "";

bool _islogging = false;

@override
Widget build(BuildContext context) {
return AlertDialog(
icon: const Icon(Icons.login),
title: const Text('登录签到系统'),
content: const Text(infotext),
actions: [
TextField(
keyboardType: TextInputType.number,
decoration: const InputDecoration(
border: OutlineInputBorder(),
labelText: '学号',
),
onChanged: (value) {},
content: SizedBox(
height: 230,
child: Column(
children: [
const Text(infotext),
const Divider(),
const SizedBox(height: 6),
TextField(
keyboardType: TextInputType.number,
decoration: const InputDecoration(
border: OutlineInputBorder(),
labelText: '学号',
),
onChanged: (value) {
_userid = value;
},
),
const SizedBox(height: 16),
TextField(
obscureText: true,
keyboardType: TextInputType.visiblePassword,
decoration: const InputDecoration(
border: OutlineInputBorder(),
labelText: '密码',
),
onChanged: (value) {
_password = value;
},
),
],
),
const SizedBox(height: 16),
TextField(
obscureText: true,
keyboardType: TextInputType.visiblePassword,
decoration: const InputDecoration(
border: OutlineInputBorder(),
labelText: '密码',
),
onChanged: (value) {
setState(() {});
},
),
actions: [
TextButton(
onPressed: () => Navigator.pop(context),
child: const Text("取消"),
),
const SizedBox(height: 16),
TextButton(
onPressed: () {},
onPressed: () => loginWithPlugin(
userid: _userid,
password: _password,
onrun: () {},
oncallback: () {
Navigator.pop(context);
},
onerror: (error) => showDialog(
barrierDismissible: false,
context: context,
builder: (context) => ErrorDialog(errorcontent: error),
),
),
child: const Text("登录"),
)
],
Expand Down
1 change: 1 addition & 0 deletions lib/widgets/qiandaocard.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class QiandaoCard extends StatelessWidget {
trailing: IconButton.filledTonal(
onPressed: () {},
icon: const Icon(Icons.task_alt),
tooltip: "去签到",
),
),
),
Expand Down
8 changes: 8 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,14 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.1.0+1"
isar_flutter_libs:
dependency: "direct main"
description:
name: isar_flutter_libs
sha256: bc6768cc4b9c61aabff77152e7f33b4b17d2fc93134f7af1c3dd51500fe8d5e8
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.1.0+1"
isar_generator:
dependency: "direct dev"
description:
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ dependencies:
sdk: flutter
crypto: ^3.0.5
isar: ^3.1.0+1
isar_flutter_libs: ^3.1.0+1
path_provider: ^2.1.5
quick_actions: ^1.0.8
dynamic_color: ^1.7.0
Expand Down
Loading

0 comments on commit 4a37dbe

Please sign in to comment.