mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-08-02 16:50:13 +08:00
opt handle res
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -6,7 +6,10 @@ import 'package:PiliPlus/grpc/view.dart';
|
||||
import 'package:PiliPlus/http/constants.dart';
|
||||
import 'package:PiliPlus/http/user.dart';
|
||||
import 'package:PiliPlus/http/video.dart';
|
||||
import 'package:PiliPlus/models/pgc/info.dart';
|
||||
import 'package:PiliPlus/models/pgc/pgc_info_model/episode.dart';
|
||||
import 'package:PiliPlus/models/pgc/pgc_info_model/result.dart';
|
||||
import 'package:PiliPlus/models/pgc_lcf.dart';
|
||||
import 'package:PiliPlus/models/triple/pgc_triple.dart';
|
||||
import 'package:PiliPlus/models/user/fav_folder.dart';
|
||||
import 'package:PiliPlus/models/video_tag/data.dart';
|
||||
import 'package:PiliPlus/pages/dynamics_repost/view.dart';
|
||||
@@ -87,9 +90,10 @@ class BangumiIntroController extends GetxController {
|
||||
Future<void> queryBangumiLikeCoinFav() async {
|
||||
var result = await VideoHttp.bangumiLikeCoinFav(epId: epId);
|
||||
if (result['status']) {
|
||||
hasLike.value = result["data"]['like'] == 1;
|
||||
_coinNum.value = result["data"]['coin_number'];
|
||||
hasFav.value = result["data"]['favorite'] == 1;
|
||||
PgcLCF data = result['data'];
|
||||
hasLike.value = data.like == 1;
|
||||
_coinNum.value = data.coinNumber!;
|
||||
hasFav.value = data.favorite == 1;
|
||||
} else {
|
||||
SmartDialog.showToast(result['msg']);
|
||||
}
|
||||
@@ -100,8 +104,8 @@ class BangumiIntroController extends GetxController {
|
||||
var result = await VideoHttp.likeVideo(bvid: bvid, type: !hasLike.value);
|
||||
if (result['status']) {
|
||||
SmartDialog.showToast(!hasLike.value ? result['data']['toast'] : '取消赞');
|
||||
bangumiItem.stat!['likes'] =
|
||||
bangumiItem.stat!['likes'] + (!hasLike.value ? 1 : -1);
|
||||
bangumiItem.stat!.likes =
|
||||
bangumiItem.stat!.likes! + (!hasLike.value ? 1 : -1);
|
||||
hasLike.value = !hasLike.value;
|
||||
} else {
|
||||
SmartDialog.showToast(result['msg']);
|
||||
@@ -116,10 +120,10 @@ class BangumiIntroController extends GetxController {
|
||||
);
|
||||
if (res['status']) {
|
||||
SmartDialog.showToast('投币成功');
|
||||
bangumiItem.stat!['coins'] = bangumiItem.stat!['coins'] + coin;
|
||||
bangumiItem.stat!.coins = bangumiItem.stat!.coins! + coin;
|
||||
if (selectLike && hasLike.value.not) {
|
||||
hasLike.value = true;
|
||||
bangumiItem.stat!['likes'] = bangumiItem.stat!['likes'] + 1;
|
||||
bangumiItem.stat!.likes = bangumiItem.stat!.likes! + 1;
|
||||
}
|
||||
_coinNum.value += coin;
|
||||
GlobalData().afterCoin(coin);
|
||||
@@ -517,12 +521,13 @@ class BangumiIntroController extends GetxController {
|
||||
}
|
||||
var result = await VideoHttp.triple(epId: epId, seasonId: seasonId);
|
||||
if (result['status']) {
|
||||
hasLike.value = result["data"]["like"] == 1;
|
||||
if (result["data"]["coin"] == 1) {
|
||||
PgcTriple data = result['data'];
|
||||
hasLike.value = data.like == 1;
|
||||
if (data.coin == 1) {
|
||||
_coinNum.value = 2;
|
||||
GlobalData().afterCoin(2);
|
||||
}
|
||||
hasFav.value = result["data"]["favorite"] == 1;
|
||||
hasFav.value = data.favorite == 1;
|
||||
SmartDialog.showToast('三连成功');
|
||||
} else {
|
||||
SmartDialog.showToast(result['msg']);
|
||||
@@ -534,7 +539,7 @@ class BangumiIntroController extends GetxController {
|
||||
|
||||
Future<void> queryIsFollowed() async {
|
||||
// try {
|
||||
// dynamic result = await Request().get(
|
||||
// var result = await Request().get(
|
||||
// 'https://www.bilibili.com/bangumi/play/ss$seasonId',
|
||||
// );
|
||||
// dom.Document document = html_parser.parse(result.data);
|
||||
|
||||
@@ -6,7 +6,7 @@ import 'package:PiliPlus/common/widgets/dialog/dialog.dart';
|
||||
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
||||
import 'package:PiliPlus/common/widgets/stat/stat.dart';
|
||||
import 'package:PiliPlus/models/common/image_preview_type.dart';
|
||||
import 'package:PiliPlus/models/pgc/info.dart';
|
||||
import 'package:PiliPlus/models/pgc/pgc_info_model/result.dart';
|
||||
import 'package:PiliPlus/pages/video/controller.dart';
|
||||
import 'package:PiliPlus/pages/video/introduction/pgc/controller.dart';
|
||||
import 'package:PiliPlus/pages/video/introduction/pgc/widgets/bangumi_panel.dart';
|
||||
@@ -114,7 +114,7 @@ class _BangumiIntroPanelState extends State<BangumiIntroPanel>
|
||||
),
|
||||
if (bangumiItem.rating != null)
|
||||
PBadge(
|
||||
text: '评分 ${bangumiItem.rating!['score']!}',
|
||||
text: '评分 ${bangumiItem.rating!.score!}',
|
||||
top: null,
|
||||
right: 6,
|
||||
bottom: 6,
|
||||
@@ -209,14 +209,13 @@ class _BangumiIntroPanelState extends State<BangumiIntroPanel>
|
||||
StatView(
|
||||
context: context,
|
||||
theme: 'gray',
|
||||
value:
|
||||
Utils.numFormat(bangumiItem.stat!['views']),
|
||||
value: Utils.numFormat(bangumiItem.stat!.views),
|
||||
),
|
||||
StatDanMu(
|
||||
context: context,
|
||||
theme: 'gray',
|
||||
value: Utils.numFormat(
|
||||
bangumiItem.stat!['danmakus']),
|
||||
value:
|
||||
Utils.numFormat(bangumiItem.stat!.danmakus),
|
||||
),
|
||||
if (isLandscape) ...[
|
||||
areasAndPubTime(theme, bangumiItem),
|
||||
@@ -287,7 +286,7 @@ class _BangumiIntroPanelState extends State<BangumiIntroPanel>
|
||||
selectStatus: bangumiIntroController.hasLike.value,
|
||||
isLoading: false,
|
||||
semanticsLabel: '点赞',
|
||||
text: Utils.numFormat(bangumiItem.stat!['likes']!),
|
||||
text: Utils.numFormat(bangumiItem.stat!.likes),
|
||||
needAnim: true,
|
||||
hasTriple: bangumiIntroController.hasLike.value &&
|
||||
bangumiIntroController.hasCoin &&
|
||||
@@ -314,7 +313,7 @@ class _BangumiIntroPanelState extends State<BangumiIntroPanel>
|
||||
selectStatus: bangumiIntroController.hasCoin,
|
||||
isLoading: false,
|
||||
semanticsLabel: '投币',
|
||||
text: Utils.numFormat(bangumiItem.stat!['coins']!),
|
||||
text: Utils.numFormat(bangumiItem.stat!.coins),
|
||||
needAnim: true,
|
||||
),
|
||||
),
|
||||
@@ -330,7 +329,7 @@ class _BangumiIntroPanelState extends State<BangumiIntroPanel>
|
||||
selectStatus: bangumiIntroController.hasFav.value,
|
||||
isLoading: false,
|
||||
semanticsLabel: '收藏',
|
||||
text: Utils.numFormat(bangumiItem.stat!['favorite']!),
|
||||
text: Utils.numFormat(bangumiItem.stat!.favorite),
|
||||
needAnim: true,
|
||||
),
|
||||
),
|
||||
@@ -341,7 +340,7 @@ class _BangumiIntroPanelState extends State<BangumiIntroPanel>
|
||||
selectStatus: false,
|
||||
isLoading: false,
|
||||
semanticsLabel: '评论',
|
||||
text: Utils.numFormat(bangumiItem.stat!['reply']!),
|
||||
text: Utils.numFormat(bangumiItem.stat!.reply),
|
||||
),
|
||||
ActionItem(
|
||||
icon: const Icon(FontAwesomeIcons.shareFromSquare),
|
||||
@@ -349,7 +348,7 @@ class _BangumiIntroPanelState extends State<BangumiIntroPanel>
|
||||
selectStatus: false,
|
||||
isLoading: false,
|
||||
semanticsLabel: '转发',
|
||||
text: Utils.numFormat(bangumiItem.stat!['share']!),
|
||||
text: Utils.numFormat(bangumiItem.stat!.share),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -372,7 +371,7 @@ class _BangumiIntroPanelState extends State<BangumiIntroPanel>
|
||||
onTap: () => handleState(bangumiIntroController.actionLikeVideo),
|
||||
selectStatus: bangumiIntroController.hasLike.value,
|
||||
isLoading: false,
|
||||
text: bangumiItem.stat!['likes']!.toString(),
|
||||
text: bangumiItem.stat!.likes!.toString(),
|
||||
),
|
||||
),
|
||||
Obx(
|
||||
@@ -381,7 +380,7 @@ class _BangumiIntroPanelState extends State<BangumiIntroPanel>
|
||||
onTap: () => handleState(bangumiIntroController.actionCoinVideo),
|
||||
selectStatus: bangumiIntroController.hasCoin,
|
||||
isLoading: false,
|
||||
text: bangumiItem.stat!['coins']!.toString(),
|
||||
text: bangumiItem.stat!.coins!.toString(),
|
||||
),
|
||||
),
|
||||
Obx(
|
||||
@@ -392,7 +391,7 @@ class _BangumiIntroPanelState extends State<BangumiIntroPanel>
|
||||
.showFavBottomSheet(context, type: 'longPress'),
|
||||
selectStatus: bangumiIntroController.hasFav.value,
|
||||
isLoading: false,
|
||||
text: bangumiItem.stat!['favorite']!.toString(),
|
||||
text: bangumiItem.stat!.favorite!.toString(),
|
||||
),
|
||||
),
|
||||
ActionRowItem(
|
||||
@@ -400,7 +399,7 @@ class _BangumiIntroPanelState extends State<BangumiIntroPanel>
|
||||
onTap: () => videoDetailCtr.tabCtr.animateTo(1),
|
||||
selectStatus: false,
|
||||
isLoading: false,
|
||||
text: bangumiItem.stat!['reply']!.toString(),
|
||||
text: bangumiItem.stat!.reply!.toString(),
|
||||
),
|
||||
ActionRowItem(
|
||||
icon: const Icon(FontAwesomeIcons.share),
|
||||
@@ -418,16 +417,14 @@ class _BangumiIntroPanelState extends State<BangumiIntroPanel>
|
||||
spacing: 6,
|
||||
children: [
|
||||
Text(
|
||||
(bangumiItem.areas!.isNotEmpty
|
||||
? bangumiItem.areas!.first['name']
|
||||
: ''),
|
||||
(bangumiItem.areas!.isNotEmpty ? bangumiItem.areas!.first.name! : ''),
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: theme.colorScheme.outline,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
bangumiItem.publish!['pub_time_show'],
|
||||
bangumiItem.publish!.pubTimeShow!,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: theme.colorScheme.outline,
|
||||
@@ -439,7 +436,7 @@ class _BangumiIntroPanelState extends State<BangumiIntroPanel>
|
||||
|
||||
Widget newEpDesc(ThemeData theme, BangumiInfoModel bangumiItem) {
|
||||
return Text(
|
||||
bangumiItem.newEp!['desc'],
|
||||
bangumiItem.newEp!.desc!,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: theme.colorScheme.outline,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:PiliPlus/models/pgc/info.dart';
|
||||
import 'package:PiliPlus/models/pgc/pgc_info_model/episode.dart';
|
||||
import 'package:PiliPlus/models/pgc/pgc_info_model/new_ep.dart';
|
||||
import 'package:PiliPlus/pages/video/controller.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
@@ -24,7 +25,7 @@ class BangumiPanel extends StatefulWidget {
|
||||
final Function changeFuc;
|
||||
final Function showEpisodes;
|
||||
final String heroTag;
|
||||
final dynamic newEp;
|
||||
final NewEp? newEp;
|
||||
|
||||
@override
|
||||
State<BangumiPanel> createState() => _BangumiPanelState();
|
||||
@@ -116,9 +117,9 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
||||
cid,
|
||||
),
|
||||
child: Text(
|
||||
widget.newEp?['desc']?.contains('连载') == true
|
||||
? '连载中,更新至${Utils.isStringNumeric(widget.newEp['title']) ? '第${widget.newEp?['title']}话' : '${widget.newEp?['title']}'}'
|
||||
: widget.newEp?['desc'],
|
||||
widget.newEp?.desc?.contains('连载') == true
|
||||
? '连载中,更新至${Utils.isStringNumeric(widget.newEp!.title) ? '第${widget.newEp!.title}话' : '${widget.newEp!.title}'}'
|
||||
: widget.newEp?.desc ?? '',
|
||||
style: const TextStyle(fontSize: 13),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -3,7 +3,7 @@ import 'package:PiliPlus/common/widgets/keep_alive_wrapper.dart';
|
||||
import 'package:PiliPlus/common/widgets/page/tabs.dart';
|
||||
import 'package:PiliPlus/common/widgets/scroll_physics.dart';
|
||||
import 'package:PiliPlus/common/widgets/stat/stat.dart';
|
||||
import 'package:PiliPlus/models/pgc/info.dart';
|
||||
import 'package:PiliPlus/models/pgc/pgc_info_model/result.dart';
|
||||
import 'package:PiliPlus/models/video_tag/data.dart';
|
||||
import 'package:PiliPlus/pages/common/common_collapse_slide_page.dart';
|
||||
import 'package:PiliPlus/pages/pgc_review/view.dart';
|
||||
@@ -110,13 +110,13 @@ class _IntroDetailState extends CommonCollapseSlidePageState<IntroDetail> {
|
||||
StatView(
|
||||
context: context,
|
||||
theme: 'gray',
|
||||
value: Utils.numFormat(widget.bangumiDetail.stat!['views']),
|
||||
value: Utils.numFormat(widget.bangumiDetail.stat!.views),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
StatDanMu(
|
||||
context: context,
|
||||
theme: 'gray',
|
||||
value: Utils.numFormat(widget.bangumiDetail.stat!['danmakus']),
|
||||
value: Utils.numFormat(widget.bangumiDetail.stat!.danmakus),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -124,17 +124,17 @@ class _IntroDetailState extends CommonCollapseSlidePageState<IntroDetail> {
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
widget.bangumiDetail.areas!.first['name'],
|
||||
widget.bangumiDetail.areas!.first.name!,
|
||||
style: smallTitle,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
widget.bangumiDetail.publish!['pub_time_show'],
|
||||
widget.bangumiDetail.publish!.pubTimeShow!,
|
||||
style: smallTitle,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
widget.bangumiDetail.newEp!['desc'],
|
||||
widget.bangumiDetail.newEp!.desc!,
|
||||
style: smallTitle,
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user