个人中心相关功能
This commit is contained in:
parent
c21b24f327
commit
a0e4428f15
@ -1,7 +1,18 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import 'state.dart';
|
||||
|
||||
class AccountLogic extends GetxController {
|
||||
String photo = "";
|
||||
final AccountState state = AccountState();
|
||||
@override
|
||||
void onInit() async{
|
||||
|
||||
super.onInit();
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
photo = prefs.getString("photo")??"";
|
||||
print(photo.toString());
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,287 +12,291 @@ class AccountPage extends StatelessWidget {
|
||||
AccountPage({Key? key}) : super(key: key);
|
||||
|
||||
final logic = Get.find<AccountLogic>();
|
||||
final state = Get.find<AccountLogic>().state;
|
||||
final state = Get
|
||||
.find<AccountLogic>()
|
||||
.state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage(getBaseImage("home_back")),
|
||||
fit: BoxFit.cover,
|
||||
return GetBuilder<AccountLogic>(builder: (logic) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage(getBaseImage("home_back")),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
appBar: MyAppBar(
|
||||
centerTitle: '账号中心',
|
||||
),
|
||||
body: Scaffold(
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
body: SafeArea(
|
||||
child: ListView(
|
||||
padding: EdgeInsets.all(16.0.sp),
|
||||
children: [
|
||||
// Container(
|
||||
// margin: EdgeInsets.only(top: 16.0),
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Text(
|
||||
// "消息提醒",
|
||||
// style: TextStyle(
|
||||
// color: Color(0xFFF7FAFA),
|
||||
// fontSize: 16.0,
|
||||
// ),
|
||||
// ),
|
||||
// Spacer(),
|
||||
// Image.asset(
|
||||
// getHomeImage("icon_in"),
|
||||
// width: 24.0,
|
||||
// height: 24.0,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Get.toNamed(AppRoutes.PhotoActivity);
|
||||
appBar: MyAppBar(
|
||||
centerTitle: '账号中心',
|
||||
),
|
||||
body: Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
body: SafeArea(
|
||||
child: ListView(
|
||||
padding: EdgeInsets.all(16.0.sp),
|
||||
children: [
|
||||
// Container(
|
||||
// margin: EdgeInsets.only(top: 16.0),
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Text(
|
||||
// "消息提醒",
|
||||
// style: TextStyle(
|
||||
// color: Color(0xFFF7FAFA),
|
||||
// fontSize: 16.0,
|
||||
// ),
|
||||
// ),
|
||||
// Spacer(),
|
||||
// Image.asset(
|
||||
// getHomeImage("icon_in"),
|
||||
// width: 24.0,
|
||||
// height: 24.0,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () {
|
||||
Get.toNamed(AppRoutes.PhotoActivity);
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(top: 16.0.sp),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
"换绑手机号",
|
||||
style: TextStyle(
|
||||
color: Color(0xFFF7FAFA),
|
||||
fontSize: 16.0.sp,
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
Text(
|
||||
logic.photo,
|
||||
style: TextStyle(
|
||||
color: Color(0xFFB7BECC),
|
||||
fontSize: 16.0.sp,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 8.0.sp),
|
||||
Image.asset(
|
||||
getHomeImage("icon_in"),
|
||||
width: 24.0.sp,
|
||||
height: 24.0.sp,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
// Container(
|
||||
// margin: EdgeInsets.only(top: 16.0),
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Text(
|
||||
// "修改密码",
|
||||
// style: TextStyle(
|
||||
// color: Color(0xFFF7FAFA),
|
||||
// fontSize: 16.0,
|
||||
// ),
|
||||
// ),
|
||||
// Spacer(),
|
||||
// Image.asset(
|
||||
// getHomeImage("icon_in"),
|
||||
// width: 24.0,
|
||||
// height: 24.0,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () {
|
||||
Get.toNamed(AppRoutes.OffAccountActivity);
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(top: 16.0.sp),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
"注销账号",
|
||||
style: TextStyle(
|
||||
color: Color(0xFFF7FAFA),
|
||||
fontSize: 16.0.sp,
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
Image.asset(
|
||||
getHomeImage("icon_in"),
|
||||
width: 24.0.sp,
|
||||
height: 24.0.sp,
|
||||
),
|
||||
],
|
||||
),
|
||||
),)
|
||||
,
|
||||
// Container(
|
||||
// margin: EdgeInsets.only(top: 0.0.sp, left: 0.sp),
|
||||
// child: Text(
|
||||
// "账号绑定",
|
||||
// style: TextStyle(
|
||||
// color: Color(0xFFF7FAFA),
|
||||
// fontSize: 16.0.sp,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// Container(
|
||||
// margin: EdgeInsets.only(top: 16.0.sp),
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Text(
|
||||
// "已绑定手机号",
|
||||
// style: TextStyle(
|
||||
// color: Color(0xFFB7BECC),
|
||||
// fontSize: 16.0.sp,
|
||||
// ),
|
||||
// ),
|
||||
// Spacer(),
|
||||
// Container(
|
||||
// alignment: Alignment.center,
|
||||
// width: 60.sp,
|
||||
// height: 28.sp,
|
||||
// decoration: BoxDecoration(
|
||||
// borderRadius: BorderRadius.circular(14.0.sp),
|
||||
// border: Border.all(
|
||||
// width: 0.4.sp,
|
||||
// color: Colors.white,
|
||||
// ),
|
||||
// ),
|
||||
// child: GestureDetector(
|
||||
// onTap: (){
|
||||
// Get.toNamed(AppRoutes.PhotoActivity);
|
||||
// },
|
||||
// child:Text(
|
||||
// "换绑",
|
||||
// style: TextStyle(
|
||||
// color: Color(0xFFB7BECC),
|
||||
// fontSize: 14.0.sp,
|
||||
// ),
|
||||
// )) ,)
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// Container(
|
||||
// margin: EdgeInsets.only(top: 16.0.sp),
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Text(
|
||||
// "微信",
|
||||
// style: TextStyle(
|
||||
// color: Color(0xFFB7BECC),
|
||||
// fontSize: 16.0.sp,
|
||||
// ),
|
||||
// ),
|
||||
// Spacer(),
|
||||
// Container(
|
||||
// alignment: Alignment.center,
|
||||
// width: 60.sp,
|
||||
// height: 28.sp,
|
||||
// decoration: BoxDecoration(
|
||||
// borderRadius: BorderRadius.circular(14.0.sp),
|
||||
// border: Border.all(
|
||||
// width: 0.4.sp,
|
||||
// color: Colors.white,
|
||||
// ),
|
||||
// ),
|
||||
// child: Text(
|
||||
// "去绑定",
|
||||
// style: TextStyle(
|
||||
// color: Color(0xFFB7BECC),
|
||||
// fontSize: 14.0.sp,
|
||||
// ),
|
||||
// )),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// Container(
|
||||
// margin: EdgeInsets.only(top: 16.0.sp),
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Text(
|
||||
// "邮箱",
|
||||
// style: TextStyle(
|
||||
// color: Color(0xFFB7BECC),
|
||||
// fontSize: 16.0.sp,
|
||||
// ),
|
||||
// ),
|
||||
// Spacer(),
|
||||
// GestureDetector(
|
||||
// onTap: (){
|
||||
// Get.toNamed(AppRoutes.BindMailActivity);
|
||||
// },
|
||||
// child: Container(
|
||||
// alignment: Alignment.center,
|
||||
// width: 60.sp,
|
||||
// height: 28.sp,
|
||||
// decoration: BoxDecoration(
|
||||
// borderRadius: BorderRadius.circular(14.0.sp),
|
||||
// border: Border.all(
|
||||
// width: 0.4.sp,
|
||||
// color: Colors.white,
|
||||
// ),
|
||||
// ),
|
||||
// child: Text(
|
||||
// "去绑定",
|
||||
// style: TextStyle(
|
||||
// color: Color(0xFFB7BECC),
|
||||
// fontSize: 14.0.sp,
|
||||
// ),
|
||||
// )),)
|
||||
//
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// Container(
|
||||
// margin: EdgeInsets.only(top: 16.0.sp),
|
||||
// child: Text(
|
||||
// "温馨提示:完成账号绑定后,手机丢失或忘记密码也可以通过其他方式登录",
|
||||
// style: TextStyle(
|
||||
// color: Color(0xFFB7BECC),
|
||||
// fontSize: 12.0.sp,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
GestureDetector(onTap: () {
|
||||
getAuthorization();
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(top: 16.0.sp),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
"换绑手机号",
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(
|
||||
top: 40.0.sp, left: 72.0.sp, right: 72.0.sp),
|
||||
height: 42.sp,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(21.0.sp),
|
||||
color: Color(0xFF21BEAB),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
"退出登录",
|
||||
style: TextStyle(
|
||||
color: Color(0xFFF7FAFA),
|
||||
fontSize: 16.0.sp,
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
Text(
|
||||
"16677778888",
|
||||
style: TextStyle(
|
||||
color: Color(0xFFB7BECC),
|
||||
fontSize: 16.0.sp,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 8.0.sp),
|
||||
Image.asset(
|
||||
getHomeImage("icon_in"),
|
||||
width: 24.0.sp,
|
||||
height: 24.0.sp,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
// Container(
|
||||
// margin: EdgeInsets.only(top: 16.0),
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Text(
|
||||
// "修改密码",
|
||||
// style: TextStyle(
|
||||
// color: Color(0xFFF7FAFA),
|
||||
// fontSize: 16.0,
|
||||
// ),
|
||||
// ),
|
||||
// Spacer(),
|
||||
// Image.asset(
|
||||
// getHomeImage("icon_in"),
|
||||
// width: 24.0,
|
||||
// height: 24.0,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: (){
|
||||
Get.toNamed(AppRoutes.OffAccountActivity);
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(top: 16.0.sp),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
"注销账号",
|
||||
style: TextStyle(
|
||||
color: Color(0xFFF7FAFA),
|
||||
fontSize: 16.0.sp,
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
Image.asset(
|
||||
getHomeImage("icon_in"),
|
||||
width: 24.0.sp,
|
||||
height: 24.0.sp,
|
||||
),
|
||||
],
|
||||
),
|
||||
) ,)
|
||||
,
|
||||
// Container(
|
||||
// margin: EdgeInsets.only(top: 0.0.sp, left: 0.sp),
|
||||
// child: Text(
|
||||
// "账号绑定",
|
||||
// style: TextStyle(
|
||||
// color: Color(0xFFF7FAFA),
|
||||
// fontSize: 16.0.sp,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// Container(
|
||||
// margin: EdgeInsets.only(top: 16.0.sp),
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Text(
|
||||
// "已绑定手机号",
|
||||
// style: TextStyle(
|
||||
// color: Color(0xFFB7BECC),
|
||||
// fontSize: 16.0.sp,
|
||||
// ),
|
||||
// ),
|
||||
// Spacer(),
|
||||
// Container(
|
||||
// alignment: Alignment.center,
|
||||
// width: 60.sp,
|
||||
// height: 28.sp,
|
||||
// decoration: BoxDecoration(
|
||||
// borderRadius: BorderRadius.circular(14.0.sp),
|
||||
// border: Border.all(
|
||||
// width: 0.4.sp,
|
||||
// color: Colors.white,
|
||||
// ),
|
||||
// ),
|
||||
// child: GestureDetector(
|
||||
// onTap: (){
|
||||
// Get.toNamed(AppRoutes.PhotoActivity);
|
||||
// },
|
||||
// child:Text(
|
||||
// "换绑",
|
||||
// style: TextStyle(
|
||||
// color: Color(0xFFB7BECC),
|
||||
// fontSize: 14.0.sp,
|
||||
// ),
|
||||
// )) ,)
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// Container(
|
||||
// margin: EdgeInsets.only(top: 16.0.sp),
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Text(
|
||||
// "微信",
|
||||
// style: TextStyle(
|
||||
// color: Color(0xFFB7BECC),
|
||||
// fontSize: 16.0.sp,
|
||||
// ),
|
||||
// ),
|
||||
// Spacer(),
|
||||
// Container(
|
||||
// alignment: Alignment.center,
|
||||
// width: 60.sp,
|
||||
// height: 28.sp,
|
||||
// decoration: BoxDecoration(
|
||||
// borderRadius: BorderRadius.circular(14.0.sp),
|
||||
// border: Border.all(
|
||||
// width: 0.4.sp,
|
||||
// color: Colors.white,
|
||||
// ),
|
||||
// ),
|
||||
// child: Text(
|
||||
// "去绑定",
|
||||
// style: TextStyle(
|
||||
// color: Color(0xFFB7BECC),
|
||||
// fontSize: 14.0.sp,
|
||||
// ),
|
||||
// )),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// Container(
|
||||
// margin: EdgeInsets.only(top: 16.0.sp),
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Text(
|
||||
// "邮箱",
|
||||
// style: TextStyle(
|
||||
// color: Color(0xFFB7BECC),
|
||||
// fontSize: 16.0.sp,
|
||||
// ),
|
||||
// ),
|
||||
// Spacer(),
|
||||
// GestureDetector(
|
||||
// onTap: (){
|
||||
// Get.toNamed(AppRoutes.BindMailActivity);
|
||||
// },
|
||||
// child: Container(
|
||||
// alignment: Alignment.center,
|
||||
// width: 60.sp,
|
||||
// height: 28.sp,
|
||||
// decoration: BoxDecoration(
|
||||
// borderRadius: BorderRadius.circular(14.0.sp),
|
||||
// border: Border.all(
|
||||
// width: 0.4.sp,
|
||||
// color: Colors.white,
|
||||
// ),
|
||||
// ),
|
||||
// child: Text(
|
||||
// "去绑定",
|
||||
// style: TextStyle(
|
||||
// color: Color(0xFFB7BECC),
|
||||
// fontSize: 14.0.sp,
|
||||
// ),
|
||||
// )),)
|
||||
//
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// Container(
|
||||
// margin: EdgeInsets.only(top: 16.0.sp),
|
||||
// child: Text(
|
||||
// "温馨提示:完成账号绑定后,手机丢失或忘记密码也可以通过其他方式登录",
|
||||
// style: TextStyle(
|
||||
// color: Color(0xFFB7BECC),
|
||||
// fontSize: 12.0.sp,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
GestureDetector(onTap: (){
|
||||
getAuthorization();
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(
|
||||
top: 40.0.sp, left: 72.0.sp, right: 72.0.sp),
|
||||
height: 42.sp,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(21.0.sp),
|
||||
color: Color(0xFF21BEAB),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
"退出登录",
|
||||
style: TextStyle(
|
||||
color: Color(0xFFF7FAFA),
|
||||
fontSize: 16.0.sp,
|
||||
),
|
||||
),
|
||||
),
|
||||
),)
|
||||
,
|
||||
],
|
||||
),)
|
||||
,
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
);
|
||||
});
|
||||
}
|
||||
Future<void> getAuthorization() async{
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
prefs.remove("Authorization");
|
||||
Get.offAllNamed(AppRoutes.Login);
|
||||
|
||||
Future<void> getAuthorization() async {
|
||||
pushLoginPage();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,16 +1,125 @@
|
||||
import 'package:circle_app/router/app_routers.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
||||
|
||||
import '../../network/api.dart';
|
||||
import '../../network/dio_manager.dart';
|
||||
import '../../util/device.dart';
|
||||
import '../../util/util.dart';
|
||||
import '../login/login/logic.dart';
|
||||
import 'state.dart';
|
||||
|
||||
class BlacklistLogic extends GetxController {
|
||||
final BlacklistState state = BlacklistState();
|
||||
final RefreshController refreshController = RefreshController();
|
||||
int page = 1;
|
||||
List<User> lists = [];
|
||||
@override
|
||||
void onInit() async{
|
||||
super.onInit();
|
||||
initList();
|
||||
}
|
||||
|
||||
initList() async{
|
||||
if(page==1){
|
||||
lists.clear();
|
||||
}
|
||||
var data =
|
||||
await DioManager.instance.get(url: Api.blackList, params: {
|
||||
'page': page,
|
||||
'page_size':20
|
||||
});
|
||||
var bean = BaseResponse<UserList>.fromJson(
|
||||
data, (data) => UserList.fromJson(data));
|
||||
if (bean.isSuccess()) {
|
||||
lists.addAll(bean.data.lists);
|
||||
}
|
||||
update();
|
||||
if (page == 1) {
|
||||
refreshController.refreshCompleted();
|
||||
} else {
|
||||
refreshController.loadComplete();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
setBlock(String userId) async {
|
||||
var data = await DioManager.instance
|
||||
.post(url: "${Api.setBlock + userId}/block", params: {
|
||||
'status': "0"
|
||||
});
|
||||
var bean = BaseResponse<dynamic>.fromJson(data, (jsonData) => jsonData,);
|
||||
if(bean.isSuccess()){
|
||||
page = 1;
|
||||
initList();
|
||||
update();
|
||||
}
|
||||
showToast(bean.msg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
class User {
|
||||
final int id;
|
||||
final String nickname;
|
||||
final String avatar;
|
||||
final String signature;
|
||||
final String birthday;
|
||||
final int age;
|
||||
final int vip;
|
||||
final int gender;
|
||||
final int role;
|
||||
final int orientation;
|
||||
final double lng;
|
||||
final double lat;
|
||||
final String city;
|
||||
final String avatarThumb;
|
||||
|
||||
User({
|
||||
required this.id,
|
||||
required this.nickname,
|
||||
required this.avatar,
|
||||
required this.signature,
|
||||
required this.birthday,
|
||||
required this.age,
|
||||
required this.vip,
|
||||
required this.gender,
|
||||
required this.role,
|
||||
required this.orientation,
|
||||
required this.lng,
|
||||
required this.lat,
|
||||
required this.city,
|
||||
required this.avatarThumb,
|
||||
});
|
||||
|
||||
factory User.fromJson(Map<String, dynamic> json) {
|
||||
return User(
|
||||
id: json['id'],
|
||||
nickname: json['nickname'],
|
||||
avatar: json['avatar'],
|
||||
signature: json['signature'],
|
||||
birthday: json['birthday'],
|
||||
age: json['age'],
|
||||
vip: json['vip'],
|
||||
gender: json['gender'],
|
||||
role: json['role'],
|
||||
orientation: json['orientation'],
|
||||
lng: json['lng'],
|
||||
lat: json['lat'],
|
||||
city: json['city'],
|
||||
avatarThumb: json['avatar_thumb'],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class UserList {
|
||||
final List<User> lists;
|
||||
|
||||
UserList({required this.lists});
|
||||
|
||||
factory UserList.fromJson(Map<String, dynamic> json) {
|
||||
var list = json['lists'] as List<dynamic>;
|
||||
List<User> userList = list.map((item) => User.fromJson(item)).toList();
|
||||
return UserList(lists: userList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,8 +1,12 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../components/my_app_bar.dart';
|
||||
import '../../router/app_routers.dart';
|
||||
import '../../util/util.dart';
|
||||
import 'logic.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@ -12,60 +16,179 @@ class BlacklistPage extends StatelessWidget {
|
||||
BlacklistPage({Key? key}) : super(key: key);
|
||||
|
||||
final logic = Get.find<BlacklistLogic>();
|
||||
final state = Get.find<BlacklistLogic>().state;
|
||||
final state = Get
|
||||
.find<BlacklistLogic>()
|
||||
.state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage(getBaseImage("home_back")),
|
||||
fit: BoxFit.cover,
|
||||
return GetBuilder<BlacklistLogic>(builder: (logic) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage(getBaseImage("home_back")),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
appBar: MyAppBar(centerTitle: '黑名单',),
|
||||
body: SafeArea(
|
||||
child: SmartRefresher(
|
||||
controller: _refreshController,
|
||||
child: ListView.builder(
|
||||
padding: EdgeInsets.all(16.sp),
|
||||
itemCount: itemCount,
|
||||
itemBuilder: (context, index) {
|
||||
return ListTile(
|
||||
title: Text('Item $index'),
|
||||
);
|
||||
},
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
appBar: MyAppBar(centerTitle: '黑名单',),
|
||||
body: SafeArea(
|
||||
child: SmartRefresher(
|
||||
controller: logic.refreshController,
|
||||
child: ListView.builder(
|
||||
|
||||
itemCount: logic.lists.length,
|
||||
itemBuilder: (context, index) {
|
||||
return ListTile(
|
||||
title: ListItem(logic.lists[index]),
|
||||
);
|
||||
},
|
||||
),
|
||||
onRefresh: _onRefresh,
|
||||
onLoading: _onLoading,
|
||||
),
|
||||
onRefresh: _onRefresh,
|
||||
onLoading: _onLoading,
|
||||
),),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Widget ListItem(User item) {
|
||||
return Container(
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
Get.toNamed(AppRoutes.UserInfoActivity, arguments: item.id.toString());
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(bottom: 16),
|
||||
child: Row(
|
||||
children: [
|
||||
Stack(children: [
|
||||
ClipOval(
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
var imgList = <String>[];
|
||||
imgList.add(item.avatar);
|
||||
Get.toNamed(AppRoutes.Swiper, arguments: {
|
||||
'imaglist': imgList,
|
||||
'index': 0
|
||||
});
|
||||
},
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: item.avatar,
|
||||
width: 53.sp,
|
||||
height: 53.sp,
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
right: 0,
|
||||
left: 0,
|
||||
bottom: 0,
|
||||
|
||||
child: item.vip > 0 ?
|
||||
Image(
|
||||
image: AssetImage(getBaseImage("vip")),
|
||||
width: 44.sp,
|
||||
height: 18.sp,
|
||||
) : Container(),)
|
||||
],),
|
||||
SizedBox(width: 10.sp),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
item.nickname,
|
||||
style: const TextStyle(color: Colors.white70,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
SizedBox(width: 4.sp),
|
||||
// SizedBox(height: 8.sp),
|
||||
_buildInfoRow(item),
|
||||
// Placeholder image
|
||||
],
|
||||
),
|
||||
|
||||
SizedBox(height: 8.sp),
|
||||
Container(
|
||||
width: 150.sp,
|
||||
child: Text(
|
||||
item.signature,
|
||||
style: TextStyle(fontSize: 12.sp, color: Color(0xFFB7BECC)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
// Pla
|
||||
Spacer(),
|
||||
GestureDetector(onTap: () {
|
||||
logic.setBlock(item.id.toString());
|
||||
},
|
||||
child: Container(
|
||||
width: 80,
|
||||
height: 28,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFFFF4D7C),
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
),
|
||||
child:
|
||||
Center(
|
||||
child: Text(
|
||||
"移出黑名单",
|
||||
style: TextStyle(fontSize: 14, color: Colors.white),
|
||||
),
|
||||
),
|
||||
),),
|
||||
],
|
||||
),
|
||||
),),
|
||||
);
|
||||
}
|
||||
Widget _buildInfoRow(User userInfoBean) {
|
||||
String ageMsg = getAgeCOntent(userInfoBean!.gender, userInfoBean!.age,
|
||||
userInfoBean!.role, userInfoBean!.orientation);
|
||||
return Row(
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(17),
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
Color.fromRGBO(141, 255, 248, 1.0),
|
||||
Color.fromRGBO(181, 211, 255, 1.0),
|
||||
],
|
||||
begin: Alignment.centerLeft,
|
||||
end: Alignment.centerRight,
|
||||
),
|
||||
),
|
||||
padding: EdgeInsets.only(
|
||||
top: 2.sp, bottom: 2.sp, left: 10.sp, right: 10.sp),
|
||||
child: Text(
|
||||
ageMsg ,
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 10,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 6.sp),
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
final RefreshController _refreshController = RefreshController();
|
||||
int itemCount = 20;
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
void _onRefresh() async {
|
||||
// Perform your refresh logic here
|
||||
// For example, make an API call to fetch new data
|
||||
await Future.delayed(Duration(seconds: 2));
|
||||
itemCount = 20;
|
||||
_refreshController.refreshCompleted();
|
||||
logic.page = 1;
|
||||
logic.initList();
|
||||
}
|
||||
|
||||
void _onLoading() async {
|
||||
// Perform your loading logic here
|
||||
// For example, make an API call to fetch more data
|
||||
await Future.delayed(Duration(seconds: 2));
|
||||
itemCount += 10;
|
||||
_refreshController.loadComplete();
|
||||
logic.page = logic.page + 1;
|
||||
logic.initList();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -36,7 +36,7 @@ class FriendslistPage extends StatelessWidget {
|
||||
onRefresh: _onRefresh,
|
||||
onLoading: _onLoading,
|
||||
child: ListView.builder(
|
||||
padding: EdgeInsets.all(16.sp),
|
||||
// padding: EdgeInsets.all(16.sp),
|
||||
itemCount: logic.lists.length,
|
||||
itemBuilder: (context, index) {
|
||||
return ListItem(logic.lists[index]);
|
||||
|
||||
@ -121,7 +121,10 @@ class Complete_materialLogic extends GetxController {
|
||||
if (state.textEditingController.text.isEmpty) {
|
||||
showToast('请输入您的昵称');
|
||||
return;
|
||||
} else if (state.sex.isEmpty) {
|
||||
} else if(state.textEditingController.text.length>6){
|
||||
showToast('昵称最多输入6个字');
|
||||
return;
|
||||
}else if (state.sex.isEmpty) {
|
||||
showToast('请选择您的属性');
|
||||
return;
|
||||
} else if (state.age.isEmpty) {
|
||||
@ -179,7 +182,10 @@ class Complete_materialLogic extends GetxController {
|
||||
if (state.textEditingController.text.isEmpty) {
|
||||
showToast('请输入您的昵称');
|
||||
return;
|
||||
} else if (state.sex.isEmpty) {
|
||||
} else if(state.textEditingController.text.length>6){
|
||||
showToast('昵称最多输入6个字');
|
||||
return;
|
||||
}else if (state.sex.isEmpty) {
|
||||
showToast('请选择您的属性');
|
||||
return;
|
||||
} else if (state.age.isEmpty) {
|
||||
|
||||
@ -42,6 +42,7 @@ class LoginLogic extends GetxController {
|
||||
Future<void> getCode() async {
|
||||
var data = await DioManager.instance.post(url: Api.sendCode, params: {"phone": phoneEditingController.text});
|
||||
var bean = BaseResponse<Data>.fromJson(data, (data) => Data.fromJson(data));
|
||||
showToast(bean.msg);
|
||||
if(kDebugMode){
|
||||
if(bean.code==200){
|
||||
codeEditingController.text = bean.data!.code.toString();
|
||||
@ -71,6 +72,7 @@ class LoginLogic extends GetxController {
|
||||
if (bean.code == 200) {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
prefs.setString('Authorization', bean.data!.Authorization.toString());
|
||||
|
||||
Get.offNamed(AppRoutes.Home);
|
||||
return;
|
||||
} else if (bean.code == 30002) {
|
||||
|
||||
@ -31,6 +31,7 @@ class MinefragmentLogic extends GetxController {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
int likeMeCount = prefs.getInt("likeMeCount") ?? 0;
|
||||
int recentVisitCount = prefs.getInt("recentVisitCount") ?? 0;
|
||||
prefs.setString("photo", bean.data.phone);
|
||||
|
||||
like_count = bean.data.likeCount??0;
|
||||
like_me_count = bean.data.likeMeCount??0;
|
||||
@ -40,7 +41,8 @@ class MinefragmentLogic extends GetxController {
|
||||
// like_me_count_new = recentVisitCount.toInt() - bean.data.likeMeCount.toInt();
|
||||
|
||||
like_me_count_new = likeMeCount - like_me_count;
|
||||
|
||||
print("***************");
|
||||
print(likeMeCount.toString()+"-"+like_me_count.toString()+"="+like_me_count_new.toString());
|
||||
|
||||
recent_visit_count_new = recentVisitCount-recent_visit_count;
|
||||
|
||||
@ -127,6 +129,7 @@ class ResponseBean {
|
||||
int recentVisitCount;
|
||||
String? vipExpireDate;
|
||||
int? vipExpireDays;
|
||||
String phone;
|
||||
|
||||
ResponseBean({
|
||||
required this.user,
|
||||
@ -135,12 +138,14 @@ class ResponseBean {
|
||||
required this.recentVisitCount,
|
||||
this.vipExpireDate,
|
||||
this.vipExpireDays,
|
||||
required this.phone
|
||||
});
|
||||
|
||||
factory ResponseBean.fromJson(Map<String, dynamic> json) {
|
||||
return ResponseBean(
|
||||
user: User.fromJson(json['user']),
|
||||
likeCount: json['like_count'],
|
||||
phone: json['phone'],
|
||||
likeMeCount: json['like_me_count'],
|
||||
recentVisitCount: json['recent_visit_count'],
|
||||
vipExpireDate: json['vip_expire_date'],
|
||||
|
||||
@ -417,6 +417,7 @@ class MinefragmentPage extends StatelessWidget {
|
||||
width: 65.sp,
|
||||
height: 65.sp,
|
||||
): CachedNetworkImage(
|
||||
fit: BoxFit.cover,
|
||||
imageUrl: logic.userInfoBean!=null ? logic.userInfoBean!.avatar: "",
|
||||
width: 65.sp,
|
||||
height: 65.sp,
|
||||
|
||||
@ -1,10 +1,36 @@
|
||||
import 'package:circle_app/util/util.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../network/api.dart';
|
||||
import '../../network/dio_manager.dart';
|
||||
import 'state.dart';
|
||||
|
||||
class OffaccountLogic extends GetxController {
|
||||
final OffaccountState state = OffaccountState();
|
||||
|
||||
|
||||
offaccount() async {
|
||||
if(state.photoController.text==''){
|
||||
showToast("请输入手机号");
|
||||
return;
|
||||
}
|
||||
if(state.photoController.text.length<11){
|
||||
showToast("请输入正确手机号");
|
||||
return;
|
||||
}
|
||||
if(state.offReasonMsg=="请选择"){
|
||||
showToast("请选择注销原因");
|
||||
return;
|
||||
}
|
||||
var data = await DioManager.instance.post(url: Api.offAccount, params: {
|
||||
"phone": state.photoController.text.toString(),
|
||||
"reason": state.offReasonMsg.toString()
|
||||
});
|
||||
var bean = BaseResponse<dynamic>.fromJson(data, (jsonData) => jsonData,);
|
||||
if(bean.isSuccess()){
|
||||
pushLoginPage();
|
||||
}else{
|
||||
showToast(bean.msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,7 +49,8 @@ class _OffaccountState extends State<OffaccountPage> {
|
||||
if(countdown > 0 ){
|
||||
|
||||
}else{
|
||||
showToast(logic.state.photoController.text.toString()+"");
|
||||
logic.offaccount();
|
||||
// showToast(logic.state.photoController.text.toString()+"");
|
||||
}
|
||||
|
||||
// 执行注销操作
|
||||
|
||||
@ -1,11 +1,92 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:circle_app/util/util.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../network/api.dart';
|
||||
import '../../network/dio_manager.dart';
|
||||
import '../account/logic.dart';
|
||||
import '../login/login/logic.dart';
|
||||
import 'state.dart';
|
||||
|
||||
class PhotoinfoLogic extends GetxController {
|
||||
final PhotoinfoState state = PhotoinfoState();
|
||||
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
timer.cancel();
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
int countdownSeconds = 60;
|
||||
bool isCountingDown = false;
|
||||
late Timer timer ;
|
||||
|
||||
|
||||
// @override
|
||||
// void dispose() {
|
||||
// timer?.cancel();
|
||||
// super.dispose();
|
||||
// }
|
||||
|
||||
|
||||
|
||||
bindingPhoto()async{
|
||||
var data = await DioManager.instance.put(url: Api.bindingPhoto, params: {
|
||||
"old_phone": state.photoController.text.toString(),
|
||||
"new_phone": state.newPhotoController.text.toString(),
|
||||
"code": state.codeController.text.toString(),
|
||||
});
|
||||
// var activity = Get.find<MinefragmentLogic>();
|
||||
// activity.isVip
|
||||
var bean = BaseResponse<dynamic>.fromJson(data, (jsonData) => jsonData,);
|
||||
showToast(bean.msg);
|
||||
if(bean.isSuccess()){
|
||||
final accountLogic = Get.find<AccountLogic>();
|
||||
accountLogic.photo = state.newPhotoController.text.toString();
|
||||
accountLogic.update();
|
||||
Get.back();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void startCountdown() {
|
||||
isCountingDown = true;
|
||||
countdownSeconds = 60;
|
||||
|
||||
timer = Timer.periodic(Duration(seconds: 1), (timer) {
|
||||
if (countdownSeconds > 0) {
|
||||
countdownSeconds--;
|
||||
update();
|
||||
print(countdownSeconds.toString());
|
||||
} else {
|
||||
isCountingDown = false;
|
||||
timer.cancel();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> getCode() async {
|
||||
if (state.newPhotoController.text == "" || state.newPhotoController.text .length < 11) {
|
||||
showToast("新手机号输入有误");
|
||||
return;
|
||||
}
|
||||
var data = await DioManager.instance.post(url: Api.sendCode, params: {"phone": state.newPhotoController.text});
|
||||
var bean = BaseResponse<Data>.fromJson(data, (data) => Data.fromJson(data));
|
||||
showToast(bean.msg);
|
||||
if(kDebugMode){
|
||||
if(bean.code==200){
|
||||
state.codeController.text = bean.data!.code.toString();
|
||||
startCountdown();
|
||||
update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,4 +1,10 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
class PhotoinfoState {
|
||||
TextEditingController photoController = TextEditingController();
|
||||
// TextEditingController passwordController = TextEditingController();
|
||||
TextEditingController newPhotoController = TextEditingController();
|
||||
TextEditingController codeController = TextEditingController();
|
||||
PhotoinfoState() {
|
||||
///Initialize variables
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import 'dart:async';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@ -9,51 +10,23 @@ import '../../components/my_app_bar.dart';
|
||||
import '../../util/util.dart';
|
||||
import 'logic.dart';
|
||||
|
||||
class PhotoinfoPage extends StatefulWidget {
|
||||
class PhotoinfoPage extends StatelessWidget {
|
||||
PhotoinfoPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_PhotoinfoPage createState() => _PhotoinfoPage();
|
||||
}
|
||||
|
||||
class _PhotoinfoPage extends State<PhotoinfoPage> {
|
||||
final logic = Get.lazyPut(() => PhotoinfoLogic());
|
||||
// @override
|
||||
// void dispose() {
|
||||
// _timer?.cancel();
|
||||
// super.dispose();
|
||||
// }
|
||||
|
||||
int _countdownSeconds = 60;
|
||||
bool _isCountingDown = false;
|
||||
Timer? _timer;
|
||||
TextEditingController _photoController = TextEditingController();
|
||||
TextEditingController _passwordController = TextEditingController();
|
||||
TextEditingController _newPhotoController = TextEditingController();
|
||||
TextEditingController _codeController = TextEditingController();
|
||||
@override
|
||||
void dispose() {
|
||||
_timer?.cancel();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void startCountdown() {
|
||||
setState(() {
|
||||
_isCountingDown = true;
|
||||
_countdownSeconds = 60;
|
||||
});
|
||||
|
||||
_timer = Timer.periodic(Duration(seconds: 1), (timer) {
|
||||
setState(() {
|
||||
if (_countdownSeconds > 0) {
|
||||
_countdownSeconds--;
|
||||
} else {
|
||||
_isCountingDown = false;
|
||||
_timer?.cancel();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<PhotoinfoLogic>(builder: (logic) {
|
||||
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
@ -88,8 +61,8 @@ class _PhotoinfoPage extends State<PhotoinfoPage> {
|
||||
children: [
|
||||
Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
padding: EdgeInsets.only(
|
||||
left: 16.0.sp, right: 10.sp),
|
||||
padding:
|
||||
EdgeInsets.only(left: 16.0.sp, right: 10.sp,top: 4.sp),
|
||||
child: Text(
|
||||
"+86",
|
||||
style: TextStyle(
|
||||
@ -102,11 +75,12 @@ class _PhotoinfoPage extends State<PhotoinfoPage> {
|
||||
height: 32.sp,
|
||||
alignment: Alignment.center,
|
||||
child: TextField(
|
||||
controller: _photoController,
|
||||
controller: logic.state.photoController,
|
||||
textAlignVertical: TextAlignVertical.center,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.digitsOnly,
|
||||
FilteringTextInputFormatter.deny(RegExp('[^0-9]')),
|
||||
FilteringTextInputFormatter.deny(
|
||||
RegExp('[^0-9]')),
|
||||
],
|
||||
keyboardType: TextInputType.phone,
|
||||
decoration: InputDecoration(
|
||||
@ -176,7 +150,7 @@ class _PhotoinfoPage extends State<PhotoinfoPage> {
|
||||
// ),
|
||||
Container(
|
||||
margin:
|
||||
EdgeInsets.fromLTRB(16.0.sp, 20.0.sp, 16.0.sp, 0.0.sp),
|
||||
EdgeInsets.fromLTRB(16.0.sp, 20.0.sp, 16.0.sp, 0.0.sp),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(4.0.sp),
|
||||
color: Color(0xff282733),
|
||||
@ -185,8 +159,8 @@ class _PhotoinfoPage extends State<PhotoinfoPage> {
|
||||
child: Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: 16.0.sp, right: 10.sp),
|
||||
padding:
|
||||
EdgeInsets.only(left: 16.0.sp, right: 10.sp,top: 4.sp),
|
||||
child: Center(
|
||||
child: Text(
|
||||
"+86",
|
||||
@ -201,12 +175,13 @@ class _PhotoinfoPage extends State<PhotoinfoPage> {
|
||||
height: 32.sp,
|
||||
alignment: Alignment.center,
|
||||
child: TextField(
|
||||
controller: _newPhotoController,
|
||||
controller: logic.state.newPhotoController,
|
||||
textAlignVertical: TextAlignVertical.center,
|
||||
keyboardType: TextInputType.phone,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.digitsOnly,
|
||||
FilteringTextInputFormatter.deny(RegExp('[^0-9]')),
|
||||
FilteringTextInputFormatter.deny(
|
||||
RegExp('[^0-9]')),
|
||||
],
|
||||
decoration: InputDecoration(
|
||||
hintText: "请输入新手机号",
|
||||
@ -256,7 +231,7 @@ class _PhotoinfoPage extends State<PhotoinfoPage> {
|
||||
height: 32.sp,
|
||||
alignment: Alignment.center,
|
||||
child: TextField(
|
||||
controller: _codeController,
|
||||
controller: logic.state.codeController,
|
||||
textAlignVertical: TextAlignVertical.center,
|
||||
decoration: InputDecoration(
|
||||
hintText: "请输入验证码",
|
||||
@ -282,9 +257,9 @@ class _PhotoinfoPage extends State<PhotoinfoPage> {
|
||||
flex: 2,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
if (!_isCountingDown) {
|
||||
// Only start countdown if not already counting down
|
||||
startCountdown();
|
||||
if (!logic.isCountingDown) {
|
||||
logic.getCode();
|
||||
//logic.startCountdown();
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
@ -297,11 +272,11 @@ class _PhotoinfoPage extends State<PhotoinfoPage> {
|
||||
height: 40.0.sp,
|
||||
child: Center(
|
||||
child: Text(
|
||||
_isCountingDown
|
||||
? '$_countdownSeconds 秒'
|
||||
logic.isCountingDown
|
||||
? logic.countdownSeconds.toString()+"s"
|
||||
: '获取验证码',
|
||||
style: TextStyle(
|
||||
color: _isCountingDown
|
||||
color: logic.isCountingDown
|
||||
? Colors.grey.shade400
|
||||
: Colors.white,
|
||||
fontSize: 14.0.sp,
|
||||
@ -315,7 +290,7 @@ class _PhotoinfoPage extends State<PhotoinfoPage> {
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsets.fromLTRB(20.0.sp, 20.0.sp, 20.0.sp, 0.0.sp),
|
||||
EdgeInsets.fromLTRB(20.0.sp, 20.0.sp, 20.0.sp, 0.0.sp),
|
||||
child: Text(
|
||||
"温馨提示:换绑成功后,将退出软件使用新手机号重新登录,旧手机号无法登录此账号,但可以重新注册。",
|
||||
style: TextStyle(
|
||||
@ -326,36 +301,43 @@ class _PhotoinfoPage extends State<PhotoinfoPage> {
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
String photo = _photoController.text;
|
||||
String password = _passwordController.text;
|
||||
String newphoto = _newPhotoController.text;
|
||||
String code = _codeController.text;
|
||||
if(photo==""||photo.length<11){
|
||||
String photo = logic.state.photoController.text;
|
||||
// String password = logic.state.passwordController.text;
|
||||
String newphoto = logic.state.newPhotoController.text;
|
||||
String code = logic.state.codeController.text;
|
||||
if (photo == "" || photo.length < 11) {
|
||||
showToast("已绑定的手机号输入有误");
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
if(password==""){
|
||||
showToast("请输入密码");
|
||||
return ;
|
||||
}
|
||||
if(newphoto==""||newphoto.length<11){
|
||||
// if(password==""){
|
||||
// showToast("请输入密码");
|
||||
// return ;
|
||||
// }
|
||||
if (newphoto == "" || newphoto.length < 11) {
|
||||
showToast("新手机号输入有误");
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
if(code==""){
|
||||
if (code == "") {
|
||||
showToast("请输入验证码");
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
logic.bindingPhoto();
|
||||
// Perform action on button press
|
||||
},
|
||||
child: Container(
|
||||
margin:
|
||||
EdgeInsets.fromLTRB(72.0.sp, 40.0.sp, 72.0.sp, 0.0.sp),
|
||||
margin: EdgeInsets.fromLTRB(
|
||||
72.0.sp, 40.0.sp, 72.0.sp, 0.0.sp),
|
||||
height: 42.0.sp,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(21.0.sp),
|
||||
color: Colors.blue,
|
||||
borderRadius: BorderRadius.circular(17),
|
||||
gradient: const LinearGradient(
|
||||
colors: [
|
||||
Color(0xFF06F9FA),
|
||||
Color(0xFFDC5BFD),
|
||||
],
|
||||
begin: Alignment.centerLeft,
|
||||
end: Alignment.centerRight,
|
||||
),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
@ -376,6 +358,4 @@ class _PhotoinfoPage extends State<PhotoinfoPage> {
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@ class SplashLogic extends GetxController {
|
||||
void onInit() async{
|
||||
super.onInit();
|
||||
if((await getAuthorization()).isEmpty){
|
||||
Get.toNamed(AppRoutes.Login);
|
||||
pushLoginPage();
|
||||
}else{
|
||||
var data =
|
||||
await DioManager.instance.put(url: Api.refreshToken,params:{});
|
||||
|
||||
@ -4,6 +4,7 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import '../../common/config.dart';
|
||||
import '../../network/api.dart';
|
||||
@ -34,6 +35,12 @@ class UserinfoLogic extends GetxController {
|
||||
@override
|
||||
void onInit() async {
|
||||
super.onInit();
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
|
||||
if(prefs.getInt('userId')!=0&&prefs.getInt('userId').toString()==userId){
|
||||
userId = '';
|
||||
}
|
||||
|
||||
if (userId == '') {
|
||||
isMe = true;
|
||||
var data = await DioManager.instance.get(url: Api.getUserInfo);
|
||||
@ -144,7 +151,7 @@ class UserinfoLogic extends GetxController {
|
||||
|
||||
setLike() async {
|
||||
var data = await DioManager.instance
|
||||
.post(url: "${Api.setBlock + userId}/follow", params: {
|
||||
.post(url: "${Api.setLike + userId}/follow", params: {
|
||||
'status': isLike?"0":"1"
|
||||
});
|
||||
var bean = BaseResponse<dynamic>.fromJson(data, (jsonData) => jsonData,);
|
||||
@ -158,7 +165,9 @@ class UserinfoLogic extends GetxController {
|
||||
|
||||
setBlock() async {
|
||||
var data = await DioManager.instance
|
||||
.post(url: "${Api.setBlock + userId}/block", params: {});
|
||||
.post(url: "${Api.setBlock + userId}/block", params: {
|
||||
'status': "1"
|
||||
});
|
||||
var bean = BaseResponse<dynamic>.fromJson(data, (jsonData) => jsonData,);
|
||||
if(bean.isSuccess()){
|
||||
Navigator.pop(Get.context!);
|
||||
|
||||
@ -431,10 +431,10 @@ class _MyTabbedScreenState extends State<UserinfoPage>
|
||||
right: 0,
|
||||
bottom: 26.sp,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
onTap: () async{
|
||||
// showToast("完善资料");
|
||||
Get.toNamed(AppRoutes.Complete_materialPage,
|
||||
arguments: "user");
|
||||
var data = await Get.toNamed(AppRoutes.Complete_materialPage, arguments: "user");
|
||||
logic.onInit();
|
||||
// controller.onInit();
|
||||
},
|
||||
child: Center(
|
||||
@ -571,6 +571,7 @@ class _MyTabbedScreenState extends State<UserinfoPage>
|
||||
arguments: {'imaglist': imgList, 'index': 0});
|
||||
},
|
||||
child: CachedNetworkImage(
|
||||
fit: BoxFit.cover,
|
||||
imageUrl: controller.userInfoBean != null
|
||||
? controller.userInfoBean!.avatar
|
||||
: "",
|
||||
|
||||
@ -115,6 +115,26 @@ class Api {
|
||||
|
||||
|
||||
|
||||
//注销账号
|
||||
static const offAccount = 'user-service/user/destroy';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//黑名单列表
|
||||
static const blackList = 'user-service/blacklist/users';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//绑定新手机号
|
||||
static const bindingPhoto = 'user-service/user/phone';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -159,12 +159,12 @@ class DioManager {
|
||||
Options options = Options(
|
||||
method: methodValues[method], headers: {
|
||||
"Authorization": await getAuthorization(),
|
||||
'versionName': await getVersionName(),
|
||||
'versionCode': await getVersionCode(),
|
||||
'osVersion': await getDeviceId(),
|
||||
'platform': Platform.isIOS ? '1' : '0',
|
||||
'imei': await getImei(),
|
||||
'brand': await getBrand(),
|
||||
'VersionName': await getVersionName(),
|
||||
'VersionCode': await getVersionCode(),
|
||||
'OsVersion': await getDeviceId(),
|
||||
'Platform': Platform.isIOS ? '1' : '0',
|
||||
'Imei': await getImei(),
|
||||
'Brand': await getBrand(),
|
||||
});
|
||||
print(">>>>>"+params.toString());
|
||||
|
||||
@ -265,12 +265,34 @@ class BaseResponse<T> {
|
||||
|
||||
factory BaseResponse.fromJson(Map<String, dynamic> json,
|
||||
T Function(dynamic) fromJsonData) {
|
||||
dynamic dataJson = json['data'];
|
||||
T? data;
|
||||
|
||||
if (dataJson != null) {
|
||||
if (dataJson is String) {
|
||||
// 处理 dataJson 是 String 类型的情况
|
||||
// 例如,可以直接将其赋值给 data 变量
|
||||
data = null; // 根据你的需求修改赋值语句
|
||||
} else if (dataJson is Map<String, dynamic>) {
|
||||
// 处理 dataJson 是 Map<String, dynamic> 类型的情况
|
||||
if (fromJsonData != null) {
|
||||
data = fromJsonData(dataJson);
|
||||
} else {
|
||||
throw Exception('未提供 fromJsonData 函数来解析数据。');
|
||||
}
|
||||
} else {
|
||||
throw Exception('无效的数据格式。期望是 String 或 Map<String, dynamic> 类型。');
|
||||
}
|
||||
}
|
||||
|
||||
return BaseResponse(
|
||||
code: json['code'],
|
||||
msg: json['msg'],
|
||||
data: json['data'] != null ? fromJsonData?.call(json['data']) : '',
|
||||
data: data,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
class QnTokenData {
|
||||
|
||||
@ -10,6 +10,8 @@ import 'package:qiniu_flutter_sdk/qiniu_flutter_sdk.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import '../common/config.dart';
|
||||
import '../network/api.dart';
|
||||
import '../network/dio_manager.dart';
|
||||
|
||||
typedef void MyCallback(String result);
|
||||
|
||||
@ -44,9 +46,18 @@ void updataQiniu(String filePath,String name,String path ,String quToken,MyCallb
|
||||
void upDataImage(String quToken ,XFile pickedFile,String updataRoute,MyCallback myCallback) async{
|
||||
// print(quToken);
|
||||
if(quToken.isEmpty){
|
||||
showToast("图片上传失败");
|
||||
SmartDialog.dismiss(force: true);
|
||||
return;
|
||||
|
||||
var data =
|
||||
await DioManager.instance.get(url: Api.getqiniuToken, params: {});
|
||||
var bean = BaseResponse<QnTokenData>.fromJson(
|
||||
data, (data) => QnTokenData.fromJson(data));
|
||||
if(bean.isSuccess()){
|
||||
quToken = bean.data!.token.toString();
|
||||
}else{
|
||||
showToast("图片上传失败");
|
||||
SmartDialog.dismiss(force: true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
var path = await getApplicationSupportDirectoryPath();
|
||||
|
||||
|
||||
@ -10,6 +10,7 @@ import 'package:get/get.dart';
|
||||
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:get/get_state_manager/get_state_manager.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:video_compress/video_compress.dart';
|
||||
|
||||
class Util {
|
||||
@ -114,7 +115,9 @@ String convertToTenThousand(int number) {
|
||||
return number.toString();
|
||||
}
|
||||
}
|
||||
pushLoginPage() {
|
||||
pushLoginPage() async{
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
prefs.clear();
|
||||
Get.offAllNamed(AppRoutes.Login);
|
||||
}
|
||||
String filterSensitiveWords(String input, List<String> sensitiveWords) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user