12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- import 'package:cpt_main/modules/home/property_news/home_property_news_page.dart';
- import 'package:cpt_main/modules/notification/notification_page.dart';
- import 'package:plugin_platform/engine/toast/toast_engine.dart';
- import 'package:riverpod_annotation/riverpod_annotation.dart';
- import 'package:router/componentRouter/community_service.dart';
- import 'package:router/componentRouter/component_service_manager.dart';
- import 'home_state.dart';
- import 'latest_news/latest_news_page.dart';
- import 'management_guides/management_guides_page.dart';
- part 'home_view_model.g.dart';
- @riverpod
- class HomeViewModel extends _$HomeViewModel {
- @override
- HomeState build() {
- return HomeState();
- }
- /// 根据索引触发点击的事件
- void switchCategory(int index) {
- switch (index) {
- case 0:
- //设备
- ComponentServiceManager().facilityService.startFacilityPage();
- break;
- case 1:
- //表单
- ComponentServiceManager().formService.startFormPage();
- break;
- case 2:
- //公告板
- ComponentServiceManager().noticeBoardService.startNoticeBoardPage();
- break;
- case 3:
- //房产
- ComponentServiceManager().propertyService.startPropertyPage();
- break;
- case 4:
- //广告服务
- ComponentServiceManager().servicesService.startServicePage();
- break;
- case 5:
- //社区
- ComponentServiceManager().communityService.startCommunityPage();
- break;
- }
- }
- //去消息通知页面
- void gotoNotificationPage() {
- NotificationPage.startInstance();
- }
- void gotoPaymentPage() {
- ComponentServiceManager().paymentService.startPaymentPage();
- }
- void gotoRewardsPage() {
- ComponentServiceManager().rewardsService.startRewardsPage();
- }
- void gotoLastNewsPage() {
- LatestNewsPage.startInstance();
- }
- void gotoPropertyNewsPage() {
- HomePropertyNewsPage.startInstance();
- }
- void gotoManageGuidePage() {
- ManagementGuidesPage.startInstance();
- }
- }
|