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,
state.openDoorBtnisUneable.value,
state.bottomBtnisEable.value, () {
Get.toNamed(Routers.videoLogPage);
Get.toNamed(Routers.videoLogPage, arguments: {
"lockId": state.keyInfos.value.lockId,
});
}));
}
endWiddget.add(

View File

@ -1,8 +1,17 @@
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'videoLog_state.dart';
class VideoLogLogic extends BaseGetXController{
class VideoLogLogic extends BaseGetXController {
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_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
@ -20,6 +19,12 @@ class _VideoLogPageState extends State<VideoLogPage> {
final logic = Get.put(VideoLogLogic());
final state = Get.find<VideoLogLogic>().state;
@override
initState() {
super.initState();
logic.getLockCloudStorageList();
}
@override
Widget build(BuildContext context) {
return Scaffold(
@ -33,15 +38,9 @@ class _VideoLogPageState extends State<VideoLogPage> {
body: Column(
children: [
//
Visibility(
visible: !state.isNavLocal.value,
child: vipTip()
),
Visibility(visible: !state.isNavLocal.value, child: vipTip()),
//
Visibility(
visible: state.isNavLocal.value,
child: localTip()
),
Visibility(visible: state.isNavLocal.value, child: localTip()),
// title加编辑按钮
editVideoTip(),
Visibility(
@ -50,46 +49,48 @@ class _VideoLogPageState extends State<VideoLogPage> {
child: ListView.builder(
itemCount: 5,
itemBuilder: (c, index) {
return Column(children: [
Container(
margin: EdgeInsets.only(left:20.w, top: 15.w, bottom: 15.w),
child: Row(
children: [
Text("2023.10.2$index", style: TextStyle(fontSize: 20.sp)),
]
)),
mainListView(index)
],);
})
)
),
return Column(
children: [
Container(
margin: EdgeInsets.only(
left: 20.w, top: 15.w, bottom: 15.w),
child: Row(children: [
Text("2023.10.2$index",
style: TextStyle(fontSize: 20.sp)),
])),
mainListView(index)
],
);
}))),
//
Visibility(
visible: state.isNavLocal.value,
child: Expanded(
child: state.localList.isNotEmpty ? ListView.builder(
itemCount: 5,
itemBuilder: (c, index) {
return Column(children: [
Container(
margin: EdgeInsets.only(left:20.w, top: 15.w, bottom: 15.w),
child: Row(
children: [
Text("2023.10.2$index", style: TextStyle(fontSize: 20.sp)),
]
)),
mainListView(index)
],);
}): NoData()
)
),
child: state.localList.isNotEmpty
? ListView.builder(
itemCount: 5,
itemBuilder: (c, index) {
return Column(
children: [
Container(
margin: EdgeInsets.only(
left: 20.w, top: 15.w, bottom: 15.w),
child: Row(children: [
Text("2023.10.2$index",
style: TextStyle(fontSize: 20.sp)),
])),
mainListView(index)
],
);
})
: NoData())),
],
),
);
}
// nav按钮
Widget navBtn(){
Widget navBtn() {
return SizedBox(
width: 300.w,
// color: Colors.white,
@ -97,59 +98,74 @@ class _VideoLogPageState extends State<VideoLogPage> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
TextButton(
onPressed: (){
onPressed: () {
setState(() {
state.isNavLocal.value = false;
});
},
child: Obx(() => Text("云存",
style: state.isNavLocal.value == true ?
TextStyle(color: Colors.grey, fontSize: 26.sp, fontWeight: FontWeight.w600) :
TextStyle(color: Colors.white, fontSize: 28.sp, fontWeight: FontWeight.w600)))
),
style: state.isNavLocal.value == true
? TextStyle(
color: Colors.grey,
fontSize: 26.sp,
fontWeight: FontWeight.w600)
: TextStyle(
color: Colors.white,
fontSize: 28.sp,
fontWeight: FontWeight.w600)))),
TextButton(
onPressed: (){
onPressed: () {
setState(() {
state.isNavLocal.value = true;
});
},
child: Obx(() => Text("本地",
style: state.isNavLocal.value == true ?
TextStyle(color: Colors.white, fontSize: 28.sp, fontWeight: FontWeight.w600) :
TextStyle(color: Colors.grey, fontSize: 26.sp, fontWeight: FontWeight.w600)))
),
style: state.isNavLocal.value == true
? TextStyle(
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(
onTap: (){
onTap: () {
Get.toNamed(Routers.valueAddedServicesHighFunctionPage);
},
child: Container(
height: 150.h,
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(
color: const Color(0xFFF6F7F8),
borderRadius: BorderRadius.circular(20.h)
),
borderRadius: BorderRadius.circular(20.h)),
child: Row(
children: [
Expanded(child: Column(
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("3天滚动储存", style: TextStyle(fontSize: 24.sp)),
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),
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(
onTap: (){
onTap: () {
Get.toNamed(Routers.videoLogDownLoadPage);
},
child: Container(
// height: 130.h,
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(
color: const Color(0xFFF6F7F8),
borderRadius: BorderRadius.circular(20.h)
),
borderRadius: BorderRadius.circular(20.h)),
child: Row(
children: [
Expanded(child: Column(
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// SizedBox(height: 20.h),
Text("下载列表", style: TextStyle(fontSize: 24.sp)),
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),
// 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(
margin: EdgeInsets.only(left:20.w),
margin: EdgeInsets.only(left: 20.w),
child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
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)),
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,
color: Colors.black54, onPressed: () {
color: Colors.black54,
onPressed: () {
Get.toNamed(Routers.editVideoLogPage);
},
)
@ -217,35 +244,34 @@ class _VideoLogPageState extends State<VideoLogPage> {
);
}
var itemW = (1.sw - 15.w*4)/3;
var itemH = (1.sw - 15.w*4)/3+40.h;
var itemW = (1.sw - 15.w * 4) / 3;
var itemH = (1.sw - 15.w * 4) / 3 + 40.h;
//
Widget mainListView(int index){
Widget mainListView(int index) {
return GridView.builder(
padding: EdgeInsets.only(left: 15.w, right: 15.w),
itemCount: index+1,
itemCount: index + 1,
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
//
//
crossAxisCount: 3,
//
mainAxisSpacing: 15.w,
//
crossAxisSpacing: 15.w,
//
childAspectRatio: itemW/itemH
),
childAspectRatio: itemW / itemH),
itemBuilder: (context, index) {
return videoItem((){
return videoItem(() {
Get.toNamed(Routers.videoLogDetailPage);
});
},
);
}
Widget videoItem(Function() action){
Widget videoItem(Function() action) {
return GestureDetector(
onTap: action,
child: SizedBox(
@ -255,14 +281,18 @@ class _VideoLogPageState extends State<VideoLogPage> {
children: [
ClipRRect(
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))
],
),
),
);
}
}

View File

@ -1,8 +1,15 @@
import 'package:get/get.dart';
class VideoLogState{
class VideoLogState {
var isNavLocal = false.obs;
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 getUseRecordListURL = '/v2/service/getUseRecordList'; //使
final String getlockCloudStorageListURL = '/lockCloudStorage/list'; //
}

View File

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

View File

@ -1960,6 +1960,13 @@ class ApiRepository {
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(
{required int mpWechatPushSwitch}) async {