feat: 用户信息缓存
This commit is contained in:
@ -19,9 +19,10 @@ class HomeController extends GetxController {
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
if(recVideo.get('cacheList') != null && recVideo.get('cacheList').isNotEmpty){
|
||||
if (recVideo.get('cacheList') != null &&
|
||||
recVideo.get('cacheList').isNotEmpty) {
|
||||
List<RecVideoItemModel> list = [];
|
||||
for(var i in recVideo.get('cacheList')){
|
||||
for (var i in recVideo.get('cacheList')) {
|
||||
list.add(i);
|
||||
}
|
||||
videoList.value = list;
|
||||
@ -36,7 +37,11 @@ class HomeController extends GetxController {
|
||||
);
|
||||
if (res['status']) {
|
||||
if (type == 'init') {
|
||||
videoList.value = res['data'];
|
||||
if (videoList.length > 1) {
|
||||
videoList.addAll(res['data']);
|
||||
} else {
|
||||
videoList.value = res['data'];
|
||||
}
|
||||
} else if (type == 'onRefresh') {
|
||||
videoList.insertAll(0, res['data']);
|
||||
} else if (type == 'onLoad') {
|
||||
|
@ -90,12 +90,12 @@ class _HomePageState extends State<HomePage>
|
||||
}
|
||||
} else {
|
||||
// 缓存数据
|
||||
if(_homeController.videoList.isNotEmpty) {
|
||||
if (_homeController.videoList.length > 1) {
|
||||
return contentGrid(
|
||||
_homeController, _homeController.videoList);
|
||||
}
|
||||
// 骨架屏
|
||||
else{
|
||||
else {
|
||||
return contentGrid(_homeController, []);
|
||||
}
|
||||
}
|
||||
|
@ -25,14 +25,16 @@ class MineController extends GetxController {
|
||||
}
|
||||
|
||||
onLogin() {
|
||||
Get.toNamed(
|
||||
'/webview',
|
||||
parameters: {
|
||||
'url': 'https://passport.bilibili.com/h5-app/passport/login',
|
||||
'type': 'login',
|
||||
'pageTitle': '登录bilibili',
|
||||
},
|
||||
);
|
||||
if (!userLogin.value) {
|
||||
Get.toNamed(
|
||||
'/webview',
|
||||
parameters: {
|
||||
'url': 'https://passport.bilibili.com/h5-app/passport/login',
|
||||
'type': 'login',
|
||||
'pageTitle': '登录bilibili',
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future queryUserInfo() async {
|
||||
|
Reference in New Issue
Block a user