1,新增云存部分跳转和接口

This commit is contained in:
Daisy 2024-04-25 10:43:56 +08:00
parent 92d5a3b473
commit ac2604a95b
7 changed files with 150 additions and 90 deletions

View File

@ -1060,7 +1060,9 @@ class _LockDetailPageState extends State<LockDetailPage>
TranslationLoader.lanKeys!.videoLog!.tr, TranslationLoader.lanKeys!.videoLog!.tr,
state.openDoorBtnisUneable.value, state.openDoorBtnisUneable.value,
state.bottomBtnisEable.value, () { state.bottomBtnisEable.value, () {
Get.toNamed(Routers.videoLogPage); Get.toNamed(Routers.videoLogPage, arguments: {
"lockId": state.keyInfos.value.lockId,
});
})); }));
} }
endWiddget.add( endWiddget.add(

View File

@ -1,8 +1,17 @@
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
import 'videoLog_state.dart'; import 'videoLog_state.dart';
class VideoLogLogic extends BaseGetXController{ class VideoLogLogic extends BaseGetXController {
VideoLogState state = VideoLogState(); VideoLogState state = VideoLogState();
} void getLockCloudStorageList() async {
var entity = await ApiRepository.to.getLockCloudStorageList(
lockId: state.getLockId.value,
);
if (entity.errorCode!.codeIsSuccessful) {
state.videoLogList.value = entity.data!.list!;
state.videoLogList.refresh();
}
}
}

View File

@ -1,4 +1,3 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@ -20,6 +19,12 @@ class _VideoLogPageState extends State<VideoLogPage> {
final logic = Get.put(VideoLogLogic()); final logic = Get.put(VideoLogLogic());
final state = Get.find<VideoLogLogic>().state; final state = Get.find<VideoLogLogic>().state;
@override
initState() {
super.initState();
logic.getLockCloudStorageList();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -33,15 +38,9 @@ class _VideoLogPageState extends State<VideoLogPage> {
body: Column( body: Column(
children: [ children: [
// //
Visibility( Visibility(visible: !state.isNavLocal.value, child: vipTip()),
visible: !state.isNavLocal.value,
child: vipTip()
),
// //
Visibility( Visibility(visible: state.isNavLocal.value, child: localTip()),
visible: state.isNavLocal.value,
child: localTip()
),
// title加编辑按钮 // title加编辑按钮
editVideoTip(), editVideoTip(),
Visibility( Visibility(
@ -50,46 +49,48 @@ class _VideoLogPageState extends State<VideoLogPage> {
child: ListView.builder( child: ListView.builder(
itemCount: 5, itemCount: 5,
itemBuilder: (c, index) { itemBuilder: (c, index) {
return Column(children: [ return Column(
Container( children: [
margin: EdgeInsets.only(left:20.w, top: 15.w, bottom: 15.w), Container(
child: Row( margin: EdgeInsets.only(
children: [ left: 20.w, top: 15.w, bottom: 15.w),
Text("2023.10.2$index", style: TextStyle(fontSize: 20.sp)), child: Row(children: [
] Text("2023.10.2$index",
)), style: TextStyle(fontSize: 20.sp)),
mainListView(index) ])),
],); mainListView(index)
}) ],
) );
), }))),
// //
Visibility( Visibility(
visible: state.isNavLocal.value, visible: state.isNavLocal.value,
child: Expanded( child: Expanded(
child: state.localList.isNotEmpty ? ListView.builder( child: state.localList.isNotEmpty
itemCount: 5, ? ListView.builder(
itemBuilder: (c, index) { itemCount: 5,
return Column(children: [ itemBuilder: (c, index) {
Container( return Column(
margin: EdgeInsets.only(left:20.w, top: 15.w, bottom: 15.w), children: [
child: Row( Container(
children: [ margin: EdgeInsets.only(
Text("2023.10.2$index", style: TextStyle(fontSize: 20.sp)), left: 20.w, top: 15.w, bottom: 15.w),
] child: Row(children: [
)), Text("2023.10.2$index",
mainListView(index) style: TextStyle(fontSize: 20.sp)),
],); ])),
}): NoData() mainListView(index)
) ],
), );
})
: NoData())),
], ],
), ),
); );
} }
// nav按钮 // nav按钮
Widget navBtn(){ Widget navBtn() {
return SizedBox( return SizedBox(
width: 300.w, width: 300.w,
// color: Colors.white, // color: Colors.white,
@ -97,59 +98,74 @@ class _VideoLogPageState extends State<VideoLogPage> {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
TextButton( TextButton(
onPressed: (){ onPressed: () {
setState(() { setState(() {
state.isNavLocal.value = false; state.isNavLocal.value = false;
}); });
}, },
child: Obx(() => Text("云存", child: Obx(() => Text("云存",
style: state.isNavLocal.value == true ? style: state.isNavLocal.value == true
TextStyle(color: Colors.grey, fontSize: 26.sp, fontWeight: FontWeight.w600) : ? TextStyle(
TextStyle(color: Colors.white, fontSize: 28.sp, fontWeight: FontWeight.w600))) color: Colors.grey,
), fontSize: 26.sp,
fontWeight: FontWeight.w600)
: TextStyle(
color: Colors.white,
fontSize: 28.sp,
fontWeight: FontWeight.w600)))),
TextButton( TextButton(
onPressed: (){ onPressed: () {
setState(() { setState(() {
state.isNavLocal.value = true; state.isNavLocal.value = true;
}); });
}, },
child: Obx(() => Text("本地", child: Obx(() => Text("本地",
style: state.isNavLocal.value == true ? style: state.isNavLocal.value == true
TextStyle(color: Colors.white, fontSize: 28.sp, fontWeight: FontWeight.w600) : ? TextStyle(
TextStyle(color: Colors.grey, fontSize: 26.sp, fontWeight: FontWeight.w600))) color: Colors.white,
), fontSize: 28.sp,
fontWeight: FontWeight.w600)
: TextStyle(
color: Colors.grey,
fontSize: 26.sp,
fontWeight: FontWeight.w600)))),
], ],
), ),
); );
} }
// //
Widget vipTip(){ Widget vipTip() {
return GestureDetector( return GestureDetector(
onTap: (){ onTap: () {
Get.toNamed(Routers.valueAddedServicesHighFunctionPage); Get.toNamed(Routers.valueAddedServicesHighFunctionPage);
}, },
child: Container( child: Container(
height: 150.h, height: 150.h,
margin: EdgeInsets.all(15.w), margin: EdgeInsets.all(15.w),
padding: EdgeInsets.only(left:20.w, top:20.w, bottom:20.w, right: 10.w), padding:
EdgeInsets.only(left: 20.w, top: 20.w, bottom: 20.w, right: 10.w),
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color(0xFFF6F7F8), color: const Color(0xFFF6F7F8),
borderRadius: BorderRadius.circular(20.h) borderRadius: BorderRadius.circular(20.h)),
),
child: Row( child: Row(
children: [ children: [
Expanded(child: Column( Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text("3天滚动储存", style: TextStyle(fontSize: 24.sp)), Text("3天滚动储存", style: TextStyle(fontSize: 24.sp)),
SizedBox(height: 10.h), SizedBox(height: 10.h),
Text("星锁已为本设备免费提供3大滚动视频储存服务", style: TextStyle(fontSize: 22.sp, color: Colors.grey)), Text("星锁已为本设备免费提供3大滚动视频储存服务",
style: TextStyle(fontSize: 22.sp, color: Colors.grey)),
], ],
)), )),
SizedBox(width: 15.w), SizedBox(width: 15.w),
Text("去升级", style: TextStyle(fontSize: 22.sp)), Text("去升级", style: TextStyle(fontSize: 22.sp)),
Image(width: 40.w, height: 24.w, image: const AssetImage("images/icon_right_black.png")) Image(
width: 40.w,
height: 24.w,
image: const AssetImage("images/icon_right_black.png"))
], ],
), ),
), ),
@ -157,33 +173,38 @@ class _VideoLogPageState extends State<VideoLogPage> {
} }
// //
Widget localTip(){ Widget localTip() {
return GestureDetector( return GestureDetector(
onTap: (){ onTap: () {
Get.toNamed(Routers.videoLogDownLoadPage); Get.toNamed(Routers.videoLogDownLoadPage);
}, },
child: Container( child: Container(
// height: 130.h, // height: 130.h,
margin: EdgeInsets.all(15.w), margin: EdgeInsets.all(15.w),
padding: EdgeInsets.only(left:20.w, top:30.w, bottom:30.w, right: 10.w), padding:
EdgeInsets.only(left: 20.w, top: 30.w, bottom: 30.w, right: 10.w),
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color(0xFFF6F7F8), color: const Color(0xFFF6F7F8),
borderRadius: BorderRadius.circular(20.h) borderRadius: BorderRadius.circular(20.h)),
),
child: Row( child: Row(
children: [ children: [
Expanded(child: Column( Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
// SizedBox(height: 20.h), // SizedBox(height: 20.h),
Text("下载列表", style: TextStyle(fontSize: 24.sp)), Text("下载列表", style: TextStyle(fontSize: 24.sp)),
SizedBox(height: 15.h), SizedBox(height: 15.h),
Text("暂无下载内容", style: TextStyle(fontSize: 22.sp, color: Colors.grey)), Text("暂无下载内容",
style: TextStyle(fontSize: 22.sp, color: Colors.grey)),
], ],
)), )),
SizedBox(width: 15.w), SizedBox(width: 15.w),
// Text("去升级", style: TextStyle(fontSize: 24.sp)), // Text("去升级", style: TextStyle(fontSize: 24.sp)),
Image(width: 40.w, height: 24.w, image: const AssetImage("images/icon_right_black.png")) Image(
width: 40.w,
height: 24.w,
image: const AssetImage("images/icon_right_black.png"))
], ],
), ),
), ),
@ -191,18 +212,24 @@ class _VideoLogPageState extends State<VideoLogPage> {
} }
// //
Widget editVideoTip(){ Widget editVideoTip() {
return Container( return Container(
margin: EdgeInsets.only(left:20.w), margin: EdgeInsets.only(left: 20.w),
child: Row( child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween, // mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text(state.isNavLocal.value == true ? "已下载":"全部视频", style: TextStyle(fontSize: 26.sp, fontWeight: FontWeight.w500)), Text(state.isNavLocal.value == true ? "已下载" : "全部视频",
style: TextStyle(fontSize: 26.sp, fontWeight: FontWeight.w500)),
Expanded(child: SizedBox(width: 10.w)), Expanded(child: SizedBox(width: 10.w)),
IconButton( IconButton(
icon: Image(width: 40.w, height: 40.w, image: const AssetImage("images/main/icon_lockDetail_monitoringEditVoice.png")), icon: Image(
width: 40.w,
height: 40.w,
image: const AssetImage(
"images/main/icon_lockDetail_monitoringEditVoice.png")),
iconSize: 30, iconSize: 30,
color: Colors.black54, onPressed: () { color: Colors.black54,
onPressed: () {
Get.toNamed(Routers.editVideoLogPage); Get.toNamed(Routers.editVideoLogPage);
}, },
) )
@ -217,35 +244,34 @@ class _VideoLogPageState extends State<VideoLogPage> {
); );
} }
var itemW = (1.sw - 15.w*4)/3; var itemW = (1.sw - 15.w * 4) / 3;
var itemH = (1.sw - 15.w*4)/3+40.h; var itemH = (1.sw - 15.w * 4) / 3 + 40.h;
// //
Widget mainListView(int index){ Widget mainListView(int index) {
return GridView.builder( return GridView.builder(
padding: EdgeInsets.only(left: 15.w, right: 15.w), padding: EdgeInsets.only(left: 15.w, right: 15.w),
itemCount: index+1, itemCount: index + 1,
shrinkWrap: true, shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
// //
crossAxisCount: 3, crossAxisCount: 3,
// //
mainAxisSpacing: 15.w, mainAxisSpacing: 15.w,
// //
crossAxisSpacing: 15.w, crossAxisSpacing: 15.w,
// //
childAspectRatio: itemW/itemH childAspectRatio: itemW / itemH),
),
itemBuilder: (context, index) { itemBuilder: (context, index) {
return videoItem((){ return videoItem(() {
Get.toNamed(Routers.videoLogDetailPage); Get.toNamed(Routers.videoLogDetailPage);
}); });
}, },
); );
} }
Widget videoItem(Function() action){ Widget videoItem(Function() action) {
return GestureDetector( return GestureDetector(
onTap: action, onTap: action,
child: SizedBox( child: SizedBox(
@ -255,14 +281,18 @@ class _VideoLogPageState extends State<VideoLogPage> {
children: [ children: [
ClipRRect( ClipRRect(
borderRadius: BorderRadius.circular(10.w), borderRadius: BorderRadius.circular(10.w),
child: Image(width: itemW, height: itemW, fit: BoxFit.fill, image: const AssetImage("images/main/icon_lockDetail_monitoringvoiceFrist.png")), child: Image(
width: itemW,
height: itemW,
fit: BoxFit.fill,
image: const AssetImage(
"images/main/icon_lockDetail_monitoringvoiceFrist.png")),
), ),
SizedBox(height:5.h), SizedBox(height: 5.h),
Text("2023.10.23 10:00", style: TextStyle(fontSize: 20.sp)) Text("2023.10.23 10:00", style: TextStyle(fontSize: 20.sp))
], ],
), ),
), ),
); );
} }
} }

View File

@ -1,8 +1,15 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
class VideoLogState{ class VideoLogState {
var isNavLocal = false.obs; var isNavLocal = false.obs;
var localList = []; var localList = [];
} var getLockId = 0.obs;
var videoLogList = [].obs;
VideoLogState() {
Map map = Get.arguments;
if (map['lockId'] != null) {
getLockId.value = map['lockId'];
}
}
}

View File

@ -221,4 +221,5 @@ abstract class Api {
final String getBuyRecordListURL = '/v2/service/getBuyRecordList'; // final String getBuyRecordListURL = '/v2/service/getBuyRecordList'; //
final String getUseRecordListURL = '/v2/service/getUseRecordList'; //使 final String getUseRecordListURL = '/v2/service/getUseRecordList'; //使
final String getlockCloudStorageListURL = '/lockCloudStorage/list'; //
} }

View File

@ -1942,6 +1942,10 @@ class ApiProvider extends BaseProvider {
jsonEncode( jsonEncode(
{'lockId': lockId, 'pageNo': pageNo, 'pageSize': pageSize})); {'lockId': lockId, 'pageNo': pageNo, 'pageSize': pageSize}));
//
Future<Response> getLockCloudStorageList(int lockId) =>
post(getlockCloudStorageListURL.toUrl, jsonEncode({'lockId': lockId}));
// //
Future<Response> setMpWechatPushSwitch(int mpWechatPushSwitch) => post( Future<Response> setMpWechatPushSwitch(int mpWechatPushSwitch) => post(
setWechatPushSwitchURL.toUrl, setWechatPushSwitchURL.toUrl,

View File

@ -1960,6 +1960,13 @@ class ApiRepository {
return CoerceFingerprintListEntity.fromJson(res.body); return CoerceFingerprintListEntity.fromJson(res.body);
} }
//
Future<CoerceFingerprintListEntity> getLockCloudStorageList(
{required int lockId}) async {
final res = await apiProvider.getLockCloudStorageList(lockId);
return CoerceFingerprintListEntity.fromJson(res.body);
}
// //
Future<VersionUndateEntity> setMpWechatPushSwitch( Future<VersionUndateEntity> setMpWechatPushSwitch(
{required int mpWechatPushSwitch}) async { {required int mpWechatPushSwitch}) async {