Compare commits
2 Commits
4bfbadd772
...
ffc13c0e85
| Author | SHA1 | Date |
|---|---|---|
|
|
ffc13c0e85 | |
|
|
b2a682081a |
|
|
@ -11,7 +11,7 @@ import 'package:wgshare/common/config/request_config.dart';
|
||||||
|
|
||||||
part 'base_structure_result.g.dart';
|
part 'base_structure_result.g.dart';
|
||||||
|
|
||||||
@JsonSerializable(genericArgumentFactories: true, fieldRename: FieldRename.snake)
|
@JsonSerializable(genericArgumentFactories: true, fieldRename: FieldRename.snake,checked: true)
|
||||||
class BaseStructureResult<T> extends Object {
|
class BaseStructureResult<T> extends Object {
|
||||||
@JsonKey(name: 'code')
|
@JsonKey(name: 'code')
|
||||||
int code;
|
int code;
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import 'package:json_annotation/json_annotation.dart';
|
||||||
|
|
||||||
part 'user_info_entity.g.dart';
|
part 'user_info_entity.g.dart';
|
||||||
|
|
||||||
@JsonSerializable()
|
@JsonSerializable(checked: true)
|
||||||
class UserInfoEntity extends Object{
|
class UserInfoEntity extends Object{
|
||||||
|
|
||||||
@JsonKey(name: 'perms')
|
@JsonKey(name: 'perms')
|
||||||
|
|
@ -42,4 +42,5 @@ class UserInfoEntity extends Object{
|
||||||
|
|
||||||
factory UserInfoEntity.fromJson(Map<String, dynamic> srcJson) => _$UserInfoEntityFromJson(srcJson);
|
factory UserInfoEntity.fromJson(Map<String, dynamic> srcJson) => _$UserInfoEntityFromJson(srcJson);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => _$UserInfoEntityToJson(this);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import 'package:wgshare/common/mixins/request_tool_mixin.dart';
|
||||||
import 'package:wgshare/common/store/app_storage_key.dart';
|
import 'package:wgshare/common/store/app_storage_key.dart';
|
||||||
import 'package:wgshare/utils/storage.dart';
|
import 'package:wgshare/utils/storage.dart';
|
||||||
|
|
||||||
|
import '../../routes/app_routes.dart';
|
||||||
import '../models/user_info_entity.dart';
|
import '../models/user_info_entity.dart';
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -24,14 +25,12 @@ class UserStore extends GetxController with RequestToolMixin {
|
||||||
userInfoEntity.value = UserInfoEntity.fromJson(userDetail);
|
userInfoEntity.value = UserInfoEntity.fromJson(userDetail);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
debugPrint('wgs输出===:$err');
|
|
||||||
StorageService.to.remove(AppStorageKey.userInfo.value);
|
StorageService.to.remove(AppStorageKey.userInfo.value);
|
||||||
}
|
}
|
||||||
if ((token?.isNotEmpty ?? false) && userInfoEntity.value != null) {
|
if ((token?.isNotEmpty ?? false) && userInfoEntity.value != null) {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/// TODO 返回登录页面
|
Get.offAllNamed(Routes.loginPage);
|
||||||
// Get.offAllNamed(Routes.login);
|
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ class MyApp extends StatelessWidget {
|
||||||
//默认专场动画
|
//默认专场动画
|
||||||
defaultTransition: Transition.fade,
|
defaultTransition: Transition.fade,
|
||||||
//初始化路由页面
|
//初始化路由页面
|
||||||
initialRoute: Routes.loginPage,
|
initialRoute: Routes.startPage,
|
||||||
|
|
||||||
/// 路由表
|
/// 路由表
|
||||||
getPages: AppPages.pages,
|
getPages: AppPages.pages,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:crypto/crypto.dart';
|
import 'package:crypto/crypto.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:wgshare/common/mixins/request_tool_mixin.dart';
|
import 'package:wgshare/common/mixins/request_tool_mixin.dart';
|
||||||
import 'package:wgshare/utils/device_info.dart';
|
import 'package:wgshare/utils/device_info.dart';
|
||||||
|
|
@ -8,8 +9,10 @@ import 'package:wgshare/utils/toast_utils.dart';
|
||||||
|
|
||||||
import '../../common/models/common/base_structure_result.dart';
|
import '../../common/models/common/base_structure_result.dart';
|
||||||
import '../../common/models/user_info_entity.dart';
|
import '../../common/models/user_info_entity.dart';
|
||||||
|
import '../../common/store/app_storage_key.dart';
|
||||||
import '../../common/store/user_store.dart';
|
import '../../common/store/user_store.dart';
|
||||||
import '../../routes/app_routes.dart';
|
import '../../routes/app_routes.dart';
|
||||||
|
import '../../utils/storage.dart';
|
||||||
import 'login_state.dart';
|
import 'login_state.dart';
|
||||||
|
|
||||||
class LoginLogic extends GetxController with RequestToolMixin {
|
class LoginLogic extends GetxController with RequestToolMixin {
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import 'package:get/get.dart';
|
||||||
import 'package:wgshare/main.dart';
|
import 'package:wgshare/main.dart';
|
||||||
import 'package:wgshare/pages/userPage/user_logic.dart';
|
import 'package:wgshare/pages/userPage/user_logic.dart';
|
||||||
import '../../common/store/user_store.dart';
|
import '../../common/store/user_store.dart';
|
||||||
|
import '../../routes/app_routes.dart';
|
||||||
import '../../utils/color_util.dart';
|
import '../../utils/color_util.dart';
|
||||||
import '../../utils/hint_dialog.dart';
|
import '../../utils/hint_dialog.dart';
|
||||||
import '../../utils/storage.dart';
|
import '../../utils/storage.dart';
|
||||||
|
|
@ -180,7 +181,8 @@ class UserPageState extends State<UserPage> {
|
||||||
|
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: (){
|
onTap: (){
|
||||||
|
UserStore.to.erase();
|
||||||
|
Get.offAllNamed(Routes.loginPage);
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 280.w,
|
width: 280.w,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue