我的资源搜索无效

This commit is contained in:
guange 2016-07-08 17:11:16 +08:00
parent 068c8967e1
commit 3c23560d77
2 changed files with 8 additions and 5 deletions

View File

@ -6,22 +6,22 @@
</div>
<div class="class-search-wrap">
<div class="class-search-inner"> <img src="/images/wechat/search.png" width="18" class="class-search-icon" />
<input class="class-detail-search" placeholder="输入关键词进行搜索" />
<input class="class-detail-search" placeholder="输入关键词进行搜索" ng-model="searchText" />
</div>
</div>
<div ng-class="{'undis': currentTab!=1}">
<div ng-repeat="r in resources" ng-class="['class-detail-row', 'f13', 'c-grey3', {'border-top': $first}]"><span class="fl ml10">{{r.filename}}</span><a ng-click="sendFile(r)" class="fr mr10 link-blue2">发送</a></div>
<div ng-repeat="r in resources|filter:searchText" ng-class="['class-detail-row', 'f13', 'c-grey3', {'border-top': $first}]"><span class="fl ml10">{{r.filename}}</span><a ng-click="sendFile(r)" class="fr mr10 link-blue2">发送</a></div>
<p ng-show="resources && resources.length<=0" class="class-test-tip">暂无课件,<br />
请登录Trustie网站,在PC浏览器中上传课件。</p>
</div>
<div ng-class="{'undis': currentTab!=2}">
<div ng-repeat="r in homeworks" ng-class="['class-detail-row', 'f13', 'c-grey3', {'border-top': $first}]"><span class="fl ml10">{{r.homework_name}}</span></div>
<div ng-repeat="r in homeworks|filter:searchText" ng-class="['class-detail-row', 'f13', 'c-grey3', {'border-top': $first}]"><span class="fl ml10">{{r.homework_name}}</span></div>
<p ng-show="homeworks && homeworks.length<=0" class="class-test-tip">暂无作业,<br />
请登录Trustie网站,在PC浏览器中创建作业。</p>
</div>
<div ng-class="{'undis': currentTab!=3}">
<div ng-repeat="r in exercise" ng-class="['class-detail-row', 'f13', 'c-grey3', {'border-top': $first}]"><span class="fl ml10">{{r.exercise_name}}</span></div>
<div ng-repeat="r in exercise|filter:searchText" ng-class="['class-detail-row', 'f13', 'c-grey3', {'border-top': $first}]"><span class="fl ml10">{{r.exercise_name}}</span></div>
<p ng-show="exercise && exercise.length<=0" class="class-test-tip">暂无测验,<br />
请登录Trustie网站,在PC浏览器中创建测验。</p>
</div>

View File

@ -6,8 +6,11 @@ app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', '$l
vm.homeworks = null;
vm.exercise = null;
vm.searchText = "";
vm.tab = function(index){
vm.currentTab = index;
vm.searchText = "";
if(index==1 && (!vm.resources || vm.resources.length <= 0 )){
$http.get(config.apiUrl + "resources?token="+auth.token()).then(function(response){
console.log(response.data);
@ -31,4 +34,4 @@ app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', '$l
vm.sendFile = function(r){
$location.path("/send_class_list").search({id: r.id});
}
}] );
}] );