首页完成

对接消息接口
master
张萌 3 years ago
parent 577781cdbf
commit 27b2bbede1

Binary file not shown.

After

Width:  |  Height:  |  Size: 564 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 863 B

@ -4,7 +4,7 @@ part 'other_api.dart';
class SAASAPI { class SAASAPI {
///HOST ///HOST
static const String host = 'http://121.41.26.225:8006'; static const String host = 'http://121.41.26.225:8008';
/// ///
static const String baseURL = '$host'; static const String baseURL = '$host';
@ -22,14 +22,17 @@ class SAASAPI {
static _Login login = _Login(); static _Login login = _Login();
static _Inspection inspection = _Inspection(); static _Inspection inspection = _Inspection();
static _City city = _City();
static _User user = _User(); static _User user = _User();
static _Message message = _Message();
/// ///
static _OtherApi other = _OtherApi(); static _OtherApi other = _OtherApi();
} }
class _Login { class _Login {
///
String get allCity => '/butlerApp/city/allCity';
///app退 ///app退
String get logOut => '/butlerApp/user/quit'; String get logOut => '/butlerApp/user/quit';
@ -89,11 +92,6 @@ class _Inspection {
'/butlerApp/user/inspection/findPlanPointInfo'; '/butlerApp/user/inspection/findPlanPointInfo';
} }
class _City {
///
String get allCity => '/app/city/allCity';
}
class _User { class _User {
/// ///
String get userProfile => '/app/user/findDetail'; String get userProfile => '/app/user/findDetail';
@ -119,3 +117,8 @@ class _User {
/// ///
String get updateAvatar => '/app/user/updateAvatarImg'; String get updateAvatar => '/app/user/updateAvatarImg';
} }
class _Message {
///app
String get messageList => '/butlerApp/user/message/list';
}

@ -33,6 +33,14 @@ class $AssetsHomeGen {
AssetGenImage get fireAlarm => AssetGenImage get fireAlarm =>
const AssetGenImage('assets/home/fire_alarm.png'); const AssetGenImage('assets/home/fire_alarm.png');
/// File path: assets/home/home_back.png
AssetGenImage get homeBack =>
const AssetGenImage('assets/home/home_back.png');
/// File path: assets/home/home_head.png
AssetGenImage get homeHead =>
const AssetGenImage('assets/home/home_head.png');
/// File path: assets/home/house_keeping.png /// File path: assets/home/house_keeping.png
AssetGenImage get houseKeeping => AssetGenImage get houseKeeping =>
const AssetGenImage('assets/home/house_keeping.png'); const AssetGenImage('assets/home/house_keeping.png');
@ -101,6 +109,9 @@ class $AssetsHomeGen {
/// File path: assets/home/key.png /// File path: assets/home/key.png
AssetGenImage get key => const AssetGenImage('assets/home/key.png'); AssetGenImage get key => const AssetGenImage('assets/home/key.png');
/// File path: assets/home/message.png
AssetGenImage get message => const AssetGenImage('assets/home/message.png');
/// File path: assets/home/nearby_pet.png /// File path: assets/home/nearby_pet.png
AssetGenImage get nearbyPet => AssetGenImage get nearbyPet =>
const AssetGenImage('assets/home/nearby_pet.png'); const AssetGenImage('assets/home/nearby_pet.png');

@ -2,6 +2,7 @@
// Project imports: // Project imports:
import 'package:aku_new_community_manager/provider/app_provider.dart'; import 'package:aku_new_community_manager/provider/app_provider.dart';
import 'package:aku_new_community_manager/provider/data_provider.dart';
import 'package:aku_new_community_manager/provider/message_provider.dart'; import 'package:aku_new_community_manager/provider/message_provider.dart';
import 'package:aku_new_community_manager/provider/user_provider.dart'; import 'package:aku_new_community_manager/provider/user_provider.dart';
import 'package:aku_new_community_manager/style/apptheme.dart'; import 'package:aku_new_community_manager/style/apptheme.dart';
@ -75,6 +76,7 @@ class MyApp extends StatelessWidget {
ChangeNotifierProvider(create: (context) => UserProvider()), ChangeNotifierProvider(create: (context) => UserProvider()),
ChangeNotifierProvider(create: (context) => AppProvider()), ChangeNotifierProvider(create: (context) => AppProvider()),
ChangeNotifierProvider(create: (context) => MessageProvider()), ChangeNotifierProvider(create: (context) => MessageProvider()),
ChangeNotifierProvider(create: (context) => DataProvider()),
], ],
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {

@ -0,0 +1,39 @@
import 'package:equatable/equatable.dart';
import 'package:json_annotation/json_annotation.dart';
part 'home_message_list_model.g.dart';
@JsonSerializable()
class HomeMessageListModel extends Equatable {
final int id;
final int type;
final int status;
final String title;
final String content;
final String sendDate;
final int jumpId;
factory HomeMessageListModel.fromJson(Map<String, dynamic> json) =>
_$HomeMessageListModelFromJson(json);
const HomeMessageListModel({
required this.id,
required this.type,
required this.status,
required this.title,
required this.content,
required this.sendDate,
required this.jumpId,
});
@override
List<Object?> get props => [
id,
type,
status,
title,
content,
sendDate,
jumpId,
];
}

@ -0,0 +1,19 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'home_message_list_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
HomeMessageListModel _$HomeMessageListModelFromJson(
Map<String, dynamic> json) =>
HomeMessageListModel(
id: json['id'] as int,
type: json['type'] as int,
status: json['status'] as int,
title: json['title'] as String,
content: json['content'] as String,
sendDate: json['sendDate'] as String,
jumpId: json['jumpId'] as int,
);

@ -1,3 +1,4 @@
import 'package:aku_new_community_manager/new_ui/auth/other_login_page.dart';
import 'package:aku_new_community_manager/new_ui/auth/psd_verify.dart'; import 'package:aku_new_community_manager/new_ui/auth/psd_verify.dart';
import 'package:aku_new_community_manager/new_ui/auth/sign_func.dart'; import 'package:aku_new_community_manager/new_ui/auth/sign_func.dart';
import 'package:aku_new_community_manager/new_ui/auth/widget/login_button_widget.dart'; import 'package:aku_new_community_manager/new_ui/auth/widget/login_button_widget.dart';
@ -11,8 +12,6 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
import 'login_root_page.dart';
class ForgotSetPsdPage extends StatefulWidget { class ForgotSetPsdPage extends StatefulWidget {
final String tel; final String tel;
@ -171,7 +170,7 @@ class _ForgotSetPsdPageState extends State<ForgotSetPsdPage> {
widget.tel, widget.tel,
_codeController.text); _codeController.text);
if (result) { if (result) {
Get.offAll(() => LoginPage()); Get.offAll(() => OtherLoginPage());
} }
} }
: null, : null,

@ -10,14 +10,14 @@ import 'package:velocity_x/velocity_x.dart';
import 'other_login_page.dart'; import 'other_login_page.dart';
class LoginPage extends StatefulWidget { class Login_root_page extends StatefulWidget {
const LoginPage({Key? key}) : super(key: key); const Login_root_page({Key? key}) : super(key: key);
@override @override
_LoginPageState createState() => _LoginPageState(); _Login_root_pageState createState() => _Login_root_pageState();
} }
class _LoginPageState extends State<LoginPage> { class _Login_root_pageState extends State<Login_root_page> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AkuScaffold( return AkuScaffold(

@ -2,7 +2,7 @@ import 'package:aku_new_community_manager/const/saas_api.dart';
import 'package:aku_new_community_manager/new_ui/auth/set_nick_nage_page.dart'; import 'package:aku_new_community_manager/new_ui/auth/set_nick_nage_page.dart';
import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart';
import 'package:aku_new_community_manager/tools/user_tool.dart'; import 'package:aku_new_community_manager/tools/user_tool.dart';
import 'package:aku_new_community_manager/ui/home/home_page.dart'; import 'package:aku_new_community_manager/ui/home/new_home/new_home_page.dart';
import 'package:aku_new_community_manager/utils/network/net_util.dart'; import 'package:aku_new_community_manager/utils/network/net_util.dart';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:get/get.dart' hide Response; import 'package:get/get.dart' hide Response;
@ -85,7 +85,7 @@ class SignFunc {
if (UserTool.userProvider.userInfoModel!.nickName == null) { if (UserTool.userProvider.userInfoModel!.nickName == null) {
await Get.to(() => SetNickNamePage()); await Get.to(() => SetNickNamePage());
} else { } else {
Get.offAll(() => HomePage()); Get.offAll(() => NewHomePage());
} }
} }

@ -26,7 +26,7 @@ class DataProvider extends ChangeNotifier {
List<ChinaRegionModel> get cityModel => _cityModel; List<ChinaRegionModel> get cityModel => _cityModel;
Future<bool> updateCityList() async { Future<bool> updateCityList() async {
var model = await NetUtil().get(SAASAPI.city.allCity); var model = await NetUtil().get(SAASAPI.login.allCity);
if (model.success) { if (model.success) {
_cityModel = (model.data as List) _cityModel = (model.data as List)
.map((e) => ChinaRegionModel.fromJson(e)) .map((e) => ChinaRegionModel.fromJson(e))

@ -0,0 +1,62 @@
import 'package:aku_new_community_manager/gen/assets.gen.dart';
import 'package:aku_new_community_manager/ui/manage_pages/inspection_manage/inspection_manage_page.dart';
import 'package:dio/dio.dart';
import 'package:equatable/equatable.dart';
import 'package:get/get.dart';
class ApplicationUtil {
ApplicationUtil(this.titles);
List<String> titles = [];
List<AppElement> get elements {
var list = <AppElement>[];
this.titles.forEach((element) {
var re = _findByTitle(element);
if (re != null) {
list.add(re);
}
});
return list;
}
AppElement? _findByTitle(String title) {
for (var item in allApplications) {
if (title == item.title) {
return item;
}
}
}
List<AppElement> get allApplications => [
AppElement(
title: '巡检管理',
imgPath: Assets.home.icPatrol.path,
onTap: () async {
await Get.to(InspectionManagePage());
}),
AppElement(
title: '工单管理',
imgPath: Assets.home.icArticle.path,
onTap: () async {})
];
}
class AppElement extends Equatable {
final String title;
final String imgPath;
final VoidCallback onTap;
const AppElement({
required this.title,
required this.imgPath,
required this.onTap,
});
@override
List<Object?> get props => [
title,
imgPath,
onTap,
];
}

@ -0,0 +1,167 @@
import 'dart:async';
import 'package:aku_new_community_manager/gen/assets.gen.dart';
import 'package:aku_new_community_manager/new_models/home/home_message_list_model.dart';
import 'package:aku_new_community_manager/utils/bee_date_util.dart';
import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:velocity_x/velocity_x.dart';
class HomeSwiper extends StatefulWidget {
final List<HomeMessageListModel> models;
const HomeSwiper({Key? key, required this.models}) : super(key: key);
@override
_HomeSwiperState createState() => _HomeSwiperState();
}
class _HomeSwiperState extends State<HomeSwiper> {
int _currentPage = 0;
final PageController _pageController = PageController(initialPage: 0);
late Timer timer;
@override
void initState() {
// _pageController.addListener(() {
// setState(() {});
// });
timer = Timer.periodic(Duration(seconds: 5), (timer) {
if (_currentPage != widget.models.length - 1) {
var page = (_currentPage + 1).toInt();
_pageController.animateToPage(page,
duration: Duration(milliseconds: 500), curve: Curves.easeInOut);
} else {
_pageController.animateToPage(0,
duration: Duration(milliseconds: 500), curve: Curves.easeInOut);
}
});
super.initState();
}
@override
Widget build(BuildContext context) {
return Container(
width: 440.w,
height: 272.w,
padding: EdgeInsets.only(left: 24.w, right: 24.w, top: 40.w),
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Color(0xFFFFC40C).withOpacity(0.15),
offset: Offset(0, 2),
blurRadius: 6,
spreadRadius: 0)
],
color: Colors.white,
borderRadius: BorderRadius.circular(8.w),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: PageView.builder(
controller: _pageController,
reverse: true,
onPageChanged: (page) {
_currentPage = page;
setState(() {});
},
itemCount: widget.models.length,
itemBuilder: (context, index) {
return _card(widget.models[index]);
},
),
),
16.w.heightBox,
_indicator(),
8.w.heightBox,
],
),
);
}
Widget _indicator() {
return Stack(
children: [
Row(
mainAxisSize: MainAxisSize.min,
children: List.generate(
widget.models.length,
(index) => GestureDetector(
onTap: () {
_pageController.animateToPage(index,
duration: Duration(milliseconds: 500),
curve: Curves.easeInOut);
setState(() {});
},
child: Material(
child: Container(
width: 32.w,
height: 6.w,
decoration: BoxDecoration(
borderRadius: index == 0
? BorderRadius.only(
topLeft: Radius.circular(3.w),
bottomLeft: Radius.circular(3.w))
: index == widget.models.length - 1
? BorderRadius.only(
topRight: Radius.circular(3.w),
bottomRight: Radius.circular(3.w))
: BorderRadius.circular(3.w),
color: Color(0xFFF6F6F6),
),
),
),
),
),
),
AnimatedPositioned(
top: 0,
left: _currentPage * 32.w,
child: Container(
width: 32.w,
height: 6.w,
decoration: BoxDecoration(
color: Color(0xFFFFC40C),
borderRadius: BorderRadius.circular(3.w),
),
),
curve: Curves.easeInOut,
duration: Duration(
milliseconds: 500,
))
],
);
}
Widget _card(HomeMessageListModel model) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Assets.home.message.image(width: 40.w, height: 40.w),
16.w.widthBox,
model.title.text.size(28.sp).color(Colors.black).bold.make(),
],
),
20.w.heightBox,
model.content.text
.size(24.sp)
.maxLines(3)
.overflow(TextOverflow.ellipsis)
.color(Colors.black.withOpacity(0.65))
.make(),
40.w.heightBox,
BeeDateUtil(DateUtil.getDateTime(model.sendDate))
.timeAgo
.text
.size(20.sp)
.color(Colors.black.withOpacity(0.25))
.make(),
],
);
}
}

@ -0,0 +1,437 @@
import 'package:aku_new_community_manager/const/saas_api.dart';
import 'package:aku_new_community_manager/gen/assets.gen.dart';
import 'package:aku_new_community_manager/new_models/home/home_message_list_model.dart';
import 'package:aku_new_community_manager/tools/user_tool.dart';
import 'package:aku_new_community_manager/ui/home/new_home/application_util.dart';
import 'package:aku_new_community_manager/ui/home/new_home/home_swiper.dart';
import 'package:aku_new_community_manager/ui/widgets/app_widgets/bee_image_network.dart';
import 'package:aku_new_community_manager/utils/bee_date_util.dart';
import 'package:aku_new_community_manager/utils/extension/list_extension.dart';
import 'package:aku_new_community_manager/utils/network/net_util.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:velocity_x/velocity_x.dart';
class NewHomePage extends StatefulWidget {
const NewHomePage({Key? key}) : super(key: key);
@override
_NewHomePageState createState() => _NewHomePageState();
}
class _NewHomePageState extends State<NewHomePage> {
List<HomeMessageListModel> _announceModels = [];
Future _getAnnounces() async {
//type
var re = await NetUtil().getList(SAASAPI.message.messageList,
params: {'type': 1, 'pageNum': 1, 'size': 10});
_announceModels =
re.rows.map((e) => HomeMessageListModel.fromJson(e)).toList();
}
@override
Widget build(BuildContext context) {
return Scaffold(
extendBody: true,
extendBodyBehindAppBar: true,
appBar: PreferredSize(
preferredSize: Size.fromHeight((72 + 96).w),
child: Padding(
padding: EdgeInsets.only(top: 96.w, left: 30.w),
child: Row(
children: [
Expanded(
child: Container(
height: 72.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
color: Colors.white.withOpacity(0.34),
),
child: Row(
children: [
24.w.widthBox,
Icon(
CupertinoIcons.search,
size: 40.w,
),
16.w.widthBox,
'搜索工单、订单号、手机'
.text
.size(28.sp)
.color(Color(0xFF333333))
.make(),
],
),
),
),
24.w.widthBox,
Icon(
CupertinoIcons.bell,
size: 40.w,
),
24.w.widthBox,
],
),
),
),
body: Stack(
children: [
Container(
child: Assets.home.homeBack.image(),
),
SafeArea(
child: EasyRefresh(
onRefresh: () async {
await _getAnnounces();
setState(() {});
},
header: MaterialHeader(),
child: ListView(
padding: EdgeInsets.symmetric(horizontal: 24.w),
children: [
(32).w.heightBox,
Padding(
padding: EdgeInsets.only(left: 8.w),
child: '今天也要努力打工哦~'.text.size(32.sp).black.bold.make(),
),
24.w.heightBox,
_headCard(),
64.w.heightBox,
_todoListWidget(),
56.w.heightBox,
_messageManageWidget(),
56.w.heightBox,
_applicationAssist(),
],
),
),
)
],
),
);
}
Container _messageManageWidget() {
var head = Row(
children: [
'信息管理'.text.size(36.sp).black.bold.make(),
Spacer(),
],
);
return Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
head,
32.w.heightBox,
Row(
children: [
HomeSwiper(models: _announceModels),
24.w.widthBox,
Flexible(
child: Container(
height: 272.w,
padding:
EdgeInsets.symmetric(horizontal: 24.w, vertical: 36.w),
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Color(0xFFFFC40C).withOpacity(0.15),
offset: Offset(0, 2),
blurRadius: 6,
spreadRadius: 0)
],
color: Colors.white,
borderRadius: BorderRadius.circular(8.w),
),
child: Column(
children: [
Row(
children: [
'未处理'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.85))
.make(),
Spacer(),
'12'.text.size(24.sp).color(Color(0xFFF01C26)).make(),
],
),
Spacer(),
Row(
children: [
'处理中'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.85))
.make(),
Spacer(),
'12'.text.size(24.sp).color(Color(0xFF1C92FF)).make(),
],
),
Spacer(),
Row(
children: [
'已处理'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.85))
.make(),
Spacer(),
'12'.text.size(24.sp).color(Color(0xFF52C41A)).make(),
],
),
Spacer(),
Row(
children: [
'全部'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.85))
.make(),
Spacer(),
'124'
.text
.size(24.sp)
.color(Color(0xFFFFC40C))
.make(),
],
)
],
),
),
),
],
),
],
),
);
}
Container _applicationAssist() {
var head = Row(
children: [
'功能助手'.text.size(36.sp).black.bold.make(),
Spacer(),
],
);
return Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
head,
32.w.heightBox,
Column(
children: [
Row(
children: ApplicationUtil(['巡检管理', '工单管理'])
.elements
.map((e) => _applicationElement(e))
.toList()
.sepWidget(separate: 60.w.widthBox),
)
],
)
],
),
);
}
Widget _applicationElement(AppElement element) {
return GestureDetector(
onTap: element.onTap,
child: Material(
color: Colors.transparent,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Image.asset(
element.imgPath,
width: 80.w,
height: 80.w,
),
10.w.heightBox,
element.title.text.size(24.sp).color(Color(0xFF111111)).make(),
],
),
),
);
}
Container _todoListWidget() {
var head = Row(
children: [
'待办事项'.text.size(36.sp).black.bold.make(),
Spacer(),
GestureDetector(
onTap: () {},
child: Material(
color: Colors.transparent,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
'查看全部待办'.text.size(28.sp).color(Color(0xFFFFC40C)).make(),
8.w.widthBox,
Container(
width: 28.w,
height: 28.w,
alignment: Alignment.center,
decoration: BoxDecoration(
color: Color(0xFFC40C),
borderRadius: BorderRadius.circular(4.w),
),
child: Icon(
CupertinoIcons.chevron_right,
color: Color(0xFFFFC40C),
size: 24.w,
),
)
],
),
),
),
],
);
return Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
head,
32.w.heightBox,
SizedBox(
height: 220.w,
child: ListView(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
children: [_todoListCard()],
),
),
],
),
);
}
Widget _headCard() {
var avatar = Container(
width: 108.w,
height: 108.w,
alignment: Alignment.center,
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.3),
borderRadius: BorderRadius.circular(54.w)),
child: ClipOval(
child: Container(
width: 96.w,
height: 96.w,
child: BeeImageNetwork(
imgs: UserTool.userProvider.userInfoModel?.imgList ?? [],
),
),
),
);
return Container(
height: 268.w,
padding: EdgeInsets.symmetric(horizontal: 40.w, vertical: 48.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16.w),
image: DecorationImage(image: Assets.home.homeHead)),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
avatar,
24.w.widthBox,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
'小蜜蜂'.text.size(32.sp).black.bold.make(),
10.w.heightBox,
Row(
children: [
Container(
padding:
EdgeInsets.symmetric(horizontal: 8.w, vertical: 4.w),
decoration: BoxDecoration(
color: Color(0xFFFFC40C),
borderRadius: BorderRadius.circular(4.w),
),
child: '测试小区'
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.85))
.make(),
),
16.w.widthBox,
Container(
padding:
EdgeInsets.symmetric(horizontal: 8.w, vertical: 4.w),
decoration: BoxDecoration(
color: Color(0xFFFFC40C),
borderRadius: BorderRadius.circular(4.w),
),
child: '行政'
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.85))
.make(),
)
],
),
],
)
],
),
);
}
Widget _todoListCard() {
return Stack(
children: [
Container(
width: 390.w,
padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.w),
decoration: BoxDecoration(
color: Color(0xFFFFC40C).withOpacity(0.03),
borderRadius: BorderRadius.circular(8.w),
border: Border.all(color: Color(0xFFFFC40C).withOpacity(0.3)),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
'电梯巡检'.text.size(28.sp).color(Color(0xFF333333)).bold.make(),
12.w.heightBox,
'时间2021-12-23 1233'
.text
.size(24.sp)
.color(Color(0xFF333333))
.make(),
8.w.heightBox,
'地点1栋1单元B2排风机房'.text.size(24.sp).color(Color(0xFF333333)).make(),
Spacer(),
BeeDateUtil(DateTime.now())
.timeAgo
.text
.size(20.sp)
.color(Color(0xFF999999))
.make(),
],
),
),
Positioned(
bottom: 0,
right: 0,
child: Container(
width: 66.w,
height: 50.w,
decoration: BoxDecoration(
color: Color(0xFFFFC40C).withOpacity(0.3),
borderRadius: BorderRadius.only(topLeft: Radius.circular(8.w)),
),
))
],
);
}
}

