|
@@ -211,73 +211,76 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { |
|
@@ -211,73 +211,76 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { |
|
211
|
child: ChangeNotifierProvider<CollectStoreProvider>(
|
211
|
child: ChangeNotifierProvider<CollectStoreProvider>(
|
|
212
|
create: (_) => CollectStoreProvider(), child: MyPage()),
|
212
|
create: (_) => CollectStoreProvider(), child: MyPage()),
|
|
213
|
)));
|
213
|
)));
|
|
214
|
- WidgetsBinding.instance.addPostFrameCallback((_) {
|
214
|
+ WidgetsBinding.instance.addPostFrameCallback((_) async {
|
|
215
|
bus.on('refresh_token', (arg) {
|
215
|
bus.on('refresh_token', (arg) {
|
|
216
|
initPlatformState();
|
216
|
initPlatformState();
|
|
217
|
});
|
217
|
});
|
|
218
|
- getSellerVersion();
|
|
|
|
219
|
- initPlatformState();
|
|
|
|
220
|
- _getTableList();
|
|
|
|
221
|
- _getSellerById();
|
|
|
|
222
|
-
|
|
|
|
223
|
- List<PullMarketingByUidSunModel> data =
|
|
|
|
224
|
- Provider.of<UserModel>(context, listen: false)
|
|
|
|
225
|
- .pullMarketingByUidSunModel;
|
|
|
|
226
|
- if (data != null && Utils.getAuthority(context, '全店任务')) {
|
|
|
|
227
|
- if (data.length > 0) {
|
|
|
|
228
|
- Future.delayed(Duration(milliseconds: 300), () {
|
|
|
|
229
|
- DialogUtil.cupertinoAlertDialog(context,
|
|
|
|
230
|
- title: "全店任务",
|
|
|
|
231
|
- content: "管理员发布了新的任务,请立即查看并完成任务",
|
|
|
|
232
|
- lTitle: "稍后提醒",
|
|
|
|
233
|
- rTitle: "立即查看", lCallback: () {
|
|
|
|
234
|
- print("稍后提醒");
|
|
|
|
235
|
- // 30分钟后重新弹窗
|
|
|
|
236
|
- _startTimerSeller();
|
|
|
|
237
|
- }, rCallback: () {
|
|
|
|
238
|
- _endTimerSeller();
|
|
|
|
239
|
- if (data.length == 1) {
|
|
|
|
240
|
- //进入营销详情
|
|
|
|
241
|
- NavigatorUtil.goSellerMyMarketingRecordsDetailPage(
|
|
|
|
242
|
- context, data[0].mid,
|
|
|
|
243
|
- fromNotify: true);
|
|
|
|
244
|
- } else {
|
|
|
|
245
|
- //进入我的客情首页
|
|
|
|
246
|
- NavigatorUtil.goMyCustomerPage(context);
|
|
|
|
247
|
- }
|
218
|
+ bool success = await getSellerVersion();
|
|
|
|
219
|
+ if (success) {
|
|
|
|
220
|
+ initPlatformState();
|
|
|
|
221
|
+ _getTableList();
|
|
|
|
222
|
+ _getSellerById();
|
|
|
|
223
|
+
|
|
|
|
224
|
+ List<PullMarketingByUidSunModel> data =
|
|
|
|
225
|
+ Provider.of<UserModel>(context, listen: false)
|
|
|
|
226
|
+ .pullMarketingByUidSunModel;
|
|
|
|
227
|
+ if (data != null && Utils.getAuthority(context, '全店任务')) {
|
|
|
|
228
|
+ if (data.length > 0) {
|
|
|
|
229
|
+ Future.delayed(Duration(milliseconds: 300), () {
|
|
|
|
230
|
+ DialogUtil.cupertinoAlertDialog(context,
|
|
|
|
231
|
+ title: "全店任务",
|
|
|
|
232
|
+ content: "管理员发布了新的任务,请立即查看并完成任务",
|
|
|
|
233
|
+ lTitle: "稍后提醒",
|
|
|
|
234
|
+ rTitle: "立即查看", lCallback: () {
|
|
|
|
235
|
+ print("稍后提醒");
|
|
|
|
236
|
+ // 30分钟后重新弹窗
|
|
|
|
237
|
+ _startTimerSeller();
|
|
|
|
238
|
+ }, rCallback: () {
|
|
|
|
239
|
+ _endTimerSeller();
|
|
|
|
240
|
+ if (data.length == 1) {
|
|
|
|
241
|
+ //进入营销详情
|
|
|
|
242
|
+ NavigatorUtil.goSellerMyMarketingRecordsDetailPage(
|
|
|
|
243
|
+ context, data[0].mid,
|
|
|
|
244
|
+ fromNotify: true);
|
|
|
|
245
|
+ } else {
|
|
|
|
246
|
+ //进入我的客情首页
|
|
|
|
247
|
+ NavigatorUtil.goMyCustomerPage(context);
|
|
|
|
248
|
+ }
|
|
|
|
249
|
+ });
|
|
248
|
});
|
250
|
});
|
|
249
|
- });
|
251
|
+ }
|
|
250
|
}
|
252
|
}
|
|
251
|
- }
|
|
|
|
252
|
- if (widget.initialIndex == 0 ||
|
|
|
|
253
|
- widget.initialIndex == 1 && needRefreshTemp == false) return;
|
|
|
|
254
|
- _initNotification();
|
|
|
|
255
|
- Future.delayed(Duration(milliseconds: 30000), () {
|
|
|
|
256
|
- //30000
|
|
|
|
257
|
- ContactModel.getInstance().uploadLocalContact(context);
|
|
|
|
258
|
- UserModel usermodel = Provider.of<UserModel>(context, listen: false);
|
|
|
|
259
|
-
|
|
|
|
260
|
- if (needUpdate && !usermodel.downLoading) {
|
|
|
|
261
|
- UpdateModelMy updateModel = new UpdateModelMy();
|
|
|
|
262
|
- updateModel.checkUpdate(context, (version) {
|
|
|
|
263
|
- updateModel.showUpdateDialog(context, version);
|
|
|
|
264
|
- }, showToast: false);
|
253
|
+ if (widget.initialIndex == 0 ||
|
|
|
|
254
|
+ widget.initialIndex == 1 && needRefreshTemp == false) return;
|
|
|
|
255
|
+ _initNotification();
|
|
|
|
256
|
+ Future.delayed(Duration(milliseconds: 30000), () {
|
|
|
|
257
|
+ //30000
|
|
|
|
258
|
+ ContactModel.getInstance().uploadLocalContact(context);
|
|
|
|
259
|
+ UserModel usermodel = Provider.of<UserModel>(context, listen: false);
|
|
|
|
260
|
+
|
|
|
|
261
|
+ if (needUpdate && !usermodel.downLoading) {
|
|
|
|
262
|
+ UpdateModelMy updateModel = new UpdateModelMy();
|
|
|
|
263
|
+ updateModel.checkUpdate(context, (version) {
|
|
|
|
264
|
+ updateModel.showUpdateDialog(context, version);
|
|
|
|
265
|
+ }, showToast: false);
|
|
|
|
266
|
+ }
|
|
|
|
267
|
+ });
|
|
|
|
268
|
+
|
|
|
|
269
|
+ if (Utils.getAuthority(context, '消息中心')) {
|
|
|
|
270
|
+ timer = Timer.periodic(Duration(minutes: 3), (_) {
|
|
|
|
271
|
+ _getAllUnMessages();
|
|
|
|
272
|
+ });
|
|
265
|
}
|
273
|
}
|
|
266
|
- });
|
|
|
|
267
|
|
274
|
|
|
268
|
- if (Utils.getAuthority(context, '消息中心')) {
|
|
|
|
269
|
- timer = Timer.periodic(Duration(minutes: 3), (_) {
|
|
|
|
270
|
- _getAllUnMessages();
|
|
|
|
271
|
- });
|
275
|
+ _getUnMsgNum();
|
|
272
|
}
|
276
|
}
|
|
273
|
-
|
|
|
|
274
|
- _getUnMsgNum();
|
|
|
|
275
|
});
|
277
|
});
|
|
276
|
}
|
278
|
}
|
|
277
|
|
279
|
|
|
278
|
getSellerVersion() async {
|
280
|
getSellerVersion() async {
|
|
279
|
await collectStoreProvider.getSellerVersion(context);
|
281
|
await collectStoreProvider.getSellerVersion(context);
|
|
280
|
- if (collectStoreProvider.sellerVersionList != null) {
|
282
|
+ if (collectStoreProvider.sellerVersionList != null &&
|
|
|
|
283
|
+ collectStoreProvider.sellerVersionList.length > 0) {
|
|
281
|
//获取到店铺过期时间
|
284
|
//获取到店铺过期时间
|
|
282
|
//店铺过期提醒
|
285
|
//店铺过期提醒
|
|
283
|
// 计算时间差
|
286
|
// 计算时间差
|
|
@@ -312,8 +315,21 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { |
|
@@ -312,8 +315,21 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { |
|
312
|
// //店铺过期日期
|
315
|
// //店铺过期日期
|
|
313
|
// _edateShow();
|
316
|
// _edateShow();
|
|
314
|
// });
|
317
|
// });
|
|
|
|
318
|
+ return true;
|
|
|
|
319
|
+ } else {
|
|
|
|
320
|
+ if (_currIndex != 4) {
|
|
|
|
321
|
+ if (App.sp.containsKey('sellerEdate')) {
|
|
|
|
322
|
+ List<String> data = App.sp.getStringList('sellerEdate');
|
|
|
|
323
|
+ if (data.contains('-1')) {
|
|
|
|
324
|
+ //已经弹过过期弹窗,默认我的
|
|
|
|
325
|
+ _currIndex = 4;
|
|
|
|
326
|
+ }
|
|
|
|
327
|
+ }
|
|
|
|
328
|
+ NavigatorUtil.goHomePage(context, initialIndex: _currIndex);
|
|
|
|
329
|
+ }
|
|
|
|
330
|
+
|
|
|
|
331
|
+ return false;
|
|
315
|
}
|
332
|
}
|
|
316
|
- setState(() {});
|
|
|
|
317
|
}
|
333
|
}
|
|
318
|
|
334
|
|
|
319
|
_getTableList() async {
|
335
|
_getTableList() async {
|
|
@@ -551,19 +567,19 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { |
|
@@ -551,19 +567,19 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { |
|
551
|
Provider.of<StoreBaseIndoProvider>(context, listen: false);
|
567
|
Provider.of<StoreBaseIndoProvider>(context, listen: false);
|
|
552
|
sellerInfoSunModel = await storeBaseIndoProvider.getSellerById(context);
|
568
|
sellerInfoSunModel = await storeBaseIndoProvider.getSellerById(context);
|
|
553
|
if (sellerInfoSunModel != null) {
|
569
|
if (sellerInfoSunModel != null) {
|
|
554
|
- if (sellerInfoSunModel.data.edate != null) {
|
|
|
|
555
|
-//获取到店铺过期时间
|
|
|
|
556
|
- //店铺过期提醒
|
|
|
|
557
|
- // 计算时间差
|
|
|
|
558
|
- //店铺过期日期
|
|
|
|
559
|
- _edateShow();
|
|
|
|
560
|
- timerSellerEdate = Timer.periodic(Duration(days: 1), (_) {
|
|
|
|
561
|
- //店铺过期提醒
|
|
|
|
562
|
- // 计算时间差
|
|
|
|
563
|
- //店铺过期日期
|
|
|
|
564
|
- _edateShow();
|
|
|
|
565
|
- });
|
|
|
|
566
|
- }
|
570
|
+// if (sellerInfoSunModel.data.edate != null) {
|
|
|
|
571
|
+// //获取到店铺过期时间
|
|
|
|
572
|
+// //店铺过期提醒
|
|
|
|
573
|
+// // 计算时间差
|
|
|
|
574
|
+// //店铺过期日期
|
|
|
|
575
|
+// _edateShow();
|
|
|
|
576
|
+// timerSellerEdate = Timer.periodic(Duration(days: 1), (_) {
|
|
|
|
577
|
+// //店铺过期提醒
|
|
|
|
578
|
+// // 计算时间差
|
|
|
|
579
|
+// //店铺过期日期
|
|
|
|
580
|
+// _edateShow();
|
|
|
|
581
|
+// });
|
|
|
|
582
|
+// }
|
|
567
|
|
583
|
|
|
568
|
if (App.sp.containsKey('user')) {
|
584
|
if (App.sp.containsKey('user')) {
|
|
569
|
String s = App.sp.getString('user');
|
585
|
String s = App.sp.getString('user');
|