Merge branch 'weixin_guange' into develop

Conflicts:
	app/services/wechat_service.rb
	public/stylesheets/weui/weixin.css
This commit is contained in:
huang 2016-05-03 17:14:58 +08:00
commit 8446fbe39a
5 changed files with 56 additions and 32 deletions

View File

@ -10,23 +10,23 @@ class WechatService
data:{
first: {
value:first,
color:"#CCCCCC"
color:"#707070"
},
keyword1:{
value:key1,
color:"#CCCCCC"
color:"#707070"
},
keyword2:{
value:key2,
color:"#CCCCCC"
color:"#707070"
},
keyword3:{
value:key3,
color:"#CCCCCC"
color:"#707070"
},
remark:{
value:remark,
color:"#CCCCCC"
color:"#707070"
}
}
}
@ -88,19 +88,19 @@ class WechatService
data:{
first: {
value:first,
color:"#CCCCCC"
color:"#707070"
},
keyword1:{
value:key1,
color:"#CCCCCC"
color:"#707070"
},
keyword2:{
value:key2,
color:"#CCCCCC"
color:"#707070"
},
remark:{
value:remark,
color:"#CCCCCC"
color:"#707070"
}
}
}

View File

@ -1,6 +1,7 @@
<div id="container">
<!-- 模板1开始可以使用scripttype设置为text/html来存放模板片段并且用id标示 -->
<div loading-spinner></div>
<div ng-repeat="act in activities">
<div ng-if="act.container_type=='Course'">
<div ng-if="act.act_type=='HomeworkCommon'">

View File

@ -14,11 +14,6 @@
</head>
<body>
<div ng-view>
<div class="loading-modal loading-bg" ng-if="loading">
<div class="loading-box">
<img src="/images/wechat/loading.gif" alt=""/><span>加载中...</span>
</div>
</div>
</div>

View File

@ -3,6 +3,7 @@ var apiUrl = '/api/v1/';
var debug = false; //调试标志,如果在本地请置为true
if(debug===true){
//apiUrl = 'http://localhost:3000/api/v1/';
apiUrl = 'https://www.trustie.net/api/v1/';
}
@ -435,6 +436,25 @@ app.directive('textAutoHeight', function($timeout){
}
});
app.directive('loadingSpinner', function ($http) {
return {
restrict: 'A',
replace: true,
template: '<div class="loading-bg"><div class="loading-box"><img src="/images/wechat/loading.gif" alt=""/><span>加载中...</span></div></div>',
link: function (scope, element, attrs) {
scope.$watch('activeCalls', function (newVal, oldVal) {
if (newVal == 0) {
$(element).hide();
}
else {
$(element).show();
}
});
}
};
});
app.config(['$routeProvider',"$httpProvider",function ($routeProvider, $httpProvider) {
$routeProvider
.when('/activities', {
@ -472,22 +492,30 @@ app.config(['$routeProvider',"$httpProvider",function ($routeProvider, $httpProv
.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;
//监听异步请求
$httpProvider.interceptors.push(function ($q, $rootScope) {
if ($rootScope.activeCalls == undefined) {
$rootScope.activeCalls = 0;
}
return {
request: function (config) {
$rootScope.activeCalls += 1;
return config;
},
requestError: function (rejection) {
$rootScope.activeCalls -= 1;
return rejection;
},
response: function (response) {
$rootScope.activeCalls -= 1;
return response;
},
responseError: function (rejection) {
$rootScope.activeCalls -= 1;
return rejection;
}
};
});
}]);

View File

@ -76,4 +76,4 @@ a.underline {text-decoration:underline;}
.loading-bg {position:fixed; width:100%; height:100%; left:0; top:0; z-index:99; background:rgba(206, 206, 206, 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: 3px; text-align: center;}
.loading-box span {display: block; font-size:13px;}
.loading-box span {display: block; font-size:12px;}