提交 c46ea472 authored 作者: yueweilu's avatar yueweilu

1、及时响应个人信息修改

2、oss 直传头像
上级 dcee668e
......@@ -27,6 +27,8 @@ PODS:
- WechatOpenSDK-XCFramework (~> 2.0.2)
- image_picker_ios (0.0.1):
- Flutter
- just_audio (0.0.1):
- Flutter
- OrderedSet (5.0.0)
- package_info_plus (0.4.5):
- Flutter
......@@ -55,6 +57,7 @@ DEPENDENCIES:
- flutter_tts (from `.symlinks/plugins/flutter_tts/ios`)
- fluwx (from `.symlinks/plugins/fluwx/ios`)
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
- just_audio (from `.symlinks/plugins/just_audio/ios`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
......@@ -86,6 +89,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/fluwx/ios"
image_picker_ios:
:path: ".symlinks/plugins/image_picker_ios/ios"
just_audio:
:path: ".symlinks/plugins/just_audio/ios"
package_info_plus:
:path: ".symlinks/plugins/package_info_plus/ios"
path_provider_foundation:
......@@ -108,6 +113,7 @@ SPEC CHECKSUMS:
flutter_tts: 0f492aab6accf87059b72354fcb4ba934304771d
fluwx: 3c7b6df42f83d444d4538f3eaeae079f12d30c37
image_picker_ios: 99dfe1854b4fa34d0364e74a78448a0151025425
just_audio: baa7252489dbcf47a4c7cc9ca663e9661c99aafa
OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c
package_info_plus: 115f4ad11e0698c8c1c5d8a689390df880f47e85
path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c
......
......@@ -12,8 +12,8 @@ class UserInfoController extends GetxController {
OssTool tool = OssTool('zxts-user-file');
print('------path--------------------------$path');
final response = await tool.putObjectFile(path);
print('------response--------------------------${response.data}');
// _changeInfo(result);
print('------response--------------------------${response.realUri}');
_changeInfo(response.realUri.toString());
}
/// 修改用用户信息
......
......@@ -12,118 +12,124 @@ class UserInfoPage extends StatefulWidget {
class _UserInfoPageState extends State<UserInfoPage> {
@override
Widget build(BuildContext context) {
return GetBuilder<UserInfoController>(
init: UserInfoController(widget.userInfo),
builder: (controller) =>
Scaffold(
appBar: AppBar(
title: const Text('个人信息'),
centerTitle: true,
),
body: Container(
margin: EdgeInsets.symmetric(
horizontal: AppTheme.margin, vertical: AppTheme.margin),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
color: Colors.white,
boxShadow: [
BoxShadow(
color: const Color(0xFFC7C7C7).withOpacity(0.5),
offset: Offset(3.w, 0),
blurRadius: 10.w,
spreadRadius: 0.w,
),
],
return WillPopScope(
onWillPop: () async {
context.pop(true);
return false;
},
child: GetBuilder<UserInfoController>(
init: UserInfoController(widget.userInfo),
builder: (controller) =>
Scaffold(
appBar: AppBar(
title: const Text('个人信息'),
centerTitle: true,
),
child: ClipRRect(
body: Container(
margin: EdgeInsets.symmetric(
horizontal: AppTheme.margin, vertical: AppTheme.margin),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
color: Colors.white,
boxShadow: [
BoxShadow(
color: const Color(0xFFC7C7C7).withOpacity(0.5),
offset: Offset(3.w, 0),
blurRadius: 10.w,
spreadRadius: 0.w,
),
],
),
child: ClipRRect(
borderRadius: BorderRadius.circular(8.w),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
/// 头像
Container(
height: 52.w,
padding: EdgeInsets.only(left: 18.w, right: 15.w),
child: GestureDetector(
onTap: () async {
final assets = await AssetsPicker.image(
context: context,
);
controller.upload(path: assets!.path);
},
child: Container(
color: Colors.transparent,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'头像',
style: TextStyle(
color: Colours.c3,
fontSize: 14.w,
height: 1.6),
),
Row(
children: [
Container(
width: 33.w,
height: 33.w,
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Colors.cyan,
/// 头像
Container(
height: 52.w,
padding: EdgeInsets.only(left: 18.w, right: 15.w),
child: GestureDetector(
onTap: () async {
final assets = await AssetsPicker.image(
context: context,
);
controller.upload(path: assets!.path);
},
child: Container(
color: Colors.transparent,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'头像',
style: TextStyle(
color: Colours.c3,
fontSize: 14.w,
height: 1.6),
),
Row(
children: [
Container(
width: 33.w,
height: 33.w,
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Colors.cyan,
),
child: CustomImage.network(
url: controller.userInfo.headImg ?? '',
radius: 16.5,
),
),
child: CustomImage.network(
url: controller.userInfo.headImg ?? '',
radius: 16.5,
),
),
Gaps.hGaps10,
SizedBox(
width: 5.w,
height: 8.w,
child: Image.asset(
'assets/images/right_arrow.png'),
)
],
)
],
Gaps.hGaps10,
SizedBox(
width: 5.w,
height: 8.w,
child: Image.asset(
'assets/images/right_arrow.png'),
)
],
)
],
),
),
),
),
),
Container(
color: Colours.cLine,
margin: EdgeInsets.symmetric(horizontal: 15.w),
height: 1.w,
),
GestureDetector(
Container(
color: Colours.cLine,
margin: EdgeInsets.symmetric(horizontal: 15.w),
height: 1.w,
),
GestureDetector(
onTap: () {
context.pushNamed(Routes.nike, extra: controller.userInfo);
},
child: _buildItem(
'昵称',
widget.userInfo.name ?? '',
)),
Container(
color: Colours.cLine,
margin: EdgeInsets.symmetric(horizontal: 15.w),
height: 1.w,
),
GestureDetector(
onTap: () {
context.pushNamed(Routes.nike, extra: controller.userInfo);
context.pushNamed(
Routes.gender, extra: controller.userInfo);
},
child: _buildItem(
'昵称',
widget.userInfo.name ?? '',
)),
Container(
color: Colours.cLine,
margin: EdgeInsets.symmetric(horizontal: 15.w),
height: 1.w,
),
GestureDetector(
onTap: () {
context.pushNamed(
Routes.gender, extra: controller.userInfo);
},
child: _buildItem(
'性别',
getGender(widget.userInfo.sex)
// widget.userInfo.sex == 1 ? '男' : '女',
)),
],
'性别',
getGender(widget.userInfo.sex)
// widget.userInfo.sex == 1 ? '男' : '女',
)),
],
),
),
),
)),);
)),),
);
}
getGender(num? sex) {
......
......@@ -169,36 +169,36 @@ class HttpService extends GetxService {
class _RequestInterceptor extends Interceptor {
@override
void onResponse(Response response, ResponseInterceptorHandler handler) async {
final responseData = response.data;
if (responseData is Map && responseData.containsKey('code')) {
final code = responseData['code'];
if (code != 200) {
handler.reject(
DioException(
requestOptions: response.requestOptions,
response: response,
type: DioExceptionType.badResponse,
),
true,
);
return;
}
} else if (response.requestOptions.responseType == ResponseType.bytes) {
}
super.onResponse(response, handler);
// if (response.data['code'] != 200) {
// handler.reject(
// DioException(
// requestOptions: response.requestOptions,
// response: response,
// type: DioExceptionType.badResponse,
// ),
// true,
// );
// }else {
// super.onResponse(response, handler);
// final responseData = response.data;
// if (responseData is Map && responseData.containsKey('code')) {
// final code = responseData['code'];
// if (code != 200) {
// handler.reject(
// DioException(
// requestOptions: response.requestOptions,
// response: response,
// type: DioExceptionType.badResponse,
// ),
// true,
// );
// return;
// }
// } else if (response.requestOptions.responseType == ResponseType.bytes) {
//
// }
// super.onResponse(response, handler);
if (response.data['code'] != 200) {
handler.reject(
DioException(
requestOptions: response.requestOptions,
response: response,
type: DioExceptionType.badResponse,
),
true,
);
}else {
super.onResponse(response, handler);
}
}
@override
......
......@@ -12,7 +12,7 @@ class OssTool {
void initOss(String bucketName) async {
Client.init(ossEndpoint: 'https://oss-cn-beijing.aliyuncs.com', bucketName:bucketName,authGetter: _authGetter);
Client.init(ossEndpoint: 'oss-cn-beijing.aliyuncs.com', bucketName:bucketName,authGetter: _authGetter);
}
// 获取临时凭证
......@@ -27,11 +27,18 @@ class OssTool {
}
// 本地文件上传
Future<Response<dynamic>> putObjectFile(String filePath){
Future<Response<dynamic>> putObjectFile(String filePath) async {
print('------------------222222222222222222222--------------$filePath');
print('------------------222222222222222222222--------------');
return Client().putObjectFile(
List<String> parts = filePath.split('/');
String fileName = parts.last;
final String path = '${DateTime.now().year}/${DateTime.now().month.toString().padLeft(2,'0')}/${DateTime.now().day.toString().padLeft(2,'0')}';
final Response<dynamic> resp = await Client().putObjectFile(
filePath,
fileKey: '$path/$fileName'
);
print('99999999999-------------${resp.realUri}---${resp.extra}--${resp.data}');
return resp;
}
// 批量本地文件上传
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论