微信loading弹框

This commit is contained in:
txz 2016-04-21 10:38:36 +08:00
parent aed3818273
commit 8e254ff722
3 changed files with 35 additions and 5 deletions

View File

@ -13,7 +13,13 @@
</head>
<body>
<div ng-view></div>
<div ng-view>
<div class="loading-modal loading-bg" ng-if="loading">
<div class="loading-box">
<img src="img/loading.gif" alt=""/><span>加载中...</span>
</div>
</div>
</div>
<script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.js"></script>

View File

@ -1,9 +1,9 @@
var app = angular.module('wechat', ['ngRoute','ngCookies']);
var apiUrl = '/api/v1/';
var debug = false; //调试标志,如果在本地请置为true
var debug = true; //调试标志,如果在本地请置为true
if(debug===true){
apiUrl = 'https://www.trustie.net/api/v1/';
apiUrl = 'http://localhost:3000/api/v1/';
}
app.factory('auth', function($http,$routeParams, $cookies, $q){
@ -399,7 +399,7 @@ app.directive('textAutoHeight', function($timeout){
}
});
app.config(['$routeProvider',function ($routeProvider) {
app.config(['$routeProvider',"$httpProvider",function ($routeProvider, $httpProvider) {
$routeProvider
.when('/activities', {
templateUrl: 'activities.html',
@ -436,4 +436,22 @@ app.config(['$routeProvider',function ($routeProvider) {
.otherwise({
redirectTo: '/activities'
});
$httpProvider.interceptors.push('timestampMarker');
}]);
//loading
app.factory('timestampMarker', ["$rootScope", function ($rootScope) {
var timestampMarker = {
request: function (config) {
$rootScope.loading = true;
config.requestTimestamp = new Date().getTime();
return config;
},
response: function (response) {
// $rootScope.loading = false;
response.config.responseTimestamp = new Date().getTime();
return response;
}
};
return timestampMarker;
}]);

View File

@ -64,4 +64,10 @@ a.underline {text-decoration:underline;}
.post-reply-trigger {font-size:13px;}
.post-input-container {padding-right:2px;}
.post-reply-input {width:100%; height:28px; line-height:28px; border:1px solid #e6e6e6; outline:none; padding:0; margin:0; border-radius:3px;}
.post-reply-submit {font-size:13px; padding:3px 8px; color:#fff; background-color:#269ac9; outline:none; border:none; display:inline-block;}
.post-reply-submit {font-size:13px; padding:3px 8px; color:#fff; background-color:#269ac9; outline:none; border:none; display:inline-block;}
/* loading 弹框*/
.loading-bg {position:fixed; width:100%; height:100%; left:0; top:0; z-index:99; background:rgba(0, 0, 0, 0.3); overflow:hidden;}
.loading-box {position:absolute; top:50%; background:white; width:160px; height:72px; left:50%; margin-top:-36px; margin-left:-80px; text-align:center;}
.loading-box img {margin-top: 12px; text-align: center;}
.loading-box span {display: block;}