feat: 整体常用控件封装,常用工具类。首页数据对接
This commit is contained in:
1 parent
d90d023e85
commit
fbcd33ea2b
50 files changed
+4558
-264
No files matched your search
@@ -0,0 +1,36 @@
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:skywood/global/client/user_client.dart';
|
||||
import 'package:skywood/main/main_root.dart';
|
||||
import 'package:skywood/utils/tools/help_nav.dart';
|
||||
import 'package:skywood/utils/tools/token_manage.dart';
|
||||
|
||||
class UserController extends GetxController {
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
|
||||
// _userRegister();
|
||||
}
|
||||
|
||||
void _userRegister() async {
|
||||
// 先拿token没有的话去注册
|
||||
final tm = TokenManager();
|
||||
String token = tm.get();
|
||||
print('tokkkkkk: $token');
|
||||
if (token.isNotEmpty) {
|
||||
// 成功后去到主页面
|
||||
print('object去主页面');
|
||||
Future.delayed(const Duration(seconds: 1), () {
|
||||
HelpNav.off(MainRoot());
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
final res = await UserClient.register();
|
||||
if (res != null) {
|
||||
tm.save(res.token);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user