Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-06-09 12:00:35 +08:00
parent c67866a148
commit dc9b345e99
9 changed files with 234 additions and 196 deletions

View File

@@ -884,4 +884,6 @@ class Api {
static const String spaceSetting = '/x/space/setting/app';
static const String spaceSettingMod = '/x/space/privacy/batch/modify';
static const String vipExpAdd = '/x/vip/experience/add';
}

View File

@@ -383,4 +383,19 @@ class UserHttp {
return {'status': false, 'msg': res.data['message']};
}
}
static Future vipExpAdd() async {
final res = await Request().post(
Api.vipExpAdd,
queryParameters: {
'mid': Accounts.main.mid,
'csrf': Accounts.main.csrf,
},
);
if (res.data['code'] == 0) {
return {'status': true};
} else {
return {'status': false, 'msg': res.data['message']};
}
}
}

View File

@@ -43,9 +43,9 @@ class Vip {
Label? label;
Vip.fromJson(Map<String, dynamic> json) {
type = json['type'];
status = json['status'] ?? 0;
dueDate = json['due_date'];
type = json['type'] ?? json['vipType'];
status = json['status'] ?? json['vipStatus'] ?? 0;
dueDate = json['due_date'] ?? json['vipDueDate'];
if (json['label'] != null) label = Label.fromJson(json['label']);
}
}

View File

@@ -251,10 +251,13 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
return AnimatedOpacity(
opacity: _visibleTitle.value ? 1 : 0,
duration: const Duration(milliseconds: 300),
child: IgnorePointer(
ignoring: !_visibleTitle.value,
child: AuthorPanel(
item: _controller.dynItem,
isDetail: true,
),
),
);
},
),

View File

@@ -2,6 +2,7 @@ import 'dart:math';
import 'package:PiliPlus/http/loading_state.dart';
import 'package:PiliPlus/http/member.dart';
import 'package:PiliPlus/http/user.dart';
import 'package:PiliPlus/http/video.dart';
import 'package:PiliPlus/models/common/member/tab_type.dart';
import 'package:PiliPlus/models_new/space/space/data.dart';
@@ -255,4 +256,13 @@ class MemberController extends CommonDataController<SpaceData, SpaceData?>
);
}
}
Future<void> vipExpAdd() async {
var res = await UserHttp.vipExpAdd();
if (res['status']) {
SmartDialog.showToast('领取成功');
} else {
SmartDialog.showToast(res['msg']);
}
}
}

View File

