个人中心相关功能
This commit is contained in:
parent
c21b24f327
commit
a0e4428f15
@ -1,7 +1,18 @@
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
import 'state.dart';
|
import 'state.dart';
|
||||||
|
|
||||||
class AccountLogic extends GetxController {
|
class AccountLogic extends GetxController {
|
||||||
|
String photo = "";
|
||||||
final AccountState state = AccountState();
|
final AccountState state = AccountState();
|
||||||
|
@override
|
||||||
|
void onInit() async{
|
||||||
|
|
||||||
|
super.onInit();
|
||||||
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
|
photo = prefs.getString("photo")??"";
|
||||||
|
print(photo.toString());
|
||||||
|
update();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,10 +12,13 @@ class AccountPage extends StatelessWidget {
|
|||||||
AccountPage({Key? key}) : super(key: key);
|
AccountPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
final logic = Get.find<AccountLogic>();
|
final logic = Get.find<AccountLogic>();
|
||||||
final state = Get.find<AccountLogic>().state;
|
final state = Get
|
||||||
|
.find<AccountLogic>()
|
||||||
|
.state;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
return GetBuilder<AccountLogic>(builder: (logic) {
|
||||||
return Container(
|
return Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
image: DecorationImage(
|
image: DecorationImage(
|
||||||
@ -55,6 +58,7 @@ class AccountPage extends StatelessWidget {
|
|||||||
// ),
|
// ),
|
||||||
// ),
|
// ),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
|
behavior: HitTestBehavior.opaque,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Get.toNamed(AppRoutes.PhotoActivity);
|
Get.toNamed(AppRoutes.PhotoActivity);
|
||||||
},
|
},
|
||||||
@ -71,7 +75,7 @@ class AccountPage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
Spacer(),
|
Spacer(),
|
||||||
Text(
|
Text(
|
||||||
"16677778888",
|
logic.photo,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Color(0xFFB7BECC),
|
color: Color(0xFFB7BECC),
|
||||||
fontSize: 16.0.sp,
|
fontSize: 16.0.sp,
|
||||||
@ -289,10 +293,10 @@ class AccountPage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getAuthorization() async {
|
Future<void> getAuthorization() async {
|
||||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
pushLoginPage();
|
||||||
prefs.remove("Authorization");
|
|
||||||
Get.offAllNamed(AppRoutes.Login);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,16 +1,125 @@
|
|||||||
import 'package:circle_app/router/app_routers.dart';
|
|
||||||
import 'package:get/get.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/api.dart';
|
||||||
import '../../network/dio_manager.dart';
|
import '../../network/dio_manager.dart';
|
||||||
import '../../util/device.dart';
|
|
||||||
import '../../util/util.dart';
|
import '../../util/util.dart';
|
||||||
import '../login/login/logic.dart';
|
|
||||||
import 'state.dart';
|
import 'state.dart';
|
||||||
|
|
||||||
class BlacklistLogic extends GetxController {
|
class BlacklistLogic extends GetxController {
|
||||||
final BlacklistState state = BlacklistState();
|
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/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
import '../../components/my_app_bar.dart';
|
import '../../components/my_app_bar.dart';
|
||||||
|
import '../../router/app_routers.dart';
|
||||||
import '../../util/util.dart';
|
import '../../util/util.dart';
|
||||||
import 'logic.dart';
|
import 'logic.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@ -12,10 +16,13 @@ class BlacklistPage extends StatelessWidget {
|
|||||||
BlacklistPage({Key? key}) : super(key: key);
|
BlacklistPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
final logic = Get.find<BlacklistLogic>();
|
final logic = Get.find<BlacklistLogic>();
|
||||||
final state = Get.find<BlacklistLogic>().state;
|
final state = Get
|
||||||
|
.find<BlacklistLogic>()
|
||||||
|
.state;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
return GetBuilder<BlacklistLogic>(builder: (logic) {
|
||||||
return Container(
|
return Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
image: DecorationImage(
|
image: DecorationImage(
|
||||||
@ -28,13 +35,13 @@ class BlacklistPage extends StatelessWidget {
|
|||||||
appBar: MyAppBar(centerTitle: '黑名单',),
|
appBar: MyAppBar(centerTitle: '黑名单',),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: SmartRefresher(
|
child: SmartRefresher(
|
||||||
controller: _refreshController,
|
controller: logic.refreshController,
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
padding: EdgeInsets.all(16.sp),
|
|
||||||
itemCount: itemCount,
|
itemCount: logic.lists.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text('Item $index'),
|
title: ListItem(logic.lists[index]),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -43,29 +50,145 @@ class BlacklistPage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),),
|
),),
|
||||||
);
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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 {
|
void _onRefresh() async {
|
||||||
// Perform your refresh logic here
|
logic.page = 1;
|
||||||
// For example, make an API call to fetch new data
|
logic.initList();
|
||||||
await Future.delayed(Duration(seconds: 2));
|
|
||||||
itemCount = 20;
|
|
||||||
_refreshController.refreshCompleted();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onLoading() async {
|
void _onLoading() async {
|
||||||
// Perform your loading logic here
|
logic.page = logic.page + 1;
|
||||||
// For example, make an API call to fetch more data
|
logic.initList();
|
||||||
await Future.delayed(Duration(seconds: 2));
|
|
||||||
itemCount += 10;
|
|
||||||
_refreshController.loadComplete();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,7 +36,7 @@ class FriendslistPage extends StatelessWidget {
|
|||||||
onRefresh: _onRefresh,
|
onRefresh: _onRefresh,
|
||||||
onLoading: _onLoading,
|
onLoading: _onLoading,
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
padding: EdgeInsets.all(16.sp),
|
// padding: EdgeInsets.all(16.sp),
|
||||||
itemCount: logic.lists.length,
|
itemCount: logic.lists.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
return ListItem(logic.lists[index]);
|
return ListItem(logic.lists[index]);
|
||||||
|
|||||||
@ -121,6 +121,9 @@ class Complete_materialLogic extends GetxController {
|
|||||||
if (state.textEditingController.text.isEmpty) {
|
if (state.textEditingController.text.isEmpty) {
|
||||||
showToast('请输入您的昵称');
|
showToast('请输入您的昵称');
|
||||||
return;
|
return;
|
||||||
|
} else if(state.textEditingController.text.length>6){
|
||||||
|
showToast('昵称最多输入6个字');
|
||||||
|
return;
|
||||||
}else if (state.sex.isEmpty) {
|
}else if (state.sex.isEmpty) {
|
||||||
showToast('请选择您的属性');
|
showToast('请选择您的属性');
|
||||||
return;
|
return;
|
||||||
@ -179,6 +182,9 @@ class Complete_materialLogic extends GetxController {
|
|||||||
if (state.textEditingController.text.isEmpty) {
|
if (state.textEditingController.text.isEmpty) {
|
||||||
showToast('请输入您的昵称');
|
showToast('请输入您的昵称');
|
||||||
return;
|
return;
|
||||||
|
} else if(state.textEditingController.text.length>6){
|
||||||
|
showToast('昵称最多输入6个字');
|
||||||
|
return;
|
||||||
}else if (state.sex.isEmpty) {
|
}else if (state.sex.isEmpty) {
|
||||||
showToast('请选择您的属性');
|
showToast('请选择您的属性');
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -42,6 +42,7 @@ class LoginLogic extends GetxController {
|
|||||||
Future<void> getCode() async {
|
Future<void> getCode() async {
|
||||||
var data = await DioManager.instance.post(url: Api.sendCode, params: {"phone": phoneEditingController.text});
|
var data = await DioManager.instance.post(url: Api.sendCode, params: {"phone": phoneEditingController.text});
|
||||||
var bean = BaseResponse<Data>.fromJson(data, (data) => Data.fromJson(data));
|
var bean = BaseResponse<Data>.fromJson(data, (data) => Data.fromJson(data));
|
||||||
|
showToast(bean.msg);
|
||||||
if(kDebugMode){
|
if(kDebugMode){
|
||||||
if(bean.code==200){
|
if(bean.code==200){
|
||||||
codeEditingController.text = bean.data!.code.toString();
|
codeEditingController.text = bean.data!.code.toString();
|
||||||
@ -71,6 +72,7 @@ class LoginLogic extends GetxController {
|
|||||||
if (bean.code == 200) {
|
if (bean.code == 200) {
|
||||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
prefs.setString('Authorization', bean.data!.Authorization.toString());
|
prefs.setString('Authorization', bean.data!.Authorization.toString());
|
||||||
|
|
||||||
Get.offNamed(AppRoutes.Home);
|
Get.offNamed(AppRoutes.Home);
|
||||||
return;
|
return;
|
||||||
} else if (bean.code == 30002) {
|
} else if (bean.code == 30002) {
|
||||||
|
|||||||
@ -31,6 +31,7 @@ class MinefragmentLogic extends GetxController {
|
|||||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
int likeMeCount = prefs.getInt("likeMeCount") ?? 0;
|
int likeMeCount = prefs.getInt("likeMeCount") ?? 0;
|
||||||
int recentVisitCount = prefs.getInt("recentVisitCount") ?? 0;
|
int recentVisitCount = prefs.getInt("recentVisitCount") ?? 0;
|
||||||
|
prefs.setString("photo", bean.data.phone);
|
||||||
|
|
||||||
like_count = bean.data.likeCount??0;
|
like_count = bean.data.likeCount??0;
|
||||||
like_me_count = bean.data.likeMeCount??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 = recentVisitCount.toInt() - bean.data.likeMeCount.toInt();
|
||||||
|
|
||||||
like_me_count_new = likeMeCount - like_me_count;
|
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;
|
recent_visit_count_new = recentVisitCount-recent_visit_count;
|
||||||
|
|
||||||
@ -127,6 +129,7 @@ class ResponseBean {
|
|||||||
int recentVisitCount;
|
int recentVisitCount;
|
||||||
String? vipExpireDate;
|
String? vipExpireDate;
|
||||||
int? vipExpireDays;
|
int? vipExpireDays;
|
||||||
|
String phone;
|
||||||
|
|
||||||
ResponseBean({
|
ResponseBean({
|
||||||
required this.user,
|
required this.user,
|
||||||
@ -135,12 +138,14 @@ class ResponseBean {
|
|||||||
required this.recentVisitCount,
|
required this.recentVisitCount,
|
||||||
this.vipExpireDate,
|
this.vipExpireDate,
|
||||||
this.vipExpireDays,
|
this.vipExpireDays,
|
||||||
|
required this.phone
|
||||||
});
|
});
|
||||||
|
|
||||||
factory ResponseBean.fromJson(Map<String, dynamic> json) {
|
factory ResponseBean.fromJson(Map<String, dynamic> json) {
|
||||||
return ResponseBean(
|
return ResponseBean(
|
||||||
user: User.fromJson(json['user']),
|
user: User.fromJson(json['user']),
|
||||||
likeCount: json['like_count'],
|
likeCount: json['like_count'],
|
||||||
|
phone: json['phone'],
|
||||||
likeMeCount: json['like_me_count'],
|
likeMeCount: json['like_me_count'],
|
||||||
recentVisitCount: json['recent_visit_count'],
|
recentVisitCount: json['recent_visit_count'],
|
||||||
vipExpireDate: json['vip_expire_date'],
|
vipExpireDate: json['vip_expire_date'],
|
||||||
|
|||||||
@ -417,6 +417,7 @@ class MinefragmentPage extends StatelessWidget {
|
|||||||
width: 65.sp,
|
width: 65.sp,
|
||||||
height: 65.sp,
|
height: 65.sp,
|
||||||
): CachedNetworkImage(
|
): CachedNetworkImage(
|
||||||
|
fit: BoxFit.cover,
|
||||||
imageUrl: logic.userInfoBean!=null ? logic.userInfoBean!.avatar: "",
|
imageUrl: logic.userInfoBean!=null ? logic.userInfoBean!.avatar: "",
|
||||||
width: 65.sp,
|
width: 65.sp,
|
||||||
height: 65.sp,
|
height: 65.sp,
|
||||||
|
|||||||
@ -1,10 +1,36 @@
|
|||||||
|
import 'package:circle_app/util/util.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
import '../../network/api.dart';
|
||||||
|
import '../../network/dio_manager.dart';
|
||||||
import 'state.dart';
|
import 'state.dart';
|
||||||
|
|
||||||
class OffaccountLogic extends GetxController {
|
class OffaccountLogic extends GetxController {
|
||||||
final OffaccountState state = OffaccountState();
|
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 ){
|
if(countdown > 0 ){
|
||||||
|
|
||||||
}else{
|
}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:circle_app/util/util.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:get/get.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';
|
import 'state.dart';
|
||||||
|
|
||||||
class PhotoinfoLogic extends GetxController {
|
class PhotoinfoLogic extends GetxController {
|
||||||
final PhotoinfoState state = PhotoinfoState();
|
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 {
|
class PhotoinfoState {
|
||||||
|
TextEditingController photoController = TextEditingController();
|
||||||
|
// TextEditingController passwordController = TextEditingController();
|
||||||
|
TextEditingController newPhotoController = TextEditingController();
|
||||||
|
TextEditingController codeController = TextEditingController();
|
||||||
PhotoinfoState() {
|
PhotoinfoState() {
|
||||||
///Initialize variables
|
///Initialize variables
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
@ -9,51 +10,23 @@ import '../../components/my_app_bar.dart';
|
|||||||
import '../../util/util.dart';
|
import '../../util/util.dart';
|
||||||
import 'logic.dart';
|
import 'logic.dart';
|
||||||
|
|
||||||
class PhotoinfoPage extends StatefulWidget {
|
class PhotoinfoPage extends StatelessWidget {
|
||||||
PhotoinfoPage({Key? key}) : super(key: key);
|
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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return GetBuilder<PhotoinfoLogic>(builder: (logic) {
|
return GetBuilder<PhotoinfoLogic>(builder: (logic) {
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
image: DecorationImage(
|
image: DecorationImage(
|
||||||
@ -88,8 +61,8 @@ class _PhotoinfoPage extends State<PhotoinfoPage> {
|
|||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
padding: EdgeInsets.only(
|
padding:
|
||||||
left: 16.0.sp, right: 10.sp),
|
EdgeInsets.only(left: 16.0.sp, right: 10.sp,top: 4.sp),
|
||||||
child: Text(
|
child: Text(
|
||||||
"+86",
|
"+86",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
@ -102,11 +75,12 @@ class _PhotoinfoPage extends State<PhotoinfoPage> {
|
|||||||
height: 32.sp,
|
height: 32.sp,
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: TextField(
|
child: TextField(
|
||||||
controller: _photoController,
|
controller: logic.state.photoController,
|
||||||
textAlignVertical: TextAlignVertical.center,
|
textAlignVertical: TextAlignVertical.center,
|
||||||
inputFormatters: [
|
inputFormatters: [
|
||||||
FilteringTextInputFormatter.digitsOnly,
|
FilteringTextInputFormatter.digitsOnly,
|
||||||
FilteringTextInputFormatter.deny(RegExp('[^0-9]')),
|
FilteringTextInputFormatter.deny(
|
||||||
|
RegExp('[^0-9]')),
|
||||||
],
|
],
|
||||||
keyboardType: TextInputType.phone,
|
keyboardType: TextInputType.phone,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
@ -185,8 +159,8 @@ class _PhotoinfoPage extends State<PhotoinfoPage> {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.only(
|
padding:
|
||||||
left: 16.0.sp, right: 10.sp),
|
EdgeInsets.only(left: 16.0.sp, right: 10.sp,top: 4.sp),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
"+86",
|
"+86",
|
||||||
@ -201,12 +175,13 @@ class _PhotoinfoPage extends State<PhotoinfoPage> {
|
|||||||
height: 32.sp,
|
height: 32.sp,
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: TextField(
|
child: TextField(
|
||||||
controller: _newPhotoController,
|
controller: logic.state.newPhotoController,
|
||||||
textAlignVertical: TextAlignVertical.center,
|
textAlignVertical: TextAlignVertical.center,
|
||||||
keyboardType: TextInputType.phone,
|
keyboardType: TextInputType.phone,
|
||||||
inputFormatters: [
|
inputFormatters: [
|
||||||
FilteringTextInputFormatter.digitsOnly,
|
FilteringTextInputFormatter.digitsOnly,
|
||||||
FilteringTextInputFormatter.deny(RegExp('[^0-9]')),
|
FilteringTextInputFormatter.deny(
|
||||||
|
RegExp('[^0-9]')),
|
||||||
],
|
],
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: "请输入新手机号",
|
hintText: "请输入新手机号",
|
||||||
@ -256,7 +231,7 @@ class _PhotoinfoPage extends State<PhotoinfoPage> {
|
|||||||
height: 32.sp,
|
height: 32.sp,
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: TextField(
|
child: TextField(
|
||||||
controller: _codeController,
|
controller: logic.state.codeController,
|
||||||
textAlignVertical: TextAlignVertical.center,
|
textAlignVertical: TextAlignVertical.center,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: "请输入验证码",
|
hintText: "请输入验证码",
|
||||||
@ -282,9 +257,9 @@ class _PhotoinfoPage extends State<PhotoinfoPage> {
|
|||||||
flex: 2,
|
flex: 2,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (!_isCountingDown) {
|
if (!logic.isCountingDown) {
|
||||||
// Only start countdown if not already counting down
|
logic.getCode();
|
||||||
startCountdown();
|
//logic.startCountdown();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -297,11 +272,11 @@ class _PhotoinfoPage extends State<PhotoinfoPage> {
|
|||||||
height: 40.0.sp,
|
height: 40.0.sp,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
_isCountingDown
|
logic.isCountingDown
|
||||||
? '$_countdownSeconds 秒'
|
? logic.countdownSeconds.toString()+"s"
|
||||||
: '获取验证码',
|
: '获取验证码',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: _isCountingDown
|
color: logic.isCountingDown
|
||||||
? Colors.grey.shade400
|
? Colors.grey.shade400
|
||||||
: Colors.white,
|
: Colors.white,
|
||||||
fontSize: 14.0.sp,
|
fontSize: 14.0.sp,
|
||||||
@ -326,18 +301,18 @@ class _PhotoinfoPage extends State<PhotoinfoPage> {
|
|||||||
),
|
),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
String photo = _photoController.text;
|
String photo = logic.state.photoController.text;
|
||||||
String password = _passwordController.text;
|
// String password = logic.state.passwordController.text;
|
||||||
String newphoto = _newPhotoController.text;
|
String newphoto = logic.state.newPhotoController.text;
|
||||||
String code = _codeController.text;
|
String code = logic.state.codeController.text;
|
||||||
if (photo == "" || photo.length < 11) {
|
if (photo == "" || photo.length < 11) {
|
||||||
showToast("已绑定的手机号输入有误");
|
showToast("已绑定的手机号输入有误");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(password==""){
|
// if(password==""){
|
||||||
showToast("请输入密码");
|
// showToast("请输入密码");
|
||||||
return ;
|
// return ;
|
||||||
}
|
// }
|
||||||
if (newphoto == "" || newphoto.length < 11) {
|
if (newphoto == "" || newphoto.length < 11) {
|
||||||
showToast("新手机号输入有误");
|
showToast("新手机号输入有误");
|
||||||
return;
|
return;
|
||||||
@ -346,16 +321,23 @@ class _PhotoinfoPage extends State<PhotoinfoPage> {
|
|||||||
showToast("请输入验证码");
|
showToast("请输入验证码");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
logic.bindingPhoto();
|
||||||
// Perform action on button press
|
// Perform action on button press
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
margin:
|
margin: EdgeInsets.fromLTRB(
|
||||||
EdgeInsets.fromLTRB(72.0.sp, 40.0.sp, 72.0.sp, 0.0.sp),
|
72.0.sp, 40.0.sp, 72.0.sp, 0.0.sp),
|
||||||
height: 42.0.sp,
|
height: 42.0.sp,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(21.0.sp),
|
borderRadius: BorderRadius.circular(17),
|
||||||
color: Colors.blue,
|
gradient: const LinearGradient(
|
||||||
|
colors: [
|
||||||
|
Color(0xFF06F9FA),
|
||||||
|
Color(0xFFDC5BFD),
|
||||||
|
],
|
||||||
|
begin: Alignment.centerLeft,
|
||||||
|
end: Alignment.centerRight,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
@ -376,6 +358,4 @@ class _PhotoinfoPage extends State<PhotoinfoPage> {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -16,7 +16,7 @@ class SplashLogic extends GetxController {
|
|||||||
void onInit() async{
|
void onInit() async{
|
||||||
super.onInit();
|
super.onInit();
|
||||||
if((await getAuthorization()).isEmpty){
|
if((await getAuthorization()).isEmpty){
|
||||||
Get.toNamed(AppRoutes.Login);
|
pushLoginPage();
|
||||||
}else{
|
}else{
|
||||||
var data =
|
var data =
|
||||||
await DioManager.instance.put(url: Api.refreshToken,params:{});
|
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:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:image_picker/image_picker.dart';
|
import 'package:image_picker/image_picker.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
import '../../common/config.dart';
|
import '../../common/config.dart';
|
||||||
import '../../network/api.dart';
|
import '../../network/api.dart';
|
||||||
@ -34,6 +35,12 @@ class UserinfoLogic extends GetxController {
|
|||||||
@override
|
@override
|
||||||
void onInit() async {
|
void onInit() async {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
|
|
||||||
|
if(prefs.getInt('userId')!=0&&prefs.getInt('userId').toString()==userId){
|
||||||
|
userId = '';
|
||||||
|
}
|
||||||
|
|
||||||
if (userId == '') {
|
if (userId == '') {
|
||||||
isMe = true;
|
isMe = true;
|
||||||
var data = await DioManager.instance.get(url: Api.getUserInfo);
|
var data = await DioManager.instance.get(url: Api.getUserInfo);
|
||||||
@ -144,7 +151,7 @@ class UserinfoLogic extends GetxController {
|
|||||||
|
|
||||||
setLike() async {
|
setLike() async {
|
||||||
var data = await DioManager.instance
|
var data = await DioManager.instance
|
||||||
.post(url: "${Api.setBlock + userId}/follow", params: {
|
.post(url: "${Api.setLike + userId}/follow", params: {
|
||||||
'status': isLike?"0":"1"
|
'status': isLike?"0":"1"
|
||||||
});
|
});
|
||||||
var bean = BaseResponse<dynamic>.fromJson(data, (jsonData) => jsonData,);
|
var bean = BaseResponse<dynamic>.fromJson(data, (jsonData) => jsonData,);
|
||||||
@ -158,7 +165,9 @@ class UserinfoLogic extends GetxController {
|
|||||||
|
|
||||||
setBlock() async {
|
setBlock() async {
|
||||||
var data = await DioManager.instance
|
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,);
|
var bean = BaseResponse<dynamic>.fromJson(data, (jsonData) => jsonData,);
|
||||||
if(bean.isSuccess()){
|
if(bean.isSuccess()){
|
||||||
Navigator.pop(Get.context!);
|
Navigator.pop(Get.context!);
|
||||||
|
|||||||
@ -431,10 +431,10 @@ class _MyTabbedScreenState extends State<UserinfoPage>
|
|||||||
right: 0,
|
right: 0,
|
||||||
bottom: 26.sp,
|
bottom: 26.sp,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () {
|
onTap: () async{
|
||||||
// showToast("完善资料");
|
// showToast("完善资料");
|
||||||
Get.toNamed(AppRoutes.Complete_materialPage,
|
var data = await Get.toNamed(AppRoutes.Complete_materialPage, arguments: "user");
|
||||||
arguments: "user");
|
logic.onInit();
|
||||||
// controller.onInit();
|
// controller.onInit();
|
||||||
},
|
},
|
||||||
child: Center(
|
child: Center(
|
||||||
@ -571,6 +571,7 @@ class _MyTabbedScreenState extends State<UserinfoPage>
|
|||||||
arguments: {'imaglist': imgList, 'index': 0});
|
arguments: {'imaglist': imgList, 'index': 0});
|
||||||
},
|
},
|
||||||
child: CachedNetworkImage(
|
child: CachedNetworkImage(
|
||||||
|
fit: BoxFit.cover,
|
||||||
imageUrl: controller.userInfoBean != null
|
imageUrl: controller.userInfoBean != null
|
||||||
? controller.userInfoBean!.avatar
|
? 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(
|
Options options = Options(
|
||||||
method: methodValues[method], headers: {
|
method: methodValues[method], headers: {
|
||||||
"Authorization": await getAuthorization(),
|
"Authorization": await getAuthorization(),
|
||||||
'versionName': await getVersionName(),
|
'VersionName': await getVersionName(),
|
||||||
'versionCode': await getVersionCode(),
|
'VersionCode': await getVersionCode(),
|
||||||
'osVersion': await getDeviceId(),
|
'OsVersion': await getDeviceId(),
|
||||||
'platform': Platform.isIOS ? '1' : '0',
|
'Platform': Platform.isIOS ? '1' : '0',
|
||||||
'imei': await getImei(),
|
'Imei': await getImei(),
|
||||||
'brand': await getBrand(),
|
'Brand': await getBrand(),
|
||||||
});
|
});
|
||||||
print(">>>>>"+params.toString());
|
print(">>>>>"+params.toString());
|
||||||
|
|
||||||
@ -265,12 +265,34 @@ class BaseResponse<T> {
|
|||||||
|
|
||||||
factory BaseResponse.fromJson(Map<String, dynamic> json,
|
factory BaseResponse.fromJson(Map<String, dynamic> json,
|
||||||
T Function(dynamic) fromJsonData) {
|
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(
|
return BaseResponse(
|
||||||
code: json['code'],
|
code: json['code'],
|
||||||
msg: json['msg'],
|
msg: json['msg'],
|
||||||
data: json['data'] != null ? fromJsonData?.call(json['data']) : '',
|
data: data,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class QnTokenData {
|
class QnTokenData {
|
||||||
|
|||||||
@ -10,6 +10,8 @@ import 'package:qiniu_flutter_sdk/qiniu_flutter_sdk.dart';
|
|||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
import '../common/config.dart';
|
import '../common/config.dart';
|
||||||
|
import '../network/api.dart';
|
||||||
|
import '../network/dio_manager.dart';
|
||||||
|
|
||||||
typedef void MyCallback(String result);
|
typedef void MyCallback(String result);
|
||||||
|
|
||||||
@ -44,10 +46,19 @@ void updataQiniu(String filePath,String name,String path ,String quToken,MyCallb
|
|||||||
void upDataImage(String quToken ,XFile pickedFile,String updataRoute,MyCallback myCallback) async{
|
void upDataImage(String quToken ,XFile pickedFile,String updataRoute,MyCallback myCallback) async{
|
||||||
// print(quToken);
|
// print(quToken);
|
||||||
if(quToken.isEmpty){
|
if(quToken.isEmpty){
|
||||||
|
|
||||||
|
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("图片上传失败");
|
showToast("图片上传失败");
|
||||||
SmartDialog.dismiss(force: true);
|
SmartDialog.dismiss(force: true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
var path = await getApplicationSupportDirectoryPath();
|
var path = await getApplicationSupportDirectoryPath();
|
||||||
|
|
||||||
CompressObject compressObject = CompressObject(
|
CompressObject compressObject = CompressObject(
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import 'package:get/get.dart';
|
|||||||
|
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
import 'package:get/get_state_manager/get_state_manager.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';
|
import 'package:video_compress/video_compress.dart';
|
||||||
|
|
||||||
class Util {
|
class Util {
|
||||||
@ -114,7 +115,9 @@ String convertToTenThousand(int number) {
|
|||||||
return number.toString();
|
return number.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pushLoginPage() {
|
pushLoginPage() async{
|
||||||
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
|
prefs.clear();
|
||||||
Get.offAllNamed(AppRoutes.Login);
|
Get.offAllNamed(AppRoutes.Login);
|
||||||
}
|
}
|
||||||
String filterSensitiveWords(String input, List<String> sensitiveWords) {
|
String filterSensitiveWords(String input, List<String> sensitiveWords) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user