我的资源界面加载前 不显示暂无数据

This commit is contained in:
yuanke 2016-07-15 19:18:30 +08:00
parent 596bfe4bfc
commit 67fa6da8ae
2 changed files with 10 additions and 3 deletions

View File

@ -18,7 +18,7 @@
<div ng-if="has_more"> <div ng-if="has_more">
<div id="more" class="more-events mt10" ng-click="loadResourceData(1,page+1);">更多</div> <div id="more" class="more-events mt10" ng-click="loadResourceData(1,page+1);">更多</div>
</div> </div>
<p ng-show="resources && resources.length<=0" class="class-test-tip">暂无课件,<br /> <p ng-show="resources_tag && resources.length<=0" class="class-test-tip">暂无课件,<br />
请登录Trustie网站在PC浏览器中上传课件。</p> 请登录Trustie网站在PC浏览器中上传课件。</p>
</div> </div>
<div ng-class="{'undis': currentTab!=2}"> <div ng-class="{'undis': currentTab!=2}">
@ -28,7 +28,7 @@
<div ng-if="homework_has_more"> <div ng-if="homework_has_more">
<div id="more_homeworks" class="more-events mt10" ng-click="loadResourceData(2,homework_page+1);">更多</div> <div id="more_homeworks" class="more-events mt10" ng-click="loadResourceData(2,homework_page+1);">更多</div>
</div> </div>
<p ng-show="homeworks && homeworks.length<=0" class="class-test-tip">暂无作业,<br /> <p ng-show="homeworks_tag == true && homeworks.length<=0" class="class-test-tip">暂无作业,<br />
请登录Trustie网站在PC浏览器中创建作业。</p> 请登录Trustie网站在PC浏览器中创建作业。</p>
</div> </div>
<div ng-class="{'undis': currentTab!=3}"> <div ng-class="{'undis': currentTab!=3}">
@ -38,7 +38,7 @@
<div ng-if="exercise_has_more"> <div ng-if="exercise_has_more">
<div id="more_exercises" class="more-events mt10" ng-click="loadResourceData(3,exercise_page+1);">更多</div> <div id="more_exercises" class="more-events mt10" ng-click="loadResourceData(3,exercise_page+1);">更多</div>
</div> </div>
<p ng-show="exercise && exercise.length<=0" class="class-test-tip">暂无测验,<br /> <p ng-show="exercises_tag == true && exercise.length<=0" class="class-test-tip">暂无测验,<br />
请登录Trustie网站在PC浏览器中创建测验。</p> 请登录Trustie网站在PC浏览器中创建测验。</p>
</div> </div>

View File

@ -6,6 +6,10 @@ app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', '$l
vm.homeworks = []; vm.homeworks = [];
vm.exercise = []; vm.exercise = [];
vm.resources_tag = false;
vm.homeworks_tag = false;
vm.exercises_tag = false;
vm.page = rms.get('page') || 0; vm.page = rms.get('page') || 0;
vm.resources = rms.get("resources") || []; vm.resources = rms.get("resources") || [];
vm.has_more = rms.get("has_more"); vm.has_more = rms.get("has_more");
@ -32,6 +36,7 @@ app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', '$l
url: apiUrl+ "resources", url: apiUrl+ "resources",
data: {token: auth.token(), page: page} data: {token: auth.token(), page: page}
}).then(function successCallback(response) { }).then(function successCallback(response) {
vm.resources_tag = true
if(response.data.page >0) { if(response.data.page >0) {
vm.resources = vm.resources.concat(response.data.data); vm.resources = vm.resources.concat(response.data.data);
} else { } else {
@ -56,6 +61,7 @@ app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', '$l
url: apiUrl+ "resources/homeworks", url: apiUrl+ "resources/homeworks",
data: {token: auth.token(), page: page} data: {token: auth.token(), page: page}
}).then(function successCallback(response) { }).then(function successCallback(response) {
vm.homeworks_tag = true
if(response.data.page >0) { if(response.data.page >0) {
vm.homeworks = vm.homeworks.concat(response.data.data); vm.homeworks = vm.homeworks.concat(response.data.data);
} else { } else {
@ -79,6 +85,7 @@ app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', '$l
url: apiUrl+ "resources/exercises", url: apiUrl+ "resources/exercises",
data: {token: auth.token(), page: page} data: {token: auth.token(), page: page}
}).then(function successCallback(response) { }).then(function successCallback(response) {
vm.exercises_tag = true;
if(response.data.page >0) { if(response.data.page >0) {
vm.exercise = vm.exercise.concat(response.data.data); vm.exercise = vm.exercise.concat(response.data.data);
} else { } else {