@@ -482,7 +482,7 @@ | |||||
"languageVersion": "2.1" | "languageVersion": "2.1" | ||||
} | } | ||||
], | ], | ||||
"generated": "2020-10-15T08:13:11.544762Z", | |||||
"generated": "2020-10-17T07:39:42.872292Z", | |||||
"generator": "pub", | "generator": "pub", | ||||
"generatorVersion": "2.8.2" | "generatorVersion": "2.8.2" | ||||
} | } |
@@ -158,19 +158,19 @@ class HomePage extends StatelessWidget { | |||||
), | ), | ||||
RaisedButton( | RaisedButton( | ||||
onPressed: () async { | onPressed: () async { | ||||
String detailUrl = 'http://www.hairuyi.com/?mod=appapi&act=gotojingdong&gid=60291609161&yhq_url=http%3A%2F%2Fcoupon.m.jd.com%2Fcoupons%2Fshow.action%3Fkey%3Dd97e1472a8a24c39a9463dbe72b3fa32%26roleId%3D38088450%26to%3Ditem.jd.com%2F60291609161.html'; | |||||
String baseUrl = detailUrl.getBaseUrl(); | |||||
if (!baseUrl.contains('jd.com')) { | |||||
Dio dio = Dio(); | |||||
var responds = await dio.get(detailUrl); | |||||
detailUrl = responds.realUri.toString(); | |||||
} | |||||
Logger.debug(detailUrl); | |||||
Jdsdk.openUrl( | |||||
url | |||||
: | |||||
detailUrl | |||||
); | |||||
// String detailUrl = 'http://www.hairuyi.com/?mod=appapi&act=gotojingdong&gid=60291609161&yhq_url=http%3A%2F%2Fcoupon.m.jd.com%2Fcoupons%2Fshow.action%3Fkey%3Dd97e1472a8a24c39a9463dbe72b3fa32%26roleId%3D38088450%26to%3Ditem.jd.com%2F60291609161.html'; | |||||
// String baseUrl = detailUrl.getBaseUrl(); | |||||
// if (!baseUrl.contains('jd.com')) { | |||||
// Dio dio = Dio(); | |||||
// var responds = await dio.get(detailUrl); | |||||
// detailUrl = responds.realUri.toString(); | |||||
// } | |||||
// Logger.debug(detailUrl); | |||||
// Jdsdk.openUrl( | |||||
// url | |||||
// : | |||||
// detailUrl | |||||
// ); | |||||
}, | }, | ||||
child: Text('嗨如意转链打开京东'), | child: Text('嗨如意转链打开京东'), | ||||
), | ), | ||||
@@ -11,7 +11,11 @@ import 'package:zhiying_comm/util/shared_prefe_util.dart'; | |||||
/// | /// | ||||
class UserInfoNotifier with ChangeNotifier { | class UserInfoNotifier with ChangeNotifier { | ||||
/// 用户信息 | /// 用户信息 | ||||
UserInfoModel _userInfo; | |||||
static UserInfoModel _userInfo; | |||||
static UserInfoModel get staitcUserInfo { | |||||
return _userInfo; | |||||
} | |||||
UserInfoModel get userInfo { | UserInfoModel get userInfo { | ||||
if (null == _userInfo) { | if (null == _userInfo) { | ||||
@@ -28,7 +32,7 @@ class UserInfoNotifier with ChangeNotifier { | |||||
/// 更新用户数据 | /// 更新用户数据 | ||||
void setUserInfo(UserInfoModel loginUser) async { | void setUserInfo(UserInfoModel loginUser) async { | ||||
print('${loginUser.toString()}'); | print('${loginUser.toString()}'); | ||||
this._userInfo = loginUser; | |||||
_userInfo = loginUser; | |||||
// 缓存数据 | // 缓存数据 | ||||
await SharedPreferencesUtil.setStringValue( | await SharedPreferencesUtil.setStringValue( | ||||
GlobalConfig.SHARED_KEY_TOKEN, loginUser.token); | GlobalConfig.SHARED_KEY_TOKEN, loginUser.token); | ||||
@@ -41,7 +45,7 @@ class UserInfoNotifier with ChangeNotifier { | |||||
/// 退出登陆 | /// 退出登陆 | ||||
void unLogin() async { | void unLogin() async { | ||||
this._userInfo = null; | |||||
_userInfo = null; | |||||
// 清除缓存数据 | // 清除缓存数据 | ||||
await SharedPreferencesUtil.setStringValue( | await SharedPreferencesUtil.setStringValue( | ||||
GlobalConfig.SHARED_KEY_TOKEN, ''); | GlobalConfig.SHARED_KEY_TOKEN, ''); | ||||
@@ -60,7 +64,11 @@ class UserInfoNotifier with ChangeNotifier { | |||||
try { | try { | ||||
String userInfoJson = await SharedPreferencesUtil.getStringValue( | String userInfoJson = await SharedPreferencesUtil.getStringValue( | ||||
GlobalConfig.SHARED_KEY_USER_INFO); | GlobalConfig.SHARED_KEY_USER_INFO); | ||||
_userInfo = UserInfoModel.fromJson(jsonDecode(userInfoJson)); | |||||
if (userInfoJson == null || userInfoJson == '') { | |||||
_userInfo = UserInfoModel(); | |||||
} else { | |||||
_userInfo = UserInfoModel.fromJson(jsonDecode(userInfoJson)); | |||||
} | |||||
} catch (e) { | } catch (e) { | ||||
Logger.log(e); | Logger.log(e); | ||||
} | } | ||||
@@ -40,8 +40,7 @@ class TaobaoAuth { | |||||
// TradeResult result = await FlutterAlibc.openByUrl(url: ''); | // TradeResult result = await FlutterAlibc.openByUrl(url: ''); | ||||
Logger.debug('${result.errorCode} ${result.errorMessage} '); | Logger.debug('${result.errorCode} ${result.errorMessage} '); | ||||
} else if (Platform.isIOS) { | } else if (Platform.isIOS) { | ||||
TradeResult result = | |||||
await FlutterAlibc.openByUrl(url: url, backUrl: "alisdk://"); | |||||
TradeResult result = await FlutterAlibc.openByUrl(url: url); | |||||
// TradeResult result = await FlutterAlibc.openByUrl(url: ''); | // TradeResult result = await FlutterAlibc.openByUrl(url: ''); | ||||
Logger.debug('${result.errorCode} ${result.errorMessage} '); | Logger.debug('${result.errorCode} ${result.errorMessage} '); | ||||
} | } | ||||