|
...
|
...
|
@@ -215,65 +215,64 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { |
|
|
|
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);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
getSellerVersion();
|
|
|
|
|
|
|
|
initPlatformState();
|
|
|
|
_getTableList();
|
|
|
|
_getSellerById();
|
|
|
|
|
|
|
|
if (Utils.getAuthority(context, '消息中心')) {
|
|
|
|
timer = Timer.periodic(Duration(minutes: 3), (_) {
|
|
|
|
_getAllUnMessages();
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
_getUnMsgNum();
|
|
|
|
|
|
|
|
if (Utils.getAuthority(context, '消息中心')) {
|
|
|
|
timer = Timer.periodic(Duration(minutes: 3), (_) {
|
|
|
|
_getAllUnMessages();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
_getUnMsgNum();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -1238,7 +1237,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { |
|
|
|
// _getAllUnMessages();
|
|
|
|
});
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
case AppLifecycleState.inactive:
|
|
|
|
print('inactive');
|
|
...
|
...
|
@@ -1263,6 +1262,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { |
|
|
|
_getAllUnMessages() {
|
|
|
|
MessageDialogModel messageModel =
|
|
|
|
Provider.of<MessageDialogModel>(context, listen: false);
|
|
|
|
|
|
|
|
messageModel.messages = [];
|
|
|
|
|
|
|
|
getUntreatedMessage(() {
|
...
|
...
|
|