'use strict'; /** * Config for the router */ app.config(['$httpProvider', '$stateProvider', '$urlRouterProvider', '$controllerProvider', '$compileProvider', '$filterProvider', '$provide', '$ocLazyLoadProvider', 'JS_REQUIRES', function($httpProvider, $stateProvider, $urlRouterProvider, $controllerProvider, $compileProvider, $filterProvider, $provide, $ocLazyLoadProvider, jsRequires) { app.controller = $controllerProvider.register; app.directive = $compileProvider.directive; app.filter = $filterProvider.register; app.factory = $provide.factory; app.service = $provide.service; app.constant = $provide.constant; app.value = $provide.value; $ocLazyLoadProvider.config({ debug: false, events: true, modules: jsRequires.modules }); // setup an abstract state for the tabs directive $stateProvider.state('tab', { url: '/tab', abstract: true, resolve: loadSequence('mainCtrl'), templateUrl: 'assets/views/weChat/tabs.html', controller: 'mainCtrl' }) .state('tab.index', { url: '/index', resolve: loadSequence('indexCtrl'), templateUrl: 'assets/views/weChat/tab-index.html', controller: 'indexCtrl' // views: { // 'tab-index': { // templateUrl: 'assets/views/weChat/tab-index.html', // controller: 'loginCtrl' // } // } }) .state('login', { url: '/login', resolve: loadSequence('loginCtrl'), templateUrl: 'assets/views/weChat/tab-login.html', controller: 'loginCtrl', cache: false, }) // .state('tab.chats', { url: '/chats', resolve: loadSequence('customformCtrl'), views: { 'tab-chats': { templateUrl: 'assets/views/weChat/customForm/customFormIndex.html', controller: 'CustomformCtrl' } } // resolve: loadSequence('aa'), // views: { // 'tab-chats': { // templateUrl: 'ionic/templates/tab-chats.html', // controller: 'aa' // } // } }) //我的事件 // .state('tab.myIncident', { // url: '/myIncident', // resolve: loadSequence('myIncidentCtrl'), // views: { // 'tab-myIncident': { // templateUrl: 'assets/views/weChat/myIncident/myIncident.html', // controller: 'myIncidentCtrl' // } // } // }) //请求人列表 .state('tab.myIncident', { url: '/myIncident', resolve: loadSequence('ngAside', 'myIncidentCtrl'), templateUrl: 'assets/views/weChat/myIncident/myIncident.html', controller: 'myIncidentCtrl' }) //请求人详情 .state('tab.myIncidentDetail', { url: '/myIncidentDetail/{item}', resolve: loadSequence('moment', 'angularMoment', 'Timeline', 'myIncidentDetailCtrl'), templateUrl: 'assets/views/weChat/myIncident/myIncidentDetail.html', controller: 'myIncidentDetailCtrl' }) //请求人表单创建 .state('tab.customFormIndex', { url: '/customFormIndex/{formKey}', templateUrl: "assets/views/weChat/customForm/customFormIndex.html", resolve: loadSequence('ui.select', 'jilian', 'directnewscroll', 'ngAside', 'swiper', 'angularFileUpload', 'customFormIndexCtrl'), pdKey: 'weChatApplyStart', // formKey: 'requestMobileEditor', controller: 'customFormIndexCtrl' }) //请求人表单查看 .state('tab.customFormDetail', { url: '/customFormDetail/{formKey}/{pdKey}/{dataId}/{taskId}/{processInstanceId}', resolve: loadSequence('customFormIndexCtrl', 'customFormDetailCtrl'), templateUrl: 'assets/views/weChat/customForm/customFormDetail.html', controller: 'customFormDetailCtrl' }) //请求人满意的评价 .state('tab.requesterDegree', { url: '/customFormIndex/{formKey}/{incidentid}', templateUrl: "assets/views/weChat/customForm/customFormIndex.html", resolve: loadSequence('customFormIndexCtrl', 'ui.select', 'angularFileUpload'), pdKey: 'weChatApplySave', // formKey: 'requestMobileEditor', controller: 'customFormIndexCtrl' }) //处理人列表 .state('tab.incidentHandler', { url: '/incidentHandler', resolve: loadSequence('ngAside', 'incidentHandlerCtrl'), templateUrl: 'assets/views/weChat/myIncident/incidentHandler.html', controller: 'incidentHandlerCtrl' }) //处理人表单查看 .state('tab.incidentHandlerCustomFormDetail', { url: '/incidentHandlerCustomFormDetail/{formKey}/{pdKey}/{dataId}/{taskId}/{processInstanceId}', templateUrl: "assets/views/weChat/customForm/customFormDetail.html", resolve: loadSequence('customFormIndexCtrl', 'moment', 'angularMoment', 'Timeline', 'customFormDetailCtrl'), pdKey: 'bpm_incident', controller: 'customFormDetailCtrl' }) //处理人表单操作 .state('tab.incidentHandlerCustomFormIndex', { // url: '/incidentHandlerCustomFormIndex', // templateUrl: "assets/views/weChat/customForm/customFormIndex.html", // resolve: loadSequence('customFormIndexCtrl'), // pdKey: 'bpm_incident', resolve: loadSequence('customFormIndexCtrl', 'multi.select.tree', 'ionicclose', 'uiSwitch', 'groupzhipai', 'knowfenlei', 'renyuan', 'fenlei', 'jilian', 'directnewscroll', 'ngAside', 'swiper', 'angularFileUpload', 'ui.select'), url: '/incidentHandlerCustomFormIndex/{taskId}/{processInstanceId}', templateUrl: "assets/views/weChat/customForm/customFormIndex.html", pdKey: 'bpm_incident', controller: 'customFormIndexCtrl' }) //处理人建单 .state('tab.incidentHandlerNew', { url: '/incidentHandlerNew', resolve: loadSequence('customFormIndexCtrl', 'multi.select.tree', 'ionicclose', 'renyuan', 'fenlei', 'jilian', 'directnewscroll', 'ngAside', 'swiper', 'angularFileUpload', 'ui.select', 'angularFileUpload'), templateUrl: "assets/views/weChat/customForm/customFormIndex.html", pdKey: 'bpm_incident', controller: 'customFormIndexCtrl' }) //知识库 .state('tab.myKnowledge', { url: '/myKnowledge', resolve: loadSequence('myKnowledgeCtrl'), templateUrl: 'assets/views/weChat/myKnowledge/myKnowledge.html', controller: 'myKnowledgeCtrl' }) //知识库查看 .state('tab.myKnowledgeDetail', { url: '/myKnowledgeDetail/{item}', resolve: loadSequence('myKnowledgeDetailCtrl'), templateUrl: 'assets/views/weChat/myKnowledge/myKnowledgeDetail.html', controller: 'myKnowledgeDetailCtrl' }) //知识库评论 // .state('myKnowledge', { // abstract: true, // url: '/myKnowledge', // // resolve: loadSequence('myKnowledgeDetailCtrl'), // templateUrl: 'assets/views/weChat/myKnowledge/myKnowledgeTab.html', // // controller: 'myKnowledgeDetailCtrl' // }) //知识库评论列表 // .state('tab.myKnowledgeList', { // url: '/myKnowledgeList', // resolve: loadSequence('myKnowledgeListCtrl'), // templateUrl: 'assets/views/weChat/myKnowledge/myKnowledgeList.html', // controller: 'myKnowledgeListCtrl' // }) //知识库评论列表 .state('tab.myKnowledgeList', { url: '/myKnowledgeList/{item}', resolve: loadSequence('myKnowledgeListCtrl'), templateUrl: 'assets/views/weChat/myKnowledge/myKnowledgeList.html', controller: 'myKnowledgeListCtrl' }) //知识库评论提交 .state('tab.myKnowledgeComment', { url: '/myKnowledgeComment/{item}', resolve: loadSequence('ionic-ratings', 'myKnowledgeCommentCtrl'), templateUrl: 'assets/views/weChat/myKnowledge/myKnowledgeComment.html', controller: 'myKnowledgeCommentCtrl' }) //知识库评论提交 // .state('myKnowledge.comment', { // url: '/myKnowledge/comment', // resolve: loadSequence('customFormIndexCtrl', 'ui.select', 'angularFileUpload'), // templateUrl: "assets/views/weChat/customForm/customFormIndex.html", // controller: 'customFormIndexCtrl' // }) //公告列表 .state('tab.myNotice', { url: '/myNotice', resolve: loadSequence('myNoticeCtrl'), templateUrl: 'assets/views/weChat/myNotice/myNotice.html', controller: 'myNoticeCtrl' }) //公告详情 .state('tab.myNoticeDetail', { url: '/myNoticeDetail/{item}', resolve: loadSequence('myNoticeDetailCtrl'), templateUrl: 'assets/views/weChat/myNotice/myNoticeDetail.html', controller: 'myNoticeDetailCtrl' }) //巡检列表 .state('tab.inspect', { url: '/inspect', resolve: loadSequence('ngAside', 'inspectCtrl'), templateUrl: 'assets/views/weChat/inspect/inspect.html', controller: 'inspectCtrl' }) //巡检编辑 .state('tab.reServiceCustomFormIndex', { url: '/reServiceCustomFormIndex/{pdKey}/{taskId}/{processInstanceId}/{formUiEdit}', templateUrl: "assets/views/weChat/customForm/customFormIndex.html", resolve: loadSequence('customFormIndexCtrl', 'uiSwitch', 'ui.select', 'angularFileUpload'), pdKey: 'weChatApplyStart', // formKey: 'requestMobileEditor', controller: 'customFormIndexCtrl' }) //巡检查看 .state('tab.reServiceCustomFormDetail', { url: '/reServiceCustomFormDetail/{pdKey}/{taskId}/{processInstanceId}/{formKey}', resolve: loadSequence('customFormIndexCtrl', 'uiSwitch', 'customFormDetailCtrl'), templateUrl: 'assets/views/weChat/customForm/customFormDetail.html', controller: 'customFormDetailCtrl' }) //仪表盘 .state('tab.handlerDashboard', { url: '/handlerDashboard', resolve: loadSequence('handlerDashboardCtrl'), templateUrl: 'assets/views/weChat/dashboard/handlerDashboard.html', controller: 'handlerDashboardCtrl' }) .state('tab.requesterDashboard', { url: '/requesterDashboard', resolve: loadSequence('moment', 'angularMoment', 'requesterDashboardCtrl'), templateUrl: 'assets/views/weChat/dashboard/requesterDashboard.html', controller: 'requesterDashboardCtrl' }) //服务指南 .state('tab.serviceInformation', { url: '/serviceInformation', resolve: loadSequence('serviceInformationCtrl'), templateUrl: 'assets/views/weChat/myServiceInformation/serviceInformation.html', controller: 'serviceInformationCtrl' }) //验证错误页面 .state('err', { url: '/err', resolve: loadSequence('errorCtrl'), templateUrl: 'assets/views/weChat/err.html', controller: 'errorCtrl' }) //测试 .state('tab.aa', { url: '/aa', template: 'aa123', }) $urlRouterProvider.otherwise('/login'); // Generates a resolve object previously configured in constant.JS_REQUIRES (config.constant.js) function loadSequence() { var _args = arguments; return { deps: ['$ocLazyLoad', '$q', function($ocLL, $q) { var promise = $q.when(1); for (var i = 0, len = _args.length; i < len; i++) { promise = promiseThen(_args[i]); } return promise; function promiseThen(_arg) { if (typeof _arg == 'function') return promise.then(_arg); else return promise.then(function() { var nowLoad = requiredData(_arg); if (!nowLoad) return $.error('Route resolve: Bad resource name [' + _arg + ']'); return $ocLL.load(nowLoad); }); } function requiredData(name) { if (jsRequires.modules) for (var m in jsRequires.modules) if (jsRequires.modules[m].name && jsRequires.modules[m].name === name) return jsRequires.modules[m]; return jsRequires.scripts && jsRequires.scripts[name]; } } ] }; } } ]);