2016-07-17 00:49:35 +08:00
|
|
|
|
|
|
|
//app.js
|
|
|
|
var app=angular.module("wechat",["ngRoute"]);app.constant("config",{rootPath:"/assets/wechat/",rootUrl:"/",apiUrl:"/api/v1/"}),app.run(["$rootScope","auth","$location","$routeParams",function(t,a,e){g_redirect_path&&g_redirect_path.length>1&&(e.path(g_redirect_path),g_redirect_path=null),t.$on("$routeChangeError",function(t,a){a&&a.templateUrl&&(a.templateUrl.endsWith("login.html")||a.templateUrl.endsWith("reg.html")||e.path("/login"))}),t.$on("$routeChangeStart",function(){})}]);
|
|
|
|
//factory.js
|
|
|
|
app.factory("alertService",function(){function t(){this.title=null,this.message=null,this.visible=null,this.cb=null}return t.prototype.showMessage=function(t,i,e){this.message=i,this.title=t,this.visible=!0,this.cb=e},t.prototype.dismiss=function(){this.message=null,this.title=null,this.visible=!1,this.cb&&this.cb()},{create:function(){return new t}}}),app.factory("auth",["$http","$routeParams","$q","session","config",function(t,i,e,a){var c=function(){var c=e.defer(),o=s();if(o&&o.length>10)c.resolve(o);else{{window.g_code||i.code||a.get("code")}t.post("/wechat/get_bind",{}).then(function(t){0!=t.data.status?c.reject(t.data.message):(a.save("token",t.data.token),c.resolve(t.data.token))})["catch"](function(t){c.reject(t)})}return c.promise},s=function(){return a.get("token")};return{get_bind:c,token:s}}]),app.factory("session",function(){return{save:function(t,i){sessionStorage.setItem(t,i)},get:function(t){return sessionStorage.getItem(t)}}}),app.factory("rms",function(){var t={},i=function(i,e){t[i]=e},e=function(i){return t[i]};return{save:i,get:e}}),app.factory("common",["$http","auth","$routeParams","rms",function(t,i,e,a){var c=function(e,a,c,s){if(c.comment&&!(c.comment.length<=0)){var o=c.comment.replace(/\n/g,"<br/>"),n={type:a,content:o,token:i.token()};c.disabled=!0,t({method:"POST",url:apiUrl+"new_comment/"+e,data:n}).then(function(){c.disabled=!1,"function"==typeof s&&s()},function(){})}},s=function(e,a){return t({method:"GET",url:apiUrl+a+"/"+e+"?token="+i.token()})},o=function(e){t({method:"POST",url:apiUrl+"praise/"+e.act_id,data:{token:i.token(),type:e.act_type}}).then(function(t){console.log(t.data)},function(){})},n=function(e){t({method:"POST",url:apiUrl+"praise/"+e.act_id,data:{token:i.token(),type:e.act_type}}).then(function(t){console.log(t.data)},function(){})},r=function(t){t.scope.formData={comment:""};var i=function(i){s(i,t.type).then(function(i){t.loadCallback(i.data)},function(){})};i(t.id),t.scope.addReply=function(e){console.log(e.comment),c(t.id,t.replyType,e,function(){t.scope.formData={comment:""},i(t.id),"function"==typeof t.replyCallback&&t.replyCallback()})},t.scope.addPraise=function(t){activities=a.get("activities")||[],course_activities=a.get("course_activities")||[],project_activities=a.get("project_activities")||[];for(var i in activities)if(activities[i].act_id==t.act_id){activities[i].praise_count+=1,activities[i].has_praise=!0;break}for(var i in course_activities)if(course_activities[i].act_id==t.act_id){course_activities[i].praise_count+=1,course_activities[i].has_praise=!0;break}for(var i in project_activities)if(project_activities[i].act_id==t.act_id){project_activities[i].praise_count+=1,project_activities[i].has_praise=!0;break}a.save("activities",activities),a.save("course_activities",course_activities),a.save("project_activities",project_activities),t.praise_count+=1,t.has_praise=!0,o(t)},t.scope.decreasePraise=function(t){activities=a.get("activities")||[],course_activities=a.get("course_activities")||[],project_activities=a.get("project_activities")||[];for(var i in activities)if(activities[i].act_id==t.act_id){activities[i].praise_count-=1,activities[i].has_praise=!1;break}for(var i in course_activities)if(course_activities[i].act_id==t.act_id){course_activities[i].praise_count-=1,course_activities[i].has_praise=!1;break}for(var i in project_activities)if(project_activities[i].act_id==t.act_id){project_activities[i].praise_count-=1,project_activities[i].has_praise=!1;break}a.save("activities",activities),a.save("course_activities",course_activities),a.save("project_activities",project_activities),t.praise_count-=1,t.has_praise=!1,n(t)}};return{init:r,addCommonReply:c,loadCommonData:s,addCommonPraise:o,decreaseCommonPraise:n}}]);
|
|
|
|
//filter.js
|
|
|
|
app.filter("safeHtml",["$sce",function(t){return function(n){return t.trustAsHtml(n)}}]),app.filter("identify",function(){return function(t){return"TeachingAsistant"==t?"\u6559\u8f85":""}});
|
|
|
|
//activity.js
|
|
|
|
app.controller("ActivityController",["$anchorScroll","$location","$scope","$http","$timeout","auth","rms","common","alertService",function(a,e,t,i,c,s,o,r,_){t.replaceUrl=function(a){return a},t.menus=["\u6240\u6709\u52a8\u6001","\u8bfe\u7a0b\u52a8\u6001","\u9879\u76ee\u52a8\u6001"],t.alertService=_.create(),console.log("ActivityController load"),t.page=o.get("page")||0,t.activities=o.get("activities")||[],t.has_more=o.get("has_more"),t.course_page=o.get("course_page")||0,t.course_activities=o.get("course_activities")||[],t.course_has_more=o.get("course_has_more"),t.project_page=o.get("project_page")||0,t.project_activities=o.get("project_activities")||[],t.project_has_more=o.get("project_has_more"),t.loadActData=function(a,e){switch(container_type="All",a){case 1:container_type="All",t.page=e;break;case 2:container_type="Course",t.course_page=e;break;case 3:container_type="Project",t.project_page=e}i({method:"POST",url:apiUrl+"activities",data:{token:s.token(),page:e,container_type:container_type}}).then(function(a){if(a.data.page>0)switch(a.data.container_type){case"All":t.activities=t.activities.concat(a.data.data);break;case"Course":t.course_activities=t.course_activities.concat(a.data.data);break;case"Project":t.project_activities=t.project_activities.concat(a.data.data);break;case 3:}else switch(a.data.container_type){case"All":t.activities=a.data.data;break;case"Course":t.course_activities=a.data.data;break;case"Project":t.project_activities=a.data.data;break;case 3:}switch(a.data.container_type){case"All":o.save("activities",t.activities),t.has_more=a.data.count+10*a.data.page<a.data.all_count,o.save("has_more",t.has_more),o.save("page",a.data.page);break;case"Course":o.save("course_activities",t.course_activities),t.course_has_more=a.data.count+10*a.data.page<a.data.all_count,o.save("course_has_more",t.course_has_more),o.save("course_page",a.data.page);break;case"Project":o.save("project_activities",t.project_activities),t.project_has_more=a.data.count+10*a.data.page<a.data.all_count,o.save("project_has_more",t.project_has_more),o.save("project_page",a.data.page);break;case 3:}console.log(a.data)},function(){})},t.tab=function(a){switch(t.currentTab=a,a){case 1:t.activities.length<=0&&t.loadActData(a,0);break;case 2:t.course_activities.length<=0&&t.loadActData(a,0);break;case 3:t.project_activities.length<=0&&t.loadActData(a,0)}},t.currentTab=1,t.activities.length<=0?t.loadActData(1,0):c(function(){window.scrollTo(0,o.get("yoffset"))}),t.goDetail=function(a,i){o.save("yoffset",window.document.body.scrollTop),o.save("activities",t.activities),o.save("course_activities",t.course_activities),o.save("project_activities",t.project_activities),e.path("/"+a+"/"+i)},t.addPraise=function(a){for(var e in t.activities)if(t.activities[e].act_id==a.act_id){t.activities[e].praise_count+=1,t.activities[e].has_praise=!0;break}for(var e in t.course_activities)if(t.course_activities[e].act_id==a.act_id){t.course_activities[e].praise_count+=1,t.course_activities[e].has_praise=!0;break}for(var e in t.project_activities)if(t.project_activities[e].act_id==a.act_id){t.project_activities[e].praise_count+=1,t.project_activities[e].has_praise=!0;break}r.addCommonPraise(a)},t.decreasePraise=function(a){for(var e in t.activities)if(t.activities[e].act_id==a.act_id){t.activities[e].praise_count-=1,t.activities[e].has_praise=!1;break}for(var e in t.course_activities)if(t.course_activities[e].act_id==a.act_id){t.course_activities[e].praise_count-=1,t.course_activities[e].has_praise=!1;break}for(var e in t.project_activities)if(t.project_activities[e].act_id==a.act_id){t.project_activities[e].praise_count-=1,t.project_activities[e].has_praise=!1;break}r.decreaseCommonPraise(a)}}]);
|
|
|
|
//blog.js
|
2016-06-20 14:45:19 +08:00
|
|
|
app.controller("BlogController",["$scope","$http","$routeParams","auth","common",function(o,l,t,n,a){a.init({id:t.id,scope:o,type:"blog_comments",replyType:"BlogComment",loadCallback:function(l){o.blog=l.data},replyCallback:function(){}})}]);
|
2016-07-17 00:49:35 +08:00
|
|
|
//class.js
|
|
|
|
app.controller("ClassController",["$scope","config","$http","auth","$location","$routeParams",function(e,s,t,o,a,n){var r=e,c=n.id,i=function(){r.teachers.length<=0&&t.get(s.apiUrl+"courses/teachers?token="+o.token()+"&course_id="+c).then(function(e){console.log(e.data),r.teachers=e.data.data}),r.students.length<=0&&t.get(s.apiUrl+"courses/students?token="+o.token()+"&course_id="+c).then(function(e){console.log(e.data),r.students=e.data.data})},u=function(){r.resources.length<=0&&t.post(s.apiUrl+"courses/"+c+"/attachments",{token:o.token(),name:""}).then(function(e){r.resources=e.data.data,r.resources_tag=!0})},h=function(){r.homeworks.length<=0&&t.get(s.apiUrl+"courses/homeworks/"+c+"?token="+o.token()).then(function(e){r.homeworks=e.data.data,console.log(e.data),r.homeworks_tag=!0})},l=function(){r.exercises.length<=0&&t.get(s.apiUrl+"courses/"+c+"/exercises?token="+o.token()).then(function(e){r.exercises=e.data.data,console.log(e.data),r.exercises_tag=!0})};r.isTeacher=!1,r.currentTab=1,r.tab=function(e){r.currentTab=e,r.searchText="",r.showClassMate=!1,r.showResources=!1,r.showHomework=!1,r.showTestcase=!1,r.resources_tag=!1,r.homeworks_tag=!1,r.exercises_tag=!1,r.isTeacher?1==e?(u(),r.showResources=!0):2==e?(h(),r.showHomework=!0):3==e?(l(),r.showTestcase=!0):4==e&&(i(),r.showClassMate=!0):2==e?(i(),r.showClassMate=!0):1==e&&(u(),r.showResources=!0)},r.course={},r.students=[],r.teachers=[],r.resources=[],r.homeworks=[],r.exercises=[],r.invite=function(){a.path("/invite_code").search({id:c})},r.sendFile=function(e){a.path("/send_class_list").search({id:e.id})},t.get(s.apiUrl+"courses/"+c+"?token="+o.token()).then(function(e){console.log(e.data),r.course=e.data.data,d(r.course.current_user_is_teacher),r.tab(1)});var d=function(e){r.isTeacher=e,r.menus=e?["\u8bfe\u4ef6","\u4f5c\u4e1a","\u5c0f\u6d4b\u9a8c","\u5b66\u751f\u7ba1\u7406"]:["\u8bfe\u4ef6","\u6211\u7684\u540c\u5b66"]}}]);
|
|
|
|
//class_list.js
|
|
|
|
app.controller("ClassListController",["$scope","config","auth","$http","$location","alertService","rms",function(e,s,a,t,o,l,n){var c=e;c.syllabuses=n.get("syllabuses")||[],c.alertService=l.create();var i=function(){t.get(s.apiUrl+"syllabuses?token="+a.token()).then(function(e){console.log(e.data),c.syllabuses=e.data.data,n.save("syllabuses",c.syllabuses)})};c.syllabuses.length<=0&&i(),c.goClass=function(e){console.log(e),o.path("/class").search({id:e})},c.newClass=function(){t.post(s.apiUrl+"syllabuses/auth",{token:a.token()}).then(function(e){console.log(e.data),0==e.data.auth?c.alertService.showMessage("\u63d0\u793a","\u975e\u6559\u5e08\u8eab\u4efd\u4e0d\u80fd\u521b\u5efa\u8bfe\u7a0b\u54e6~"):o.path("/new_class")})},c.goResource=function(){o.path("/myresource")},c.joinClass=function(){var e=window.prompt("\u8bf7\u8f93\u51655\u4f4d\u73ed\u7ea7\u9080\u8bf7\u7801(\u4e0d\u533a\u5206\u5927\u5c0f\u5199)");e&&5==e.length?t.post(s.apiUrl+"courses/join",{token:a.token(),invite_code:e}).then(function(e){console.log(e.data),0!=e.data.status?c.alertService.showMessage("\u9519\u8bef",e.data.message):(c.alertService.showMessage("\u63d0\u793a","\u52a0\u5165\u8bfe\u7a0b\u6210\u529f"),i())}):e&&c.alertService.showMessage("\u9519\u8bef","\u9080\u8bf7\u7801\u683c\u5f0f\u4e0d\u6b63\u786e")},c.onSetting=function(e){console.log(e),n.save("current_edit_syllobus",e),o.path("/edit_class").search({id:e.id})}}]);
|
|
|
|
//course_notice.js
|
2016-06-20 14:45:19 +08:00
|
|
|
app.controller("CourseNoticeController",["$scope","$http","$routeParams","auth","common",function(o,e,t,n,a){a.init({id:t.id,scope:o,type:"newss",replyType:"News",loadCallback:function(e){o.news=e.data},replyCallback:function(){}})}]);
|
2016-07-17 00:49:35 +08:00
|
|
|
//discussion.js
|
2016-06-20 14:45:19 +08:00
|
|
|
app.controller("DiscussionController",["$scope","$http","$routeParams","auth","common",function(o,s,a,e,n){n.init({id:a.id,scope:o,type:"messages",replyType:"Message",loadCallback:function(s){o.discussion=s.data},replyCallback:function(){}})}]);
|
2016-07-17 00:49:35 +08:00
|
|
|
//edit_class.js
|
|
|
|
app.controller("EditClassController",["$scope","$http","auth","config","alertService","$location","$routeParams","rms",function(s,e,a,l,t,o,r,n){var u=s;u.syllabus=n.get("current_edit_syllobus");var i=r.id;if(u.syllabus||e.get(l.apiUrl+"syllabuses/"+i+"?token="+a.token()).then(function(s){if(console.log(s.data),u.syllabus=s.data.data,u.syllabus){for(var e in u.syllabus.courses){var a=u.syllabus.courses[e];a.tmpname=a.name}u.syllabus.tmptitle=u.syllabus.title}}),console.log(u.syllabus),u.syllabus){for(var c in u.syllabus.courses){var d=u.syllabus.courses[c];d.tmpname=d.name}u.syllabus.tmptitle=u.syllabus.title}u.alertService_1=t.create(),u.alertService_2=t.create(),u.addClass=function(){u.syllabus.courses.push({can_setting:!0})},u.deleteClass=function(s){var t=u.syllabus.courses[s];t.id>0?u.alertService_2.showMessage("\u63d0\u793a","\u60a8\u786e\u5b9a\u8981\u5220\u9664\u8be5\u73ed\u7ea7\u5417\uff1f",function(){e.post(l.apiUrl+"courses/"+t.id+"/del",{token:a.token()}).then(function(e){0!=e.data.status?u.alertService_1.showMessage("\u51fa\u9519\u4e86",e.data.message):u.alertService_1.showMessage("\u63d0\u793a","\u5220\u9664\u73ed\u7ea7\u6210\u529f",function(){u.syllabus.courses.splice(s,1)}),console.log(e.data.data)})}):u.syllabus.courses.splice(s,1)},u.newClass=function(s,t){if(s.$setSubmitted(),console.log(t),!s.$valid)return void console.log(s.$error);var r=[],c=[];for(var d in u.syllabus.courses){var b=u.syllabus.courses[d];b.id?b.tmpname!=b.name&&c.push({id:b.id,name:b.tmpname}):r.push(b.tmpname)}e.post(l.apiUrl+"syllabuses/"+i+"/edit",{token:a.token(),id:i,title:u.syllabus.tmptitle,add_courses:r,modify_courses:c}).then(function(s){0!=s.data.status?u.alertService_1.showMessage("\u51fa\u9519\u4e86",s.data.message):u.alertService_1.showMessage("\u63d0\u793a","\u4fdd\u5b58\u8bfe\u7a0b\u6210\u529f",function(){n.save("syllabuses",[]),o.path("/class_list")}),console.log(s.data.data)})},u.fadeText=function(){s.change=!0}}]);
|
|
|
|
//homework.js
|
2016-06-20 14:45:19 +08:00
|
|
|
app.controller("HomeworkController",["$scope","$http","$routeParams","auth","common",function(o,e,l,n,r){r.init({id:l.id,scope:o,type:"whomeworks",replyType:"HomeworkCommon",loadCallback:function(e){console.log(e),o.homework=e.data},replyCallback:function(){}})}]);
|
2016-07-17 00:49:35 +08:00
|
|
|
//invite_code.js
|
|
|
|
app.controller("InviteCodeController",["$scope","$http","$routeParams","config","auth",function(t,e,i,n,o){var a=t;a.course={};var c=i.id;e.get(n.apiUrl+"courses/"+c+"?token="+o.token()).then(function(t){console.log(t.data),a.course=t.data.data}),a.share=function(){window.WeixinJSBridge.invoke("sendAppMessage",{appid:"wxf694495398c7d470",type:"link",data_url:"",img_url:"http://pnewsapp.tc.qq.com/newsapp_bt/0/9963967/640",img_height:370,img_width:550,link:"http://view.inews.qq.com/a/WXN2013101101385701",desc:"desc",title:"title"},function(){})}}]);
|
|
|
|
//issue.js
|
2016-06-20 14:45:19 +08:00
|
|
|
app.controller("IssueController",["$scope","$http","$routeParams","auth","common",function(o,e,l,s,t){t.init({id:l.id,scope:o,type:"issues",replyType:"Issue",loadCallback:function(e){console.log(e),o.issue=e.data},replyCallback:function(){}})}]);
|
2016-07-17 00:49:35 +08:00
|
|
|
//journals.js
|
2016-06-20 14:45:19 +08:00
|
|
|
app.controller("JournalsController",["$scope","$http","$routeParams","auth","common",function(o,a,e,l,n){n.init({id:e.id,scope:o,type:"journal_for_messages",replyType:"JournalsForMessage",loadCallback:function(a){o.message=a.data},replyCallback:function(){}})}]);
|
2016-07-17 00:49:35 +08:00
|
|
|
//login.js
|
|
|
|
app.controller("LoginController",["$scope","$http","$location","$routeParams","alertService","config","auth","session",function(e,o,t,a,i,n,s,l){s.get_bind().then(function(){t.path("/activities")}),a.code&&l.save("code",a.code);var r=e;r.loginFailed=!1,r.alertService=i.create(),r.findPwdDialog=i.create(),r.login=function(a,i){return a.$setSubmitted(),console.log(i),a.$valid?(console.log(apiUrl+"auth"),void o.post(n.apiUrl+"users/wxbind",{login:i.login,password:i.password}).then(function(o){console.log(o.data),r.loginFailed=0!=o.data.status,e.loginFailed?r.alertService.showMessage("\u51fa\u9519\u4e86",o.data.message):r.alertService.showMessage("\u63d0\u793a",o.data.message,function(){t.path("/activities")})})["catch"](function(e){r.alertService.showMessage("\u51fa\u9519\u4e86",e)})):void console.log(a.$error)},r.showBox=function(){r.findPwdDialog.showMessage("\u63d0\u793a","\u8bf7\u8bbf\u95eewww.trustie.net\u83b7\u53d6\u5bc6\u7801\uff0c\u8c22\u8c22\uff01")},r.goReg=function(){t.path("/reg")}}]);
|
|
|
|
//myresource.js
|
|
|
|
app.controller("MyResourceController",["$scope","$http","auth","config","$location","rms",function(e,a,o,s,r,t){var c=e;c.menus=["\u8bfe\u4ef6","\u4f5c\u4e1a","\u6d4b\u9a8c"],c.resources=[],c.homeworks=[],c.exercise=[],c.resources_tag=!1,c.homeworks_tag=!1,c.exercises_tag=!1,c.page=t.get("page")||0,c.resources=t.get("resources")||[],c.has_more=t.get("has_more"),c.homework_page=t.get("homework_page")||0,c.homeworks=t.get("homeworks")||[],c.homework_has_more=t.get("homework_has_more"),c.exercise_page=t.get("exercise_page")||0,c.exercise=t.get("exercise")||[],c.exercise_has_more=t.get("exercise_has_more"),c.searchText="",c.sendFile=function(e){r.path("/send_class_list").search({id:e.id})},c.loadResourceData=function(e,s){1==e?(c.page=s,a({method:"POST",url:apiUrl+"resources",data:{token:o.token(),page:s}}).then(function(e){c.resources_tag=!0,c.resources=e.data.page>0?c.resources.concat(e.data.data):e.data.data,t.save("resources",c.resources),c.has_more=e.data.count+10*e.data.page<e.data.all_count,t.save("has_more",c.has_more),t.save("page",e.data.page),console.log(e.data)},function(){})):2==e?(c.homework_page=s,a({method:"POST",url:apiUrl+"resources/homeworks",data:{token:o.token(),page:s}}).then(function(e){c.homeworks_tag=!0,c.homeworks=e.data.page>0?c.homeworks.concat(e.data.data):e.data.data,t.save("homeworks",c.homeworks),c.homework_has_more=e.data.count+10*e.data.page<e.data.all_count,t.save("homework_has_more",c.has_more),t.save("homework_page",e.data.page),console.log(e.data)},function(){})):3==e&&(c.exercise_page=s,a({method:"POST",url:apiUrl+"resources/exercises",data:{token:o.token(),page:s}}).then(function(e){c.exercises_tag=!0,c.exercise=e.data.page>0?c.exercise.concat(e.data.data):e.data.data,t.save("exercise",c.exercise),c.exercise_has_more=e.data.count+10*e.data.page<e.data.all_count,t.save("exercise_has_more",c.exercise_has_more),t.save("exercise_page",e.data.page),console.log(e.data)},function(){}))},c.tab=function(e){switch(c.currentTab=e,c.searchText="",e){case 1:c.resources.length<=0&&c.loadResourceData(e,0);break;case 2:c.homeworks.length<=0&&c.loadResourceData(e,0);break;case 3:c.exercise.length<=0&&c.loadResourceData(e,0)}},c.tab(1)}]);
|
|
|
|
//new_class.js
|
|
|
|
app.controller("NewClassController",["$scope","$http","auth","config","alertService","$location","rms",function(s,e,a,l,t,o,r){var n=s;n.alertService=t.create(),n.syllabus={courses:[{name:""}]},n.addClass=function(){n.syllabus.courses.push({})},n.deleteClass=function(s){n.syllabus.courses.splice(s,1)},n.newClass=function(s,t){if(s.$setSubmitted(),console.log(t),!s.$valid)return void console.log(s.$error);var c=[];for(var u in n.syllabus.courses)c.push(n.syllabus.courses[u].name);e.post(l.apiUrl+"syllabuses",{token:a.token(),title:t.title,courses:c}).then(function(s){0!=s.data.status?n.alertService.showMessage("\u51fa\u9519\u4e86",s.data.message):n.alertService.showMessage("\u63d0\u793a","\u65b0\u5efa\u8bfe\u7a0b\u6210\u529f",function(){r.save("syllabuses",[]),o.path("/class_list")}),console.log(s.data.data)})}}]);
|
|
|
|
//reg.js
|
|
|
|
app.controller("RegController",["$scope","$http","$location","alertService","$location",function(e,o,a,s,a){var t=e;t.errDialog=s.create(),t.successDialog=s.create(),t.goLogin=function(){a.path("/login")},t.isagreed=!0,t.agreed=function(e){t.isagreed=!e},t.reg=function(e,s){return e.$setSubmitted(),console.log(e),e.$valid?(console.log(s),void o.post(apiUrl+"users",{login:s.username,password:s.password,mail:s.email}).then(function(e){0!=e.data.status?t.errDialog.showMessage("\u51fa\u9519\u4e86",e.data.message):t.successDialog.showMessage("\u63d0\u793a","\u6ce8\u518c\u4e14\u7ed1\u5b9a\u5fae\u4fe1\u6210\u529f",function(){a.path("/activities")})},function(e){t.errDialog.showMessage("\u51fa\u9519\u4e86",e.data)})):void console.log(e.$error)}}]);
|
|
|
|
//send_class_list.js
|
|
|
|
app.controller("SendClassListController",["$scope","$http","$routeParams","config","auth","alertService","rms",function(e,s,o,a,t,r){var c=e,n=o.id;c.alertService=r.create(),c.syllabuses=[];var l=function(){s.get(a.apiUrl+"syllabuses?token="+t.token()).then(function(e){console.log(e.data),c.syllabuses=e.data.data})};l(),c.selectCourse=function(e){"boolean"!=typeof e.checked&&(e.checked=!1),e.checked=!e.checked},c.sendToCourses=function(){var e=[];for(var o in c.syllabuses)for(var r in c.syllabuses[o].courses)c.syllabuses[o].courses[r].checked&&e.push(c.syllabuses[o].courses[r].id);return e.length<=0?void c.alertService.showMessage("\u63d0\u9192","\u8bf7\u5148\u9009\u62e9\u73ed\u7ea7"):void s.post(a.apiUrl+"resources/send",{token:t.token(),course_ids:e,send_id:n}).then(function(e){console.log(e.data),0==e.data.status?c.alertService.showMessage("\u63d0\u793a","\u53d1\u9001\u6210\u529f",function(){window.history.back()}):c.alertService.showMessage("\u53d1\u9001\u51fa\u9519",e.data.message)})}}]);
|
|
|
|
//alert.js
|
2016-07-07 15:03:45 +08:00
|
|
|
app.directive("myAlert",["config",function(t){return{templateUrl:t.rootPath+"templates/alert.html",scope:{title:"=",message:"=",visible:"=",cb:"="},link:function(t){t.dismiss=function(){t.visible=!1,"function"==typeof t.cb&&t.cb()}}}}]),app.directive("myAlert2",["config",function(t){return{templateUrl:t.rootPath+"templates/alert2.html",scope:{title:"=",message:"=",visible:"=",cb:"="},link:function(t){t.dismiss=function(){t.visible=!1},t.confirm=function(){t.visible=!1,"function"==typeof t.cb&&t.cb()}}}}]);
|
2016-07-17 00:49:35 +08:00
|
|
|
//form_validate.js
|
2016-06-20 14:45:19 +08:00
|
|
|
app.directive("pwdconfirm",function(){return{require:"ngModel",link:function(r,n,i,e){e.$validators.pwdconfirm=function(n,i){return r.user&&r.user.password==i}}}});
|
2016-07-17 00:49:35 +08:00
|
|
|
//input_auto.js
|
2016-07-15 14:49:23 +08:00
|
|
|
app.directive("inputAuto",function(){return{restrict:"A",scope:{},link:function(n,t){var i=t.parent().children().children().eq(0),c=t.next();t.on("input",function(){console.log(c),i.html(t[0].value);var n=i[0].scrollHeight;t.css("height",n+"px")}),c.on("click",function(){t.css("height","28px")})}}});
|
2016-07-17 00:49:35 +08:00
|
|
|
//loading_spinner.js
|
2016-07-03 00:08:51 +08:00
|
|
|
app.directive("loadingSpinner",["$http","config",function(t,e){return{templateUrl:e.rootPath+"templates/loading.html"}}]);
|
2016-07-17 00:49:35 +08:00
|
|
|
//routes.js
|
2016-07-15 19:53:38 +08:00
|
|
|
app.config(["$routeProvider","$httpProvider","$locationProvider","config",function(e,l,t,o){var r=o.rootPath,s={delay:["auth",function(e){return e.get_bind()}]},n=function(e,l){return{templateUrl:r+e,controller:l,resolve:s}};e.when("/login",{templateUrl:r+"login.html",controller:"LoginController"}).when("/reg",{templateUrl:r+"reg.html",controller:"RegController"}).when("/activites",n("activities.html","ActivityController")).when("/issues/:id",n("issue_detail.html","IssueController")).when("/project_discussion/:id",n("project_discussion.html","DiscussionController")).when("/homework/:id",n("homework_detail.html","HomeworkController")).when("/course_notice/:id",n("course_notice.html","CourseNoticeController")).when("/course_discussion/:id",n("course_discussion.html","DiscussionController")).when("/journal_for_message/:id",n("jour_message_detail.html","JournalsController")).when("/blog_comment/:id",n("blog_detail.html","BlogController")).when("/class",n("class.html","ClassController")).when("/new_class",n("new_class.html","NewClassController")).when("/edit_class",n("edit_class.html","EditClassController")).when("/class_list",n("class_list.html","ClassListController")).when("/myresource",n("myresource.html","MyResourceController")).when("/invite_code",{templateUrl:r+"invite_code.html",controller:"InviteCodeController"}).when("/send_class_list",n("send_class_list.html","SendClassListController")).otherwise({redirectTo:"/activites"}),l.interceptors.push(["$q","$rootScope",function(e,l){return void 0==l.activeCalls&&(l.activeCalls=0),{request:function(e){return l.activeCalls+=1,e},requestError:function(e){return l.activeCalls-=1,e},response:function(e){return l.activeCalls-=1,e},responseError:function(e){return l.activeCalls-=1,e}}}])}]);
|