feat: 移除黑名单、隐藏黑名单上限显示 issues #90
This commit is contained in:
@ -288,6 +288,9 @@ class Api {
|
|||||||
// 黑名单
|
// 黑名单
|
||||||
static const String blackLst = '/x/relation/blacks';
|
static const String blackLst = '/x/relation/blacks';
|
||||||
|
|
||||||
|
// 移除黑名单
|
||||||
|
static const String removeBlack = '/x/relation/modify';
|
||||||
|
|
||||||
// github 获取最新版
|
// github 获取最新版
|
||||||
static const String latestApp =
|
static const String latestApp =
|
||||||
'https://api.github.com/repos/guozhigq/pilipala/releases/latest';
|
'https://api.github.com/repos/guozhigq/pilipala/releases/latest';
|
||||||
|
|||||||
@ -23,4 +23,31 @@ class BlackHttp {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 移除黑名单
|
||||||
|
static Future removeBlack({required int fid}) async {
|
||||||
|
var res = await Request().post(
|
||||||
|
Api.removeBlack,
|
||||||
|
queryParameters: {
|
||||||
|
'act': 6,
|
||||||
|
'csrf': await Request.getCsrf(),
|
||||||
|
'fid': fid,
|
||||||
|
'jsonp': 'jsonp',
|
||||||
|
're_src': 116,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (res.data['code'] == 0) {
|
||||||
|
return {
|
||||||
|
'status': true,
|
||||||
|
'data': [],
|
||||||
|
'msg': '操作成功',
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
'status': false,
|
||||||
|
'data': [],
|
||||||
|
'msg': res.data['message'],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/common/widgets/http_error.dart';
|
import 'package:pilipala/common/widgets/http_error.dart';
|
||||||
@ -60,7 +61,7 @@ class _BlackListPageState extends State<BlackListPage> {
|
|||||||
centerTitle: false,
|
centerTitle: false,
|
||||||
title: Obx(
|
title: Obx(
|
||||||
() => Text(
|
() => Text(
|
||||||
'黑名单管理 (${_blackListController.blackList.length} / 5000)',
|
'黑名单管理 - ${_blackListController.blackList.length}',
|
||||||
style: Theme.of(context).textTheme.titleMedium,
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -104,10 +105,11 @@ class _BlackListPageState extends State<BlackListPage> {
|
|||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
dense: true,
|
dense: true,
|
||||||
// trailing: TextButton(
|
trailing: TextButton(
|
||||||
// onPressed: () {},
|
onPressed: () => _blackListController
|
||||||
// child: const Text('移除'),
|
.removeBlack(list[index].mid),
|
||||||
// ),
|
child: const Text('移除'),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -154,4 +156,12 @@ class BlackListController extends GetxController {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future removeBlack(mid) async {
|
||||||
|
var result = await BlackHttp.removeBlack(fid: mid);
|
||||||
|
if (result['status']) {
|
||||||
|
blackList.removeWhere((e) => e.mid == mid);
|
||||||
|
SmartDialog.showToast(result['msg']);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user