浏览代码

1、app与H5共享token

tags/0.0.18+3^2
PH2 3 年前
父节点
当前提交
5703241449
共有 3 个文件被更改,包括 30 次插入7 次删除
  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 查看文件

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

// H5根域名
DomainModel domain;

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

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

static AppConfigModel _config;

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

static AppConfigModel getConfig() => _config;

@@ -55,6 +58,7 @@ class AppConfigModel {
guideImage = json['guide_image'] != null ? new AppConfigGuideModel.fromJson(json['guide_image']) : null;
guideData = json['guide_data'] != null ? GuideData.fromJson(json['guide_data']) : null;
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() {
@@ -65,6 +69,9 @@ class AppConfigModel {
if (this.guideImage != null) {
data['guide_image'] = this.guideImage.toJson();
}
if (this.domain != null) {
data['domain'] = this.domain.toJson();
}
return data;
}
}
@@ -79,6 +86,7 @@ class AppConfigKeyModel {
AppConfigKeyItemModel bugly;
GDModel gd;


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

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

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 {
String androidKey;
String iosKey;


+ 4
- 0
lib/register.dart 查看文件

@@ -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;


+ 0
- 5
pubspec.yaml 查看文件

@@ -68,11 +68,6 @@ dependencies:
url: http://192.168.0.138:3000/FnuoOS_ZhiYing/flutter_bugly.git
# 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



正在加载...
取消
保存