@@ -136,7 +136,22 @@ class _MemberPageState extends State<MemberPage> {
),
),
if (_userController.ownerMid != 0)
if (_userController.mid == _userController.ownerMid)
if (_userController.mid == _userController.ownerMid) ...[
if ((_userController
.loadingState.value.data?.card?.vip?.status ??
0) >
0)
PopupMenuItem(
onTap: _userController.vipExpAdd,
child: const Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.upcoming_outlined, size: 19),
SizedBox(width: 10),
Text('大会员经验'),
],
),
),
PopupMenuItem(
onTap: () => Get.toNamed('/spaceSetting'),
child: const Row(
@@ -147,8 +162,8 @@ class _MemberPageState extends State<MemberPage> {
Text('空间设置'),
],
),
)
else ...[
),
] else ...[
const PopupMenuDivider(),
PopupMenuItem(
onTap: () => showDialog(

View File

@@ -1,8 +1,10 @@
import 'package:PiliPlus/common/constants.dart';
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
import 'package:PiliPlus/models/common/image_type.dart';
import 'package:PiliPlus/models/common/theme/theme_type.dart';
import 'package:PiliPlus/models/user/info.dart';
import 'package:PiliPlus/pages/mine/controller.dart';
import 'package:PiliPlus/utils/extension.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
@@ -18,10 +20,7 @@ class _MinePageState extends State<MinePage> {
final MineController _mineController = Get.put(MineController())
..queryUserInfo();
Widget _header(ThemeData theme) => FittedBox(
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
Widget _header(ThemeData theme) => Row(
children: [
const SizedBox(width: 12),
Image.asset(
@@ -33,7 +32,7 @@ class _MinePageState extends State<MinePage> {
'PiliPlus',
style: theme.textTheme.titleMedium,
),
const SizedBox(width: 30),
const Spacer(),
IconButton(
iconSize: 40.0,
padding: const EdgeInsets.all(8),
@@ -78,7 +77,6 @@ class _MinePageState extends State<MinePage> {
),
const SizedBox(width: 10),
],
),
);
@override
@@ -98,7 +96,8 @@ class _MinePageState extends State<MinePage> {
}
Widget userInfoBuild(ThemeData theme) {
LevelInfo? levelInfo = _mineController.userInfo.value.levelInfo;
UserInfoData userInfo = _mineController.userInfo.value;
LevelInfo? levelInfo = userInfo.levelInfo;
TextStyle style = TextStyle(
fontSize: theme.textTheme.titleMedium!.fontSize,
color: theme.colorScheme.primary,
@@ -115,28 +114,38 @@ class _MinePageState extends State<MinePage> {
mainAxisSize: MainAxisSize.min,
children: [
const SizedBox(width: 20),
ClipOval(
child: _mineController.userInfo.value.face != null
? NetworkImgLayer(
src: _mineController.userInfo.value.face,
userInfo.face != null
? Stack(
clipBehavior: Clip.none,
children: [
NetworkImgLayer(
src: userInfo.face,
semanticsLabel: '头像',
type: ImageType.avatar,
width: 55,
height: 55,
)
: Container(
width: 55,
height: 55,
alignment: Alignment.center,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: theme.colorScheme.onInverseSurface,
),
if (userInfo.vipStatus != null &&
userInfo.vipStatus! > 0)
Positioned(
right: -1,
bottom: -2,
child: Image.asset(
'assets/images/big-vip.png',
height: 19,
semanticLabel: "大会员",
),
),
],
)
: ClipOval(
child: Image.asset(
width: 55,
height: 55,
'assets/images/noface.jpeg',
semanticLabel: "默认头像",
),
),
),
const SizedBox(width: 16),
Expanded(
child: Column(
@@ -144,25 +153,28 @@ class _MinePageState extends State<MinePage> {
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
FittedBox(
child: Row(
mainAxisSize: MainAxisSize.min,
Row(
spacing: 4,
children: [
Text(
_mineController.userInfo.value.uname ?? '点击头像登录',
style: theme.textTheme.titleMedium!
.copyWith(height: 1),
Flexible(
child: Text(
userInfo.uname ?? '点击头像登录',
style: theme.textTheme.titleMedium!.copyWith(
height: 1,
color: userInfo.vipStatus != null &&
userInfo.vipStatus! > 0 &&
userInfo.vipType == 2
? context.vipColor
: null,
),
),
),
const SizedBox(width: 4),
Image.asset(
'assets/images/lv/lv${_mineController.userInfo.value.isSeniorMember == 1 ? '6_s' : _mineController.userInfo.value.levelInfo != null ? _mineController.userInfo.value.levelInfo!.currentLevel : '0'}.png',
'assets/images/lv/lv${levelInfo == null ? 0 : userInfo.isSeniorMember == 1 ? '6_s' : levelInfo.currentLevel}.png',
height: 10,
semanticLabel:
'等级:${_mineController.userInfo.value.levelInfo != null ? _mineController.userInfo.value.levelInfo!.currentLevel : '0'}',
),
],
),
),
const SizedBox(height: 8),
FittedBox(
child: Text.rich(
@@ -176,9 +188,7 @@ class _MinePageState extends State<MinePage> {
),
),
TextSpan(
text:
(_mineController.userInfo.value.money ?? '-')
.toString(),
text: userInfo.money?.toString() ?? '-',
style: TextStyle(
fontSize: theme.textTheme.labelSmall!.fontSize,
fontWeight: FontWeight.bold,
@@ -215,9 +225,7 @@ class _MinePageState extends State<MinePage> {
),
),
const SizedBox(height: 4),
SizedBox(
height: 2,
child: LinearProgressIndicator(
LinearProgressIndicator(
minHeight: 2,
value: levelInfo != null
? (levelInfo.currentExp! / levelInfo.nextExp!)
@@ -226,7 +234,6 @@ class _MinePageState extends State<MinePage> {
valueColor: AlwaysStoppedAnimation<Color>(
theme.colorScheme.primary),
),
),
],
),
),
@@ -235,83 +242,70 @@ class _MinePageState extends State<MinePage> {
),
),
const SizedBox(height: 10),
SizedBox(
Center(
child: SizedBox(
width: 240,
height: 100,
child: GridView.count(
padding: EdgeInsets.zero,
physics: const NeverScrollableScrollPhysics(),
crossAxisCount: 3,
child: Row(
children: [
InkWell(
_btn(
count: _mineController.userStat.value.dynamicCount,
countStyle: style,
name: '动态',
nameStyle: theme.textTheme.labelMedium,
onTap: _mineController.pushDynamic,
borderRadius: StyleString.mdRadius,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
(_mineController.userStat.value.dynamicCount ?? '-')
.toString(),
key: ValueKey<String>(_mineController
.userStat.value.dynamicCount
.toString()),
style: style,
),
const SizedBox(height: 8),
Text(
'动态',
style: theme.textTheme.labelMedium,
),
],
),
),
InkWell(
_btn(
count: _mineController.userStat.value.following,
countStyle: style,
name: '关注',
nameStyle: theme.textTheme.labelMedium,
onTap: _mineController.pushFollow,
borderRadius: StyleString.mdRadius,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
(_mineController.userStat.value.following ?? '-')
.toString(),
key: ValueKey<String>(
_mineController.userStat.value.following.toString()),
style: style,
),
const SizedBox(height: 8),
Text(
'关注',
style: theme.textTheme.labelMedium,
_btn(
count: _mineController.userStat.value.follower,
countStyle: style,
name: '粉丝',
nameStyle: theme.textTheme.labelMedium,
onTap: _mineController.pushFans,
),
],
),
),
InkWell(
onTap: _mineController.pushFans,
),
const SizedBox(height: 20),
],
);
}
Widget _btn({
required int? count,
required TextStyle countStyle,
required String name,
required TextStyle? nameStyle,
required VoidCallback onTap,
}) {
return InkWell(
onTap: onTap,
borderRadius: StyleString.mdRadius,
child: SizedBox(
width: 80,
height: 80,
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
(_mineController.userStat.value.follower ?? '-')
.toString(),
key: ValueKey<String>(
_mineController.userStat.value.follower.toString()),
style: style,
count?.toString() ?? '-',
style: countStyle,
),
const SizedBox(height: 8),
Text(
'粉丝',
style: theme.textTheme.labelMedium,
name,
style: nameStyle,
),
],
),
),
],
),
),
],
);
}
}

View File

@@ -50,6 +50,7 @@ class _PgcReviewPageState extends State<PgcReviewPage>
indicatorWeight: 0,
overlayColor: WidgetStateProperty.all(Colors.transparent),
splashFactory: NoSplash.splashFactory,
padding: const EdgeInsets.only(left: 6),
indicatorPadding:
const EdgeInsets.symmetric(horizontal: 3, vertical: 8),
indicator: BoxDecoration(

View File

@@ -193,14 +193,13 @@ class _PgcPanelState extends State<PgcPanel> {
const SizedBox(width: 2),
if (item.badge != null) ...[
const Spacer(),
if (item.badge == '会员') ...[
if (item.badge == '会员')
Image.asset(
'assets/images/big-vip.png',
height: 16,
semanticLabel: "大会员",
),
],
if (item.badge != '会员') ...[
)
else
Text(
item.badge!,
style: TextStyle(
@@ -208,7 +207,6 @@ class _PgcPanelState extends State<PgcPanel> {
color: theme.colorScheme.primary,
),
),
],
]
],
),