Browse Source

1、app与H5共享token

tags/0.0.18+3^2
PH2 3 years ago
parent
commit
5703241449
3 changed files with 30 additions and 7 deletions
  1. +26
    -2
      lib/models/app_config_model.dart
  2. +4
    -0
      lib/register.dart
  3. +0
    -5
      pubspec.yaml

+ 26
- 2
lib/models/app_config_model.dart View File

@@ -12,6 +12,9 @@ class AppConfigModel {
// 引导页 // 引导页
AppConfigGuideModel guideImage; AppConfigGuideModel guideImage;


// H5根域名
DomainModel domain;

///新引导页参数 ///新引导页参数
GuideData guideData; GuideData guideData;


@@ -19,7 +22,7 @@ class AppConfigModel {


static AppConfigModel _config; static AppConfigModel _config;


AppConfigModel({this.keys, this.guideImage});
AppConfigModel({this.keys, this.guideImage, this.domain});


static AppConfigModel getConfig() => _config; static AppConfigModel getConfig() => _config;


@@ -55,6 +58,7 @@ class AppConfigModel {
guideImage = json['guide_image'] != null ? new AppConfigGuideModel.fromJson(json['guide_image']) : null; guideImage = json['guide_image'] != null ? new AppConfigGuideModel.fromJson(json['guide_image']) : null;
guideData = json['guide_data'] != null ? GuideData.fromJson(json['guide_data']) : null; guideData = json['guide_data'] != null ? GuideData.fromJson(json['guide_data']) : null;
appStartDelay = json['app_start_delay'] != null ? json['app_start_delay'] : '0.5'; appStartDelay = json['app_start_delay'] != null ? json['app_start_delay'] : '0.5';
domain = json['domain'] != null ? new DomainModel.fromJson(json['domain']) : null;
} }


Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@@ -65,6 +69,9 @@ class AppConfigModel {
if (this.guideImage != null) { if (this.guideImage != null) {
data['guide_image'] = this.guideImage.toJson(); data['guide_image'] = this.guideImage.toJson();
} }
if (this.domain != null) {
data['domain'] = this.domain.toJson();
}
return data; return data;
} }
} }
@@ -79,6 +86,7 @@ class AppConfigKeyModel {
AppConfigKeyItemModel bugly; AppConfigKeyItemModel bugly;
GDModel gd; GDModel gd;



AppConfigKeyModel({this.weibo, this.qq, this.weixin, this.jdIos, this.jdAndroid, this.taobao, this.bugly}); AppConfigKeyModel({this.weibo, this.qq, this.weixin, this.jdIos, this.jdAndroid, this.taobao, this.bugly});


AppConfigKeyModel.fromJson(Map<String, dynamic> json) { AppConfigKeyModel.fromJson(Map<String, dynamic> json) {
@@ -118,7 +126,6 @@ class AppConfigKeyModel {
if (this.bugly != null) { if (this.bugly != null) {
data['bugly_list'] = this.bugly.toJson(); data['bugly_list'] = this.bugly.toJson();
} }

return data; return data;
} }
} }
@@ -261,6 +268,23 @@ class AppConfigGuideModel {
} }
} }


class DomainModel {
String h5Url;

DomainModel({this.h5Url});

DomainModel.fromJson(Map<String, dynamic> json) {
h5Url = json['h5_url']?.toString();
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['h5_url'] = this.h5Url;
return data;
}

}

class GDModel { class GDModel {
String androidKey; String androidKey;
String iosKey; String iosKey;


+ 4
- 0
lib/register.dart View File

@@ -187,6 +187,10 @@ class BaseWidgetRegister {
} }
} }


// 缓存h5根域名, 用来与h5共享token等数据
SharedPreferencesUtil.setStringValue(GlobalConfig.H5_DOMAIN, config?.domain?.h5Url ?? '');
Logger.log('h5 根域名 = ' + config?.domain?.h5Url ?? '');

}); });


return null; return null;


+ 0
- 5
pubspec.yaml View File

@@ -68,11 +68,6 @@ dependencies:
url: http://192.168.0.138:3000/FnuoOS_ZhiYing/flutter_bugly.git url: http://192.168.0.138:3000/FnuoOS_ZhiYing/flutter_bugly.git
# ath: ../flutter_bugly # ath: ../flutter_bugly


zhiying_flutter_webview:
git:
url: http://192.168.0.138:3000/FnuoOS_ZhiYing/zhiying_flutter_webview.git
ref: 0.0.4

# 特效底部 # 特效底部
# convex_bottom_bar: ^2.7.1+2 # convex_bottom_bar: ^2.7.1+2




Loading…
Cancel
Save