From 38b97aa55877a351bc23b375b5175d061ed6d837 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Wed, 24 Jun 2015 16:23:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8B=E8=BD=BDurl=E6=9C=89=E4=B8=A4?= =?UTF-8?q?=E5=A4=84=E9=9C=80=E8=A6=81=E5=A4=84=E7=90=86=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/application.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/public/javascripts/application.js b/public/javascripts/application.js index b90011a4f..ce5a960cf 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -863,6 +863,10 @@ function redo() { window.location.reload() } +function encodeHomeworkUrl(url){ + var file = encodeURI(url).replace(/\+/g, '%2B'); + return '/zipdown/download?file='+file; +} //// 作业附件删除 $(function(){ @@ -880,8 +884,7 @@ $(function(){ } if(res.length==1){ - var file = encodeURI(res[0].file).replace(/\+/g, '%2B'); - location.href = '/zipdown/download?file='+file;return; + location.href = encodeHomeworkUrl(res[0].file);return; } document.getElementById('light').style.display='block'; @@ -894,7 +897,7 @@ $(function(){ } else { des = '第'+res[i].index+'个学生的作品下载'; } - $('
  • '+(i+1)+'. '+des+'  (共'+res[i].size+'M)
  • ').appendTo($container); + $('
  • '+(i+1)+'. '+des+'  (共'+res[i].size+'M)
  • ').appendTo($container); } } @@ -911,7 +914,7 @@ $(function(){ else { if(res.length==1){ - location.href = '/zipdown/download?file='+res[0].file;return; + location.href = encodeHomeworkUrl(res[0].file);return; } document.getElementById('light').style.display='block'; $container = $('#light .upload_box_ul'); @@ -923,7 +926,7 @@ $(function(){ } else { des = '第'+res[i].index+'个学生的作品下载'; } - $('
  • '+(i+1)+'. '+des+'  (共'+res[i].size+'M)
  • ').appendTo($container); + $('
  • '+(i+1)+'. '+des+'  (共'+res[i].size+'M)
  • ').appendTo($container); } }