初始化
This commit is contained in:
@@ -0,0 +1,121 @@
|
||||
import '../../tools_base/banner/ads_grid_view_widget.dart';
|
||||
|
||||
/// 广告信息
|
||||
class AdsInfoModel {
|
||||
// ----- 基础信息 -----
|
||||
String? id;
|
||||
String? title;
|
||||
String? cover; //封面图
|
||||
String? href; //跳转地址
|
||||
String? newUrl;
|
||||
|
||||
// ----- 官方/来源信息 -----
|
||||
String? officialImg;
|
||||
String? officialName;
|
||||
String? officialDesc;
|
||||
String? officialUrl;
|
||||
String? officialType;
|
||||
|
||||
// ----- 展示位置与排序 -----
|
||||
String? positionName;
|
||||
String? imPosition; //IM 广告位标识(IM_LIST_BANNER 等字符串 key)
|
||||
/// 广告位置
|
||||
/// 0 - 启动页广告
|
||||
/// 1 - 首页-推荐显示小广告
|
||||
/// 2 - 首页-推荐公告展示
|
||||
/// 3 - 消息界面广告
|
||||
/// 4 - 首页-热点 banner广告
|
||||
int? position;
|
||||
|
||||
/// 同一位置使用此进行排序
|
||||
int? sortCode;
|
||||
|
||||
/// 广告样式
|
||||
/// full-screen 全屏(启动页、短视频)
|
||||
/// banner-720300 Banner720300
|
||||
/// banner-720150 Banner720150
|
||||
/// banner-750700 Banner750700
|
||||
/// banner-800450 Banner800450
|
||||
/// pop-ups-600800 弹窗600800
|
||||
/// pop-ups-512512 弹窗512512
|
||||
/// small-cube 小方块
|
||||
/// vertical-cube 竖方块
|
||||
String? coverImgSize;
|
||||
|
||||
// ----- 业务控制 -----
|
||||
int? moduleType; //楼凤广告模块过滤
|
||||
int? watchTime; //广告关闭时长
|
||||
|
||||
AdsInfoModel({this.id, this.cover, this.href, this.title});
|
||||
|
||||
/// 是否有广告倒计时
|
||||
bool get hasAdTime => (watchTime ?? 0) > 0;
|
||||
|
||||
/// 根据 coverImgSize 映射广告布局样式(small-cube 与未知值同走默认)
|
||||
AdStyle get adStyle => switch (coverImgSize) {
|
||||
'vertical-cube' => AdStyle.oneScrollBig,
|
||||
'banner-720300' => AdStyle.banner,
|
||||
_ => AdStyle.twoAutoScroll,
|
||||
};
|
||||
|
||||
//同时兼容 Adv(image/name/url) 与 ShuApp(icon/name/url) 字段
|
||||
AdsInfoModel.fromJson(dynamic json) {
|
||||
json ??= {};
|
||||
id = json['id'];
|
||||
title = json['title'] ?? json['name'];
|
||||
cover = json['cover'] ?? json['image'] ?? json['icon'];
|
||||
href = json['href'] ?? json['url'];
|
||||
newUrl = json['newUrl'];
|
||||
officialImg = json['officialImg'];
|
||||
officialName = json['officialName'];
|
||||
officialDesc = json['officialDesc'];
|
||||
officialUrl = json['officialUrl'];
|
||||
officialType = json['officialType'];
|
||||
positionName = json['positionName'];
|
||||
position = json['position'];
|
||||
sortCode = json['sortCode'];
|
||||
coverImgSize = json['coverImgSize'];
|
||||
moduleType = json['moduleType'];
|
||||
watchTime = json['watchTime'];
|
||||
}
|
||||
|
||||
//和 fromJson 同一套解析,别再各写一份
|
||||
static AdsInfoModel fromMap(Map<dynamic, dynamic>? map) => AdsInfoModel.fromJson(map);
|
||||
|
||||
Map toJson() => {
|
||||
"id": id,
|
||||
"title": title,
|
||||
"cover": cover,
|
||||
"href": href,
|
||||
"position": position,
|
||||
"sortCode": sortCode,
|
||||
"positionName": positionName,
|
||||
};
|
||||
}
|
||||
|
||||
/// 公告信息
|
||||
class AnnounceInfoBean {
|
||||
String? content;
|
||||
String? cover;
|
||||
String? href; //图片公告点击时跳转的地址
|
||||
int? type; //0:系统公告 1:图片公告 3:活动公告
|
||||
String? title;
|
||||
|
||||
static AnnounceInfoBean fromJson(Map<String, dynamic>? map) {
|
||||
map ??= {};
|
||||
return AnnounceInfoBean()
|
||||
..content = map['content']
|
||||
..cover = map['cover']
|
||||
..href = map['href']
|
||||
..type = map['type']
|
||||
..title = map['title'];
|
||||
}
|
||||
|
||||
Map toJson() => {
|
||||
"content": content,
|
||||
"cover": cover,
|
||||
"href": href,
|
||||
"type": type,
|
||||
"title": title,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user