Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
ChatGPT
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
关振斌
ChatGPT
Commits
5e105725
Commit
5e105725
authored
Jul 17, 2023
by
netyouli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复收藏报错,收藏列表显示错误bug
parent
67118e06
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
156 additions
and
46 deletions
+156
-46
lib/common/apis/news.dart
lib/common/apis/news.dart
+1
-1
lib/common/apis/user.dart
lib/common/apis/user.dart
+2
-2
lib/common/values/server.dart
lib/common/values/server.dart
+1
-1
lib/pages/ai-draw-image/image_square_list_view.dart
lib/pages/ai-draw-image/image_square_list_view.dart
+1
-0
lib/pages/my-work/controller.dart
lib/pages/my-work/controller.dart
+11
-10
lib/pages/my-work/models.dart
lib/pages/my-work/models.dart
+72
-1
lib/pages/my-work/view.dart
lib/pages/my-work/view.dart
+68
-31
No files found.
lib/common/apis/news.dart
View file @
5e105725
...
...
@@ -99,7 +99,7 @@ class NewsAPI {
// 收藏图片
static
Future
<
CommonResponse
>
updateCollectImg
(
String
imgUrl
,
int
isCancel
)
async
{
var
response
=
await
HttpUtil
().
post
(
'/
midJourney/createImageByBlend
'
,
data:
{
var
response
=
await
HttpUtil
().
post
(
'/
imgInfo/updateCollectImg
'
,
data:
{
"imgUrl"
:
imgUrl
,
"isCancel"
:
isCancel
,
"userId"
:
"
${UserStore.to.profile.id}
"
...
...
lib/common/apis/user.dart
View file @
5e105725
...
...
@@ -247,11 +247,11 @@ class UserAPI {
return
MyWorkResponse
.
fromJson
(
response
);
}
static
Future
<
My
Work
Response
>
getMyCollectImages
()
async
{
static
Future
<
My
Collect
Response
>
getMyCollectImages
()
async
{
var
response
=
await
HttpUtil
().
get
(
'/imgInfo/getCollectImg'
,
);
return
My
Work
Response
.
fromJson
(
response
);
return
My
Collect
Response
.
fromJson
(
response
);
}
static
Future
<
MyWorkResponse
>
getSquareImages
()
async
{
...
...
lib/common/values/server.dart
View file @
5e105725
...
...
@@ -12,7 +12,7 @@
// http://192.168.110.66:8083/api/doc.html
// const SERVER_API_URL = 'http://192.168.110.23:8083/api'; // 大黄蜂
const
SERVER_API_URL
=
'http://192.168.110.1
59
:8083/api'
;
// 清
const
SERVER_API_URL
=
'http://192.168.110.1
93
:8083/api'
;
// 清
// http://192.168.110.25:8083/
// const SERVER_API_URL = 'http://192.168.2.178:8083/api';
...
...
lib/pages/ai-draw-image/image_square_list_view.dart
View file @
5e105725
...
...
@@ -30,6 +30,7 @@ class ImageSquareListView extends StatelessWidget {
noDataText:
'没有更多数据啦'
),
child:
Obx
(()
=>
MasonryGridView
.
count
(
padding:
const
EdgeInsets
.
fromLTRB
(
10
,
10
,
10
,
10
),
itemCount:
controller
.
squareImgaes
.
value
.
length
,
crossAxisCount:
2
,
itemBuilder:
(
BuildContext
context
,
int
index
)
{
...
...
lib/pages/my-work/controller.dart
View file @
5e105725
...
...
@@ -23,7 +23,8 @@ import 'models.dart';
class
MyWorkController
extends
GetxController
{
late
var
refreshController
=
RefreshController
();
var
models
=
AIDrawTextToImageModel
();
var
images
=
Rx
<
List
<
MyWorkData
>>([]);
var
collectImages
=
Rx
<
List
<
MyCollectData
>>([]);
var
workImages
=
Rx
<
List
<
MyWorkData
>>([]);
var
title
=
""
.
obs
;
@override
...
...
@@ -42,8 +43,8 @@ class MyWorkController extends GetxController {
}
onClickImage
(
int
index
)
async
{
if
(
index
>=
0
&&
index
<
i
mages
.
value
.
length
)
{
final
item
=
i
mages
.
value
[
index
];
if
(
index
>=
0
&&
index
<
collectI
mages
.
value
.
length
)
{
final
item
=
collectI
mages
.
value
[
index
];
final
conversionId
=
await
UserAPI
.
createConversion
();
EasyLoading
.
dismiss
();
if
(
conversionId
==
401
)
{
...
...
@@ -54,13 +55,13 @@ class MyWorkController extends GetxController {
arguments:
{
"opearter"
:
OpearterType
.
imageResult
,
"conversionId"
:
conversionId
,
"imageUrls"
:
[
item
.
minio
Url
??
""
],
"enText"
:
item
.
content
,
"text"
:
item
.
content
,
"imageUrls"
:
[
item
.
img
Url
??
""
],
"enText"
:
""
,
"text"
:
""
,
"ratio"
:
"16:9"
,
"s"
:
""
,
"styleName"
:
item
.
style
??
"通用风格"
,
"messageId"
:
item
.
messageId
??
""
"styleName"
:
"通用风格"
,
"messageId"
:
""
});
}
}
...
...
@@ -78,7 +79,7 @@ class MyWorkController extends GetxController {
final
res
=
await
UserAPI
.
getMyWorkImages
();
EasyLoading
.
dismiss
();
if
(
res
.
status
==
200
)
{
i
mages
.
value
=
res
.
data
??
[];
workI
mages
.
value
=
res
.
data
??
[];
}
else
{
EasyLoading
.
showError
(
res
.
message
??
"请求我的作品异常"
);
}
...
...
@@ -96,7 +97,7 @@ class MyWorkController extends GetxController {
final
res
=
await
UserAPI
.
getMyCollectImages
();
EasyLoading
.
dismiss
();
if
(
res
.
status
==
200
)
{
i
mages
.
value
=
res
.
data
??
[];
collectI
mages
.
value
=
res
.
data
??
[];
}
else
{
EasyLoading
.
showError
(
res
.
message
??
"请求我的收藏异常"
);
}
...
...
lib/pages/my-work/models.dart
View file @
5e105725
...
...
@@ -36,7 +36,7 @@ class MyWorkData {
String
?
messageId
;
String
?
minioUrl
;
String
?
createTime
;
dynamic
style
;
String
?
style
;
int
?
showSquare
;
MyWorkData
(
...
...
@@ -76,3 +76,74 @@ class MyWorkData {
return
data
;
}
}
class
MyCollectResponse
{
int
?
status
;
String
?
message
;
List
<
MyCollectData
>?
data
;
int
?
timestamp
;
MyCollectResponse
({
this
.
status
,
this
.
message
,
this
.
data
,
this
.
timestamp
});
MyCollectResponse
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
status
=
json
[
'status'
];
message
=
json
[
'message'
];
if
(
json
[
'data'
]
!=
null
)
{
data
=
[];
json
[
'data'
].
forEach
((
v
)
{
data
?.
add
(
new
MyCollectData
.
fromJson
(
v
));
});
}
timestamp
=
json
[
'timestamp'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'status'
]
=
this
.
status
;
data
[
'message'
]
=
this
.
message
;
if
(
this
.
data
!=
null
)
{
data
[
'data'
]
=
this
.
data
?.
map
((
v
)
=>
v
.
toJson
()).
toList
();
}
data
[
'timestamp'
]
=
this
.
timestamp
;
return
data
;
}
}
class
MyCollectData
{
int
?
id
;
int
?
userId
;
String
?
imgUrl
;
int
?
isCancel
;
String
?
createTime
;
String
?
updateTime
;
MyCollectData
(
{
this
.
id
,
this
.
userId
,
this
.
imgUrl
,
this
.
isCancel
,
this
.
createTime
,
this
.
updateTime
});
MyCollectData
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
id
=
json
[
'id'
];
userId
=
json
[
'userId'
];
imgUrl
=
json
[
'imgUrl'
];
isCancel
=
json
[
'isCancel'
];
createTime
=
json
[
'createTime'
];
updateTime
=
json
[
'updateTime'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'id'
]
=
this
.
id
;
data
[
'userId'
]
=
this
.
userId
;
data
[
'imgUrl'
]
=
this
.
imgUrl
;
data
[
'isCancel'
]
=
this
.
isCancel
;
data
[
'createTime'
]
=
this
.
createTime
;
data
[
'updateTime'
]
=
this
.
updateTime
;
return
data
;
}
}
\ No newline at end of file
lib/pages/my-work/view.dart
View file @
5e105725
...
...
@@ -33,8 +33,10 @@ class MyWorkPage extends GetView<MyWorkController> {
loadingText:
"正在加载中..."
,
noDataText:
'没有更多数据啦'
),
child:
Obx
(()
=>
MasonryGridView
.
count
(
itemCount:
controller
.
images
.
value
.
length
,
child:
Obx
(()
{
if
(
controller
.
title
.
value
==
"我的收藏"
)
{
return
MasonryGridView
.
count
(
itemCount:
controller
.
collectImages
.
value
.
length
,
crossAxisCount:
2
,
itemBuilder:
(
BuildContext
context
,
int
index
)
{
return
InkWell
(
...
...
@@ -46,7 +48,7 @@ class MyWorkPage extends GetView<MyWorkController> {
child:
CachedNetworkImage
(
fit:
BoxFit
.
cover
,
height:
index
%
2
==
0
?
260
:
200
,
imageUrl:
controller
.
images
.
value
[
index
].
minio
Url
??
""
,
imageUrl:
controller
.
collectImages
.
value
[
index
].
img
Url
??
""
,
placeholder:
(
context
,
url
)
=>
Container
(
alignment:
Alignment
.
center
,
child:
const
SizedBox
(
...
...
@@ -65,7 +67,42 @@ class MyWorkPage extends GetView<MyWorkController> {
},
mainAxisSpacing:
10.0
,
crossAxisSpacing:
10.0
,
))
);
}
return
MasonryGridView
.
count
(
itemCount:
controller
.
workImages
.
value
.
length
,
crossAxisCount:
2
,
itemBuilder:
(
BuildContext
context
,
int
index
)
{
return
InkWell
(
onTap:
()
{
controller
.
onClickImage
(
index
);
},
child:
ClipRRect
(
borderRadius:
BorderRadius
.
circular
(
10
),
child:
CachedNetworkImage
(
fit:
BoxFit
.
cover
,
height:
index
%
2
==
0
?
260
:
200
,
imageUrl:
controller
.
workImages
.
value
[
index
].
minioUrl
??
""
,
placeholder:
(
context
,
url
)
=>
Container
(
alignment:
Alignment
.
center
,
child:
const
SizedBox
(
width:
30
,
height:
30
,
child:
CircularProgressIndicator
(),
),
),
errorWidget:
(
context
,
url
,
error
)
=>
Container
(
alignment:
Alignment
.
center
,
child:
Text
(
error
.
toString
()),
),
)
),
);
},
mainAxisSpacing:
10.0
,
crossAxisSpacing:
10.0
,
);
})
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment