diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index e0c8f834a..85879d5fb 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1842,11 +1842,11 @@ end if params[:property] all_homework_ids = @homeworks.empty? ? "(-1)" : "(" + @homeworks.map{|h| h.id}.join(",") + ")" if params[:property] == "1" - @homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 1 order by created_at desc") + @homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 1") elsif params[:property] == "2" - @homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 2 order by created_at desc") + @homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 2") elsif params[:property] == "3" - @homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 3 order by created_at desc") + @homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 3") end end @limit = 10 @@ -1875,11 +1875,11 @@ end if params[:property] all_homework_ids = @homeworks.empty? ? "(-1)" : "(" + @homeworks.map{|h| h.id}.join(",") + ")" if params[:property] == "1" - @homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 1 order by created_at desc") + @homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 1") elsif params[:property] == "2" - @homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 2 order by created_at desc") + @homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 2") elsif params[:property] == "3" - @homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 3 order by created_at desc") + @homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 3") end end @limit = 10 @@ -1913,11 +1913,11 @@ end if params[:property] all_homework_ids = @homeworks.empty? ? "(-1)" : "(" + @homeworks.map{|h| h.id}.join(",") + ")" if params[:property] == "1" - @homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 1") + @homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 1 order by created_at desc") elsif params[:property] == "2" - @homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 2") + @homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 2 order by created_at desc") elsif params[:property] == "3" - @homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 3") + @homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 3 order by created_at desc") end end @limit = 10 diff --git a/public/assets/wechat/project_discussion.html b/public/assets/wechat/project_discussion.html index 4812f750d..597a333bf 100644 --- a/public/assets/wechat/project_discussion.html +++ b/public/assets/wechat/project_discussion.html @@ -92,7 +92,7 @@
- +
diff --git a/public/assets/wechat/templates/at.html b/public/assets/wechat/templates/at.html index 5d26b73a6..8ca4fd44d 100644 --- a/public/assets/wechat/templates/at.html +++ b/public/assets/wechat/templates/at.html @@ -4,7 +4,7 @@
-
diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 479905d3c..6c00676cb 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -950,10 +950,16 @@ $(function(){ return; } - if(res.length<1){ - return; + if (res.err == -2) { + alert("该作业没有任何附件可下载"); + return; } + if(res.length < 1 ){ + alert("该作业没有任何附件可下载"); + return; + } + if(res.length==1){ if(res[0].base64file){ location.href = encodeHomeworkUrl(res[0].base64file, true);return; @@ -983,10 +989,22 @@ $(function(){ $('#download_homework_attachments').bind('ajax:complete', function (event, data, status, xhr) { if(status == 'success'){ var res = JSON.parse(data.responseText); - if(res.length == null){ - alert("该作业没有任何附件可下载"); + + if(res.err == -1){ + var htmlvalue = '

温馨提示

'+ + '

因附件资源太大,请通过微信或者QQ联系Trustie管理员
辅助您完成下载

'+ + '确  定
'; + pop_box_new(htmlvalue,380,166); + return; } - else if(res.length<1){ + + if (res.err == -2) { + alert("该作业没有任何附件可下载"); + return; + } + + if(res.length < 1 ){ + alert("该作业没有任何附件可下载"); return; } else diff --git a/public/javascripts/wechat/others/factory.js b/public/javascripts/wechat/others/factory.js index 5d4800ac3..cd4bf78a9 100644 --- a/public/javascripts/wechat/others/factory.js +++ b/public/javascripts/wechat/others/factory.js @@ -93,7 +93,7 @@ app.factory('rms', function(){ return {save: save, get: get}; }); -app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx','$location', function($http, auth, $routeParams,rms,config,wx,$location){ +app.factory('common', ['$http', '$location', '$anchorScroll', 'auth', '$routeParams','rms','config','wx','$location', function($http, $location, $anchorScroll, auth, $routeParams,rms,config,wx,$location){ var addCommonReply = function(id, type, data,args,reply_type, beforeReply, cb){ if(!data.comment || data.comment.length<=0){ return; @@ -523,6 +523,11 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx','$loc if(newValue.length > oldValue.length && newValue.match(/@$/)=='@'){ console.log('@ fire'); vm.showAtDialog = true; + + window.scrollTo(0,0); + + + $location.hash(); if(!vm.at_persons){ $http.get('/at/'+$routeParams.id+'.json?type='+atType).then(function (response) { vm.at_persons = response.data;