Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2026-01-02 12:05:31 +08:00
parent 80e007bac6
commit 041af37bb0
67 changed files with 775 additions and 838 deletions

View File

@@ -1,5 +1,6 @@
import 'package:PiliPlus/common/widgets/dialog/dialog.dart';
import 'package:PiliPlus/http/dynamics.dart';
import 'package:PiliPlus/http/loading_state.dart';
import 'package:PiliPlus/http/msg.dart';
import 'package:PiliPlus/models/dynamics/vote_model.dart';
import 'package:PiliPlus/utils/accounts.dart';
@@ -56,15 +57,16 @@ class CreateVoteController extends GetxController {
Future<void> queryData() async {
final res = await DynamicsHttp.voteInfo(voteId);
if (res.isSuccess) {
if (res case Success(:final response)) {
key = Utils.generateRandomString(6);
final VoteInfo data = res.data;
title.value = data.title!;
desc.value = data.desc ?? '';
type.value = data.options.first.imgUrl?.isNotEmpty == true ? 1 : 0;
options.value = data.options;
choiceCnt.value = data.choiceCnt!;
endtime.value = DateTime.fromMillisecondsSinceEpoch(data.endTime! * 1000);
title.value = response.title!;
desc.value = response.desc ?? '';
type.value = response.options.first.imgUrl?.isNotEmpty == true ? 1 : 0;
options.value = response.options;
choiceCnt.value = response.choiceCnt!;
endtime.value = DateTime.fromMillisecondsSinceEpoch(
response.endTime! * 1000,
);
canCreate.value = true;
} else {
showConfirmDialog(
@@ -98,8 +100,8 @@ class CreateVoteController extends GetxController {
final res = await (voteId == null
? DynamicsHttp.createVote(voteInfo)
: DynamicsHttp.updateVote(voteInfo));
if (res.isSuccess) {
voteInfo.voteId = res.data;
if (res case Success(:final response)) {
voteInfo.voteId = response;
Get.back(result: voteInfo);
} else {
res.toast();
@@ -112,9 +114,9 @@ class CreateVoteController extends GetxController {
category: 'daily',
biz: 'vote',
);
if (res.isSuccess) {
if (res case Success(:final response)) {
options
..[index].imgUrl = res.data.imageUrl
..[index].imgUrl = response.imageUrl
..refresh();
updateCanCreate();
} else {