| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- /**
- * index
- *
- */
- define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'common/services', 'common/directives', 'angular-toaster', 'ngSanitize', 'common/query/Project'], function(angularAMD) {
- 'use strict';
- var app = angular.module('myApp', [ 'ui.router', 'ui.bootstrap', 'ng.local', 'ngTable', 'common.services', 'common.directives', 'toaster', 'ProjectService']);
- app.init = function() {
- angularAMD.bootstrap(app);
- };
- app.config(['$httpProvider', function ($httpProvider) {
- // http拦截
- $httpProvider.interceptors.push('httpInterceptor');
- }]);
- app.factory('httpInterceptor', ['$window', '$q', '$injector', 'BaseService', function ($window, $q, $injector, BaseService) {
- var httpInterceptor = {
- 'responseError': function (response) {
- if (response.status == 401) {// UNAUTHORIZED
- window.location.href = response.data.loginUrl || 'index';
- return $q.reject(response);
- }
- return $q.reject(response);
- }
- }
- return httpInterceptor;
- }]);
- app.config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) {
- $urlRouterProvider.otherwise("/");
- $stateProvider.state("project", angularAMD.route({
- url : '/',
- title : '项目列表',
- templateUrl : 'static/view/project/project_list.html',
- controller : 'ProjectListCtrl',
- controllerUrl : 'app/controllers/ProjectListCtrl'
- })).state("detail", angularAMD.route({
- url : '/detail/:id',
- title : '项目详情',
- templateUrl : 'static/view/project/project_detail.html',
- controller : 'ProjectDetailCtrl',
- controllerUrl : 'app/controllers/ProjectDetailCtrl'
- })).state("organization", angularAMD.route({
- url : '/organization/:id',
- title : '机构介绍',
- templateUrl : 'static/view/project/organization_detail.html',
- controller : 'OrganizationDetailCtrl',
- controllerUrl : 'app/controllers/OrganizationDetailCtrl'
- })).state("paySucccess", {
- url : '/donationsOver/:tradeNo',
- title : '支付完成',
- templateUrl : 'static/view/project/donationsOver.html',
- controller : 'donationsOverCtrl'
- }).state("wxPayQrcode", {
- url : '/donateQrcode',
- title : '微信扫码',
- templateUrl : 'static/view/project/donateQrcode.html'
- // controller : 'donationsOverCtrl'
- });
- }]);
- // app.run(['$rootScope', 'BaseService', 'StoreInfo', function($rootScope, BaseService, StoreInfo) {
- // $rootScope.rootPath = BaseService.getRootPath();
- //
- // }]);
- // app.controller('hotNewsCtrl', ['$scope', 'News', function ($scope, News) {
- //
- // }]);
- app.controller('donationsOverCtrl', ['$scope', '$stateParams', '$http', function ($scope, $stateParams, $http) {
- var loadData = function () {
- var tradeNo = $stateParams.tradeNo;
- $http.get('/projectrecode/detail/' + tradeNo, {
- }).success(function (data) {
- $scope.projectRecode = data;
- }).error(function () {
- alert("查询支付结果出错");
- });
- };
- loadData();
- }]);
- return app;
- });
|