@ -16,6 +16,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/route_manager.dart'; import 'package:get/route_manager.dart';
@Deprecated('旧页面')
class LoginPage extends StatefulWidget { class LoginPage extends StatefulWidget {
LoginPage({Key? key}) : super(key: key); LoginPage({Key? key}) : super(key: key);

@ -22,6 +22,7 @@ import 'package:pin_input_text_field/pin_input_text_field.dart';
import 'package:power_logger/power_logger.dart'; import 'package:power_logger/power_logger.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@Deprecated('旧页面')
class LoginSMSPage extends StatefulWidget { class LoginSMSPage extends StatefulWidget {
final String phone; final String phone;
LoginSMSPage({Key? key, required this.phone}) : super(key: key); LoginSMSPage({Key? key, required this.phone}) : super(key: key);

@ -1,6 +1,6 @@
// Flutter imports: // Flutter imports:
// Project imports: // Project imports:
import 'package:aku_new_community_manager/new_ui/auth/login_root_page.dart'; import 'package:aku_new_community_manager/new_ui/auth/other_login_page.dart';
import 'package:aku_new_community_manager/provider/app_provider.dart'; import 'package:aku_new_community_manager/provider/app_provider.dart';
import 'package:aku_new_community_manager/provider/user_provider.dart'; import 'package:aku_new_community_manager/provider/user_provider.dart';
import 'package:aku_new_community_manager/style/app_style.dart'; import 'package:aku_new_community_manager/style/app_style.dart';
@ -143,7 +143,7 @@ class _SplashPageState extends State<SplashPage> {
if (HiveStore.appBox!.containsKey('token')) { if (HiveStore.appBox!.containsKey('token')) {
await userProvider.setLogin(HiveStore.appBox!.get('token')); await userProvider.setLogin(HiveStore.appBox!.get('token'));
} else { } else {
Get.to(() => LoginPage()); Get.to(() => OtherLoginPage());
} }
}); });
} }

