Преглед на файлове

更新用户信息

tags/0.0.1
Weller преди 4 години
родител
ревизия
82b326198a
променени са 4 файла, в които са добавени 27 реда и са изтрити 20 реда
  1. +1
    -1
      .dart_tool/package_config.json
  2. +13
    -13
      example/lib/main.dart
  3. +12
    -4
      lib/models/user/user_info_model_notifier.dart
  4. +1
    -2
      lib/util/taobao/taobao_auth.dart

+ 1
- 1
.dart_tool/package_config.json Целия файл

@@ -482,7 +482,7 @@
"languageVersion": "2.1"
}
],
"generated": "2020-10-15T08:13:11.544762Z",
"generated": "2020-10-17T07:39:42.872292Z",
"generator": "pub",
"generatorVersion": "2.8.2"
}

+ 13
- 13
example/lib/main.dart Целия файл

@@ -158,19 +158,19 @@ class HomePage extends StatelessWidget {
),
RaisedButton(
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('嗨如意转链打开京东'),
),


+ 12
- 4
lib/models/user/user_info_model_notifier.dart Целия файл

@@ -11,7 +11,11 @@ import 'package:zhiying_comm/util/shared_prefe_util.dart';
///
class UserInfoNotifier with ChangeNotifier {
/// 用户信息
UserInfoModel _userInfo;
static UserInfoModel _userInfo;

static UserInfoModel get staitcUserInfo {
return _userInfo;
}

UserInfoModel get userInfo {
if (null == _userInfo) {
@@ -28,7 +32,7 @@ class UserInfoNotifier with ChangeNotifier {
/// 更新用户数据
void setUserInfo(UserInfoModel loginUser) async {
print('${loginUser.toString()}');
this._userInfo = loginUser;
_userInfo = loginUser;
// 缓存数据
await SharedPreferencesUtil.setStringValue(
GlobalConfig.SHARED_KEY_TOKEN, loginUser.token);
@@ -41,7 +45,7 @@ class UserInfoNotifier with ChangeNotifier {

/// 退出登陆
void unLogin() async {
this._userInfo = null;
_userInfo = null;
// 清除缓存数据
await SharedPreferencesUtil.setStringValue(
GlobalConfig.SHARED_KEY_TOKEN, '');
@@ -60,7 +64,11 @@ class UserInfoNotifier with ChangeNotifier {
try {
String userInfoJson = await SharedPreferencesUtil.getStringValue(
GlobalConfig.SHARED_KEY_USER_INFO);
_userInfo = UserInfoModel.fromJson(jsonDecode(userInfoJson));
if (userInfoJson == null || userInfoJson == '') {
_userInfo = UserInfoModel();
} else {
_userInfo = UserInfoModel.fromJson(jsonDecode(userInfoJson));
}
} catch (e) {
Logger.log(e);
}


+ 1
- 2
lib/util/taobao/taobao_auth.dart Целия файл

@@ -40,8 +40,7 @@ class TaobaoAuth {
// TradeResult result = await FlutterAlibc.openByUrl(url: '');
Logger.debug('${result.errorCode} ${result.errorMessage} ');
} 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: '');
Logger.debug('${result.errorCode} ${result.errorMessage} ');
}


Зареждане…
Отказ
Запис