|
...
|
...
|
@@ -211,73 +211,76 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { |
|
|
|
child: ChangeNotifierProvider<CollectStoreProvider>(
|
|
|
|
create: (_) => CollectStoreProvider(), child: MyPage()),
|
|
|
|
)));
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
|
|
|
bus.on('refresh_token', (arg) {
|
|
|
|
initPlatformState();
|
|
|
|
});
|
|
|
|
getSellerVersion();
|
|
|
|
initPlatformState();
|
|
|
|
_getTableList();
|
|
|
|
_getSellerById();
|
|
|
|
|
|
|
|
List<PullMarketingByUidSunModel> data =
|
|
|
|
Provider.of<UserModel>(context, listen: false)
|
|
|
|
.pullMarketingByUidSunModel;
|
|
|
|
if (data != null && Utils.getAuthority(context, '全店任务')) {
|
|
|
|
if (data.length > 0) {
|
|
|
|
Future.delayed(Duration(milliseconds: 300), () {
|
|
|
|
DialogUtil.cupertinoAlertDialog(context,
|
|
|
|
title: "全店任务",
|
|
|
|
content: "管理员发布了新的任务,请立即查看并完成任务",
|
|
|
|
lTitle: "稍后提醒",
|
|
|
|
rTitle: "立即查看", lCallback: () {
|
|
|
|
print("稍后提醒");
|
|
|
|
// 30分钟后重新弹窗
|
|
|
|
_startTimerSeller();
|
|
|
|
}, rCallback: () {
|
|
|
|
_endTimerSeller();
|
|
|
|
if (data.length == 1) {
|
|
|
|
//进入营销详情
|
|
|
|
NavigatorUtil.goSellerMyMarketingRecordsDetailPage(
|
|
|
|
context, data[0].mid,
|
|
|
|
fromNotify: true);
|
|
|
|
} else {
|
|
|
|
//进入我的客情首页
|
|
|
|
NavigatorUtil.goMyCustomerPage(context);
|
|
|
|
}
|
|
|
|
bool success = await getSellerVersion();
|
|
|
|
if (success) {
|
|
|
|
initPlatformState();
|
|
|
|
_getTableList();
|
|
|
|
_getSellerById();
|
|
|
|
|
|
|
|
List<PullMarketingByUidSunModel> data =
|
|
|
|
Provider.of<UserModel>(context, listen: false)
|
|
|
|
.pullMarketingByUidSunModel;
|
|
|
|
if (data != null && Utils.getAuthority(context, '全店任务')) {
|
|
|
|
if (data.length > 0) {
|
|
|
|
Future.delayed(Duration(milliseconds: 300), () {
|
|
|
|
DialogUtil.cupertinoAlertDialog(context,
|
|
|
|
title: "全店任务",
|
|
|
|
content: "管理员发布了新的任务,请立即查看并完成任务",
|
|
|
|
lTitle: "稍后提醒",
|
|
|
|
rTitle: "立即查看", lCallback: () {
|
|
|
|
print("稍后提醒");
|
|
|
|
// 30分钟后重新弹窗
|
|
|
|
_startTimerSeller();
|
|
|
|
}, rCallback: () {
|
|
|
|
_endTimerSeller();
|
|
|
|
if (data.length == 1) {
|
|
|
|
//进入营销详情
|
|
|
|
NavigatorUtil.goSellerMyMarketingRecordsDetailPage(
|
|
|
|
context, data[0].mid,
|
|
|
|
fromNotify: true);
|
|
|
|
} else {
|
|
|
|
//进入我的客情首页
|
|
|
|
NavigatorUtil.goMyCustomerPage(context);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (widget.initialIndex == 0 ||
|
|
|
|
widget.initialIndex == 1 && needRefreshTemp == false) return;
|
|
|
|
_initNotification();
|
|
|
|
Future.delayed(Duration(milliseconds: 30000), () {
|
|
|
|
//30000
|
|
|
|
ContactModel.getInstance().uploadLocalContact(context);
|
|
|
|
UserModel usermodel = Provider.of<UserModel>(context, listen: false);
|
|
|
|
|
|
|
|
if (needUpdate && !usermodel.downLoading) {
|
|
|
|
UpdateModelMy updateModel = new UpdateModelMy();
|
|
|
|
updateModel.checkUpdate(context, (version) {
|
|
|
|
updateModel.showUpdateDialog(context, version);
|
|
|
|
}, showToast: false);
|
|
|
|
if (widget.initialIndex == 0 ||
|
|
|
|
widget.initialIndex == 1 && needRefreshTemp == false) return;
|
|
|
|
_initNotification();
|
|
|
|
Future.delayed(Duration(milliseconds: 30000), () {
|
|
|
|
//30000
|
|
|
|
ContactModel.getInstance().uploadLocalContact(context);
|
|
|
|
UserModel usermodel = Provider.of<UserModel>(context, listen: false);
|
|
|
|
|
|
|
|
if (needUpdate && !usermodel.downLoading) {
|
|
|
|
UpdateModelMy updateModel = new UpdateModelMy();
|
|
|
|
updateModel.checkUpdate(context, (version) {
|
|
|
|
updateModel.showUpdateDialog(context, version);
|
|
|
|
}, showToast: false);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
if (Utils.getAuthority(context, '消息中心')) {
|
|
|
|
timer = Timer.periodic(Duration(minutes: 3), (_) {
|
|
|
|
_getAllUnMessages();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
if (Utils.getAuthority(context, '消息中心')) {
|
|
|
|
timer = Timer.periodic(Duration(minutes: 3), (_) {
|
|
|
|
_getAllUnMessages();
|
|
|
|
});
|
|
|
|
_getUnMsgNum();
|
|
|
|
}
|
|
|
|
|
|
|
|
_getUnMsgNum();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
getSellerVersion() async {
|
|
|
|
await collectStoreProvider.getSellerVersion(context);
|
|
|
|
if (collectStoreProvider.sellerVersionList != null) {
|
|
|
|
if (collectStoreProvider.sellerVersionList != null &&
|
|
|
|
collectStoreProvider.sellerVersionList.length > 0) {
|
|
|
|
//获取到店铺过期时间
|
|
|
|
//店铺过期提醒
|
|
|
|
// 计算时间差
|
|
...
|
...
|
@@ -312,8 +315,21 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { |
|
|
|
// //店铺过期日期
|
|
|
|
// _edateShow();
|
|
|
|
// });
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
if (_currIndex != 4) {
|
|
|
|
if (App.sp.containsKey('sellerEdate')) {
|
|
|
|
List<String> data = App.sp.getStringList('sellerEdate');
|
|
|
|
if (data.contains('-1')) {
|
|
|
|
//已经弹过过期弹窗,默认我的
|
|
|
|
_currIndex = 4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
NavigatorUtil.goHomePage(context, initialIndex: _currIndex);
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
|
|
|
|
_getTableList() async {
|
|
...
|
...
|
@@ -551,19 +567,19 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { |
|
|
|
Provider.of<StoreBaseIndoProvider>(context, listen: false);
|
|
|
|
sellerInfoSunModel = await storeBaseIndoProvider.getSellerById(context);
|
|
|
|
if (sellerInfoSunModel != null) {
|
|
|
|
if (sellerInfoSunModel.data.edate != null) {
|
|
|
|
//获取到店铺过期时间
|
|
|
|
//店铺过期提醒
|
|
|
|
// 计算时间差
|
|
|
|
//店铺过期日期
|
|
|
|
_edateShow();
|
|
|
|
timerSellerEdate = Timer.periodic(Duration(days: 1), (_) {
|
|
|
|
//店铺过期提醒
|
|
|
|
// 计算时间差
|
|
|
|
//店铺过期日期
|
|
|
|
_edateShow();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
// if (sellerInfoSunModel.data.edate != null) {
|
|
|
|
// //获取到店铺过期时间
|
|
|
|
// //店铺过期提醒
|
|
|
|
// // 计算时间差
|
|
|
|
// //店铺过期日期
|
|
|
|
// _edateShow();
|
|
|
|
// timerSellerEdate = Timer.periodic(Duration(days: 1), (_) {
|
|
|
|
// //店铺过期提醒
|
|
|
|
// // 计算时间差
|
|
|
|
// //店铺过期日期
|
|
|
|
// _edateShow();
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
|
|
|
|
if (App.sp.containsKey('user')) {
|
|
|
|
String s = App.sp.getString('user');
|
...
|
...
|
|