mirror of
https://github.com/qinglong-app/qinglong_app.git
synced 2025-10-09 16:48:19 +08:00
优化使用体验
This commit is contained in:
@@ -8,7 +8,7 @@ class TokenInterceptor extends Interceptor {
|
|||||||
@override
|
@override
|
||||||
void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
|
void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
|
||||||
options.headers["User-Agent"] =
|
options.headers["User-Agent"] =
|
||||||
"Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1";
|
"qinglong_client";
|
||||||
|
|
||||||
options.headers["Content-Type"] = "application/json;charset=UTF-8";
|
options.headers["Content-Type"] = "application/json;charset=UTF-8";
|
||||||
|
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ class UserInfoViewModel {
|
|||||||
|
|
||||||
historyAccounts.insert(0, UserInfoBean(userName: _userName, password: _passWord, useSecretLogined: _useSecertLogined, host: _host));
|
historyAccounts.insert(0, UserInfoBean(userName: _userName, password: _passWord, useSecretLogined: _useSecertLogined, host: _host));
|
||||||
|
|
||||||
while (historyAccounts.length > 5) {
|
while (historyAccounts.length > 3) {
|
||||||
historyAccounts.removeLast();
|
historyAccounts.removeLast();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,111 +74,113 @@ class _AddTaskPageState extends ConsumerState<AddTaskPage> {
|
|||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: Column(
|
body: SingleChildScrollView(
|
||||||
mainAxisSize: MainAxisSize.min,
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
mainAxisSize: MainAxisSize.min,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
Padding(
|
children: [
|
||||||
padding: const EdgeInsets.symmetric(
|
Padding(
|
||||||
horizontal: 15,
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 15,
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
const SizedBox(
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
const Text(
|
||||||
|
"名称:",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextField(
|
||||||
|
focusNode: focusNode,
|
||||||
|
controller: _nameController,
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
contentPadding: EdgeInsets.fromLTRB(0, 5, 0, 5),
|
||||||
|
hintText: "请输入名称",
|
||||||
|
),
|
||||||
|
autofocus: false,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
child: Column(
|
Padding(
|
||||||
mainAxisSize: MainAxisSize.min,
|
padding: const EdgeInsets.symmetric(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
horizontal: 15,
|
||||||
children: [
|
),
|
||||||
const SizedBox(
|
child: Column(
|
||||||
height: 15,
|
mainAxisSize: MainAxisSize.min,
|
||||||
),
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
const Text(
|
children: [
|
||||||
"名称:",
|
const SizedBox(
|
||||||
style: TextStyle(
|
height: 15,
|
||||||
fontSize: 16,
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
),
|
),
|
||||||
),
|
const Text(
|
||||||
TextField(
|
"命令:",
|
||||||
focusNode: focusNode,
|
style: TextStyle(
|
||||||
controller: _nameController,
|
fontSize: 16,
|
||||||
decoration: const InputDecoration(
|
fontWeight: FontWeight.w600,
|
||||||
contentPadding: EdgeInsets.fromLTRB(0, 5, 0, 5),
|
),
|
||||||
hintText: "请输入名称",
|
|
||||||
),
|
),
|
||||||
autofocus: false,
|
TextField(
|
||||||
),
|
controller: _commandController,
|
||||||
],
|
maxLines: 4,
|
||||||
|
minLines: 1,
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
contentPadding: EdgeInsets.fromLTRB(0, 5, 0, 5),
|
||||||
|
hintText: "请输入命令",
|
||||||
|
),
|
||||||
|
autofocus: false,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
Padding(
|
||||||
Padding(
|
padding: const EdgeInsets.symmetric(
|
||||||
padding: const EdgeInsets.symmetric(
|
horizontal: 15,
|
||||||
horizontal: 15,
|
),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
const SizedBox(
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
const Text(
|
||||||
|
"定时:",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextField(
|
||||||
|
controller: _cronController,
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
contentPadding: EdgeInsets.fromLTRB(0, 5, 0, 5),
|
||||||
|
hintText: "请输入定时",
|
||||||
|
),
|
||||||
|
autofocus: false,
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 5,
|
||||||
|
),
|
||||||
|
const Text(
|
||||||
|
"定时的cron不校验是否正确",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
child: Column(
|
],
|
||||||
mainAxisSize: MainAxisSize.min,
|
),
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
const SizedBox(
|
|
||||||
height: 15,
|
|
||||||
),
|
|
||||||
const Text(
|
|
||||||
"命令:",
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 16,
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
TextField(
|
|
||||||
controller: _commandController,
|
|
||||||
maxLines: 4,
|
|
||||||
minLines: 1,
|
|
||||||
decoration: const InputDecoration(
|
|
||||||
contentPadding: EdgeInsets.fromLTRB(0, 5, 0, 5),
|
|
||||||
hintText: "请输入命令",
|
|
||||||
),
|
|
||||||
autofocus: false,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(
|
|
||||||
horizontal: 15,
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
const SizedBox(
|
|
||||||
height: 15,
|
|
||||||
),
|
|
||||||
const Text(
|
|
||||||
"定时:",
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 16,
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
TextField(
|
|
||||||
controller: _cronController,
|
|
||||||
decoration: const InputDecoration(
|
|
||||||
contentPadding: EdgeInsets.fromLTRB(0, 5, 0, 5),
|
|
||||||
hintText: "请输入定时",
|
|
||||||
),
|
|
||||||
autofocus: false,
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 5,
|
|
||||||
),
|
|
||||||
const Text(
|
|
||||||
"定时的cron不校验是否正确",
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 12,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,13 +6,6 @@ import 'package:qinglong_app/module/task/task_bean.dart';
|
|||||||
import 'package:qinglong_app/utils/extension.dart';
|
import 'package:qinglong_app/utils/extension.dart';
|
||||||
|
|
||||||
var taskProvider = ChangeNotifierProvider((ref) => TaskViewModel());
|
var taskProvider = ChangeNotifierProvider((ref) => TaskViewModel());
|
||||||
Map<int, int> sort = {
|
|
||||||
0: 0,
|
|
||||||
5: 1,
|
|
||||||
3: 2,
|
|
||||||
1: 3,
|
|
||||||
4: 4,
|
|
||||||
};
|
|
||||||
|
|
||||||
class TaskViewModel extends BaseViewModel {
|
class TaskViewModel extends BaseViewModel {
|
||||||
static const String allStr = "全部脚本";
|
static const String allStr = "全部脚本";
|
||||||
@@ -45,27 +38,81 @@ class TaskViewModel extends BaseViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void sortList() {
|
void sortList() {
|
||||||
list.sort((TaskBean a, TaskBean b) {
|
List<TaskBean> p = [];
|
||||||
int? sortA = (a.isPinned == 1 && a.status != 0)
|
List<TaskBean> r = [];
|
||||||
? 5
|
List<TaskBean> d = [];
|
||||||
: (a.isDisabled == 1 && a.status != 0)
|
|
||||||
? 4
|
|
||||||
: a.status;
|
|
||||||
int? sortB = (b.isPinned == 1 && b.status != 0)
|
|
||||||
? 5
|
|
||||||
: (b.isDisabled == 1 && b.status != 0)
|
|
||||||
? 4
|
|
||||||
: b.status;
|
|
||||||
|
|
||||||
return sort[sortA!]! - sort[sortB!]!;
|
|
||||||
});
|
|
||||||
|
|
||||||
for (int i = 0; i < list.length; i++) {
|
for (int i = 0; i < list.length; i++) {
|
||||||
if (list[i].isPinned == 1) {
|
if (list[i].isPinned == 1) {
|
||||||
list.insert(0, list.removeAt(i));
|
p.add(list.removeAt(i));
|
||||||
|
i--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (list[i].status == 0) {
|
||||||
|
r.add(list.removeAt(i));
|
||||||
|
i--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (list[i].isDisabled == 1) {
|
||||||
|
d.add(list.removeAt(i));
|
||||||
|
i--;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p.sort((TaskBean a, TaskBean b) {
|
||||||
|
bool c = DateTime.fromMillisecondsSinceEpoch(a.created ?? 0).isBefore(DateTime.fromMillisecondsSinceEpoch(b.created ?? 0));
|
||||||
|
if (c == true) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
});
|
||||||
|
|
||||||
|
p.sort((a, b) {
|
||||||
|
return (a.isDisabled ?? 0) - (b.isDisabled ?? 0);
|
||||||
|
});
|
||||||
|
|
||||||
|
p.sort((a, b) {
|
||||||
|
if (a.status == 0 && b.status == 0) {
|
||||||
|
bool c = DateTime.fromMillisecondsSinceEpoch(a.created ?? 0).isBefore(DateTime.fromMillisecondsSinceEpoch(b.created ?? 0));
|
||||||
|
if (c == true) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
} else {
|
||||||
|
return (a.status ?? 0) - (b.status ?? 0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
r.sort((a, b) {
|
||||||
|
bool c = DateTime.fromMillisecondsSinceEpoch(a.created ?? 0).isBefore(DateTime.fromMillisecondsSinceEpoch(b.created ?? 0));
|
||||||
|
if (c == true) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
});
|
||||||
|
|
||||||
|
d.sort((a, b) {
|
||||||
|
bool c = DateTime.fromMillisecondsSinceEpoch(a.created ?? 0).isBefore(DateTime.fromMillisecondsSinceEpoch(b.created ?? 0));
|
||||||
|
if (c == true) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
});
|
||||||
|
|
||||||
|
list.sort((a, b) {
|
||||||
|
bool c = DateTime.fromMillisecondsSinceEpoch(a.created ?? 0).isBefore(DateTime.fromMillisecondsSinceEpoch(b.created ?? 0));
|
||||||
|
if (c == true) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
});
|
||||||
|
|
||||||
|
list.insertAll(0, r);
|
||||||
|
list.insertAll(0, p);
|
||||||
|
list.addAll(d);
|
||||||
|
|
||||||
running.clear();
|
running.clear();
|
||||||
running.addAll(list.where((element) => element.status == 0));
|
running.addAll(list.where((element) => element.status == 0));
|
||||||
neverRunning.clear();
|
neverRunning.clear();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
name: qinglong_app
|
name: qinglong_app
|
||||||
description: A new Flutter project.
|
description: A new Flutter project.
|
||||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||||
version: 1.0.8+10
|
version: 1.0.9+11
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.15.1 <3.0.0"
|
sdk: ">=2.15.1 <3.0.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user