Browse Source

1、获取page支持后缀的方式来添加

2、新增商品渠道类型
tags/0.0.2^0
PH2 4 years ago
parent
commit
323427942f
2 changed files with 33 additions and 5 deletions
  1. +16
    -5
      lib/util/global_config.dart
  2. +17
    -0
      lib/util/page_factory.dart

+ 16
- 5
lib/util/global_config.dart View File

@@ -7,6 +7,18 @@ class GlobalConfig {
/// 成功返回的CODE值 /// 成功返回的CODE值
static final int RESPONSE_SUCCESS_CODE = 1; static final int RESPONSE_SUCCESS_CODE = 1;


/// 通用标志key
static final String SKIP_IDENTIFIER = 'skip_identifier';

/// ====================== 各个渠道的key ====================== ///
static final String PROVIDER_TB = 'taobao'; // 淘宝
static final String PROVIDER_TM = 'tianmao'; // 天猫
static final String PROVIDER_JD = 'jd'; // 京东
static final String PROVIDER_KL = 'kaola'; // 考拉
static final String PROVIDER_VIP = 'vip'; // 唯品会
static final String PROVIDER_SN = 'suning'; // 苏宁
static final String PROVIDER_PDD = 'pdd'; // 拼多多

/// ====================== Shared_prefe_key ====================== /// /// ====================== Shared_prefe_key ====================== ///
/// 用户token /// 用户token
static final String SHARED_KEY_TOKEN = 'sp_token'; static final String SHARED_KEY_TOKEN = 'sp_token';
@@ -20,11 +32,10 @@ class GlobalConfig {
/// 用户json /// 用户json
static final String SHARED_KEY_USER_INFO = 'sp_userinfo'; static final String SHARED_KEY_USER_INFO = 'sp_userinfo';




/// 货币类型 /// 货币类型
static final String MONEY_TYPE = "¥ "; static final String MONEY_TYPE = "¥ ";
/// 天猫 淘宝类型
static final String PROVIDER_TM = 'tianmao';
static final String PROVIDER_TB = 'taobao';

// /// 天猫 淘宝类型
// static final String PROVIDER_TM = 'tianmao';
// static final String PROVIDER_TB = 'taobao';
} }

+ 17
- 0
lib/util/page_factory.dart View File

@@ -30,6 +30,23 @@ class PageFactory {
if (pageCreater.containsKey(name)) { if (pageCreater.containsKey(name)) {
return pageCreater[name](model); return pageCreater[name](model);
} }
// ⚠️ 由于使用了跳转标志带有后缀,所以需要判断是否带有后缀,如果带有并且是数字,则清除后缀获取page
String tempName;
try{
String suffixStr = name.substring(name.lastIndexOf('.') + 1, name.length);
tempName = name.substring(0, name.lastIndexOf('.'));
Logger.log('sufix = $suffixStr , prefix = $tempName');
int suffixNum = int.parse(suffixStr);
Logger.log('suffixNum = $suffixNum}');
}catch(e){
tempName = null;
Logger.debug(e);
}

if(!EmptyUtil.isEmpty(tempName) && pageCreater.containsKey(tempName)){
return pageCreater[tempName](model);
}

return EmptyPage(); return EmptyPage();
} }




Loading…
Cancel
Save