mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-20 03:06:59 +08:00
show user name
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -953,4 +953,6 @@ class Api {
|
||||
'/x/web-interface/popular/series/list';
|
||||
|
||||
static const String popularPrecious = '/x/web-interface/popular/precious';
|
||||
|
||||
static const String userRealName = '/x/member/app/up/realname';
|
||||
}
|
||||
|
||||
@@ -11,9 +11,11 @@ import 'package:PiliPlus/models_new/login_log/data.dart';
|
||||
import 'package:PiliPlus/models_new/media_list/data.dart';
|
||||
import 'package:PiliPlus/models_new/space_setting/data.dart';
|
||||
import 'package:PiliPlus/models_new/sub/sub/data.dart';
|
||||
import 'package:PiliPlus/models_new/user_real_name/data.dart';
|
||||
import 'package:PiliPlus/models_new/video/video_tag/data.dart';
|
||||
import 'package:PiliPlus/utils/accounts.dart';
|
||||
import 'package:PiliPlus/utils/accounts/account.dart';
|
||||
import 'package:PiliPlus/utils/app_sign.dart';
|
||||
import 'package:PiliPlus/utils/global_data.dart';
|
||||
import 'package:PiliPlus/utils/wbi_sign.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
@@ -475,4 +477,23 @@ class UserHttp {
|
||||
return Error(res.data['message']);
|
||||
}
|
||||
}
|
||||
|
||||
static Future<LoadingState<UserRealNameData>> getUserRealName(
|
||||
Object mid,
|
||||
) async {
|
||||
final params = {
|
||||
'access_key': Accounts.main.accessKey,
|
||||
'up_mid': mid,
|
||||
};
|
||||
AppSign.appSign(params);
|
||||
final res = await Request().get(
|
||||
Api.userRealName,
|
||||
queryParameters: params,
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return Success(UserRealNameData.fromJson(res.data['data']));
|
||||
} else {
|
||||
return Error(res.data['message']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ class SpaceCard {
|
||||
json['live_fans_wearing'] as Map<String, dynamic>,
|
||||
),
|
||||
spaceTag: (json['space_tag'] as List<dynamic>?)
|
||||
?.where((e) => (e?['title'] as String?)?.startsWith('IP') == true)
|
||||
?.where((e) => const ['location', 'real_name'].contains(e['type']))
|
||||
.map((e) => SpaceTag.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
faceNftNew: json['face_nft_new'] as int?,
|
||||
|
||||
20
lib/models_new/user_real_name/data.dart
Normal file
20
lib/models_new/user_real_name/data.dart
Normal file
@@ -0,0 +1,20 @@
|
||||
import 'package:PiliPlus/models_new/user_real_name/reject_page.dart';
|
||||
|
||||
class UserRealNameData {
|
||||
String? name;
|
||||
String? namePrefix;
|
||||
bool? show;
|
||||
RejectPage? rejectPage;
|
||||
|
||||
UserRealNameData({this.name, this.namePrefix, this.show, this.rejectPage});
|
||||
|
||||
factory UserRealNameData.fromJson(Map<String, dynamic> json) =>
|
||||
UserRealNameData(
|
||||
name: json['name'] as String?,
|
||||
namePrefix: json['name_prefix'] as String?,
|
||||
show: json['show'] as bool?,
|
||||
rejectPage: json['reject_page'] == null
|
||||
? null
|
||||
: RejectPage.fromJson(json['reject_page'] as Map<String, dynamic>),
|
||||
);
|
||||
}
|
||||
19
lib/models_new/user_real_name/reject_page.dart
Normal file
19
lib/models_new/user_real_name/reject_page.dart
Normal file
@@ -0,0 +1,19 @@
|
||||
class RejectPage {
|
||||
String? title;
|
||||
String? text;
|
||||
String? img;
|
||||
|
||||
RejectPage({this.title, this.text, this.img});
|
||||
|
||||
factory RejectPage.fromJson(Map<String, dynamic> json) => RejectPage(
|
||||
title: json['title'] as String?,
|
||||
text: json['text'] as String?,
|
||||
img: json['img'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'title': title,
|
||||
'text': text,
|
||||
'img': img,
|
||||
};
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import 'package:PiliPlus/models_new/space/space/images.dart';
|
||||
import 'package:PiliPlus/models_new/space/space/live.dart';
|
||||
import 'package:PiliPlus/models_new/space/space/pr_info.dart';
|
||||
import 'package:PiliPlus/utils/accounts.dart';
|
||||
import 'package:PiliPlus/utils/app_scheme.dart';
|
||||
import 'package:PiliPlus/utils/context_ext.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/image_utils.dart';
|
||||
@@ -240,9 +241,9 @@ class UserInfoCard extends StatelessWidget {
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20, top: 6, right: 20),
|
||||
child: Wrap(
|
||||
spacing: 8,
|
||||
spacing: 10,
|
||||
runSpacing: 8,
|
||||
crossAxisAlignment: WrapCrossAlignment.end,
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () => Utils.copyText(card.mid.toString()),
|
||||
@@ -255,13 +256,23 @@ class UserInfoCard extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
...?card.spaceTag?.map(
|
||||
(item) => Text(
|
||||
item.title ?? '',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: colorScheme.outline,
|
||||
),
|
||||
),
|
||||
(item) {
|
||||
final hasUri = item.uri?.isNotEmpty == true;
|
||||
final child = Text(
|
||||
item.title ?? '',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: hasUri ? colorScheme.secondary : colorScheme.outline,
|
||||
),
|
||||
);
|
||||
if (hasUri) {
|
||||
return GestureDetector(
|
||||
onTap: () => PiliScheme.routePushFromUrl(item.uri!),
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
return child;
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -195,8 +195,8 @@ class _UgcIntroPanelState extends State<UgcIntroPanel> {
|
||||
if (introController.enableAi) _aiBtn,
|
||||
],
|
||||
),
|
||||
if (videoDetail.argueInfo?.argueMsg?.isNotEmpty == true &&
|
||||
introController.showArgueMsg) ...[
|
||||
if (introController.showArgueMsg &&
|
||||
videoDetail.argueInfo?.argueMsg?.isNotEmpty == true) ...[
|
||||
const SizedBox(height: 2),
|
||||
Text.rich(
|
||||
TextSpan(
|
||||
|
||||
@@ -11,6 +11,7 @@ import 'package:PiliPlus/pages/video/reply_reply/view.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/id_utils.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:PiliPlus/utils/request_utils.dart';
|
||||
import 'package:PiliPlus/utils/url_utils.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:app_links/app_links.dart';
|
||||
@@ -102,6 +103,10 @@ abstract class PiliScheme {
|
||||
// bilibili://space/12345678?frommodule=XX&h5awaken=random
|
||||
String? mid = uriDigitRegExp.firstMatch(path)?.group(1);
|
||||
if (mid != null) {
|
||||
if (path.startsWith('/realname')) {
|
||||
RequestUtils.showUserRealName(mid);
|
||||
return true;
|
||||
}
|
||||
PageUtils.toDupNamed('/member?mid=$mid', off: off);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import 'package:PiliPlus/pages/group_panel/view.dart';
|
||||
import 'package:PiliPlus/pages/later/controller.dart';
|
||||
import 'package:PiliPlus/utils/accounts.dart';
|
||||
import 'package:PiliPlus/utils/context_ext.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/feed_back.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/storage_key.dart';
|
||||
@@ -618,4 +619,28 @@ abstract class RequestUtils {
|
||||
)
|
||||
..startCaptcha(registerData);
|
||||
}
|
||||
|
||||
static Future<void> showUserRealName(String mid) async {
|
||||
final res = await UserHttp.getUserRealName(mid);
|
||||
if (res.isSuccess) {
|
||||
final data = res.data;
|
||||
final show = !data.name.isNullOrEmpty;
|
||||
Get.dialog(
|
||||
AlertDialog(
|
||||
title: SelectableText(
|
||||
show ? data.name! : data.rejectPage?.title ?? '',
|
||||
),
|
||||
content: show ? null : Text(data.rejectPage?.text ?? ''),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: Get.back,
|
||||
child: const Text('关闭'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
} else {
|
||||
res.toast();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user