Merge branches 'master' and 'master' of https://git.oa00.com/bee/aku_community

hmxc
张萌 4 years ago
commit a49c394648

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

@ -91,6 +91,10 @@ class R {
static const String ASSETS_APPLICATIONS_TOY_PNG = static const String ASSETS_APPLICATIONS_TOY_PNG =
'assets/applications/toy.png'; 'assets/applications/toy.png';
/// ![preview](file:///Users/akufe/Documents/aku_community/assets/applications/transfer.png)
static const String ASSETS_APPLICATIONS_TRANSFER_PNG =
'assets/applications/transfer.png';
/// ![preview](file:///Users/akufe/Documents/aku_community/assets/applications/visitor_invite.png) /// ![preview](file:///Users/akufe/Documents/aku_community/assets/applications/visitor_invite.png)
static const String ASSETS_APPLICATIONS_VISITOR_INVITE_PNG = static const String ASSETS_APPLICATIONS_VISITOR_INVITE_PNG =
'assets/applications/visitor_invite.png'; 'assets/applications/visitor_invite.png';

@ -56,7 +56,7 @@ class AO extends Equatable {
/// ///
List<AO> appObjects = [ List<AO> appObjects = [
if (false) AO('一键开门', R.ASSETS_APPLICATIONS_OEPN_DOOR_PNG, () => Scaffold()), if (false) AO('一键开门', R.ASSETS_APPLICATIONS_OEPN_DOOR_PNG, () => Scaffold()),
if (false)
AO('开门码', R.ASSETS_APPLICATIONS_DOOR_CODE_PNG, () => OpeningCodePage()), AO('开门码', R.ASSETS_APPLICATIONS_DOOR_CODE_PNG, () => OpeningCodePage()),
AO('访客邀请', R.ASSETS_APPLICATIONS_VISITOR_INVITE_PNG, AO('访客邀请', R.ASSETS_APPLICATIONS_VISITOR_INVITE_PNG,
() => VisitorAccessPage()), () => VisitorAccessPage()),
@ -76,7 +76,7 @@ List<AO> appObjects = [
AO('借还管理', R.ASSETS_APPLICATIONS_BORROW_PNG, () => SelectBorrowReturnPage()), AO('借还管理', R.ASSETS_APPLICATIONS_BORROW_PNG, () => SelectBorrowReturnPage()),
AO('一键报警', R.ASSETS_APPLICATIONS_POLICE_PNG, () => AlarmPage()), AO('一键报警', R.ASSETS_APPLICATIONS_POLICE_PNG, () => AlarmPage()),
AO('设施预约', R.ASSETS_ICONS_TOOL_FACILITY_PNG, () => FacilityAppointmentPage()), AO('设施预约', R.ASSETS_ICONS_TOOL_FACILITY_PNG, () => FacilityAppointmentPage()),
AO('快递包裹', R.ASSETS_IMAGES_PLACEHOLDER_WEBP, () => ExpressPackagePage()), AO('快递包裹', R.ASSETS_APPLICATIONS_TRANSFER_PNG, () => ExpressPackagePage()),
// AO( // AO(
// '小区教育', // '小区教育',
// R.ASSETS_IMAGES_PLACEHOLDER_WEBP, // R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
@ -135,7 +135,7 @@ List<AO> get recommendApp => _recommendApp.map((e) => AO.fromRaw(e)).toList();
/// original value /// original value
List<String> _smartManagerApp = [ List<String> _smartManagerApp = [
'一键开门', if (false) '一键开门',
'开门码', '开门码',
'访客邀请', '访客邀请',
'报事报修', '报事报修',

@ -1,5 +1,6 @@
import 'dart:io'; import 'dart:io';
import 'package:aku_community/provider/app_provider.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -8,12 +9,14 @@ import 'package:flutter/services.dart';
import 'package:firebase_core/firebase_core.dart'; import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_crashlytics/firebase_crashlytics.dart'; import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:fluwx/fluwx.dart'; import 'package:fluwx/fluwx.dart';
import 'package:get/get.dart';
import 'package:jpush_flutter/jpush_flutter.dart'; import 'package:jpush_flutter/jpush_flutter.dart';
import 'package:power_logger/power_logger.dart'; import 'package:power_logger/power_logger.dart';
import 'package:aku_community/constants/app_theme.dart'; import 'package:aku_community/constants/app_theme.dart';
import 'package:aku_community/constants/config.dart'; import 'package:aku_community/constants/config.dart';
import 'package:aku_community/utils/message_parser.dart'; import 'package:aku_community/utils/message_parser.dart';
import 'package:provider/provider.dart';
class MainInitialize { class MainInitialize {
///firebase ///firebase
@ -52,6 +55,9 @@ class MainInitialize {
onReceiveNotification: (message) async { onReceiveNotification: (message) async {
LoggerData.addData(message, tag: 'onReceiveNotification'); LoggerData.addData(message, tag: 'onReceiveNotification');
await MessageParser(message).shot(); await MessageParser(message).shot();
final appProvider =
Provider.of<AppProvider>(Get.context!, listen: false);
appProvider.getMessageCenter();
}, },
onOpenNotification: jPushLogger('onOpenNotification'), onOpenNotification: jPushLogger('onOpenNotification'),
onReceiveMessage: jPushLogger('onReceiveMessage'), onReceiveMessage: jPushLogger('onReceiveMessage'),

@ -69,8 +69,12 @@ class _HomePageState extends State<HomePage>
actions: [ actions: [
Badge( Badge(
elevation: 0, elevation: 0,
showBadge: appProvider.messageCenterModel.sysCount == 0, showBadge: appProvider.messageCenterModel.commentCount != 0 ||
position: BadgePosition.topEnd(), appProvider.messageCenterModel.sysCount != 0,
position: BadgePosition.topEnd(
top: 8,
end: 8,
),
child: ColumnActionButton( child: ColumnActionButton(
onPressed: () { onPressed: () {
if (LoginUtil.isNotLogin) return; if (LoginUtil.isNotLogin) return;
@ -79,7 +83,7 @@ class _HomePageState extends State<HomePage>
title: '消息', title: '消息',
path: R.ASSETS_ICONS_ALARM_PNG, path: R.ASSETS_ICONS_ALARM_PNG,
), ),
) ),
], ],
), ),
body: EasyRefresh( body: EasyRefresh(

@ -21,16 +21,11 @@ class MessageCenterPage extends StatefulWidget {
} }
class _MessageCenterPageState extends State<MessageCenterPage> { class _MessageCenterPageState extends State<MessageCenterPage> {
EasyRefreshController? _refreshController; EasyRefreshController _refreshController = EasyRefreshController();
@override
void initState() {
super.initState();
_refreshController = EasyRefreshController();
}
@override @override
void dispose() { void dispose() {
_refreshController?.dispose(); _refreshController.dispose();
super.dispose(); super.dispose();
} }
@ -80,7 +75,7 @@ class _MessageCenterPageState extends State<MessageCenterPage> {
MaterialButton( MaterialButton(
onPressed: () async { onPressed: () async {
await NetUtil().dio!.get(API.message.allRead); await NetUtil().dio!.get(API.message.allRead);
_refreshController!.callRefresh(); _refreshController.callRefresh();
setState(() {}); setState(() {});
}, },
child: '全部已读'.text.size(28.sp).black.make(), child: '全部已读'.text.size(28.sp).black.make(),
@ -90,6 +85,7 @@ class _MessageCenterPageState extends State<MessageCenterPage> {
body: EasyRefresh( body: EasyRefresh(
header: MaterialHeader(), header: MaterialHeader(),
firstRefresh: true, firstRefresh: true,
controller: _refreshController,
onRefresh: () async { onRefresh: () async {
appProvider.getMessageCenter(); appProvider.getMessageCenter();
}, },
@ -100,7 +96,12 @@ class _MessageCenterPageState extends State<MessageCenterPage> {
title: '系统通知', title: '系统通知',
content: appProvider.messageCenterModel.sysTitle ?? '无系统通知消息', content: appProvider.messageCenterModel.sysTitle ?? '无系统通知消息',
count: appProvider.messageCenterModel.sysCount ?? 0, count: appProvider.messageCenterModel.sysCount ?? 0,
onTap: () => Get.to(() => SystemMessagePage()), onTap: () async {
await NetUtil().dio!.get(API.message.allReadComment);
await Get.to(() => SystemMessagePage());
_refreshController.callRefresh();
setState(() {});
},
), ),
_buildCard( _buildCard(
path: R.ASSETS_ICONS_COMMENT_NOTICE_PNG, path: R.ASSETS_ICONS_COMMENT_NOTICE_PNG,
@ -110,7 +111,8 @@ class _MessageCenterPageState extends State<MessageCenterPage> {
count: appProvider.messageCenterModel.commentCount ?? 0, count: appProvider.messageCenterModel.commentCount ?? 0,
onTap: () async { onTap: () async {
await NetUtil().dio!.get(API.message.allReadComment); await NetUtil().dio!.get(API.message.allReadComment);
Get.to(() => CommentMessagePage()); await Get.to(() => CommentMessagePage());
_refreshController.callRefresh();
setState(() {}); setState(() {});
}, },
), ),

@ -1,3 +1,4 @@
import 'package:aku_community/constants/api.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -255,8 +256,7 @@ class _VisitorAccessPageState extends State<VisitorAccessPage> {
tel: tel, tel: tel,
); );
if (result != null) if (result != null)
Share.share( Share.share('${API.host}/static/dist/index.html#/visitor?$result');
'http://test.akuhotel.com:8804/static/dist/index.html#/visitor?$result');
}, },
minWidth: double.infinity, minWidth: double.infinity,
height: 96.w, height: 96.w,

@ -139,12 +139,15 @@ class AppProvider extends ChangeNotifier {
} }
} }
Map<String, Object>? _location; Map<String, dynamic>? _location;
Map<String, Object>? get location => _location; Map<String, dynamic>? get location => _location;
late AMapFlutterLocation _aMapFlutterLocation; late AMapFlutterLocation _aMapFlutterLocation;
startLocation() { startLocation() {
if (kIsWeb || Platform.isMacOS) return; if (kIsWeb || Platform.isMacOS) {
getWeather();
return;
}
_aMapFlutterLocation = AMapFlutterLocation(); _aMapFlutterLocation = AMapFlutterLocation();
_aMapFlutterLocation.onLocationChanged().listen((event) { _aMapFlutterLocation.onLocationChanged().listen((event) {
_location = event; _location = event;
@ -164,11 +167,19 @@ class AppProvider extends ChangeNotifier {
_aMapFlutterLocation.destroy(); _aMapFlutterLocation.destroy();
} }
// Location _location;
// Location get location => _location;
getWeather() async { getWeather() async {
late num longitude;
late num latitude;
if (kIsWeb || Platform.isMacOS) {
longitude = 116.46;
latitude = 39.92;
} else {
longitude = _location!['longitude'];
latitude = _location!['latitude'];
}
Response response = await Dio().get( Response response = await Dio().get(
'https://api.caiyunapp.com/v2.5/${AppConfig.caiYunAPI}/${_location!['longitude']},${_location!['latitude']}/realtime.json', 'https://api.caiyunapp.com/v2.5/${AppConfig.caiYunAPI}/$longitude,$latitude/realtime.json',
); );
LoggerData.addData(response); LoggerData.addData(response);
_weatherModel = RealTimeWeatherModel.fromJson(response.data); _weatherModel = RealTimeWeatherModel.fromJson(response.data);

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flustars/flustars.dart'; import 'package:flustars/flustars.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:jpush_flutter/jpush_flutter.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:aku_community/constants/api.dart'; import 'package:aku_community/constants/api.dart';
@ -31,6 +32,7 @@ class UserProvider extends ChangeNotifier {
} }
logout() { logout() {
JPush().deleteAlias();
final appProvider = Provider.of<AppProvider>(Get.context!, listen: false); final appProvider = Provider.of<AppProvider>(Get.context!, listen: false);
appProvider.setCurrentHouse(null); appProvider.setCurrentHouse(null);
_isLogin = false; _isLogin = false;
@ -46,6 +48,9 @@ class UserProvider extends ChangeNotifier {
Future updateProfile() async { Future updateProfile() async {
_userInfoModel = await SignFunc.getUserInfo(); _userInfoModel = await SignFunc.getUserInfo();
if (_userInfoModel != null) {
await JPush().setAlias(_userInfoModel!.id.toString());
}
notifyListeners(); notifyListeners();
} }

@ -1,3 +1,5 @@
import 'package:aku_community/provider/app_provider.dart';
import 'package:badges/badges.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@ -53,10 +55,19 @@ class _CommunityPageState extends State<CommunityPage>
Widget build(BuildContext context) { Widget build(BuildContext context) {
super.build(context); super.build(context);
final userProvider = Provider.of<UserProvider>(context); final userProvider = Provider.of<UserProvider>(context);
final appProvider = Provider.of<AppProvider>(context);
return BeeScaffold( return BeeScaffold(
title: '社区', title: '社区',
actions: [ actions: [
ColumnActionButton( Badge(
elevation: 0,
showBadge: appProvider.messageCenterModel.commentCount != 0 ||
appProvider.messageCenterModel.sysCount != 0,
position: BadgePosition.topEnd(
top: 8,
end: 8,
),
child: ColumnActionButton(
onPressed: () { onPressed: () {
if (LoginUtil.isNotLogin) return; if (LoginUtil.isNotLogin) return;
Get.to(() => MessageCenterPage()); Get.to(() => MessageCenterPage());
@ -64,6 +75,7 @@ class _CommunityPageState extends State<CommunityPage>
title: '消息', title: '消息',
path: R.ASSETS_ICONS_ALARM_PNG, path: R.ASSETS_ICONS_ALARM_PNG,
), ),
),
], ],
fab: FloatingActionButton( fab: FloatingActionButton(
onPressed: () async { onPressed: () async {

@ -1,7 +1,8 @@
import 'package:aku_community/base/base_style.dart'; // import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/constants/api.dart'; import 'package:aku_community/constants/api.dart';
import 'package:aku_community/models/market/goods_item.dart'; import 'package:aku_community/models/market/goods_item.dart';
import 'package:aku_community/ui/market/goods/goods_detail_page.dart'; import 'package:aku_community/ui/market/goods/goods_card.dart';
// import 'package:aku_community/ui/market/goods/goods_detail_page.dart';
import 'package:aku_community/utils/network/base_model.dart'; import 'package:aku_community/utils/network/base_model.dart';
import 'package:aku_community/utils/network/net_util.dart'; import 'package:aku_community/utils/network/net_util.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
@ -18,7 +19,8 @@ import 'package:aku_community/ui/market/category/category_page.dart';
import 'package:aku_community/ui/market/search/search_goods_page.dart'; import 'package:aku_community/ui/market/search/search_goods_page.dart';
import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/utils/headers.dart';
import 'package:aku_community/widget/bee_scaffold.dart'; import 'package:aku_community/widget/bee_scaffold.dart';
import 'package:aku_community/widget/tab_bar/bee_tab_bar.dart'; import 'package:waterfall_flow/waterfall_flow.dart';
// import 'package:aku_community/widget/tab_bar/bee_tab_bar.dart';
class MarketPage extends StatefulWidget { class MarketPage extends StatefulWidget {
MarketPage({Key? key}) : super(key: key); MarketPage({Key? key}) : super(key: key);
@ -28,8 +30,7 @@ class MarketPage extends StatefulWidget {
} }
class _MarketPageState extends State<MarketPage> class _MarketPageState extends State<MarketPage>
with AutomaticKeepAliveClientMixin, TickerProviderStateMixin { with AutomaticKeepAliveClientMixin {
late TabController _tabController;
List<MarketCategoryModel> _marketModels = []; List<MarketCategoryModel> _marketModels = [];
List<GoodsItem> _hotItems = []; List<GoodsItem> _hotItems = [];
@ -45,7 +46,6 @@ class _MarketPageState extends State<MarketPage>
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_tabController = TabController(length: 2, vsync: this);
updateMarketInfo().then((_) { updateMarketInfo().then((_) {
setState(() {}); setState(() {});
}); });
@ -111,8 +111,11 @@ class _MarketPageState extends State<MarketPage>
//AppBar top Widget height //AppBar top Widget height
//bottom height: 48 //bottom height: 48
// flexibleSpace ( - )/4*2 + + bottom + top // flexibleSpace ( - )/4*2 + + bottom + top
expandedHeight: // *
(mediaWidth - 32.w * 2) / 4 * 2 + 16.w * 2 + 48 + 68.w, //expandedHeight:
//(mediaWidth - 32.w * 2) / 4 * 2 + 16.w * 2 + 48 + 68.w,
//
expandedHeight: (mediaWidth - 32.w * 2) / 4 * 2 + 16.w * 2,
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
elevation: 0, elevation: 0,
flexibleSpace: FlexibleSpaceBar( flexibleSpace: FlexibleSpaceBar(
@ -122,55 +125,55 @@ class _MarketPageState extends State<MarketPage>
top: 16.w, top: 16.w,
left: 32.w, left: 32.w,
right: 32.w, right: 32.w,
bottom: 16.w + 48, //bottom bottom: 16.w, //bottom
), ),
child: Column( child: Column(
children: [ children: [
SizedBox( // SizedBox(
height: 58.w, // height: 58.w,
child: Row( // child: Row(
children: [ // children: [
Text( // Text(
'热搜:', // '热搜:',
style: TextStyle( // style: TextStyle(
fontSize: 20.sp, // fontSize: 20.sp,
), // ),
), // ),
20.wb, // 20.wb,
ListView.separated( // ListView.separated(
scrollDirection: Axis.horizontal, // scrollDirection: Axis.horizontal,
separatorBuilder: (_, __) => 20.wb, // separatorBuilder: (_, __) => 20.wb,
itemBuilder: (context, index) { // itemBuilder: (context, index) {
final item = _hotItems[index]; // final item = _hotItems[index];
return MaterialButton( // return MaterialButton(
padding: // padding:
EdgeInsets.symmetric(horizontal: 40.w), // EdgeInsets.symmetric(horizontal: 40.w),
minWidth: 0, // minWidth: 0,
shape: StadiumBorder( // shape: StadiumBorder(
side: BorderSide( // side: BorderSide(
color: ktextSubColor, // color: ktextSubColor,
width: 1, // width: 1,
), // ),
), // ),
materialTapTargetSize: // materialTapTargetSize:
MaterialTapTargetSize.shrinkWrap, // MaterialTapTargetSize.shrinkWrap,
onPressed: () { // onPressed: () {
Get.to(() => GoodsDetailPage(id: item.id)); // Get.to(() => GoodsDetailPage(id: item.id));
}, // },
child: Text( // child: Text(
item.title, // item.title,
style: TextStyle( // style: TextStyle(
color: ktextSubColor, // color: ktextSubColor,
), // ),
), // ),
); // );
}, // },
itemCount: _hotItems.length, // itemCount: _hotItems.length,
).expand(), // ).expand(),
], // ],
), // ),
), // ),
10.hb, // 10.hb,
gridItems.expand(), gridItems.expand(),
], ],
), ),
@ -178,29 +181,35 @@ class _MarketPageState extends State<MarketPage>
), ),
pinned: true, pinned: true,
toolbarHeight: 0, toolbarHeight: 0,
bottom: PreferredSize( // bottom: PreferredSize(
child: Material( // child: Material(
color: Color(0xFFF9F9F9), // color: Color(0xFFF9F9F9),
child: Align( // child: Align(
alignment: Alignment.centerLeft, // alignment: Alignment.centerLeft,
child: BeeTabBar( // child: BeeTabBar(
scrollable: true, // scrollable: true,
controller: _tabController, // controller: _tabController,
tabs: ['社区商城', '二手市场'], // tabs: ['社区商城', '二手市场'],
), // ),
), // ),
), // ),
preferredSize: Size.fromHeight(48), // preferredSize: Size.fromHeight(48),
), // ),
), ),
]; ];
}, },
body: TabBarView( body: WaterfallFlow.builder(
children: [ gridDelegate: SliverWaterfallFlowDelegateWithFixedCrossAxisCount(
SizedBox(), crossAxisCount: 2,
SizedBox(), mainAxisSpacing: 20.w,
], crossAxisSpacing: 20.w,
controller: _tabController, ),
padding: EdgeInsets.all(32.w),
itemBuilder: (context, index) {
final item = _hotItems[index];
return GoodsCard(item: item);
},
itemCount: _hotItems.length,
), ),
), ),
); );

Loading…
Cancel
Save