36 lines
1.3 KiB
Dart
36 lines
1.3 KiB
Dart
import 'dart:async';
|
|
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_state.dart';
|
|
import 'package:star_lock/tools/toast.dart';
|
|
import '../../../../network/api_repository.dart';
|
|
import '../../../../tools/baseGetXController.dart';
|
|
|
|
class MinePersonInfoLogic extends BaseGetXController {
|
|
final MinePersonInfoState state = MinePersonInfoState();
|
|
//用户信息
|
|
Future<void> getUserInfoRequest() async {
|
|
var entity = await ApiRepository.to.getUserInfo("");
|
|
if (entity.errorCode!.codeIsSuccessful) {
|
|
state.mineInfoData.value = entity.data!;
|
|
state.nickname.value = entity.data!.nickname!;
|
|
state.mobileStr.value = entity.data!.mobile!;
|
|
state.emailStr.value = entity.data!.email!;
|
|
state.countryStr.value = entity.data!.countryName!;
|
|
state.haveSafeAnswer.value = entity.data!.haveSafeAnswer!;
|
|
}
|
|
}
|
|
|
|
//上传头像 先获取upToken 再调用updateUserInfo
|
|
Future<void> getUpTokenRequest() async {
|
|
var entity = await ApiRepository.to.getUpToken(state.typeStr.value);
|
|
if (entity.errorCode!.codeIsSuccessful) {}
|
|
}
|
|
|
|
//更新个人信息-头像
|
|
Future<void> updateUserInfoRequest() async {
|
|
var entity = await ApiRepository.to.updateUserInfo(state.headUrl.value);
|
|
if (entity.errorCode!.codeIsSuccessful) {
|
|
Toast.show(msg: '操作成功');
|
|
}
|
|
}
|
|
}
|