基础组件库
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 
 

137 řádky
3.8 KiB

  1. import 'package:zhiying_comm/zhiying_comm.dart';
  2. // 应用配置信息
  3. class AppConfigModel {
  4. // 应用配置的key
  5. AppConfigKeyModel keys;
  6. // 引导页
  7. AppConfigGuideModel guideImage;
  8. static AppConfigModel _config;
  9. AppConfigModel({this.keys, this.guideImage});
  10. static AppConfigModel getConfig() => _config;
  11. static Future<AppConfigModel> init() async {
  12. Map result =
  13. await NetUtil.post('/api/v1/app/guide', method: NetMethod.GET);
  14. try {
  15. var data = result['data'];
  16. _config = AppConfigModel.fromJson(Map<String, dynamic>.from(data));
  17. Logger.debug('基础设置初始化');
  18. return _config;
  19. } catch (err) {
  20. Logger.error(err);
  21. }
  22. return null;
  23. }
  24. AppConfigModel.fromJson(Map<String, dynamic> json) {
  25. keys = json['keys'] != null ? new AppConfigKeyModel.fromJson(json['keys']) : null;
  26. guideImage = json['guide_image'] != null
  27. ? new AppConfigGuideModel.fromJson(json['guide_image'])
  28. : null;
  29. }
  30. Map<String, dynamic> toJson() {
  31. final Map<String, dynamic> data = new Map<String, dynamic>();
  32. if (this.keys != null) {
  33. data['keys'] = this.keys.toJson();
  34. }
  35. if (this.guideImage != null) {
  36. data['guide_image'] = this.guideImage.toJson();
  37. }
  38. return data;
  39. }
  40. }
  41. class AppConfigKeyModel {
  42. AppConfigKeyItemModel weibo;
  43. AppConfigKeyItemModel qq;
  44. AppConfigKeyItemModel weixin;
  45. AppConfigKeyItemModel jdIos;
  46. AppConfigKeyItemModel jdAndroid;
  47. AppConfigKeyModel({this.weibo, this.qq, this.weixin, this.jdIos, this.jdAndroid});
  48. AppConfigKeyModel.fromJson(Map<String, dynamic> json) {
  49. weibo = json['weibo'] != null ? new AppConfigKeyItemModel.fromJson(json['weibo']) : null;
  50. qq = json['qq'] != null ? new AppConfigKeyItemModel.fromJson(json['qq']) : null;
  51. weixin =
  52. json['weixin'] != null ? new AppConfigKeyItemModel.fromJson(json['weixin']) : null;
  53. jdIos = json['jd_ios'] != null ? new AppConfigKeyItemModel.fromJson(json['jd_ios']) : null;
  54. jdAndroid = json['jd_android'] != null
  55. ? new AppConfigKeyItemModel.fromJson(json['jd_android'])
  56. : null;
  57. }
  58. Map<String, dynamic> toJson() {
  59. final Map<String, dynamic> data = new Map<String, dynamic>();
  60. if (this.weibo != null) {
  61. data['weibo'] = this.weibo.toJson();
  62. }
  63. if (this.qq != null) {
  64. data['qq'] = this.qq.toJson();
  65. }
  66. if (this.weixin != null) {
  67. data['weixin'] = this.weixin.toJson();
  68. }
  69. if (this.jdIos != null) {
  70. data['jd_ios'] = this.jdIos.toJson();
  71. }
  72. if (this.jdAndroid != null) {
  73. data['jd_android'] = this.jdAndroid.toJson();
  74. }
  75. return data;
  76. }
  77. }
  78. class AppConfigKeyItemModel {
  79. String appId;
  80. String appkey;
  81. String secret;
  82. String redirectUrl;
  83. String universalLink;
  84. AppConfigKeyItemModel({this.appkey, this.secret, this.redirectUrl});
  85. AppConfigKeyItemModel.fromJson(Map<String, dynamic> json) {
  86. appId = json['app_id'];
  87. appkey = json['appkey'];
  88. secret = json['secret'];
  89. redirectUrl = json['redirect_url'];
  90. universalLink = json['universal_link'];
  91. }
  92. Map<String, dynamic> toJson() {
  93. final Map<String, dynamic> data = new Map<String, dynamic>();
  94. data['app_id'] = this.appId;
  95. data['appkey'] = this.appkey;
  96. data['secret'] = this.secret;
  97. data['redirect_url'] = this.redirectUrl;
  98. data['universal_link'] = this.universalLink;
  99. return data;
  100. }
  101. }
  102. class AppConfigGuideModel {
  103. String isShowIndicator;
  104. List<String> images;
  105. AppConfigGuideModel({this.isShowIndicator, this.images});
  106. AppConfigGuideModel.fromJson(Map<String, dynamic> json) {
  107. isShowIndicator = json['is_show_indicator'];
  108. images = json['images'].cast<String>();
  109. }
  110. Map<String, dynamic> toJson() {
  111. final Map<String, dynamic> data = new Map<String, dynamic>();
  112. data['is_show_indicator'] = this.isShowIndicator;
  113. data['images'] = this.images;
  114. return data;
  115. }
  116. }