Merge branch 'design'
This commit is contained in:
@ -15,5 +15,4 @@ class Constants {
|
|||||||
// 59b43e04ad6965f34319062b478f83dd TV端
|
// 59b43e04ad6965f34319062b478f83dd TV端
|
||||||
static const String appSec = '59b43e04ad6965f34319062b478f83dd';
|
static const String appSec = '59b43e04ad6965f34319062b478f83dd';
|
||||||
static const String thirdSign = '04224646d1fea004e79606d3b038c84a';
|
static const String thirdSign = '04224646d1fea004e79606d3b038c84a';
|
||||||
static const List<int> publicFavFolder = <int>[0, 2, 22];
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
import 'package:connectivity_plus/connectivity_plus.dart';
|
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
|
import 'package:pilipala/utils/login.dart';
|
||||||
|
|
||||||
class ApiInterceptor extends Interceptor {
|
class ApiInterceptor extends Interceptor {
|
||||||
@override
|
@override
|
||||||
@ -18,6 +19,9 @@ class ApiInterceptor extends Interceptor {
|
|||||||
void onResponse(Response response, ResponseInterceptorHandler handler) {
|
void onResponse(Response response, ResponseInterceptorHandler handler) {
|
||||||
try {
|
try {
|
||||||
// 在响应之后处理数据
|
// 在响应之后处理数据
|
||||||
|
if (response.data is Map && response.data['code'] == -101) {
|
||||||
|
LoginUtils.loginOut();
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
print('ApiInterceptor: $err');
|
print('ApiInterceptor: $err');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -516,4 +516,34 @@ class UserHttp {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 解析up投稿
|
||||||
|
static Future parseUpArchiveVideo({
|
||||||
|
required int mid,
|
||||||
|
required int oid,
|
||||||
|
required String bvid,
|
||||||
|
String sortField = 'pubtime',
|
||||||
|
}) async {
|
||||||
|
var res = await Request().get(
|
||||||
|
'https://www.bilibili.com/list/$mid',
|
||||||
|
data: {
|
||||||
|
'oid': oid,
|
||||||
|
'bvid': bvid,
|
||||||
|
'sort_field': sortField,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
String scriptContent =
|
||||||
|
extractScriptContents(parse(res.data).body!.outerHtml)[0];
|
||||||
|
int startIndex = scriptContent.indexOf('{');
|
||||||
|
int endIndex = scriptContent.lastIndexOf('};');
|
||||||
|
String jsonContent = scriptContent.substring(startIndex, endIndex + 1);
|
||||||
|
// 解析JSON字符串为Map
|
||||||
|
Map<String, dynamic> jsonData = json.decode(jsonContent);
|
||||||
|
return {
|
||||||
|
'status': true,
|
||||||
|
'data': jsonData['resourceList']
|
||||||
|
.map<MediaVideoItemModel>((e) => MediaVideoItemModel.fromJson(e))
|
||||||
|
.toList()
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -97,6 +97,8 @@ class VideoHttp {
|
|||||||
for (var i in res.data['data']['items']) {
|
for (var i in res.data['data']['items']) {
|
||||||
// 屏蔽推广和拉黑用户
|
// 屏蔽推广和拉黑用户
|
||||||
if (i['card_goto'] != 'ad_av' &&
|
if (i['card_goto'] != 'ad_av' &&
|
||||||
|
i['card_goto'] != 'ad_web_s' &&
|
||||||
|
i['card_goto'] != 'ad_web' &&
|
||||||
(!enableRcmdDynamic ? i['card_goto'] != 'picture' : true) &&
|
(!enableRcmdDynamic ? i['card_goto'] != 'picture' : true) &&
|
||||||
(i['args'] != null &&
|
(i['args'] != null &&
|
||||||
!blackMidsList.contains(i['args']['up_mid']))) {
|
!blackMidsList.contains(i['args']['up_mid']))) {
|
||||||
|
|||||||
@ -24,7 +24,7 @@ class BangumiIntroController extends GetxController {
|
|||||||
// 视频bvid
|
// 视频bvid
|
||||||
String bvid = Get.parameters['bvid']!;
|
String bvid = Get.parameters['bvid']!;
|
||||||
var seasonId = Get.parameters['seasonId'] != null
|
var seasonId = Get.parameters['seasonId'] != null
|
||||||
? int.parse(Get.parameters['seasonId']!)
|
? int.tryParse(Get.parameters['seasonId']!)
|
||||||
: null;
|
: null;
|
||||||
var epId = Get.parameters['epId'] != null
|
var epId = Get.parameters['epId'] != null
|
||||||
? int.tryParse(Get.parameters['epId']!)
|
? int.tryParse(Get.parameters['epId']!)
|
||||||
@ -69,6 +69,7 @@ class BangumiIntroController extends GetxController {
|
|||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
|
print('bangumi: ${Get.parameters.toString()}');
|
||||||
userInfo = userInfoCache.get('userInfoCache');
|
userInfo = userInfoCache.get('userInfoCache');
|
||||||
userLogin = userInfo != null;
|
userLogin = userInfo != null;
|
||||||
if (userLogin && seasonId != null) {
|
if (userLogin && seasonId != null) {
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:pilipala/common/constants.dart';
|
import 'package:pilipala/common/constants.dart';
|
||||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||||
|
import 'package:pilipala/utils/logic_utils.dart';
|
||||||
import 'package:pilipala/utils/utils.dart';
|
import 'package:pilipala/utils/utils.dart';
|
||||||
|
|
||||||
class FavItem extends StatelessWidget {
|
class FavItem extends StatelessWidget {
|
||||||
@ -96,9 +97,7 @@ class VideoContent extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
Text(
|
Text(
|
||||||
Constants.publicFavFolder.contains(favFolderItem.attr)
|
LogicUtils.isPublic(favFolderItem.attr) ? '公开' : '私密',
|
||||||
? '公开'
|
|
||||||
: '私密',
|
|
||||||
textAlign: TextAlign.start,
|
textAlign: TextAlign.start,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: Theme.of(context).textTheme.labelMedium!.fontSize,
|
fontSize: Theme.of(context).textTheme.labelMedium!.fontSize,
|
||||||
|
|||||||
@ -1,14 +1,16 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:pilipala/http/member.dart';
|
import 'package:pilipala/http/member.dart';
|
||||||
|
import 'package:pilipala/http/search.dart';
|
||||||
import 'package:pilipala/models/member/archive.dart';
|
import 'package:pilipala/models/member/archive.dart';
|
||||||
import 'package:pilipala/utils/global_data_cache.dart';
|
import 'package:pilipala/utils/global_data_cache.dart';
|
||||||
|
import 'package:pilipala/utils/utils.dart';
|
||||||
|
|
||||||
class MemberArchiveController extends GetxController {
|
class MemberArchiveController extends GetxController {
|
||||||
final ScrollController scrollController = ScrollController();
|
final ScrollController scrollController = ScrollController();
|
||||||
late int mid;
|
late int mid;
|
||||||
int pn = 1;
|
int pn = 1;
|
||||||
int count = 0;
|
RxInt count = 0.obs;
|
||||||
RxMap<String, String> currentOrder = <String, String>{}.obs;
|
RxMap<String, String> currentOrder = <String, String>{}.obs;
|
||||||
RxList<Map<String, String>> orderList = [
|
RxList<Map<String, String>> orderList = [
|
||||||
{'type': 'pubdate', 'label': '最新发布'},
|
{'type': 'pubdate', 'label': '最新发布'},
|
||||||
@ -50,11 +52,11 @@ class MemberArchiveController extends GetxController {
|
|||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
if (type == 'init') {
|
if (type == 'init') {
|
||||||
archivesList.value = res['data'].list.vlist;
|
archivesList.value = res['data'].list.vlist;
|
||||||
|
count.value = res['data'].page['count'];
|
||||||
}
|
}
|
||||||
if (type == 'onLoad') {
|
if (type == 'onLoad') {
|
||||||
archivesList.addAll(res['data'].list.vlist);
|
archivesList.addAll(res['data'].list.vlist);
|
||||||
}
|
}
|
||||||
count = res['data'].page['count'];
|
|
||||||
pn += 1;
|
pn += 1;
|
||||||
}
|
}
|
||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
@ -76,4 +78,29 @@ class MemberArchiveController extends GetxController {
|
|||||||
Future onLoad() async {
|
Future onLoad() async {
|
||||||
getMemberArchive('onLoad');
|
getMemberArchive('onLoad');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future toViewPlayAll() async {
|
||||||
|
final VListItemModel firstItem = archivesList.first;
|
||||||
|
final String bvid = firstItem.bvid!;
|
||||||
|
final int cid = await SearchHttp.ab2c(bvid: bvid);
|
||||||
|
final String heroTag = Utils.makeHeroTag(bvid);
|
||||||
|
late Map sortFieldMap = {
|
||||||
|
'pubdate': 'pubtime',
|
||||||
|
'click': 'play',
|
||||||
|
'fav': 'fav',
|
||||||
|
};
|
||||||
|
Get.toNamed(
|
||||||
|
'/video?bvid=${firstItem.bvid}&cid=$cid',
|
||||||
|
arguments: {
|
||||||
|
'videoItem': firstItem,
|
||||||
|
'heroTag': heroTag,
|
||||||
|
'sourceType': 'up_archive',
|
||||||
|
'oid': firstItem.aid,
|
||||||
|
'favTitle': '${firstItem.owner!.name!} - ${currentOrder['label']!}',
|
||||||
|
'favInfo': firstItem,
|
||||||
|
'count': count.value,
|
||||||
|
'sortField': sortFieldMap[currentOrder['type']],
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -135,6 +135,15 @@ class _MemberArchivePageState extends State<MemberArchivePage> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
floatingActionButton: Obx(
|
||||||
|
() => _memberArchivesController.count > 0
|
||||||
|
? FloatingActionButton.extended(
|
||||||
|
onPressed: _memberArchivesController.toViewPlayAll,
|
||||||
|
label: const Text('播放全部'),
|
||||||
|
icon: const Icon(Icons.playlist_play),
|
||||||
|
)
|
||||||
|
: const SizedBox(),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -61,16 +61,7 @@ class SettingController extends GetxController {
|
|||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
// 清空cookie
|
await LoginUtils.loginOut();
|
||||||
await Request.cookieManager.cookieJar.deleteAll();
|
|
||||||
Request.dio.options.headers['cookie'] = '';
|
|
||||||
|
|
||||||
// 清空本地存储的用户标识
|
|
||||||
userInfoCache.put('userInfoCache', null);
|
|
||||||
localCache
|
|
||||||
.put(LocalCacheKey.accessKey, {'mid': -1, 'value': ''});
|
|
||||||
|
|
||||||
await LoginUtils.refreshLoginStatus(false);
|
|
||||||
SmartDialog.dismiss().then((value) => Get.back());
|
SmartDialog.dismiss().then((value) => Get.back());
|
||||||
},
|
},
|
||||||
child: const Text('确认'),
|
child: const Text('确认'),
|
||||||
|
|||||||
@ -119,6 +119,7 @@ class VideoDetailController extends GetxController
|
|||||||
List<MediaVideoItemModel> mediaList = <MediaVideoItemModel>[];
|
List<MediaVideoItemModel> mediaList = <MediaVideoItemModel>[];
|
||||||
RxBool isWatchLaterVisible = false.obs;
|
RxBool isWatchLaterVisible = false.obs;
|
||||||
RxString watchLaterTitle = ''.obs;
|
RxString watchLaterTitle = ''.obs;
|
||||||
|
RxInt watchLaterCount = 0.obs;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
@ -170,7 +171,7 @@ class VideoDetailController extends GetxController
|
|||||||
|
|
||||||
sourceType.value = argMap['sourceType'] ?? 'normal';
|
sourceType.value = argMap['sourceType'] ?? 'normal';
|
||||||
isWatchLaterVisible.value =
|
isWatchLaterVisible.value =
|
||||||
sourceType.value == 'watchLater' || sourceType.value == 'fav';
|
['watchLater', 'fav', 'up_archive'].contains(sourceType.value);
|
||||||
if (sourceType.value == 'watchLater') {
|
if (sourceType.value == 'watchLater') {
|
||||||
watchLaterTitle.value = '稍后再看';
|
watchLaterTitle.value = '稍后再看';
|
||||||
fetchMediaList();
|
fetchMediaList();
|
||||||
@ -179,6 +180,11 @@ class VideoDetailController extends GetxController
|
|||||||
watchLaterTitle.value = argMap['favTitle'];
|
watchLaterTitle.value = argMap['favTitle'];
|
||||||
queryFavVideoList();
|
queryFavVideoList();
|
||||||
}
|
}
|
||||||
|
if (sourceType.value == 'up_archive') {
|
||||||
|
watchLaterTitle.value = argMap['favTitle'];
|
||||||
|
watchLaterCount.value = argMap['count'];
|
||||||
|
queryArchiveVideoList();
|
||||||
|
}
|
||||||
tabCtr.addListener(() {
|
tabCtr.addListener(() {
|
||||||
onTabChanged();
|
onTabChanged();
|
||||||
});
|
});
|
||||||
@ -585,7 +591,9 @@ class VideoDetailController extends GetxController
|
|||||||
}
|
}
|
||||||
|
|
||||||
void toggeleWatchLaterVisible(bool val) {
|
void toggeleWatchLaterVisible(bool val) {
|
||||||
if (sourceType.value == 'watchLater' || sourceType.value == 'fav') {
|
if (sourceType.value == 'watchLater' ||
|
||||||
|
sourceType.value == 'fav' ||
|
||||||
|
sourceType.value == 'up_archive') {
|
||||||
isWatchLaterVisible.value = !isWatchLaterVisible.value;
|
isWatchLaterVisible.value = !isWatchLaterVisible.value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -616,8 +624,19 @@ class VideoDetailController extends GetxController
|
|||||||
changeMediaList: changeMediaList,
|
changeMediaList: changeMediaList,
|
||||||
panelTitle: watchLaterTitle.value,
|
panelTitle: watchLaterTitle.value,
|
||||||
bvid: bvid,
|
bvid: bvid,
|
||||||
mediaId: Get.arguments['mediaId'],
|
mediaId: [
|
||||||
|
'watchLater',
|
||||||
|
'fav',
|
||||||
|
].contains(sourceType.value)
|
||||||
|
? Get.arguments['mediaId']
|
||||||
|
: Get.arguments['favInfo'].owner.mid,
|
||||||
hasMore: mediaList.length != Get.arguments['count'],
|
hasMore: mediaList.length != Get.arguments['count'],
|
||||||
|
type: [
|
||||||
|
'watchLater',
|
||||||
|
'fav',
|
||||||
|
].contains(sourceType.value)
|
||||||
|
? 3
|
||||||
|
: 1,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
replyReplyBottomSheetCtr?.closed.then((value) {
|
replyReplyBottomSheetCtr?.closed.then((value) {
|
||||||
@ -667,6 +686,21 @@ class VideoDetailController extends GetxController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future queryArchiveVideoList() async {
|
||||||
|
final Map argMap = Get.arguments;
|
||||||
|
var favInfo = argMap['favInfo'];
|
||||||
|
var sortField = argMap['sortField'];
|
||||||
|
var res = await UserHttp.parseUpArchiveVideo(
|
||||||
|
mid: favInfo.owner.mid,
|
||||||
|
oid: oid.value,
|
||||||
|
bvid: bvid,
|
||||||
|
sortField: sortField,
|
||||||
|
);
|
||||||
|
if (res['status']) {
|
||||||
|
mediaList = res['data'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 监听tabBarView切换
|
// 监听tabBarView切换
|
||||||
void onTabChanged() {
|
void onTabChanged() {
|
||||||
isWatchLaterVisible.value = tabCtr.index == 0;
|
isWatchLaterVisible.value = tabCtr.index == 0;
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/common/constants.dart';
|
|
||||||
import 'package:pilipala/common/widgets/http_error.dart';
|
import 'package:pilipala/common/widgets/http_error.dart';
|
||||||
import 'package:pilipala/utils/feed_back.dart';
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
|
import 'package:pilipala/utils/logic_utils.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
|
|
||||||
class FavPanel extends StatefulWidget {
|
class FavPanel extends StatefulWidget {
|
||||||
@ -67,14 +67,13 @@ class _FavPanelState extends State<FavPanel> {
|
|||||||
onTap: () =>
|
onTap: () =>
|
||||||
widget.ctr!.onChoose(item.favState != 1, index),
|
widget.ctr!.onChoose(item.favState != 1, index),
|
||||||
dense: true,
|
dense: true,
|
||||||
leading: Icon(
|
leading: Icon(LogicUtils.isPublic(item.attr)
|
||||||
Constants.publicFavFolder.contains(item.attr)
|
|
||||||
? Icons.folder_outlined
|
? Icons.folder_outlined
|
||||||
: Icons.lock_outline),
|
: Icons.lock_outline),
|
||||||
minLeadingWidth: 0,
|
minLeadingWidth: 0,
|
||||||
title: Text(item.title!),
|
title: Text(item.title!),
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
'${item.mediaCount}个内容 - ${Constants.publicFavFolder.contains(item.attr) ? '公开' : '私密'}',
|
'${item.mediaCount}个内容 - ${LogicUtils.isPublic(item.attr) ? '公开' : '私密'}',
|
||||||
),
|
),
|
||||||
trailing: Transform.scale(
|
trailing: Transform.scale(
|
||||||
scale: 0.9,
|
scale: 0.9,
|
||||||
|
|||||||
@ -783,7 +783,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
Obx(
|
Obx(
|
||||||
() => Visibility(
|
() => Visibility(
|
||||||
visible: vdCtr.sourceType.value == 'watchLater' ||
|
visible: vdCtr.sourceType.value == 'watchLater' ||
|
||||||
vdCtr.sourceType.value == 'fav',
|
vdCtr.sourceType.value == 'fav' ||
|
||||||
|
vdCtr.sourceType.value == 'up_archive',
|
||||||
child: AnimatedPositioned(
|
child: AnimatedPositioned(
|
||||||
duration: const Duration(milliseconds: 400),
|
duration: const Duration(milliseconds: 400),
|
||||||
curve: Curves.easeInOut,
|
curve: Curves.easeInOut,
|
||||||
@ -815,8 +816,11 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
child: Row(children: [
|
child: Row(children: [
|
||||||
const Icon(Icons.playlist_play, size: 24),
|
const Icon(Icons.playlist_play, size: 24),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
Text(
|
Expanded(
|
||||||
|
child: Text(
|
||||||
vdCtr.watchLaterTitle.value,
|
vdCtr.watchLaterTitle.value,
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Theme.of(context)
|
color: Theme.of(context)
|
||||||
.colorScheme
|
.colorScheme
|
||||||
@ -825,7 +829,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
letterSpacing: 0.2,
|
letterSpacing: 0.2,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const Spacer(),
|
),
|
||||||
|
const SizedBox(width: 50),
|
||||||
const Icon(Icons.keyboard_arrow_up_rounded, size: 26),
|
const Icon(Icons.keyboard_arrow_up_rounded, size: 26),
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -19,8 +19,9 @@ class MediaListPanel extends StatefulWidget {
|
|||||||
this.changeMediaList,
|
this.changeMediaList,
|
||||||
this.panelTitle,
|
this.panelTitle,
|
||||||
this.bvid,
|
this.bvid,
|
||||||
this.mediaId,
|
required this.mediaId,
|
||||||
this.hasMore = false,
|
this.hasMore = false,
|
||||||
|
required this.type,
|
||||||
super.key,
|
super.key,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -29,8 +30,9 @@ class MediaListPanel extends StatefulWidget {
|
|||||||
final Function? changeMediaList;
|
final Function? changeMediaList;
|
||||||
final String? panelTitle;
|
final String? panelTitle;
|
||||||
final String? bvid;
|
final String? bvid;
|
||||||
final int? mediaId;
|
final int mediaId;
|
||||||
final bool hasMore;
|
final bool hasMore;
|
||||||
|
final int type;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<MediaListPanel> createState() => _MediaListPanelState();
|
State<MediaListPanel> createState() => _MediaListPanelState();
|
||||||
@ -59,8 +61,8 @@ class _MediaListPanelState extends State<MediaListPanel> {
|
|||||||
|
|
||||||
void loadMore() async {
|
void loadMore() async {
|
||||||
var res = await UserHttp.getMediaList(
|
var res = await UserHttp.getMediaList(
|
||||||
type: 3,
|
type: widget.type,
|
||||||
bizId: widget.mediaId!,
|
bizId: widget.mediaId,
|
||||||
ps: 20,
|
ps: 20,
|
||||||
oid: mediaList.last.id,
|
oid: mediaList.last.id,
|
||||||
);
|
);
|
||||||
|
|||||||
6
lib/utils/logic_utils.dart
Normal file
6
lib/utils/logic_utils.dart
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
class LogicUtils {
|
||||||
|
// 收藏夹是否公开
|
||||||
|
static bool isPublic(int attr) {
|
||||||
|
return (attr & 1) == 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -7,15 +7,20 @@ import 'package:flutter/services.dart';
|
|||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
|
import 'package:pilipala/http/index.dart';
|
||||||
import 'package:pilipala/http/user.dart';
|
import 'package:pilipala/http/user.dart';
|
||||||
import 'package:pilipala/pages/dynamics/index.dart';
|
import 'package:pilipala/pages/dynamics/index.dart';
|
||||||
import 'package:pilipala/pages/home/index.dart';
|
import 'package:pilipala/pages/home/index.dart';
|
||||||
import 'package:pilipala/pages/mine/index.dart';
|
import 'package:pilipala/pages/mine/index.dart';
|
||||||
import 'package:pilipala/utils/cookie.dart';
|
import 'package:pilipala/utils/cookie.dart';
|
||||||
|
import 'package:pilipala/utils/global_data_cache.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
import 'package:uuid/uuid.dart';
|
import 'package:uuid/uuid.dart';
|
||||||
|
|
||||||
class LoginUtils {
|
class LoginUtils {
|
||||||
|
static Box userInfoCache = GStrorage.userInfo;
|
||||||
|
static Box localCache = GStrorage.localCache;
|
||||||
|
|
||||||
static Future refreshLoginStatus(bool status) async {
|
static Future refreshLoginStatus(bool status) async {
|
||||||
try {
|
try {
|
||||||
// 更改我的页面登录状态
|
// 更改我的页面登录状态
|
||||||
@ -109,4 +114,14 @@ class LoginUtils {
|
|||||||
Clipboard.setData(ClipboardData(text: content));
|
Clipboard.setData(ClipboardData(text: content));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 退出登录
|
||||||
|
static loginOut() async {
|
||||||
|
await Request.cookieManager.cookieJar.deleteAll();
|
||||||
|
Request.dio.options.headers['cookie'] = '';
|
||||||
|
userInfoCache.put('userInfoCache', null);
|
||||||
|
localCache.put(LocalCacheKey.accessKey, {'mid': -1, 'value': ''});
|
||||||
|
GlobalDataCache().userInfo = null;
|
||||||
|
await refreshLoginStatus(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user