assets
This commit is contained in:
parent
0e415fffff
commit
dd892993dd
|
@ -27,32 +27,32 @@
|
|||
</div>
|
||||
|
||||
<!--<script src="https://dn-demotest.qbox.me/angular.all.min.js"></script>-->
|
||||
<script src="/javascripts/wechat/build/angular.all.min.js"></script>
|
||||
<!--<script src="/javascripts/wechat/build/app.min.js?version=20160709-0920"></script>-->
|
||||
<script src="/javascripts/wechat/app.js"></script>
|
||||
<script src="/javascripts/wechat/others/factory.js"></script>
|
||||
<script src="/javascripts/wechat/others/filter.js"></script>
|
||||
<script src="/javascripts/wechat/directives/alert.js"></script>
|
||||
<script src="/javascripts/wechat/directives/form_validate.js"></script>
|
||||
<script src="/javascripts/wechat/directives/input_auto.js"></script>
|
||||
<script src="/javascripts/wechat/directives/loading_spinner.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/reg.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/invite_code.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/login.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/activity.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/new_class.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/edit_class.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/blog.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/course_notice.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/discussion.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/homework.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/issue.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/journals.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/class.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/class_list.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/myresource.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/send_class_list.js"></script>
|
||||
<script src="/javascripts/wechat/others/routes.js"></script>
|
||||
<script src="/javascripts/wechat/build/angular.all.min.js"></script>
|
||||
<script src="/javascripts/wechat/build/app.min.js?version=20160715-1449"></script>
|
||||
<!-- <script src="/javascripts/wechat/app.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/others/factory.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/others/filter.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/directives/alert.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/directives/form_validate.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/directives/input_auto.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/directives/loading_spinner.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/controllers/reg.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/controllers/invite_code.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/controllers/login.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/controllers/activity.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/controllers/new_class.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/controllers/edit_class.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/controllers/blog.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/controllers/course_notice.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/controllers/discussion.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/controllers/homework.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/controllers/issue.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/controllers/journals.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/controllers/class.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/controllers/class_list.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/controllers/myresource.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/controllers/send_class_list.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/others/routes.js"></script> -->
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
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,r){g_redirect_path&&g_redirect_path.length>1&&(e.path(g_redirect_path),g_redirect_path=null),t.$on("$routeChangeError",function(t,a,r){a&&a.templateUrl&&(a.templateUrl.endsWith("login.html")||a.templateUrl.endsWith("reg.html")||e.path("/login"))}),t.$on("$routeChangeStart",function(t,a,e){})}]);
|
||||
app.factory("alertService",function(){function t(){this.title=null,this.message=null,this.visible=null,this.cb=null}return t.prototype.showMessage=function(t,e,n){this.message=e,this.title=t,this.visible=!0,this.cb=n},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,e,n,o,a){var i=function(){var a=n.defer(),i=c();if(i&&i.length>10)a.resolve(i);else{window.g_code||e.code||o.get("code");t.post("/wechat/get_bind",{}).then(function(t){0!=t.data.status?a.reject(t.data.message):(o.save("token",t.data.token),a.resolve(t.data.token))})["catch"](function(t){a.reject(t)})}return a.promise},c=function(){return o.get("token")};return{get_bind:i,token:c}}]),app.factory("session",function(){return{save:function(t,e){sessionStorage.setItem(t,e)},get:function(t){return sessionStorage.getItem(t)}}}),app.factory("rms",function(){var t={},e=function(e,n){t[e]=n},n=function(e){return t[e]};return{save:e,get:n}}),app.factory("common",["$http","auth","$routeParams",function(t,e,n){var o=function(n,o,a,i){if(a.comment&&!(a.comment.length<=0)){var c=a.comment.replace(/\n/g,"<br/>"),s={type:o,content:c,token:e.token()};a.disabled=!0,t({method:"POST",url:apiUrl+"new_comment/"+n,data:s}).then(function(t){a.disabled=!1,"function"==typeof i&&i()},function(t){})}},a=function(n,o){return t({method:"GET",url:apiUrl+o+"/"+n+"?token="+e.token()})},i=function(n){n.praise_count+=1,n.has_praise=!0,t({method:"POST",url:apiUrl+"praise/"+n.act_id,data:{token:e.token(),type:n.act_type}}).then(function(t){console.log(t.data)},function(t){})},c=function(n){n.praise_count-=1,n.has_praise=!1,t({method:"POST",url:apiUrl+"praise/"+n.act_id,data:{token:e.token(),type:n.act_type}}).then(function(t){console.log(t.data)},function(t){})},s=function(t){t.scope.formData={comment:""};var e=function(e){a(e,t.type).then(function(e){t.loadCallback(e.data)},function(t){})};e(t.id),t.scope.addReply=function(n){console.log(n.comment),o(t.id,t.replyType,n,function(){t.scope.formData={comment:""},e(t.id),"function"==typeof t.replyCallback&&t.replyCallback()})},t.scope.addPraise=i,t.scope.decreasePraise=c};return{init:s,addCommonReply:o,loadCommonData:a,addCommonPraise:i,decreaseCommonPraise:c}}]);
|
||||
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,c){var s=function(){var c=e.defer(),s=o();if(s&&s.length>10)c.resolve(s);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},o=function(){return a.get("token")};return{get_bind:s,token:o}}]),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(t){c.disabled=!1,"function"==typeof s&&s()},function(t){})}},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(t){})},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(t){})},r=function(t){t.scope.formData={comment:""};var i=function(i){s(i,t.type).then(function(i){t.loadCallback(i.data)},function(t){})};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}}]);
|
||||
app.filter("safeHtml",["$sce",function(t){return function(n){return t.trustAsHtml(n)}}]),app.filter("identify",function(){return function(t){return"TeachingAsistant"==t?"教辅":""}});
|
||||
app.controller("ActivityController",["$anchorScroll","$location","$scope","$http","$timeout","auth","rms","common","alertService",function(e,a,t,c,o,i,r,s,n){t.replaceUrl=function(e){return e},t.menus=["所有动态","课程动态","项目动态"],t.alertService=n.create(),console.log("ActivityController load"),t.page=r.get("page")||0,t.activities=r.get("activities")||[],t.has_more=r.get("has_more"),t.course_page=r.get("course_page")||0,t.course_activities=r.get("course_activities")||[],t.course_has_more=r.get("course_has_more"),t.project_page=r.get("project_page")||0,t.project_activities=r.get("project_activities")||[],t.project_has_more=r.get("project_has_more"),t.loadActData=function(e,a){switch(container_type="All",e){case 1:container_type="All",t.page=a;break;case 2:container_type="Course",t.course_page=a;break;case 3:container_type="Project",t.project_page=a}c({method:"POST",url:apiUrl+"activities",data:{token:i.token(),page:a,container_type:container_type}}).then(function(e){if(e.data.page>0)switch(e.data.container_type){case"All":t.activities=t.activities.concat(e.data.data);break;case"Course":t.course_activities=t.course_activities.concat(e.data.data);break;case"Project":t.project_activities=t.project_activities.concat(e.data.data);break;case 3:}else switch(e.data.container_type){case"All":t.activities=e.data.data;break;case"Course":t.course_activities=e.data.data;break;case"Project":t.project_activities=e.data.data;break;case 3:}switch(e.data.container_type){case"All":r.save("activities",t.activities),t.has_more=e.data.count+10*e.data.page<e.data.all_count,r.save("has_more",t.has_more),r.save("page",e.data.page);break;case"Course":r.save("course_activities",t.course_activities),t.course_has_more=e.data.count+10*e.data.page<e.data.all_count,r.save("course_has_more",t.course_has_more),r.save("course_page",e.data.page);break;case"Project":r.save("project_activities",t.project_activities),t.project_has_more=e.data.count+10*e.data.page<e.data.all_count,r.save("project_has_more",t.project_has_more),r.save("project_page",e.data.page);break;case 3:}console.log(e.data)},function(e){})},t.tab=function(e){switch(t.currentTab=e,e){case 1:t.activities.length<=0&&t.loadActData(e,0);break;case 2:t.course_activities.length<=0&&t.loadActData(e,0);break;case 3:t.project_activities.length<=0&&t.loadActData(e,0)}},t.currentTab=1,t.activities.length<=0?t.loadActData(1,0):o(function(){window.scrollTo(0,r.get("yoffset"))}),t.goDetail=function(e,t,c){r.save("yoffset",window.document.body.scrollTop),a.path("/"+e+"/"+t)},t.addPraise=function(e){s.addCommonPraise(e)},t.decreasePraise=function(e){s.decreaseCommonPraise(e)}}]);
|
||||
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=["所有动态","课程动态","项目动态"],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(a){})},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,c){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)}}]);
|
||||
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(){}})}]);
|
||||
app.controller("ClassController",["$scope","config","$http","auth","$location","$routeParams",function(e,s,t,o,a,n){var r=e,c=n.id,u=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})},i=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?(i(),r.showResources=!0):2==e?(h(),r.showHomework=!0):3==e?(l(),r.showTestcase=!0):4==e&&(u(),r.showClassMate=!0):2==e?(u(),r.showClassMate=!0):1==e&&(i(),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,e?r.menus=["课件","作业","小测验","学生管理"]:r.menus=["课件","我的同学"]}}]);
|
||||
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("提示","非教师身份不能创建课程哦~"):o.path("/new_class")})},c.goResource=function(){o.path("/myresource")},c.joinClass=function(){var e=window.prompt("请输入5位班级邀请码(不区分大小写)");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("错误",e.data.message):(c.alertService.showMessage("提示","加入课程成功"),i())}):e&&c.alertService.showMessage("错误","邀请码格式不正确")},c.onSetting=function(e){console.log(e),n.save("current_edit_syllobus",e),o.path("/edit_class").search({id:e.id})}}]);
|
||||
|
@ -14,11 +14,11 @@ app.controller("IssueController",["$scope","$http","$routeParams","auth","common
|
|||
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(){}})}]);
|
||||
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("出错了",o.data.message):r.alertService.showMessage("提示",o.data.message,function(){t.path("/activities")})})["catch"](function(e){r.alertService.showMessage("出错了",e)})):void console.log(a.$error)},r.showBox=function(){r.findPwdDialog.showMessage("提示","请访问www.trustie.net获取密码,谢谢!")},r.goReg=function(){t.path("/reg")}}]);
|
||||
app.controller("MyResourceController",["$scope","$http","auth","config","$location",function(e,o,t,n,r){var s=e;s.menus=["课件","作业","测验"],s.resources=null,s.homeworks=null,s.exercise=null,s.searchText="",s.tab=function(e){s.currentTab=e,s.searchText="",1==e&&(!s.resources||s.resources.length<=0)?o.get(n.apiUrl+"resources?token="+t.token()).then(function(e){console.log(e.data),s.resources=e.data.data}):2==e&&(!s.homeworks||s.homeworks.length<=0)?o.get(n.apiUrl+"resources/homeworks?token="+t.token()).then(function(e){console.log(e.data),s.homeworks=e.data.data}):3==e&&(!s.exercise||s.exercise.length<=0)&&o.get(n.apiUrl+"resources/exercies?token="+t.token()).then(function(e){console.log(e.data),s.exercise=e.data.data})},s.tab(1),s.sendFile=function(e){r.path("/send_class_list").search({id:e.id})}}]);
|
||||
app.controller("NewClassController",["$scope","$http","auth","config","alertService","$location",function(s,e,a,o,l,t){var r=s;r.alertService=l.create(),r.syllabus={courses:[{name:""}]},r.addClass=function(){r.syllabus.courses.push({})},r.deleteClass=function(s){r.syllabus.courses.splice(s,1)},r.newClass=function(s,l){if(s.$setSubmitted(),console.log(l),!s.$valid)return void console.log(s.$error);var t=[];for(var n in r.syllabus.courses)t.push(r.syllabus.courses[n].name);e.post(o.apiUrl+"syllabuses",{token:a.token(),title:l.title,courses:t}).then(function(s){0!=s.data.status?r.alertService.showMessage("出错了",s.data.message):r.alertService.showMessage("提示","新建课程成功",function(){window.history.back()}),console.log(s.data.data)})}}]);
|
||||
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("出错了",s.data.message):n.alertService.showMessage("提示","新建课程成功",function(){r.save("syllabuses",[]),o.path("/class_list")}),console.log(s.data.data)})}}]);
|
||||
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("出错了",e.data.message):t.successDialog.showMessage("提示","注册且绑定微信成功",function(){a.path("/activities")})},function(e){t.errDialog.showMessage("出错了",e.data)})):void console.log(e.$error)}}]);
|
||||
app.controller("SendClassListController",["$scope","$http","$routeParams","config","auth","alertService","rms",function(e,s,o,a,t,r,c){var n=e,l=o.id;n.alertService=r.create(),n.syllabuses=[];var i=function(){s.get(a.apiUrl+"syllabuses?token="+t.token()).then(function(e){console.log(e.data),n.syllabuses=e.data.data})};i(),n.selectCourse=function(e){"boolean"!=typeof e.checked&&(e.checked=!1),e.checked=!e.checked},n.sendToCourses=function(){var e=[];for(var o in n.syllabuses)for(var r in n.syllabuses[o].courses)n.syllabuses[o].courses[r].checked&&e.push(n.syllabuses[o].courses[r].id);return e.length<=0?void n.alertService.showMessage("提醒","请先选择班级"):void s.post(a.apiUrl+"resources/send",{token:t.token(),course_ids:e,send_id:l}).then(function(e){console.log(e.data),0==e.data.status?n.alertService.showMessage("提示","发送成功",function(){window.history.back()}):n.alertService.showMessage("发送出错",e.data.message)})}}]);
|
||||
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()}}}}]);
|
||||
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}}}});
|
||||
app.directive("inputAuto",function(){return{restrict:"A",scope:{},link:function(n,t){var e=t.parent().children().children().eq(0),i=t.next();t.on("input",function(){console.log(i),e.html(t[0].value);var n=e[0].scrollHeight;t.css("height",n+"px")}),i.on("click",function(){t.css("height","28px")})}}});
|
||||
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")})}}});
|
||||
app.directive("loadingSpinner",["$http","config",function(t,e){return{templateUrl:e.rootPath+"templates/loading.html"}}]);
|
||||
app.config(["$routeProvider","$httpProvider","$locationProvider","config",function(e,o,t,l){var r=l.rootPath,s={delay:["auth",function(e){return e.get_bind()}]},n=function(e,o){return{templateUrl:r+e,controller:o,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",n("invite_code.html","InviteCodeController")).when("/send_class_list",n("send_class_list.html","SendClassListController")).otherwise({redirectTo:"/activites"}),o.interceptors.push(["$q","$rootScope",function(e,o){return void 0==o.activeCalls&&(o.activeCalls=0),{request:function(e){return o.activeCalls+=1,e},requestError:function(e){return o.activeCalls-=1,e},response:function(e){return o.activeCalls-=1,e},responseError:function(e){return o.activeCalls-=1,e}}}])}]);
|
Loading…
Reference in New Issue