@ -0,0 +1,44 @@
import 'package:aku_new_community_manager/const/saas_api.dart';
import 'package:aku_new_community_manager/gen/assets.gen.dart';
import 'package:aku_new_community_manager/models/common/img_model.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class BeeImageNetwork extends StatelessWidget {
final List<ImgModel>? imgs;
final List<String>? urls;
final double? width;
final double? height;
final BoxFit? fit;
const BeeImageNetwork(
{Key? key,
this.imgs,
this.width,
this.height,
this.urls,
this.fit = BoxFit.cover})
: assert(imgs != null || urls != null),
super(key: key);
@override
Widget build(BuildContext context) {
return FadeInImage.assetNetwork(
placeholder: Assets.placeholder.path,
image: imgs == null
? SAASAPI.image(urls!.isEmpty ? '' : urls!.first)
: SAASAPI.image(ImgModel.first(imgs)),
imageErrorBuilder: (context, obj, stackTrace) {
return Image.asset(
Assets.placeholder.path,
width: width ?? 160.w,
height: height ?? 160.w,
fit: BoxFit.fill,
);
},
height: height ?? 160.w,
width: width ?? 160.w,
fit: fit,
);
}
}

@ -0,0 +1,51 @@
import 'package:common_utils/common_utils.dart';
class BeeDateUtil {
DateTime? date;
BeeDateUtil(this.date);
DateTime get _now => DateTime.now();
bool get sameYear => _now.year == this.date!.year;
bool get sameMonth => sameYear && _now.month == this.date!.month;
bool get sameDay => sameMonth && _now.day == this.date!.day;
bool get isYesterday =>
(DateTime(_now.year, _now.month, _now.day - 1).compareTo(
DateTime(this.date!.year, this.date!.month, this.date!.day)) ==
0);
bool get isDoubleYesterday =>
(DateTime(_now.year, _now.month, _now.day - 2).compareTo(
DateTime(this.date!.year, this.date!.month, this.date!.day)) ==
0);
String get timeAgo {
Duration duration = _now.difference(date!);
if (duration.inSeconds <= 60) return '${duration.inSeconds}秒前';
if (duration.inMinutes <= 60) return '${duration.inMinutes}分钟前';
if (duration.inHours <= 12) return '${duration.inHours}小时前';
if (isYesterday) return '昨天';
if (isDoubleYesterday) return '前天';
if (duration.inDays <= 30)
return '${duration.inDays}天前';
else
return DateUtil.formatDate(date, format: 'yyyy-MM-dd');
}
String get timeAgoWithHm {
Duration duration = _now.difference(date!);
if (duration.inSeconds <= 60) return '${duration.inSeconds}秒前';
if (duration.inMinutes <= 60) return '${duration.inMinutes}分钟前';
if (duration.inHours <= 12) return '${duration.inHours}小时前';
if (isYesterday) return '昨天';
if (isDoubleYesterday) return '前天';
if (duration.inDays <= 30)
return '${duration.inDays}天前';
else
return DateUtil.formatDate(date, format: 'yyyy-MM-dd HH-mm');
}
}

