课程列表 + - 按钮增加效果,资源发送界面课程列表显示和课程列表界面保持一直

This commit is contained in:
yuanke 2016-07-06 17:08:22 +08:00
parent 9eee510649
commit 9d46040f7a
3 changed files with 34 additions and 13 deletions

View File

@ -3,8 +3,8 @@
<div class="blue-title">课程列表</div>
<div ng-repeat="syllabus in syllabuses">
<div class="course-list-row f13 c-grey3 mt10"><img src="/images/wechat/plus.png" width="15" class="fl ml10 mt11 spread-btn" /><img src="/images/wechat/minus.png" width="15" class="fl ml10 mt11 retract-btn undis" /><span class="fl ml10">{{syllabus.title}}</span><img src="/images/wechat/setting.png" width="15" class="fr mr10 mt10" ng-click="onSetting(syllabus)" /></div>
<ul class="class-list f13 c-grey3">
<div ng-click="syllabus.show_plus = !syllabus.show_plus" class="course-list-row f13 c-grey3 mt10"><img src="/images/wechat/plus.png" ng-show="syllabus.show_plus" width="15" class="fl ml10 mt11 spread-btn" /><img src="/images/wechat/minus.png" ng-show="!syllabus.show_plus" width="15" class="fl ml10 mt11 retract-btn " /><span class="fl ml10">{{syllabus.title}}</span><img src="/images/wechat/setting.png" width="15" class="fr mr10 mt10" ng-click="onSetting(syllabus)" /></div>
<ul ng-show="!syllabus.show_plus" class="class-list f13 c-grey3">
<li ng-click="goClass(course.id)" ng-repeat="course in syllabus.courses" ng-class="{'border-bottom-none': $last}">
<img src="/images/wechat/dot.png" width="15px" class="class-list-dot" />
<span class="fl ml10 class-list-name hidden">{{course.name}}</span>

View File

@ -3,10 +3,21 @@
<div loading-spinner></div>
<div class="blue-title">发送课程列表</div>
<div class="course-list-row f13 c-grey3 mt10"><img src="/images/wechat/plus.png" width="15" class="fl ml10 mt11 spread-btn undis" /><img src="/images/wechat/minus.png" width="15" class="fl ml10 mt11 retract-btn " /><span class="fl ml10">未命名课程</span></div>
<ul class="class-list f13 c-grey3">
<li ng-click="selectCourse(course)" ng-class="{'border-bottom-none': $last }" ng-repeat="course in courses"><img src="/images/wechat/dot.png" width="15px" class="class-list-dot" /><span class="fl ml10 class-list-name hidden">{{course.name}}</span><span ng-class="['login-box', 'fr', 'mr5', 'mt12', {'checked': course.checked}]"></span></li>
</ul>
<div ng-repeat="syllabus in syllabuses">
<div ng-click="syllabus.show_plus = !syllabus.show_plus" class="course-list-row f13 c-grey3 mt10"><img src="/images/wechat/plus.png" ng-show="syllabus.show_plus" width="15" class="fl ml10 mt11 spread-btn" /><img src="/images/wechat/minus.png" ng-show="!syllabus.show_plus" width="15" class="fl ml10 mt11 retract-btn " /><span class="fl ml10">{{syllabus.title}}</span></div>
<ul ng-show="!syllabus.show_plus" class="class-list f13 c-grey3">
<li ng-click="selectCourse(course)" ng-class="{'border-bottom-none': $last }" ng-repeat="course in syllabus.courses"><img src="/images/wechat/dot.png" width="15px" class="class-list-dot" /><span class="fl ml10 class-list-name hidden">{{course.name}}</span><span ng-class="['login-box', 'fr', 'mr5', 'mt12', {'checked': course.checked}]"></span></li>
</ul>
</div>
<!--<div class="course-list-row f13 c-grey3 mt10"><img src="/images/wechat/plus.png" width="15" class="fl ml10 mt11 spread-btn undis" /><img src="/images/wechat/minus.png" width="15" class="fl ml10 mt11 retract-btn " /><span class="fl ml10">未命名课程</span></div>-->
<!--<ul class="class-list f13 c-grey3">-->
<!--<li ng-click="selectCourse(course)" ng-class="{'border-bottom-none': $last }" ng-repeat="course in courses"><img src="/images/wechat/dot.png" width="15px" class="class-list-dot" /><span class="fl ml10 class-list-name hidden">{{course.name}}</span><span ng-class="['login-box', 'fr', 'mr5', 'mt12', {'checked': course.checked}]"></span></li>-->
<!--</ul>-->
<div class="btn2 bg-blue" ng-click="sendToCourses()">发送</div>
<my-alert message="alertService.message" title="alertService.title" visible="alertService.visible" cb="alertService.cb"></my-alert>

View File

@ -1,15 +1,23 @@
app.controller('SendClassListController', ['$scope', '$http','$routeParams', 'config','auth','alertService', function($scope, $http, $routeParams, config, auth, alertService){
app.controller('SendClassListController', ['$scope', '$http','$routeParams', 'config','auth','alertService', function($scope, $http, $routeParams, config, auth, alertService,rms){
var vm = $scope;
var send_id = $routeParams.id;
vm.alertService = alertService.create();
vm.courses = [];
// vm.courses = [];
vm.syllabuses = [];
var loadClassList = function () {
$http.get(config.apiUrl + "courses?token=" + auth.token() + "&per_page_count=10&page=1").then(
// $http.get(config.apiUrl + "courses?token=" + auth.token() + "&per_page_count=10&page=1").then(
// function (response) {
// console.log(response.data);
// vm.courses = response.data.data;
// }
// );
$http.get(config.apiUrl + "syllabuses?token=" + auth.token()).then(
function (response) {
console.log(response.data);
vm.courses = response.data.data;
vm.syllabuses = response.data.data;
rms.save('syllabuses', vm.syllabuses);
}
);
};
@ -24,9 +32,11 @@ app.controller('SendClassListController', ['$scope', '$http','$routeParams', 'co
vm.sendToCourses = function(){
var course_ids = [];
for(var i in vm.courses){
if(vm.courses[i].checked){
course_ids.push(vm.courses[i].id);
for(var i in vm.syllabuses) {
for (var j in vm.syllabuses[i].courses) {
if (vm.syllabuses[i].courses[j].checked) {
course_ids.push(vm.syllabuses[i].courses[j].id);
}
}
}