1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- 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';
- 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(){
- ToastEngine.show("去最近新闻的页面");
- }
- void gotoPropertyNewsPage(){
- ToastEngine.show("去房产新闻的页面");
- }
- void gotoManageGuidePage(){
- ToastEngine.show("去管理员指引的页面");
- }
- }
|