Merge branches 'dev_aliyun' and 'develop' of https://bdgit.educoder.net/Hjqreturn/educoder into develop

dev_home
杨树明 5 years ago
commit 99a9719cf5

@ -49,7 +49,7 @@ class GitsController < ApplicationController
shixunname = git_url.split("/")[1].split(".")[0]
repo_name = username + "/" + shixunname
uid_logger("git start: repo_name is #{repo_name}")
shixun = Shixun.select([:id, :user_id, :repo_name, :identifier]).where(repo_name: repo_name).first
shixun = Shixun.select([:id, :user_id, :repo_name, :identifier]).where(repo_name: repo_name, laboratory_id: nil).first
uid_logger("git start auth: shixun identifier is #{shixun.try(:identifier)}")
uid_logger("git start auth: systemuser is #{system_user.try(:login)}")

@ -2,8 +2,26 @@ module Util
module UUID
module_function
DCODES = %W(2 3 4 5 6 7 8 9 a b c f e f g h i j k l m n o p q r s t u v w x y z)
def time_uuid(format: '%Y%m%d%H%M%S', suffix: 8)
"#{Time.zone.now.strftime(format)}#{Random.rand(10**suffix).to_i}"
end
# 随机生成字符
def generate_identifier(container, num, pre='')
code = DCODES.sample(num).join
if container == User
while container.exists?(login: pre+code) do
code = DCODES.sample(num).join
end
else
while container.exists?(identifier: code) do
code = DCODES.sample(num).join
end
end
code
end
end
end

@ -60,7 +60,11 @@ class Subjects::CopySubjectService < ApplicationService
to_shixun = Shixun.new
to_shixun.attributes = shixun.attributes.dup.except('id', 'user_id', 'identifier', 'homepage_show',
'use_scope', 'averge_star', 'myshixuns_count')
to_shixun.identifier = Util::UUID.generate_identifier(Shixun, 8)
to_shixun.user_id = user_id
if laboratory
to_shixun.laboratory_id = laboratory.id
end
to_shixun.save!
copy_shixun_info_data!(shixun, to_shixun)
@ -71,7 +75,9 @@ class Subjects::CopySubjectService < ApplicationService
copy_shixun_members_data!(to_shixun)
# 云上实验室
laboratory.laboratory_shixuns.create(shixun: to_shixun) if laboratory
if laboratory
laboratory.laboratory_shixuns.create(shixun: to_shixun)
end
to_shixun
end

@ -0,0 +1,5 @@
class AddLaboraryIdForShixun < ActiveRecord::Migration[5.2]
def change
add_column :shixuns, :laboratory_id, :integer
end
end

@ -174,7 +174,7 @@ class CCommentItem extends Component{
// <div>{item.content} {item.user_info.user_name}</div>
// src={getImageUrl(`images/${item.image_url}`)}
const imgSrc = (!item.user_info.user_image_url || item.user_info.user_image_url === '--') ? `${getUrl()}/images/edu_user/anony.png` : item.user_info.user_image_url;
const imgSrc = (!item.user_info.user_image_url || item.user_info.user_image_url === '--') ? `edu_user/anony.png` : item.user_info.user_image_url;
return (
<div className="comment_item_cont appraise df clearfix" key={item.id}>
<div className="J_Comment_Face fl">

@ -1283,7 +1283,7 @@ submittojoinclass=(value)=>{
<div className="edu-menu-list" style={{top: '60px',width:"240px"}}>
<div className="overPart"></div>
<ul className={coursestypes===true&&this.props.user&&this.props.user.main_site===true?"fl headwith100b edu-txt-center pr ul-leftline":"fl with50 edu-txt-center pr ul-leftline"}>
<ul className={coursestypes===true&&this.props.user&&this.props.user.main_site===false?"fl headwith100b edu-txt-center pr ul-leftline":"fl with50 edu-txt-center pr ul-leftline"}>
{this.props.current_user&&this.props.current_user.user_identity==="学生"?"":coursestypes===true?"":<li><a onClick={(url)=>this.getUser("/courses/new")}>新建翻转课堂</a></li>}
{shixuntype===true?"":<li><a onClick={(url)=>this.getUser("/shixuns/new")}>新建实训项目</a></li>}
{this.props.Headertop===undefined?"":
@ -1291,7 +1291,7 @@ submittojoinclass=(value)=>{
}
{this.props.user&&this.props.user.main_site===true?<li><a onClick={(url)=>this.getUser("/projects/new","projects")} target="_blank">新建开发项目</a></li>:""}
</ul>
{coursestypes===true&&this.props.user&&this.props.user.main_site===true?"":<ul className="fl with50 edu-txt-center">
{coursestypes===true&&this.props.user&&this.props.user.main_site===false?"":<ul className="fl with50 edu-txt-center">
{coursestypes===true?"":<li>
<a onClick={this.tojoinclass}>加入翻转课堂</a>
@ -1360,7 +1360,7 @@ submittojoinclass=(value)=>{
</div>
</div>
<div className="fl mr30 edu-menu-panel headIcon">
{this.props.user&&this.props.user.main_site===true? <div className="fl mr30 edu-menu-panel headIcon">
{ user===undefined?"":user.login===""?"": <a
href={`/messages/${user.login}/user_tidings`}
style={{position:'relative'}}
@ -1373,7 +1373,7 @@ submittojoinclass=(value)=>{
</a>
}
</div>
</div>:""}
<Modal
keyboard={false}

@ -87,7 +87,7 @@ class SiderBar extends Component {
render() {
return (
<div className="-task-sidebar">
this.props.mygetHelmetapi&&this.props.mygetHelmetapi.main_site===true?<div className="-task-sidebar">
<div className="gotop" tooltips="返回顶部">
<a>
<i className="iconfont icon-shangjiantou color-white"></i>
@ -129,8 +129,8 @@ class SiderBar extends Component {
</a>
</div>
</div>
);
</div>:""
);
}
}

@ -677,7 +677,10 @@ export function TPMIndexHOC(WrappedComponent) {
{...this.state}
{...this.dialogObj}
/>:""}
<SiderBar Headertop={Headertop}/>
<SiderBar
{...this.props}
{...this.state}
Headertop={Headertop}/>
{/* 注释掉了1440 影响到了手机屏幕的展示 */}
<style>{
`

@ -950,8 +950,8 @@ class Newshixuns extends Component {
<div className="mb10 edu-back-white">
<p className="padding10-20 bor-bottom-greyE color-grey-3 clearfix">
<span className="fl font-18 lineh-35">创建实训</span>
<a className="fr font-16 mt3 color-blue" href="/forums/2943"
target="_blank">实训制作指南</a>
{this.props.user&&this.props.user.main_site===true?<a className="fr font-16 mt3 color-blue" href="/forums/2943"
target="_blank">实训制作指南</a>:""}
</p>
<div className="padding30-20">

Loading…
Cancel
Save