diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb
index a85937315..dde7828c5 100644
--- a/app/controllers/attachments_controller.rb
+++ b/app/controllers/attachments_controller.rb
@@ -15,8 +15,13 @@ class AttachmentsController < ApplicationController
       update_downloads(@file)
       redirect_to @file.cloud_url and return
     end
-    send_file(absolute_path(local_path(@file)), filename: @file.filename, type: @file.content_type.presence || 'application/octet-stream')
 
+    pdf_attachment = params[:disposition] || "attachment"
+    if pdf_attachment == "inline"
+      render pdf: absolute_path(local_path(@file)), filename: @file.filename, disposition: 'inline', type: @file.content_type.presence || 'application/octet-stream'
+    else
+      send_file(absolute_path(local_path(@file)), filename: @file.filename,stream:false, type: @file.content_type.presence || 'application/octet-stream')
+    end
     update_downloads(@file)
   end
 
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 099d45406..47f50a05f 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -52,7 +52,8 @@ module ApplicationHelper
 
     shixun_id = shixun_id.blank? ? -1 : shixun_id.join(",")
     Shixun.select([:id, :name, :user_id, :challenges_count, :myshixuns_count, :trainee, :identifier]).where("id
-                   in(#{shixun_id}) or homepage_show =1").unhidden.order("myshixuns_count desc, homepage_show asc").limit(3)
+                   in(#{shixun_id})").unhidden.order("homepage_show asc, myshixuns_count desc").limit(3)
+
   end
 
   # 相关推荐
@@ -257,8 +258,8 @@ module ApplicationHelper
     end
   end
 
-  def download_url attachment
-    attachment_path(attachment)
+  def download_url attachment,options={}
+    attachment_path(attachment,options)
   end
 
   # 耗时:天、小时、分、秒
diff --git a/app/services/duplicate_course_service.rb b/app/services/duplicate_course_service.rb
index 27ae2f784..acff0a726 100644
--- a/app/services/duplicate_course_service.rb
+++ b/app/services/duplicate_course_service.rb
@@ -11,7 +11,7 @@ class DuplicateCourseService < ApplicationService
       @course = copy_course!
 
       copy_course_modules!
-      Rails.logger.info("###########second_category_list#{@second_category_list}")
+
       join_course!
 
       copy_homework_commons!
diff --git a/app/views/attachment_histories/_attachment_history.json.jbuilder b/app/views/attachment_histories/_attachment_history.json.jbuilder
index 285aced42..a2369888f 100644
--- a/app/views/attachment_histories/_attachment_history.json.jbuilder
+++ b/app/views/attachment_histories/_attachment_history.json.jbuilder
@@ -6,6 +6,7 @@ json.publish_time attachment.publish_time
 json.quotes attachment.quotes_count
 json.downloads_count attachment.downloads_count
 json.created_on attachment.created_on
-json.url attachment_path(attachment, type: 'history').gsub("/api","")
+# json.url attachment_path(attachment, type: 'history').gsub("/api","")
 json.is_pdf attachment.is_history_pdf?
+json.url attachment.is_history_pdf? ? attachment_path(attachment, type: 'history',disposition:"inline") : attachment_path(attachment, type: 'history')
 json.attachment_id attachment.attachment_id
diff --git a/app/views/attachments/_attachment.json.jbuilder b/app/views/attachments/_attachment.json.jbuilder
index 01a7f4163..a8ad0a286 100644
--- a/app/views/attachments/_attachment.json.jbuilder
+++ b/app/views/attachments/_attachment.json.jbuilder
@@ -1,7 +1,8 @@
 json.id attachment.id
 json.title attachment.title
 json.is_public attachment.publiced?
-json.is_lock attachment.locked?(@is_member)
+# json.is_lock attachment.locked?(@is_member)
+json.is_lock !attachment.publiced?
 json.is_publish attachment.published?
 json.publish_time attachment.publish_time
 json.unified_setting attachment.unified_setting
@@ -10,4 +11,5 @@ json.quotes attachment.quotes_count
 json.description attachment.description
 json.downloads_count attachment.downloads_count
 json.created_on attachment.created_on
-json.url download_url(attachment) unless attachment.locked?(@is_member)
+json.is_pdf attachment.is_pdf?
+json.url attachment.is_pdf? ? download_url(attachment,disposition:"inline") : download_url(attachment)
diff --git a/app/views/attachments/_attachment_simple.json.jbuilder b/app/views/attachments/_attachment_simple.json.jbuilder
index ad98fadb5..6737838d1 100644
--- a/app/views/attachments/_attachment_simple.json.jbuilder
+++ b/app/views/attachments/_attachment_simple.json.jbuilder
@@ -2,5 +2,7 @@ json.id attachment.id
 json.title attachment.title
 json.filesize  number_to_human_size attachment.filesize
 json.description attachment.description
-json.url download_url(attachment)
+json.is_pdf attachment.is_pdf?
+json.url attachment.is_pdf? ? download_url(attachment,disposition:"inline") : download_url(attachment)
+# json.url download_url(attachment)
 json.set! :delete, delete.nil? ? true : delete if defined? delete
\ No newline at end of file
diff --git a/app/views/attachments/_attachment_small.json.jbuilder b/app/views/attachments/_attachment_small.json.jbuilder
index 97cbee120..853c14b40 100644
--- a/app/views/attachments/_attachment_small.json.jbuilder
+++ b/app/views/attachments/_attachment_small.json.jbuilder
@@ -1,6 +1,6 @@
 json.id attachment.id
 json.title attachment.title
 json.filesize number_to_human_size(attachment.filesize)
-json.url download_url(attachment)
+json.is_pdf attachment.is_pdf?
+json.url attachment.is_pdf? ? download_url(attachment,disposition:"inline") : download_url(attachment)
 json.created_on attachment.created_on
-json.is_pdf attachment.is_pdf?
\ No newline at end of file
diff --git a/app/views/files/histories.json.jbuilder b/app/views/files/histories.json.jbuilder
index ed322bb17..7039752e7 100644
--- a/app/views/files/histories.json.jbuilder
+++ b/app/views/files/histories.json.jbuilder
@@ -1,9 +1,3 @@
 
-# json.partial! 'attachments/attachment_small', attachment: @file
-json.id @file.id
-json.title @file.title
-json.filesize number_to_human_size(@file.filesize)
-json.url download_url(@file).gsub("/api","")
-json.created_on @file.created_on
-json.is_pdf @file.is_pdf?
+json.partial! 'attachments/attachment_small', attachment: @file
 json.partial! "attachment_histories/list", attachment_histories: @attachment_histories
diff --git a/app/views/files/index.json.jbuilder b/app/views/files/index.json.jbuilder
index 81fa406dd..7fe3bf5b7 100644
--- a/app/views/files/index.json.jbuilder
+++ b/app/views/files/index.json.jbuilder
@@ -8,6 +8,7 @@ json.data do
   json.course_is_public @course.is_public?
   json.files do
     json.array! @attachments do |attachment|
+      json.is_history_file attachment.attachment_histories.count > 0 #是否有历史文件
       json.partial! "attachments/attachment", attachment: attachment
       json.author do
         json.partial! "users/user_simple", user: attachment.author
diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js
index 563724040..d3405ebf5 100644
--- a/public/react/src/modules/courses/Resource/Fileslistitem.js
+++ b/public/react/src/modules/courses/Resource/Fileslistitem.js
@@ -38,29 +38,13 @@ class Fileslistitem extends Component{
         }).then((result)=>{
 
 						if(result.data.attachment_histories.length===0){
-							if(result.data.is_pdf===true){
-								//预览pdf
-								axios({
-									method:'get',
-								  url:result.data.url,
-									responseType: 'arraybuffer',
-								}).then((result)=>{
-										var binaryData = [];
-										binaryData.push(result.data);
-										 this.url =window.URL.createObjectURL(new Blob(binaryData, {type:"application/pdf"}));
-										window.open(this.url);
-									})
-							}else{
-							let link = document.createElement('a');
-							document.body.appendChild(link);
-							link.href = "/api"+result.data.url;
-							link.download = result.data.title;
-							//兼容火狐浏览器
-							let evt = document.createEvent("MouseEvents");
-							evt.initEvent("click", false, false);
-							link.dispatchEvent(evt);
-							document.body.removeChild(link);
-							}
+							// if(result.data.is_pdf===true){
+							// 	this.props.ShowOnlinePdf(result.data.url)
+							// 	//预览pdf
+							// }else{
+							//
+							// }
+							this.props.DownloadFileA(result.data.title,result.data.url)
 						}else{
 							this.setState({
 								Showoldfiles:true,
@@ -146,8 +130,6 @@ class Fileslistitem extends Component{
             discussMessage,
         } = this.props;
 
-
-
         return(
             <div className="graduateTopicList boardsList">
 
diff --git a/public/react/src/modules/courses/coursesPublic/Showoldfiles.js b/public/react/src/modules/courses/coursesPublic/Showoldfiles.js
index 483768271..693e3448b 100644
--- a/public/react/src/modules/courses/coursesPublic/Showoldfiles.js
+++ b/public/react/src/modules/courses/coursesPublic/Showoldfiles.js
@@ -43,16 +43,7 @@ class Showoldfiles extends Component{
 	}
 
 	showfiless=(url)=>{
-		axios({
-			method:'get',
-			url:url,
-			responseType: 'arraybuffer',
-		}).then((result)=>{
-			var binaryData = [];
-			binaryData.push(result.data);
-			this.url =window.URL.createObjectURL(new Blob(binaryData, {type:"application/pdf"}));
-			window.open(this.url);
-		})
+		this.props.ShowOnlinePdf(url)
 	}
 	render(){
 		let {visible,allfiles}=this.props;
@@ -187,10 +178,11 @@ class Showoldfiles extends Component{
 												<div className="clearfix edu-txt-center lineh-40 bor-bottom-greyE" id={allfiles.id}>
 
 													<li className="fl fontlefts">
-														{allfiles.is_pdf===false?
-														<a className={"isabox"} href={"/api"+allfiles.url} >{allfiles.title}</a>:
-															<a className={"isabox"} onClick={()=>this.showfiless(allfiles.url)} >{allfiles.title}</a>
-														}
+														<a className={"isabox"} href={allfiles.url} >{allfiles.title}</a>
+														{/*{allfiles.is_pdf===false?*/}
+														{/*<a className={"isabox"} href={allfiles.url} >{allfiles.title}</a>:*/}
+															{/*<a className={"isabox"} onClick={()=>this.showfiless(allfiles.url)} >{allfiles.title}</a>*/}
+														{/*}*/}
 														<span className={"newcolor-orange fl"}>当前版本</span>
 													</li>
 
@@ -206,11 +198,11 @@ class Showoldfiles extends Component{
 																<div className="clearfix edu-txt-center lineh-40 bor-bottom-greyE" id={item.id} key={key}>
 
 																	<li className="fl fontlefts">
-
-																		{item.is_pdf===false?
-																			<a  className={"isabox"} href={"/api"+item.url}>{item.title}</a>:
-																			<a className={"isabox"} onClick={()=>this.showfiless(item.url)} >{item.title}</a>
-																		}
+																		<a  className={"isabox"} href={item.url}>{item.title}</a>
+																		{/*{item.is_pdf===false?*/}
+																			{/*<a  className={"isabox"} href={item.url}>{item.title}</a>:*/}
+																			{/*<a className={"isabox"} onClick={()=>this.showfiless(item.url)} >{item.title}</a>*/}
+																		{/*}*/}
 																	</li>
 
 																	<li className="fl filesves ">
diff --git a/public/react/src/modules/page/Index.js b/public/react/src/modules/page/Index.js
index 1513405b0..3a273e0d6 100644
--- a/public/react/src/modules/page/Index.js
+++ b/public/react/src/modules/page/Index.js
@@ -242,7 +242,7 @@ class Index extends Component {
 							updateChallengePath={context.updateChallengePath}
 
 	    					
-	    					time_limit={context.time_limit}
+	    					time_limit={context.time_limit + 5}
 
 								resetTestSetsExpandedArray={context.resetTestSetsExpandedArray}
 	    					onRunCodeTestFinish={context.onRunCodeTestFinish}
diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js
index f87f128a1..682e8f866 100644
--- a/public/react/src/modules/tpm/TPMIndexHOC.js
+++ b/public/react/src/modules/tpm/TPMIndexHOC.js
@@ -321,6 +321,30 @@ export function TPMIndexHOC(WrappedComponent) {
       checkIfProfileCompleted = () => {
         return this.state.current_user && this.state.current_user.profile_completed
       }
+
+			ShowOnlinePdf = (url) => {
+				return  axios({
+										method:'get',
+										url:url,
+										responseType: 'arraybuffer',
+									}).then((result)=>{
+										var binaryData = [];
+										binaryData.push(result.data);
+										this.url =window.URL.createObjectURL(new Blob(binaryData, {type:"application/pdf"}));
+										window.open(this.url);
+									})
+			}
+			DownloadFileA=(title,url)=>{
+				let link = document.createElement('a');
+				document.body.appendChild(link);
+				link.href =url;
+				link.download = title;
+				//兼容火狐浏览器
+				let evt = document.createEvent("MouseEvents");
+				evt.initEvent("click", false, false);
+				link.dispatchEvent(evt);
+				document.body.removeChild(link);
+			}
 	  	render() {
           let{Headertop,Footerdown, isRender, AccountProfiletype}=this.state;
           const common = {
@@ -334,11 +358,12 @@ export function TPMIndexHOC(WrappedComponent) {
             isNotMember: this.isNotMember,
             isUserid:this.state.coursedata&&this.state.coursedata.userid,
             fetchUser: this.fetchUser,
-
             showLoginDialog: this.showLoginDialog,
             checkIfLogin: this.checkIfLogin,
             showProfileCompleteDialog: this.showProfileCompleteDialog,
             checkIfProfileCompleted: this.checkIfProfileCompleted,
+						ShowOnlinePdf:(url)=>this.ShowOnlinePdf(url),
+						DownloadFileA:(title,url)=>this.DownloadFileA(title,url),
           }
 		    return (
 		    	<div>