Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
book-app
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
book-app
Commits
f5087672
提交
f5087672
authored
1月 18, 2024
作者:
yueweilu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改头像
上级
01eb5429
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
20 行增加
和
9 行删除
+20
-9
common.dart
lib/apis/common.dart
+5
-3
controller.dart
lib/pages/user_info/controller.dart
+13
-4
view.dart
lib/pages/user_info/view.dart
+2
-2
没有找到文件。
lib/apis/common.dart
浏览文件 @
f5087672
...
@@ -145,21 +145,22 @@ abstract class CommonAPI {
...
@@ -145,21 +145,22 @@ abstract class CommonAPI {
'is_select'
:
love
'is_select'
:
love
},
},
);
);
if
(
result
.
data
is
Map
&&
result
.
data
[
'is_success'
]
==
1
){
if
(
result
.
data
is
!
Map
&&
result
.
data
[
'is_success'
]
==
1
){
return
true
;
return
true
;
}
}
return
false
;
return
false
;
}
}
/// 10、上传文件
/// 10、上传文件
static
Future
upload
({
static
Future
<
String
>
upload
({
required
String
path
required
String
path
})
async
{
})
async
{
final
result
=
await
HttpService
.
to
.
upload
(
final
result
=
await
HttpService
.
to
.
upload
(
'/v1/members/Information/uploadFile'
,
'/v1/members/Information/uploadFile'
,
path:
path
path:
path
);
);
print
(
result
.
data
);
if
(
result
.
data
is
!
Map
)
return
''
;
return
result
.
data
[
'filesUrl'
];
}
}
}
}
\ No newline at end of file
lib/pages/user_info/controller.dart
浏览文件 @
f5087672
part of
user_info
;
part of
user_info
;
class
UserInfoController
extends
GetxController
{
class
UserInfoController
extends
GetxController
{
final
UserInfoModel
userInfo
;
UserInfoController
(
this
.
userInfo
);
/// 上传头像
/// 上传头像
void
upload
({
void
upload
({
required
String
path
required
String
path
})
async
{
})
async
{
var
result
=
await
CommonAPI
.
upload
(
path:
path
);
String
result
=
await
CommonAPI
.
upload
(
path:
path
);
print
(
result
);
_changeInfo
(
result
);
update
();
}
}
/// 修改用用户信息
/// 修改用用户信息
void
_changeInfo
(
String
img
)
async
{
final
result
=
await
MineAPI
.
changeInfo
(
headImg:
img
);
if
(
result
){
Toast
.
show
(
'修改成功'
);
userInfo
.
headImg
=
img
;
update
();
}
}
}
}
\ No newline at end of file
lib/pages/user_info/view.dart
浏览文件 @
f5087672
...
@@ -15,7 +15,7 @@ class _UserInfoPageState extends State<UserInfoPage> {
...
@@ -15,7 +15,7 @@ class _UserInfoPageState extends State<UserInfoPage> {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
GetBuilder
<
UserInfoController
>(
return
GetBuilder
<
UserInfoController
>(
init:
UserInfoController
(),
init:
UserInfoController
(
widget
.
userInfo
),
builder:
(
controller
)
=>
Scaffold
(
builder:
(
controller
)
=>
Scaffold
(
appBar:
AppBar
(
appBar:
AppBar
(
title:
const
Text
(
'个人信息'
),
title:
const
Text
(
'个人信息'
),
...
@@ -70,7 +70,7 @@ class _UserInfoPageState extends State<UserInfoPage> {
...
@@ -70,7 +70,7 @@ class _UserInfoPageState extends State<UserInfoPage> {
shape:
BoxShape
.
circle
,
shape:
BoxShape
.
circle
,
color:
Colors
.
cyan
,
color:
Colors
.
cyan
,
),
),
child:
CustomImage
.
network
(
url:
widget
.
userInfo
.
headImg
??
''
),
child:
CustomImage
.
network
(
url:
controller
.
userInfo
.
headImg
??
''
,
radius:
16.5
,
),
),
),
Gaps
.
hGaps10
,
Gaps
.
hGaps10
,
SizedBox
(
SizedBox
(
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论