Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
book-app
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
book-app
Commits
d43154ef
提交
d43154ef
authored
1月 18, 2024
作者:
yueweilu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add
上级
ad49261f
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
181 行增加
和
88 行删除
+181
-88
common.dart
lib/apis/common.dart
+12
-0
mine.dart
lib/apis/mine.dart
+28
-0
view.dart
lib/pages/mine/view.dart
+1
-1
controller.dart
lib/pages/user_info/controller.dart
+19
-0
index.dart
lib/pages/user_info/index.dart
+9
-2
view.dart
lib/pages/user_info/view.dart
+104
-81
routes.dart
lib/routes/routes.dart
+1
-1
http.dart
lib/services/http.dart
+6
-2
theme.dart
lib/theme.dart
+1
-1
没有找到文件。
lib/apis/common.dart
浏览文件 @
d43154ef
...
...
@@ -133,6 +133,7 @@ abstract class CommonAPI {
}
/// 9、收藏 取消收藏
///
static
Future
<
bool
>
love
({
required
String
bookId
,
required
String
love
...
...
@@ -150,5 +151,15 @@ abstract class CommonAPI {
return
false
;
}
/// 10、上传文件
static
Future
upload
({
required
String
path
})
async
{
final
result
=
await
HttpService
.
to
.
upload
(
'/v1/members/Information/uploadFile'
,
path:
path
);
print
(
result
.
data
);
}
}
\ No newline at end of file
lib/apis/mine.dart
浏览文件 @
d43154ef
...
...
@@ -177,5 +177,32 @@ abstract class MineAPI {
});
}
/// 11、修改用户信息
///
static
Future
<
bool
>
changeInfo
({
String
?
name
,
String
?
sex
,
String
?
headImg
})
async
{
Map
<
String
,
dynamic
>
params
=
{};
if
(
name
!=
null
){
params
[
'name'
]
=
name
;
}
if
(
sex
!=
null
){
params
[
'sex'
]
=
sex
;
}
if
(
headImg
!=
null
){
params
[
'head_img'
]
=
headImg
;
}
final
result
=
await
HttpService
.
to
.
post
(
'/v1/members/Information/editInformation'
,
params:
params
);
if
(
result
.
data
is
Map
&&
result
.
data
[
'is_success'
]
==
1
){
return
true
;
}
return
false
;
}
}
\ No newline at end of file
lib/pages/mine/view.dart
浏览文件 @
d43154ef
...
...
@@ -68,7 +68,7 @@ class _MinePageState extends State<MinePage> {
child:
Column
(
children:
[
BuildUser
(
userInfo:
controller
.
userInfo
,
onTap:
(){
context
.
pushNamed
(
Routes
.
userInfo
);
context
.
pushNamed
(
Routes
.
userInfo
,
extra:
controller
.
userInfo
);
},),
Gaps
.
vGaps10
,
BuildRead
(
items:
controller
.
reads
,
onTap:
(
ReadModel
model
)
async
{
...
...
lib/pages/user_info/controller.dart
0 → 100644
浏览文件 @
d43154ef
part of
user_info
;
class
UserInfoController
extends
GetxController
{
/// 上传头像
void
upload
({
required
String
path
})
async
{
var
result
=
await
CommonAPI
.
upload
(
path:
path
);
print
(
result
);
update
();
}
/// 修改用用户信息
}
\ No newline at end of file
lib/pages/user_info/index.dart
浏览文件 @
d43154ef
...
...
@@ -3,9 +3,16 @@ library user_info;
import
'package:flutter/material.dart'
;
import
'package:flutter_book/theme.dart'
;
import
'package:flutter_book/utils/index.dart'
;
import
'package:flutter_book/widgets/index.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
import
'package:get/get.dart'
;
import
'package:get/get_state_manager/src/simple/get_controllers.dart'
;
import
'package:go_router/go_router.dart'
;
import
'package:image_picker/image_picker.dart'
;
import
'../../apis/index.dart'
;
import
'../../models/index.dart'
;
import
'../../routes/index.dart'
;
part
'view.dart'
;
\ No newline at end of file
part
'view.dart'
;
part
'controller.dart'
;
\ No newline at end of file
lib/pages/user_info/view.dart
浏览文件 @
d43154ef
part of
user_info
;
class
UserInfoPage
extends
StatefulWidget
{
const
UserInfoPage
({
Key
?
key
})
:
super
(
key:
key
);
final
UserInfoModel
userInfo
;
const
UserInfoPage
({
Key
?
key
,
required
this
.
userInfo
})
:
super
(
key:
key
);
@override
State
<
UserInfoPage
>
createState
()
=>
_UserInfoPageState
();
...
...
@@ -10,98 +14,117 @@ class UserInfoPage extends StatefulWidget {
class
_UserInfoPageState
extends
State
<
UserInfoPage
>
{
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
AppBar
(
title:
const
Text
(
'个人信息'
),
centerTitle:
true
,
),
body:
Container
(
margin:
const
EdgeInsets
.
symmetric
(
horizontal:
AppTheme
.
margin
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
),
color:
Colors
.
white
,
return
GetBuilder
<
UserInfoController
>(
init:
UserInfoController
(),
builder:
(
controller
)
=>
Scaffold
(
appBar:
AppBar
(
title:
const
Text
(
'个人信息'
),
centerTitle:
true
,
),
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
[
/// 头像
Container
(
height:
52
,
padding:
const
EdgeInsets
.
only
(
left:
18
,
right:
15
),
child:
GestureDetector
(
onTap:
(){
body:
Container
(
margin:
const
EdgeInsets
.
symmetric
(
horizontal:
AppTheme
.
margin
,
vertical:
AppTheme
.
margin
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
),
color:
Colors
.
white
,
boxShadow:
[
BoxShadow
(
color:
const
Color
(
0xFFC7C7C7
).
withOpacity
(
0.5
),
offset:
const
Offset
(
3
,
0
),
blurRadius:
10
.
w
,
spreadRadius:
0
.
w
,
),
],
),
child:
ClipRRect
(
borderRadius:
BorderRadius
.
circular
(
8
),
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
[
/// 头像
Container
(
height:
52
,
padding:
const
EdgeInsets
.
only
(
left:
18
,
right:
15
),
child:
GestureDetector
(
onTap:
()
async
{
final
assets
=
await
AssetsPicker
.
image
(
context:
context
,
source
:
ImageSource
.
gallery
,
maxWidth:
512
,
maxHeight:
512
,
);
controller
.
upload
(
path:
assets
!.
path
);
},
child:
Container
(
color:
Colors
.
transparent
,
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
const
Text
(
'头像'
,
style:
TextStyle
(
color:
Colours
.
c3
,
fontSize:
14
,
height:
1.6
),),
Row
(
},
child:
Container
(
color:
Colors
.
transparent
,
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Container
(
width:
33
.
w
,
height:
33
.
w
,
decoration:
const
BoxDecoration
(
shape:
BoxShape
.
circle
,
color:
Colors
.
cyan
,
),
),
Gaps
.
hGaps10
,
Container
(
width:
5
,
height:
8
,
color:
Colors
.
cyan
,
const
Text
(
'头像'
,
style:
TextStyle
(
color:
Colours
.
c3
,
fontSize:
14
,
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:
widget
.
userInfo
.
headImg
??
''
),
),
Gaps
.
hGaps10
,
SizedBox
(
width:
5
,
height:
8
,
child:
Image
.
asset
(
'assets/images/right_arrow.png'
),
)
],
)
],
)
]
,
)
,
)
,
),
),
),
Container
(
color:
Colours
.
cLine
,
margin:
const
EdgeInsets
.
symmetric
(
horizontal:
15
),
height:
1
,),
GestureDetector
(
onTap:
(){
context
.
pushNamed
(
Routes
.
nike
);
},
child:
_buildItem
(
'昵称'
,
widget
.
userInfo
.
name
??
''
,
)
),
Container
(
color:
Colours
.
cLine
,
margin:
const
EdgeInsets
.
symmetric
(
horizontal:
15
),
height:
1
,),
_buildItem
(
'性别'
,
widget
.
userInfo
.
sex
==
1
?
'男'
:
'女'
,),
],
),
Container
(
color:
Colours
.
cLine
,
margin:
const
EdgeInsets
.
symmetric
(
horizontal:
15
),
height:
1
,),
_buildItem
(
'昵称'
,
'随便起个名字'
,
Routes
.
nike
),
Container
(
color:
Colours
.
cLine
,
margin:
const
EdgeInsets
.
symmetric
(
horizontal:
15
),
height:
1
,),
_buildItem
(
'性别'
,
'男'
,
'linkTo'
),
],
),
)
),
)
),
);
}
Widget
_buildItem
(
String
title
,
String
value
,
String
linkTo
,{
VoidCallback
?
onTap
})
{
return
GestureDetector
(
onTap:
(){
if
(
linkTo
.
isNotEmpty
){
context
.
pushNamed
(
linkTo
);
if
(
onTap
!=
null
)
onTap
;
}
},
child:
Container
(
padding:
const
EdgeInsets
.
only
(
left:
18
,
right:
15
),
color:
Colors
.
transparent
,
height:
52
,
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
[
Text
(
title
,
style:
const
TextStyle
(
fontSize:
14
,
color:
Colours
.
c3
,),),
Row
(
children:
[
Text
(
value
,
style:
const
TextStyle
(
fontSize:
14
,
color:
Colours
.
c9
,),),
Gaps
.
hGaps10
,
Container
(
width:
5
,
height:
8
,
color:
Colors
.
cyan
,
)
],
)
Widget
_buildItem
(
String
title
,
String
value
)
{
return
Container
(
padding:
const
EdgeInsets
.
only
(
left:
18
,
right:
15
),
color:
Colors
.
transparent
,
height:
52
,
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
[
Text
(
title
,
style:
const
TextStyle
(
fontSize:
14
,
color:
Colours
.
c3
,),),
Row
(
children:
[
Text
(
value
,
style:
const
TextStyle
(
fontSize:
14
,
color:
Colours
.
c9
,),),
Gaps
.
hGaps10
,
SizedBox
(
width:
5
,
height:
8
,
child:
Image
.
asset
(
'assets/images/right_arrow.png'
),
)
],
)
],
),
],
),
);
}
...
...
lib/routes/routes.dart
浏览文件 @
d43154ef
...
...
@@ -205,7 +205,7 @@ abstract class Routes {
pageBuilder:
(
context
,
state
)
=>
CupertinoPage
(
name:
state
.
uri
.
toString
(),
key:
state
.
pageKey
,
child:
const
UserInfoPage
(
)
child:
UserInfoPage
(
userInfo:
state
.
extra
as
UserInfoModel
,
)
)
),
GoRoute
(
...
...
lib/services/http.dart
浏览文件 @
d43154ef
...
...
@@ -38,8 +38,12 @@ class HttpService extends GetxService {
}
if
(
params
!=
null
)
{
params
.
addAll
(
headers
);
headers
[
'Sign'
]
=
SignTool
.
createSign
(
params
!);
}
headers
[
'Sign'
]
=
SignTool
.
createSign
(
params
!);
else
{
headers
[
'Sign'
]
=
SignTool
.
createSign
(
headers
);
}
// Console.log(headers);
return
headers
;
}
...
...
@@ -114,7 +118,7 @@ class HttpService extends GetxService {
requestOptions
.
headers
=
_getHeaders
(
excludeToken:
excludeToken
,
url:
url
);
final
name
=
path
.
substring
(
path
.
lastIndexOf
(
'/'
)
+
1
,
path
.
length
);
final
image
=
await
MultipartFile
.
fromFile
(
path
,
filename:
name
);
final
formData
=
FormData
.
fromMap
({
'file'
:
image
});
final
formData
=
FormData
.
fromMap
({
'file
s
'
:
image
});
final
response
=
await
_dio
.
post
(
url
,
data:
formData
,
...
...
lib/theme.dart
浏览文件 @
d43154ef
...
...
@@ -71,7 +71,7 @@ abstract class AppTheme {
static
ThemeData
get
light
{
var
scheme
=
ColorScheme
.
light
(
background:
Colo
rs
.
white
,
background:
Colo
urs
.
cF9
,
onBackground:
const
Color
(
0xFF333333
),
surface:
Colors
.
white
,
onSurface:
const
Color
(
0xFF333333
),
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论