@ -1,8 +1,7 @@
// Dart imports: // Dart imports:
import 'dart:io'; import 'dart:io';
// Project imports: import 'package:aku_new_community_manager/const/saas_api.dart';
import 'package:aku_new_community_manager/const/api.dart';
import 'package:aku_new_community_manager/provider/user_provider.dart'; import 'package:aku_new_community_manager/provider/user_provider.dart';
import 'package:aku_new_community_manager/saas_models/net_model/base_list_model.dart'; import 'package:aku_new_community_manager/saas_models/net_model/base_list_model.dart';
import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart'; import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart';
@ -24,10 +23,10 @@ class NetUtil {
NetUtil._internal() { NetUtil._internal() {
BaseOptions options = BaseOptions( BaseOptions options = BaseOptions(
baseUrl: API.baseURL, baseUrl: SAASAPI.baseURL,
connectTimeout: API.networkTimeOut, connectTimeout: SAASAPI.networkTimeOut,
receiveTimeout: API.networkTimeOut, receiveTimeout: SAASAPI.networkTimeOut,
sendTimeout: API.networkTimeOut, sendTimeout: SAASAPI.networkTimeOut,
headers: {}, headers: {},
); );
if (_dio == null) _dio = Dio(options); if (_dio == null) _dio = Dio(options);
@ -49,11 +48,11 @@ class NetUtil {
///call auth after login ///call auth after login
auth(int token) { auth(int token) {
_dio!.options.headers.putIfAbsent('butlerApp-admin-token', () => token); _dio!.options.headers.putIfAbsent('butlerApp-login-token', () => token);
} }
logout() { logout() {
_dio!.options.headers.remove('butlerApp-admin-token'); _dio!.options.headers.remove('butlerApp-login-token');
} }
/// ## alias of Dio().get /// ## alias of Dio().get

Loading…
Cancel
Save