初始化
This commit is contained in:
@@ -0,0 +1,277 @@
|
||||
/// 签到列表响应模型
|
||||
class CheckinPrizeResp {
|
||||
CheckinInfo? checkin;
|
||||
CheckinConfig? config;
|
||||
List<CheckinPrize>? prizes;
|
||||
List<CheckinPrize>? bigPrizes;
|
||||
|
||||
CheckinPrizeResp({this.checkin, this.config, this.prizes});
|
||||
|
||||
CheckinPrizeResp.fromJson(Map<String, dynamic> json) {
|
||||
checkin = json['checkin'] != null
|
||||
? CheckinInfo.fromJson(json['checkin'])
|
||||
: null;
|
||||
config = json['config'] != null
|
||||
? CheckinConfig.fromJson(json['config'])
|
||||
: null;
|
||||
if (json['prizes'] != null) {
|
||||
prizes = <CheckinPrize>[];
|
||||
json['prizes'].forEach((v) {
|
||||
prizes!.add(CheckinPrize.fromJson(v));
|
||||
});
|
||||
}
|
||||
if (json['bigPrizes'] != null) {
|
||||
bigPrizes = <CheckinPrize>[];
|
||||
json['bigPrizes'].forEach((v) {
|
||||
bigPrizes!.add(CheckinPrize.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = {};
|
||||
if (checkin != null) {
|
||||
data['checkin'] = checkin!.toJson();
|
||||
}
|
||||
if (config != null) {
|
||||
data['config'] = config!.toJson();
|
||||
}
|
||||
if (prizes != null) {
|
||||
data['prizes'] = prizes!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
if (bigPrizes != null) {
|
||||
data['bigPrizes'] = bigPrizes!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
/// 签到信息
|
||||
class CheckinInfo {
|
||||
int? continuouslyDays; // 连续签到天数
|
||||
int? cumulativeDays; // 累计签到天数(本月)
|
||||
bool? todayChecked; // 今日是否已经签过到
|
||||
bool? doubleReward;
|
||||
CheckinInfo({this.continuouslyDays, this.cumulativeDays, this.todayChecked,this.doubleReward});
|
||||
|
||||
CheckinInfo.fromJson(Map<String, dynamic> json) {
|
||||
continuouslyDays = json['continuouslyDays'];
|
||||
cumulativeDays = json['cumulativeDays'];
|
||||
todayChecked = json['todayChecked'];
|
||||
doubleReward=json['doubleReward'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = {};
|
||||
data['continuouslyDays'] = continuouslyDays;
|
||||
data['cumulativeDays'] = cumulativeDays;
|
||||
data['todayChecked'] = todayChecked;
|
||||
data['doubleReward']=doubleReward;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
/// 签到配置
|
||||
class CheckinConfig {
|
||||
String? backgroundImage; // 背景图片
|
||||
String? description; // 规则说明
|
||||
bool? enable; // 是否启用
|
||||
String? rewardBgVideoUrl; //视频
|
||||
List<IntegerExchange>? integerExchangeList;
|
||||
|
||||
CheckinConfig({this.backgroundImage, this.description, this.enable,this.rewardBgVideoUrl});
|
||||
|
||||
CheckinConfig.fromJson(Map<String, dynamic> json) {
|
||||
backgroundImage = json['backgroundImage'];
|
||||
description = json['description'];
|
||||
enable = json['enable'];
|
||||
rewardBgVideoUrl = json['rewardBgVideoUrl'];
|
||||
if (json['integerExchangeList'] != null) {
|
||||
integerExchangeList = <IntegerExchange>[];
|
||||
json['integerExchangeList'].forEach((v) {
|
||||
integerExchangeList!.add(IntegerExchange.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = {};
|
||||
data['backgroundImage'] = backgroundImage;
|
||||
data['description'] = description;
|
||||
data['enable'] = enable;
|
||||
data['rewardBgVideoUrl'] = rewardBgVideoUrl;
|
||||
if (integerExchangeList != null) {
|
||||
data['integerExchangeList'] = integerExchangeList!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class IntegerExchange{
|
||||
String? name;
|
||||
String? icon;
|
||||
IntegerExchange({this.name, this.icon});
|
||||
IntegerExchange.fromJson(Map<String, dynamic> json) {
|
||||
name = json['name'];
|
||||
icon = json['icon'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = {};
|
||||
data['name'] = name;
|
||||
data['icon'] = icon;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
/// 签到奖励
|
||||
class CheckinPrize {
|
||||
bool? bigPrize; // 大奖,有问题提示的
|
||||
int? checkinDays; // 签到天数
|
||||
int? checkinType; // 签到类型 Enum: 0, 1, 2
|
||||
String? createdAt;
|
||||
String? id; // ID
|
||||
String? image; // 图片
|
||||
String? prizeId; // 奖品ID
|
||||
bool? status; // 状态(是否已领取)
|
||||
String? title; // 标题
|
||||
String? updatedAt;
|
||||
int? score; // 签到奖励积分数量
|
||||
String? prizeName;
|
||||
bool? isCheckedIn;
|
||||
bool? canClaim;//是否可以补领
|
||||
bool? isReceive;//是否可以补领
|
||||
bool? isExpired;//是否过期
|
||||
|
||||
CheckinPrize({
|
||||
this.bigPrize,
|
||||
this.checkinDays,
|
||||
this.checkinType,
|
||||
this.createdAt,
|
||||
this.id,
|
||||
this.image,
|
||||
this.prizeId,
|
||||
this.status,
|
||||
this.title,
|
||||
this.updatedAt,
|
||||
this.score,
|
||||
this.prizeName,
|
||||
this.isCheckedIn,
|
||||
this.isReceive,
|
||||
this.canClaim,
|
||||
this.isExpired,
|
||||
});
|
||||
|
||||
CheckinPrize.fromJson(Map<String, dynamic> json) {
|
||||
bigPrize = json['bigPrize'];
|
||||
checkinDays = json['checkinDays'];
|
||||
checkinType = json['checkinType'];
|
||||
createdAt = json['createdAt'];
|
||||
id = json['id'];
|
||||
image = json['image'];
|
||||
prizeId = json['prizeId'];
|
||||
status = json['status'];
|
||||
title = json['title'];
|
||||
updatedAt = json['updatedAt'];
|
||||
score = json['score'];
|
||||
prizeName = json['prizeName'];
|
||||
isCheckedIn = json['isCheckedIn'];
|
||||
canClaim = json['canClaim'];
|
||||
isReceive = json['isReceive'];
|
||||
isExpired = json['isExpired'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = {};
|
||||
data['bigPrize'] = bigPrize;
|
||||
data['checkinDays'] = checkinDays;
|
||||
data['checkinType'] = checkinType;
|
||||
data['createdAt'] = createdAt;
|
||||
data['id'] = id;
|
||||
data['image'] = image;
|
||||
data['prizeId'] = prizeId;
|
||||
data['status'] = status;
|
||||
data['title'] = title;
|
||||
data['updatedAt'] = updatedAt;
|
||||
data['score'] = score;
|
||||
data['prizeName'] = prizeName;
|
||||
data['isCheckedIn'] = isCheckedIn;
|
||||
data['canClaim'] = canClaim;
|
||||
data['isReceive'] = isReceive;
|
||||
data['isExpired'] = isExpired;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
/// 执行签到响应
|
||||
class CheckinDoResp {
|
||||
CheckinInfo? checkin;
|
||||
String? message;
|
||||
List<CheckinRewardPrize>? prizes;
|
||||
String? prizeVideo;
|
||||
|
||||
CheckinDoResp({this.checkin, this.message, this.prizes});
|
||||
|
||||
CheckinDoResp.fromJson(Map<String, dynamic> json) {
|
||||
checkin = json['checkin'] != null
|
||||
? CheckinInfo.fromJson(json['checkin'])
|
||||
: null;
|
||||
message = json['message'];
|
||||
prizeVideo = json['prizeVideo'];
|
||||
if (json['prizes'] != null) {
|
||||
prizes = <CheckinRewardPrize>[];
|
||||
json['prizes'].forEach((v) {
|
||||
prizes!.add(CheckinRewardPrize.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = {};
|
||||
if (checkin != null) {
|
||||
data['checkin'] = checkin!.toJson();
|
||||
}
|
||||
data['message'] = message;
|
||||
data['prizeVideo'] = prizeVideo;
|
||||
if (prizes != null) {
|
||||
data['prizes'] = prizes!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
/// 签到奖励详情
|
||||
class CheckinRewardPrize {
|
||||
bool? countRand;
|
||||
int? prizeCount;
|
||||
String? prizeImage;
|
||||
String? prizeTitle;
|
||||
int? prizeType;
|
||||
|
||||
CheckinRewardPrize({
|
||||
this.countRand,
|
||||
this.prizeCount,
|
||||
this.prizeImage,
|
||||
this.prizeTitle,
|
||||
this.prizeType,
|
||||
});
|
||||
|
||||
CheckinRewardPrize.fromJson(Map<String, dynamic> json) {
|
||||
countRand = json['countRand'];
|
||||
prizeCount = json['prizeCount'];
|
||||
prizeImage = json['prizeImage'];
|
||||
prizeTitle = json['prizeTitle'];
|
||||
prizeType = json['prizeType'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = {};
|
||||
data['countRand'] = countRand;
|
||||
data['prizeCount'] = prizeCount;
|
||||
data['prizeImage'] = prizeImage;
|
||||
data['prizeTitle'] = prizeTitle;
|
||||
data['prizeType'] = prizeType;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hgdj/tools_base/widget/net_image_widget.dart';
|
||||
import 'package:video_player/video_player.dart';
|
||||
|
||||
import 'checkin_model.dart';
|
||||
|
||||
class CongratulationsRewardDialog extends StatelessWidget {
|
||||
final VoidCallback? onExchange;
|
||||
final List<IntegerExchange>? prizeList;
|
||||
// final String? videoUrl;
|
||||
// final String? videoToken;
|
||||
final VideoPlayerController? videoPlayerCtr;
|
||||
const CongratulationsRewardDialog({
|
||||
super.key,
|
||||
this.onExchange,
|
||||
this.prizeList,
|
||||
// this.videoUrl,
|
||||
// this.videoToken,
|
||||
this.videoPlayerCtr,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// 不包 Dialog / 不铺满屏幕 → 点击 content 之外的区域由 Get.dialog 的 barrierDismissible 关闭
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 27),
|
||||
alignment: Alignment.center,
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 356,
|
||||
width: 319,
|
||||
child: VideoPlayer(videoPlayerCtr!),
|
||||
),
|
||||
SizedBox(height: 18),
|
||||
Text(
|
||||
"- 积分可兑换以下豪礼 -",
|
||||
style: TextStyle(color: Color(0xffFFD900), fontSize: 14),
|
||||
),
|
||||
SizedBox(height: 12),
|
||||
// 奖励列表
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: prizeList
|
||||
?.map((e) => _buildRewardItem(e.name ?? "", e.icon ?? ""))
|
||||
.toList() ??
|
||||
[],
|
||||
),
|
||||
SizedBox(height: 36),
|
||||
// 底部按钮
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
Get.back();
|
||||
onExchange?.call();
|
||||
},
|
||||
child: Container(
|
||||
height: 44,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
border: Border.all(
|
||||
color: const Color(0xFFFFD700), width: 2),
|
||||
),
|
||||
child: Text(
|
||||
"兑换好礼",
|
||||
style: TextStyle(
|
||||
color: const Color(0xFFFFD700),
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: GestureDetector(
|
||||
onTap: () => Get.back(),
|
||||
child: Container(
|
||||
height: 44,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xffFFD900),
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
),
|
||||
child: Text(
|
||||
"继续领积分",
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
).paddingSymmetric(horizontal: 33),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildRewardItem(String title, String iconPath) {
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
width: 53,
|
||||
height: 53,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withValues(alpha: 0.2),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(
|
||||
color: Colors.white.withValues(alpha: .5), width: 0.5)),
|
||||
padding: EdgeInsets.all(6),
|
||||
child: NetworkImageLoader(imageUrl: iconPath, fit: BoxFit.contain),
|
||||
),
|
||||
SizedBox(height: 6),
|
||||
SizedBox(
|
||||
width: 65,
|
||||
child: Text(
|
||||
title,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 10,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hgdj/assets_tool/images.dart';
|
||||
import 'package:hgdj/hj_utils/screen.dart';
|
||||
|
||||
class CustomProgressBar extends StatelessWidget {
|
||||
final double progress; // 0 ~ 1
|
||||
|
||||
const CustomProgressBar({super.key, required this.progress});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withValues(alpha: .1),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
double width = constraints.maxWidth;
|
||||
return Stack(
|
||||
alignment: Alignment.centerLeft,
|
||||
children: [
|
||||
SizedBox(height: 18),
|
||||
// 背景
|
||||
Container(
|
||||
height: 6,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withValues(alpha: .1),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
|
||||
// 进度
|
||||
Container(
|
||||
height: 6,
|
||||
width: width * progress,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: Color(0xffF68804),
|
||||
),
|
||||
),
|
||||
// 小图标(跟随进度,两端不溢出)
|
||||
Positioned(
|
||||
left: (width - 18) * progress,
|
||||
child: Image.asset("ic_sign_indicator.webp".mineImgPath,
|
||||
width: 18, height: 18, fit: BoxFit.cover),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
8.sizeBoxW,
|
||||
// 右侧百分比
|
||||
Text(
|
||||
"${(progress * 100).toInt()}%",
|
||||
style: TextStyle(color: Colors.white, fontSize: 12),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,323 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hgdj/assets_tool/images.dart';
|
||||
import 'package:hgdj/config/address.dart';
|
||||
import 'package:hgdj/hj_page/mine/mine_share/mine_share_page.dart';
|
||||
import 'package:hgdj/hj_page/mine/welfare/sign_daily_logic.dart';
|
||||
import 'package:hgdj/hj_page/mine/welfare/widget/checkin_model.dart';
|
||||
import 'package:hgdj/hj_page/mine/welfare/widget/congratulations_reward_dialog.dart';
|
||||
import 'package:hgdj/hj_page/mine/welfare/widget/sign_dialog.dart';
|
||||
import 'package:hgdj/hj_page/mine/welfare/widget/sign_in_model.dart';
|
||||
import 'package:hgdj/hj_utils/api_service/mine_service.dart';
|
||||
import 'package:hgdj/tools_base/global_store/store.dart';
|
||||
import 'package:hgdj/tools_base/toast.dart';
|
||||
import 'package:linked_scroll_controller/linked_scroll_controller.dart';
|
||||
import 'package:video_player/video_player.dart';
|
||||
import 'package:hgdj/hj_utils/video_view_type.dart';
|
||||
|
||||
/// 每日签到 Logic
|
||||
/// 负责签到列表加载、签到/补领接口、双倍奖励视频播放、跳转积分兑换 Tab
|
||||
class MineSignLogic extends GetxController {
|
||||
/// 父级页面 Logic(用于切 Tab + 滚动到 Tab 位置)
|
||||
final SignDailyPageLogic? parentLogic;
|
||||
MineSignLogic({this.parentLogic});
|
||||
|
||||
// ========== 状态 ==========
|
||||
bool isSigned = false; // 今日是否签到
|
||||
bool doubleReward = false; // 是否触发双倍奖励
|
||||
int continuousDays = 0; // 连续签到天数
|
||||
int cumulativeDays = 0; // 累计签到天数(本月)
|
||||
String? videoUrl; // 双倍奖励视频 ID
|
||||
List<CheckinPrize>? checkList; // 普通签到奖励
|
||||
List<CheckinPrize>? vipCheckList; // 会员签到奖励(大礼)
|
||||
List<IntegerExchange>? prizeLists; // 积分兑换列表
|
||||
final extraRewardList = <ExtraSignRewardItem>[]; // 额外签到奖励
|
||||
|
||||
// ========== 滚动控制器(三排联动) ==========
|
||||
late final LinkedScrollControllerGroup scrollGroup;
|
||||
late final ScrollController titleScrollCtr; // 第 0 排:天数标题
|
||||
late final ScrollController normalScrollCtr; // 第 1 排:普通奖励
|
||||
late final ScrollController vipScrollCtr; // 第 2 排:会员奖励
|
||||
VideoPlayerController? videoPlayerCtr;
|
||||
|
||||
// ========== 生命周期 ==========
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
scrollGroup = LinkedScrollControllerGroup();
|
||||
titleScrollCtr = scrollGroup.addAndGet();
|
||||
normalScrollCtr = scrollGroup.addAndGet();
|
||||
vipScrollCtr = scrollGroup.addAndGet();
|
||||
getSignList();
|
||||
getExtralSignList();
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
titleScrollCtr.dispose();
|
||||
normalScrollCtr.dispose();
|
||||
vipScrollCtr.dispose();
|
||||
videoPlayerCtr?.dispose();
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
// ========== 公开方法 ==========
|
||||
|
||||
/// 获取签到主列表(普通 + 会员奖励 + 积分兑换配置)
|
||||
Future<void> getSignList() async {
|
||||
final res = await MineService.getSignList();
|
||||
if (res == null) return;
|
||||
isSigned = res.checkin?.todayChecked ?? false;
|
||||
continuousDays = res.checkin?.continuouslyDays ?? 0;
|
||||
cumulativeDays = res.checkin?.cumulativeDays ?? 0;
|
||||
doubleReward = res.checkin?.doubleReward ?? false;
|
||||
prizeLists = res.config?.integerExchangeList;
|
||||
checkList = res.prizes;
|
||||
vipCheckList = res.bigPrizes;
|
||||
update();
|
||||
}
|
||||
|
||||
/// 获取额外签到奖励列表
|
||||
Future<void> getExtralSignList() async {
|
||||
try {
|
||||
final res = await MineService.getExtraDayMark();
|
||||
if (res != null) {
|
||||
extraRewardList
|
||||
..clear()
|
||||
..addAll(res);
|
||||
update();
|
||||
}
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
/// 点击签到按钮
|
||||
Future<void> doSignIn() async {
|
||||
if (isSigned) {
|
||||
showToast('今日已签到');
|
||||
return;
|
||||
}
|
||||
final res = await MineService.postDayMark();
|
||||
if (res?.checkin == null) return;
|
||||
showToast('签到成功');
|
||||
// 同步签到状态
|
||||
continuousDays = res!.checkin!.continuouslyDays ?? 0;
|
||||
cumulativeDays = res.checkin!.cumulativeDays ?? 0;
|
||||
isSigned = res.checkin!.todayChecked ?? false;
|
||||
doubleReward = res.checkin!.doubleReward ?? false;
|
||||
videoUrl = res.prizeVideo ?? '';
|
||||
getSignList();
|
||||
update();
|
||||
globalStore.refreshWallet();
|
||||
// 第 8 天起仅 toast 不弹窗;前 7 天:双倍奖励弹特效,否则弹普通签到弹窗
|
||||
if (continuousDays > 7) return;
|
||||
if (doubleReward) {
|
||||
_showDoubleRewardDialog();
|
||||
} else {
|
||||
_showNormalSignDialog();
|
||||
}
|
||||
}
|
||||
|
||||
/// 会员奖励补领
|
||||
Future<void> doCheckinClaimVip() async {
|
||||
final resp = await MineService.claimCheckinVip();
|
||||
if (resp?.checkin == null) {
|
||||
showToast(resp?.message ?? '补领失败');
|
||||
return;
|
||||
}
|
||||
showToast(resp?.message ?? '补领成功');
|
||||
continuousDays = resp!.checkin!.continuouslyDays ?? 0;
|
||||
cumulativeDays = resp.checkin!.cumulativeDays ?? 0;
|
||||
isSigned = resp.checkin!.todayChecked ?? false;
|
||||
doubleReward = resp.checkin!.doubleReward ?? false;
|
||||
videoUrl = resp.prizeVideo ?? '';
|
||||
update();
|
||||
await getSignList();
|
||||
globalStore.refreshWallet();
|
||||
}
|
||||
|
||||
/// 补签:调用接口 + 弹"邀请分享"引导弹窗
|
||||
Future<void> doResign(SignInListItem item) async {
|
||||
await MineService.postReSign(item.id ?? '');
|
||||
Get.dialog(
|
||||
_ResignGuideDialog(
|
||||
onConfirm: () {
|
||||
Get.back();
|
||||
Get.to(() => MineSharePage());
|
||||
},
|
||||
onCancel: Get.back,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 切到"积分兑换" Tab,并把页面滚到 Tab 栏刚好贴在 AppBar 下方
|
||||
void gotoExchangeTab() {
|
||||
final parent = parentLogic;
|
||||
if (parent == null) return;
|
||||
parent.tabCtr.animateTo(1);
|
||||
// 等一帧让弹窗 dismiss 后 layout 稳定,再算位置
|
||||
WidgetsBinding.instance
|
||||
.addPostFrameCallback((_) => _scrollTabKeyBelowAppBar());
|
||||
}
|
||||
|
||||
/// 让 parent.tabKey 对应的 widget 滚到 AppBar 下沿
|
||||
void _scrollTabKeyBelowAppBar() {
|
||||
final parent = parentLogic;
|
||||
if (parent == null || !parent.outerCtr.hasClients) return;
|
||||
final ctx = parent.tabKey.currentContext;
|
||||
if (ctx == null) return;
|
||||
final box = ctx.findRenderObject() as RenderBox?;
|
||||
if (box == null || !box.attached) return;
|
||||
// tabKey widget 当前在屏幕中的 Y 坐标
|
||||
final dy = box.localToGlobal(Offset.zero).dy;
|
||||
// AppBar 总高度 = 状态栏 + 工具栏
|
||||
final appBarHeight = MediaQuery.of(ctx).padding.top + kToolbarHeight;
|
||||
// 目标偏移 = 当前偏移 + (widget 屏幕 Y - AppBar 高度)
|
||||
// 滚完后 widget 顶端正好贴 AppBar 底部
|
||||
final target = (parent.outerCtr.offset + dy - appBarHeight).clamp(
|
||||
0.0,
|
||||
parent.outerCtr.position.maxScrollExtent,
|
||||
);
|
||||
parent.outerCtr.animateTo(
|
||||
target,
|
||||
duration: const Duration(milliseconds: 300),
|
||||
curve: Curves.easeOut,
|
||||
);
|
||||
}
|
||||
|
||||
// ========== 私有方法 ==========
|
||||
|
||||
/// 弹双倍奖励特效弹窗(视频循环播放)
|
||||
/// 弹窗关闭后会自动暂停并释放 videoPlayerCtr,避免后台仍在播放
|
||||
void _showDoubleRewardDialog() async {
|
||||
videoPlayerCtr?.dispose();
|
||||
final ctr = PlayerFactory.network(
|
||||
'${Address.baseApiPath}/vid/h5/m3u8/$videoUrl?token=${Address.token}&c=${Address.cdnAddress}');
|
||||
videoPlayerCtr = ctr;
|
||||
final dialogFuture = Get.dialog(
|
||||
CongratulationsRewardDialog(
|
||||
onExchange: gotoExchangeTab,
|
||||
prizeList: prizeLists,
|
||||
videoPlayerCtr: ctr,
|
||||
),
|
||||
);
|
||||
try {
|
||||
await ctr.initialize();
|
||||
await ctr.setLooping(true);
|
||||
await ctr.play();
|
||||
} catch (e) {
|
||||
// 弹窗已用此 ctr 构建,无法换 view 重试,仅内存切换;落本地由后续成功播放的播放器确认
|
||||
if (isDecoderError(e)) switchToPlatformView();
|
||||
}
|
||||
// 等弹窗 dismiss(点击关闭/兑换/外部点击/back 都会触发)
|
||||
await dialogFuture;
|
||||
await ctr.pause();
|
||||
await ctr.dispose();
|
||||
// 防止与下次双倍奖励的新实例冲突
|
||||
if (identical(videoPlayerCtr, ctr)) videoPlayerCtr = null;
|
||||
}
|
||||
|
||||
/// 弹普通签到弹窗
|
||||
void _showNormalSignDialog() {
|
||||
Get.dialog(
|
||||
SignInDialog(
|
||||
signInList: checkList,
|
||||
continuousDays: continuousDays,
|
||||
prizeList: prizeLists,
|
||||
callback: gotoExchangeTab,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// 补签引导弹窗(私有给 Logic 用)
|
||||
class _ResignGuideDialog extends StatelessWidget {
|
||||
final VoidCallback onConfirm;
|
||||
final VoidCallback onCancel;
|
||||
const _ResignGuideDialog({required this.onConfirm, required this.onCancel});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
child: Stack(
|
||||
children: [
|
||||
Container(
|
||||
width: 300,
|
||||
margin: const EdgeInsets.only(left: 32, right: 32, bottom: 100),
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(20)),
|
||||
child: Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
Container(
|
||||
margin: const EdgeInsets.only(top: 30),
|
||||
padding: const EdgeInsets.fromLTRB(24, 100, 24, 24),
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage('icon_resign_bg.webp'.mineImgPath),
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const SizedBox(height: 260),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: _btn(onCancel, '离开', isPrimary: false)),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: _btn(onConfirm, '立即邀请', isPrimary: true)),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 0,
|
||||
right: 10,
|
||||
child: GestureDetector(
|
||||
onTap: onCancel,
|
||||
child: Image.asset('icon_resign_close.png'.mineImgPath,
|
||||
width: 30, height: 30),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _btn(VoidCallback onTap, String text, {required bool isPrimary}) {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
height: 50,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: isPrimary ? null : Colors.white.withValues(alpha: 0.8),
|
||||
gradient: isPrimary
|
||||
? const LinearGradient(
|
||||
colors: [Color(0xFFF68804), Color(0xFFF68804)],
|
||||
begin: Alignment.centerLeft,
|
||||
end: Alignment.centerRight,
|
||||
)
|
||||
: null,
|
||||
borderRadius: BorderRadius.circular(25),
|
||||
border: isPrimary
|
||||
? null
|
||||
: Border.all(color: const Color(0xFFB7B7B7), width: 1),
|
||||
),
|
||||
child: Text(
|
||||
text,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: isPrimary ? Colors.white : const Color(0xFF666666),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hgdj/hj_model/mine/happy/happy_model.dart';
|
||||
import 'package:hgdj/hj_model/splash/ads_model.dart';
|
||||
import 'package:hgdj/hj_utils/screen.dart';
|
||||
import 'package:hgdj/tools_base/banner/ads_banner_widget.dart';
|
||||
|
||||
import '../../../../tools_base/banner/ads_item.dart';
|
||||
|
||||
class RecommendAppPage extends StatelessWidget {
|
||||
final AdTabConfig model;
|
||||
|
||||
const RecommendAppPage(this.model, {super.key});
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CustomScrollView(
|
||||
slivers: [
|
||||
if (model.bannerAds?.isNotEmpty ?? false)
|
||||
SliverPadding(
|
||||
padding: EdgeInsets.only(left: 16, right: 16, top: 12),
|
||||
sliver: SliverToBoxAdapter(
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: AspectRatio(
|
||||
aspectRatio: 343 / 143,
|
||||
child: AdsBannerWidget(
|
||||
model.bannerAds ?? [],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (model.hengAds != null)
|
||||
SliverMainAxisGroup(
|
||||
slivers: [
|
||||
SliverToBoxAdapter(
|
||||
child: _buildNormalTitle(model.hengAds?.title ?? ''),
|
||||
),
|
||||
SliverToBoxAdapter(
|
||||
child: 10.sizeBoxH,
|
||||
),
|
||||
SliverPadding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16),
|
||||
sliver: SliverGrid.builder(
|
||||
itemCount: model.hengAds?.items?.length,
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 5,
|
||||
crossAxisSpacing: 2,
|
||||
mainAxisSpacing: 10,
|
||||
childAspectRatio: 82 / 105,
|
||||
),
|
||||
itemBuilder: (_, index) =>
|
||||
_buildVItem(model.hengAds!.items![index], index)),
|
||||
)
|
||||
],
|
||||
),
|
||||
if (model.shuAds != null)
|
||||
SliverMainAxisGroup(
|
||||
slivers: [
|
||||
SliverToBoxAdapter(
|
||||
child: _buildNormalTitle(model.shuAds?.title ?? ''),
|
||||
),
|
||||
SliverPadding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16),
|
||||
sliver: SliverList.separated(
|
||||
itemCount: model.shuAds?.items?.length ?? 0,
|
||||
separatorBuilder: (_, __) =>
|
||||
model.shuAds?.title == '热门推荐' ? 10.sizeBoxH : 1.line,
|
||||
itemBuilder: (_, index) {
|
||||
final info = model.shuAds!.items![index];
|
||||
if (model.shuAds?.title == '热门推荐')
|
||||
return _buildHBItem(info, index);
|
||||
return _buildHItem(info, index);
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildNormalTitle(String title) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.fromLTRB(0, 20, 0, 0),
|
||||
child: Row(
|
||||
children: [
|
||||
15.sizeBoxW,
|
||||
Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 16.0,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 竖版的广告
|
||||
_buildVItem(AdsInfoModel item, int index) {
|
||||
return AdsItem(
|
||||
adInfo: item,
|
||||
clickType: 0,
|
||||
);
|
||||
}
|
||||
|
||||
_buildHItem(AdsInfoModel item, int index) {
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
12.sizeBoxH,
|
||||
AdsItem(
|
||||
adInfo: item,
|
||||
showType: AdShowType.hor,
|
||||
clickType: 0,
|
||||
),
|
||||
12.sizeBoxH,
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
_buildHBItem(AdsInfoModel item, int index) {
|
||||
return AdsItem(
|
||||
adInfo: item,
|
||||
showType: AdShowType.vImgText,
|
||||
clickType: 0,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,287 @@
|
||||
import 'package:easy_rich_text/easy_rich_text.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hgdj/assets_tool/images.dart';
|
||||
import 'package:hgdj/hj_utils/screen.dart';
|
||||
|
||||
import '../../../../tools_base/widget/net_image_widget.dart';
|
||||
import 'checkin_model.dart';
|
||||
|
||||
class SignInDialog extends StatelessWidget {
|
||||
final List<CheckinPrize>? signInList; // 签到日历数据
|
||||
final int? continuousDays; // 连续签到天数
|
||||
final Function? callback;
|
||||
final List<IntegerExchange>? prizeList;
|
||||
|
||||
SignInDialog(
|
||||
{super.key,
|
||||
this.signInList,
|
||||
this.continuousDays,
|
||||
this.callback,
|
||||
this.prizeList});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Dialog(
|
||||
backgroundColor: Colors.transparent,
|
||||
insetPadding: EdgeInsets.symmetric(horizontal: 30),
|
||||
child: Stack(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 12, right: 12, top: 12, bottom: 40),
|
||||
margin: EdgeInsets.only(top: 50),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
color: Color(0xff0F0F0F),
|
||||
border: Border.all(width: 1, color: Color(0xffFFE7B4))),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
// 描述
|
||||
EasyRichText(
|
||||
'已连续签到 $continuousDays 天,第7天有惊喜好礼相送!',
|
||||
defaultStyle: TextStyle(color: Colors.white, fontSize: 14),
|
||||
patternList: [
|
||||
EasyRichTextPattern(
|
||||
stringBeforeTarget: '已连续签到 ',
|
||||
targetString: '$continuousDays',
|
||||
style: TextStyle(color: Color(0xffFFDA0B), fontSize: 14),
|
||||
),
|
||||
EasyRichTextPattern(
|
||||
targetString: '第7天有惊喜好礼相送!',
|
||||
style: TextStyle(color: Color(0xffFFDA0B), fontSize: 14),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
12.sizeBoxH,
|
||||
Divider(height: 1, color: Colors.white.withValues(alpha: .1)),
|
||||
12.sizeBoxH,
|
||||
// Grid 奖励
|
||||
_buildGrid(),
|
||||
13.sizeBoxH,
|
||||
Container(
|
||||
padding: EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xffFFD900).withValues(alpha: .1),
|
||||
borderRadius: BorderRadius.circular(12)),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
"- 积分可兑换以下豪礼 -",
|
||||
style: TextStyle(
|
||||
color: Color(0xffFFD900),
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 12),
|
||||
// 奖励列表
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: prizeList
|
||||
?.map((e) => _buildRewardItem(
|
||||
e.name ?? "", e.icon ?? ""))
|
||||
.toList() ??
|
||||
[],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 24),
|
||||
// 按钮
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
Get.back();
|
||||
callback?.call();
|
||||
},
|
||||
child: Container(
|
||||
height: 44,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
border: Border.all(
|
||||
color: const Color(0xFFFFD700), width: 2),
|
||||
),
|
||||
child: Text(
|
||||
"兑换好礼",
|
||||
style: TextStyle(
|
||||
color: const Color(0xFFFFD700),
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
Get.back();
|
||||
},
|
||||
child: Container(
|
||||
height: 44,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xffFFD900),
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
),
|
||||
child: Text(
|
||||
"继续领积分",
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Image.asset('sign_take_top.webp'.mineImgPath,
|
||||
height: 30, fit: BoxFit.contain)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// =========================
|
||||
// Grid
|
||||
// =========================
|
||||
Widget _buildGrid() {
|
||||
final list = signInList?.take(6).toList() ?? [];
|
||||
return Container(
|
||||
height: 68,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withValues(alpha: .05),
|
||||
borderRadius: BorderRadius.circular(20)),
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
scrollDirection: Axis.horizontal,
|
||||
physics: const ScrollPhysics(),
|
||||
itemCount: list.length,
|
||||
padding: EdgeInsets.zero,
|
||||
itemBuilder: (_, i) {
|
||||
final item = list[i];
|
||||
return _buildItem(item, i);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// =========================
|
||||
// 单个格子
|
||||
// =========================
|
||||
Widget _buildItem(CheckinPrize item, int index) {
|
||||
final isSigned = (continuousDays ?? 0) > index;
|
||||
bool active = continuousDays == index;
|
||||
return Container(
|
||||
margin: EdgeInsets.only(right: 7),
|
||||
width: 42,
|
||||
height: 68,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: Colors.white.withValues(alpha: .1),
|
||||
border: active
|
||||
? Border.all(color: const Color(0xffFFDA0B), width: 0.5)
|
||||
: null,
|
||||
),
|
||||
// padding: EdgeInsets.all(5),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
(item.image != null && item.image!.isNotEmpty)
|
||||
? ColorFiltered(
|
||||
colorFilter: isSigned == true
|
||||
? ColorFilter.matrix([
|
||||
0.2126,
|
||||
0.7152,
|
||||
0.0722,
|
||||
0,
|
||||
0,
|
||||
0.2126,
|
||||
0.7152,
|
||||
0.0722,
|
||||
0,
|
||||
0,
|
||||
0.2126,
|
||||
0.7152,
|
||||
0.0722,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
])
|
||||
: ColorFilter.mode(
|
||||
Colors.transparent, BlendMode.multiply),
|
||||
child: NetworkImageLoader(
|
||||
imageUrl: item.image!,
|
||||
width: 34,
|
||||
height: 34,
|
||||
fit: BoxFit.contain))
|
||||
: Image.asset(
|
||||
isSigned == true
|
||||
? 'checked_in_coin.webp'.mineImgPath
|
||||
: 'check_in_coin.webp'.mineImgPath,
|
||||
width: 34,
|
||||
height: 34,
|
||||
fit: BoxFit.cover),
|
||||
Text(
|
||||
item.prizeName ?? '',
|
||||
style: TextStyle(
|
||||
color: isSigned == true ? Colors.white : Color(0xffFFD900),
|
||||
fontSize: 10),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildRewardItem(String title, String iconPath) {
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
width: 53,
|
||||
height: 53,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withValues(alpha: .05),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(
|
||||
color: Colors.white.withValues(alpha: .2), width: 0.5)),
|
||||
padding: EdgeInsets.all(6),
|
||||
child: NetworkImageLoader(imageUrl: iconPath, fit: BoxFit.contain),
|
||||
),
|
||||
SizedBox(height: 6),
|
||||
SizedBox(
|
||||
width: 60,
|
||||
child: Text(
|
||||
title,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 10,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,271 @@
|
||||
class SignInModel {
|
||||
final int? consecutiveSignDays;
|
||||
final List<SignInListItem>? list;
|
||||
final List<int>? reSign;
|
||||
final int? remainDay;
|
||||
final int? reSignPrice;
|
||||
final int? today;
|
||||
final int? value;
|
||||
final bool? isSign;
|
||||
// final Prize? signPrize;
|
||||
|
||||
SignInModel({
|
||||
this.consecutiveSignDays,
|
||||
this.list,
|
||||
this.remainDay,
|
||||
this.reSignPrice,
|
||||
this.value,
|
||||
this.reSign,
|
||||
this.isSign,
|
||||
this.today,
|
||||
// this.signPrize,
|
||||
});
|
||||
|
||||
factory SignInModel.fromJson(Map<String, dynamic> json) => SignInModel(
|
||||
consecutiveSignDays: json["consecutiveSignDays"],
|
||||
list:
|
||||
json["list"] == null ? [] : List<SignInListItem>.from(json["list"]!.map((x) => SignInListItem.fromJson(x))),
|
||||
reSign: json["reSign"] == null ? [] : List<int>.from(json["reSign"]!.map((x) => x)),
|
||||
remainDay: json["remainDay"],
|
||||
reSignPrice: json["reSignPrice"],
|
||||
value: json["value"],
|
||||
isSign: json["isSign"],
|
||||
today: json["today"],
|
||||
// signPrize: Prize.fromJson(json['signPrize']),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"consecutiveSignDays": consecutiveSignDays,
|
||||
"list": list == null ? [] : List<dynamic>.from(list!.map((x) => x.toJson())),
|
||||
"reSign": reSign,
|
||||
"reSignPrice": reSignPrice,
|
||||
"remainDay": remainDay,
|
||||
"value": value,
|
||||
"isSign": isSign,
|
||||
"today": today,
|
||||
// "signPrize": signPrize?.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
class SignInListItem {
|
||||
final int? boonType;
|
||||
final String? desc;
|
||||
final int? finishCondition;
|
||||
final int? finishValue;
|
||||
final String? id;
|
||||
final List<Prize>? prizes;
|
||||
int? status; //任务状态 1:未完成 2:已完成 3:已领取 4:补签
|
||||
final String? title;
|
||||
final String? name;
|
||||
final String? prizeId;
|
||||
bool? isToday;
|
||||
|
||||
SignInListItem({
|
||||
this.boonType,
|
||||
this.desc,
|
||||
this.finishCondition,
|
||||
this.finishValue,
|
||||
this.id,
|
||||
this.prizes,
|
||||
this.status,
|
||||
this.title,
|
||||
this.prizeId,
|
||||
this.isToday,
|
||||
this.name,
|
||||
});
|
||||
|
||||
factory SignInListItem.fromJson(Map<String, dynamic> json) => SignInListItem(
|
||||
boonType: json["boonType"],
|
||||
desc: json["desc"],
|
||||
finishCondition: json["finishCondition"],
|
||||
finishValue: json["finishValue"],
|
||||
id: json["id"],
|
||||
prizes: json["prizes"] == null ? [] : List<Prize>.from(json["prizes"]!.map((x) => Prize.fromJson(x))),
|
||||
status: json["status"],
|
||||
isToday: json["isToday"],
|
||||
title: json["title"],
|
||||
prizeId: json["prizeId"],
|
||||
name: json["name"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"boonType": boonType,
|
||||
"desc": desc,
|
||||
"finishCondition": finishCondition,
|
||||
"finishValue": finishValue,
|
||||
"id": id,
|
||||
"prizes": prizes == null ? [] : List<dynamic>.from(prizes!.map((x) => x.toJson())),
|
||||
"status": status,
|
||||
"title": title,
|
||||
"prizeId": prizeId,
|
||||
"name": name,
|
||||
};
|
||||
}
|
||||
|
||||
class Prize {
|
||||
final String? activityId;
|
||||
final int? count;
|
||||
final String? createTimt;
|
||||
final String? desc;
|
||||
final String? id;
|
||||
final String? image;
|
||||
final int? level;
|
||||
final String? name;
|
||||
final int? price;
|
||||
final int? sort;
|
||||
final bool? status;
|
||||
final int? type;
|
||||
final String? updateTime;
|
||||
final int? validityTime;
|
||||
final int? value;
|
||||
final String? vipCardId;
|
||||
final String? weights;
|
||||
|
||||
Prize({
|
||||
this.activityId,
|
||||
this.count,
|
||||
this.createTimt,
|
||||
this.desc,
|
||||
this.id,
|
||||
this.image,
|
||||
this.level,
|
||||
this.name,
|
||||
this.price,
|
||||
this.sort,
|
||||
this.status,
|
||||
this.type,
|
||||
this.updateTime,
|
||||
this.validityTime,
|
||||
this.value,
|
||||
this.vipCardId,
|
||||
this.weights,
|
||||
});
|
||||
|
||||
factory Prize.fromJson(Map<String, dynamic> json) => Prize(
|
||||
activityId: json["activityId"],
|
||||
count: json["count"],
|
||||
createTimt: json["createTimt"],
|
||||
desc: json["desc"],
|
||||
id: json["id"],
|
||||
image: json["image"],
|
||||
level: json["level"],
|
||||
name: json["name"],
|
||||
price: json["price"],
|
||||
sort: json["sort"],
|
||||
status: json["status"],
|
||||
type: json["type"],
|
||||
updateTime: json["updateTime"],
|
||||
validityTime: json["validityTime"],
|
||||
value: json["value"],
|
||||
vipCardId: json["vipCardId"],
|
||||
weights: json["weights"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"activityId": activityId,
|
||||
"count": count,
|
||||
"createTimt": createTimt,
|
||||
"desc": desc,
|
||||
"id": id,
|
||||
"image": image,
|
||||
"level": level,
|
||||
"name": name,
|
||||
"price": price,
|
||||
"sort": sort,
|
||||
"status": status,
|
||||
"type": type,
|
||||
"updateTime": updateTime,
|
||||
"validityTime": validityTime,
|
||||
"value": value,
|
||||
"vipCardId": vipCardId,
|
||||
"weights": weights,
|
||||
};
|
||||
}
|
||||
|
||||
class ExtraSignRewardItem {
|
||||
final String? activityId;
|
||||
final int? count;
|
||||
final String? createTimt;
|
||||
final String? desc;
|
||||
final bool? extraPrizeStatus; // 是否已领取额外奖励
|
||||
final int? finishCondition; // 完成条件(需要签到的天数)
|
||||
final String? id;
|
||||
final String? image;
|
||||
final int? level;
|
||||
final String? name;
|
||||
final int? price;
|
||||
final int? sort;
|
||||
final bool? status;
|
||||
final int? type;
|
||||
final String? updateTime;
|
||||
final int? validityTime;
|
||||
final int? value;
|
||||
final String? vipCardId;
|
||||
final String? weights;
|
||||
|
||||
ExtraSignRewardItem({
|
||||
this.activityId,
|
||||
this.count,
|
||||
this.createTimt,
|
||||
this.desc,
|
||||
this.extraPrizeStatus,
|
||||
this.finishCondition,
|
||||
this.id,
|
||||
this.image,
|
||||
this.level,
|
||||
this.name,
|
||||
this.price,
|
||||
this.sort,
|
||||
this.status,
|
||||
this.type,
|
||||
this.updateTime,
|
||||
this.validityTime,
|
||||
this.value,
|
||||
this.vipCardId,
|
||||
this.weights,
|
||||
});
|
||||
|
||||
factory ExtraSignRewardItem.fromJson(Map<String, dynamic> json) => ExtraSignRewardItem(
|
||||
activityId: json["activityId"],
|
||||
count: json["count"],
|
||||
createTimt: json["createTimt"],
|
||||
desc: json["desc"],
|
||||
extraPrizeStatus: json["extraPrizeStatus"],
|
||||
finishCondition: json["finishCondition"],
|
||||
id: json["id"],
|
||||
image: json["image"],
|
||||
level: json["level"],
|
||||
name: json["name"],
|
||||
price: json["price"],
|
||||
sort: json["sort"],
|
||||
status: json["status"],
|
||||
type: json["type"],
|
||||
updateTime: json["updateTime"],
|
||||
validityTime: json["validityTime"],
|
||||
value: json["value"],
|
||||
vipCardId: json["vipCardId"],
|
||||
weights: json["weights"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"activityId": activityId,
|
||||
"count": count,
|
||||
"createTimt": createTimt,
|
||||
"desc": desc,
|
||||
"extraPrizeStatus": extraPrizeStatus,
|
||||
"finishCondition": finishCondition,
|
||||
"id": id,
|
||||
"image": image,
|
||||
"level": level,
|
||||
"name": name,
|
||||
"price": price,
|
||||
"sort": sort,
|
||||
"status": status,
|
||||
"type": type,
|
||||
"updateTime": updateTime,
|
||||
"validityTime": validityTime,
|
||||
"value": value,
|
||||
"vipCardId": vipCardId,
|
||||
"weights": weights,
|
||||
};
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user