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

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

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