diff --git a/lib/http/api.dart b/lib/http/api.dart index 872cedd5..ba12b485 100644 --- a/lib/http/api.dart +++ b/lib/http/api.dart @@ -1,6 +1,7 @@ class Api { // 推荐视频 - // http://app.bilibili.com/x/v2/feed/index + // static const String recommendList = + // 'https://app.bilibili.com/x/v2/feed/index?appkey=27eb53fc9058f8c3'; static const String recommendList = '/x/web-interface/index/top/feed/rcmd'; // 热门视频 diff --git a/lib/http/init.dart b/lib/http/init.dart index 767de50f..925b5633 100644 --- a/lib/http/init.dart +++ b/lib/http/init.dart @@ -82,9 +82,14 @@ class Request { //响应流上前后两次接受到数据的间隔,单位为毫秒。 receiveTimeout: const Duration(milliseconds: 12000), //Http请求头. - // headers: { - // 'cookie': '', - // }, + headers: { + // 'cookie': '', + "env": 'prod', + "app-key": 'android', + "x-bili-aurora-eid": 'UlMFQVcABlAH', + "x-bili-aurora-zone": 'sh001', + // "x-bili-mid": '' + }, ); dio.options = options; diff --git a/lib/models/search/result.dart b/lib/models/search/result.dart index 9e2d9cbd..08adad59 100644 --- a/lib/models/search/result.dart +++ b/lib/models/search/result.dart @@ -1,4 +1,5 @@ import 'package:pilipala/utils/em.dart'; +import 'package:pilipala/utils/utils.dart'; class SearchVideoModel { SearchVideoModel({this.list}); @@ -86,25 +87,12 @@ class SearchVideoItemModel { videoReview = json['video_review']; pubdate = json['pubdate']; senddate = json['senddate']; - duration = _dutation(json['duration']); + duration = Utils.duration(json['duration']); owner = Owner.fromJson(json); stat = Stat.fromJson(json); } } -_dutation(String duration) { - List timeList = duration.split(':'); - int len = timeList.length; - if (len == 2) { - return int.parse(timeList[0]) * 60 + int.parse(timeList[1]); - } - if (len == 3) { - return int.parse(timeList[0]) * 3600 + - int.parse(timeList[1]) * 60 + - timeList[2]; - } -} - class Stat { Stat({ this.view, diff --git a/lib/pages/home/widgets/app_bar.dart b/lib/pages/home/widgets/app_bar.dart index 7d3d131e..6f851df9 100644 --- a/lib/pages/home/widgets/app_bar.dart +++ b/lib/pages/home/widgets/app_bar.dart @@ -73,6 +73,7 @@ class HomeAppBar extends StatelessWidget { src: userInfoCache.get('userInfoCache').face, ), ), + const SizedBox(width: 10), ] else ...[ IconButton( onPressed: () => showModalBottomSheet( diff --git a/lib/pages/media/controller.dart b/lib/pages/media/controller.dart index 79336c98..88fef372 100644 --- a/lib/pages/media/controller.dart +++ b/lib/pages/media/controller.dart @@ -42,7 +42,7 @@ class MediaController extends GetxController { } Future queryFavFolder() async { - if (!userLogin.value) { + if (!userLogin.value || GStrorage.user.get(UserBoxKey.userMid) == null) { return {'status': false, 'data': [], 'msg': '未登录'}; } var res = await await UserHttp.userfavFolder( diff --git a/lib/pages/media/view.dart b/lib/pages/media/view.dart index 82cb80a2..0860ddb9 100644 --- a/lib/pages/media/view.dart +++ b/lib/pages/media/view.dart @@ -119,9 +119,9 @@ class MediaPage extends StatelessWidget { mediaController.favFolderData.value.count!; bool flag = favFolderCount > favFolderList.length; return Obx(() => ListView.builder( - itemCount: mediaController - .favFolderData.value.list!.length + - (flag ? 1 : 0), + itemCount: + mediaController.favFolderData.value.list!.length + + (flag ? 1 : 0), itemBuilder: (context, index) { if (flag && index == favFolderList.length) { return Padding( diff --git a/lib/pages/video/detail/reply/widgets/reply_item.dart b/lib/pages/video/detail/reply/widgets/reply_item.dart index c8624094..7564f146 100644 --- a/lib/pages/video/detail/reply/widgets/reply_item.dart +++ b/lib/pages/video/detail/reply/widgets/reply_item.dart @@ -2,6 +2,7 @@ import 'dart:developer'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_meedu_media_kit/meedu_player.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:get/get.dart'; import 'package:pilipala/common/widgets/network_img_layer.dart'; @@ -467,6 +468,9 @@ InlineSpan buildContent(BuildContext context, content) { }); } // content.message = content.message.replaceAll(RegExp(r"\{vote:.*?\}"), ' '); + if (content.message.contains('&')) { + content.message = content.message.replaceAll('&', '&'); + } // 匹配表情 content.message.splitMapJoin( RegExp(r"\[.*?\]"), @@ -584,10 +588,14 @@ InlineSpan buildContent(BuildContext context, content) { style: TextStyle( color: Theme.of(context).colorScheme.primary, ), - // recognizer: TapGestureRecognizer() - // ..onTap = () => { - // print('time 点击'), - // }, + recognizer: TapGestureRecognizer() + ..onTap = () { + Get.find(tag: Get.arguments['heroTag']) + .meeduPlayerController + .seekTo( + Duration(seconds: Utils.duration(matchStr)), + ); + }, ), ); return ''; diff --git a/lib/utils/utils.dart b/lib/utils/utils.dart index 61e644d6..ce49b625 100644 --- a/lib/utils/utils.dart +++ b/lib/utils/utils.dart @@ -142,4 +142,18 @@ class Utils { static String makeHeroTag(v) { return v.toString() + Random().nextInt(9999).toString(); } + + static int duration(String duration) { + List timeList = duration.split(':'); + int len = timeList.length; + if (len == 2) { + return int.parse(timeList[0]) * 60 + int.parse(timeList[1]); + } + if (len == 3) { + return int.parse(timeList[0]) * 3600 + + int.parse(timeList[1]) * 60 + + int.parse(timeList[2]); + } + return 0; + } }