Merge branch 'dev_aliyun' into dev_tj

merge aliyun
chromesetting
tangjiang 5 years ago
commit 1be6f7651d

@ -9,9 +9,11 @@ class HacksController < ApplicationController
def start def start
# 未发布的编程题,只能作者、或管理员访问 # 未发布的编程题,只能作者、或管理员访问
start_hack_auth start_hack_auth
user_hack = @hack.hack_user_lastest_codes.mine(current_user.id) user_hack = @hack.hack_user_lastest_codes.where(user_id: current_user.id).first
logger.info("#user_hack: #{user_hack}")
identifier = identifier =
if user_hack.present? if user_hack.present?
logger.info("#####user_hack_id:#{user_hack.id}")
user_hack.identifier user_hack.identifier
else else
user_identifier = generate_identifier HackUserLastestCode, 12 user_identifier = generate_identifier HackUserLastestCode, 12

@ -247,7 +247,7 @@ class MyshixunsController < ApplicationController
def update_file def update_file
begin begin
@hide_code = Shixun.where(id: @myshixun.shixun_id).pluck(:hide_code).first @hide_code = Shixun.where(id: @myshixun.shixun_id).pluck(:hide_code).first
tip_exception("技术平台为空!") if @myshixun.mirror_name.blank? tip_exception("实验环境不能为空,请查看实训模板的环境配置项是否正确!") if (@myshixun.mirror_name.blank? || @myshixun.mirror_name.first.to_s == "-1")
path = params[:path].strip unless params[:path].blank? path = params[:path].strip unless params[:path].blank?
game_id = params[:game_id] game_id = params[:game_id]
game = Game.find(game_id) game = Game.find(game_id)

@ -8,7 +8,7 @@ class HackUserLastestCode < ApplicationRecord
belongs_to :user belongs_to :user
has_many :hack_user_codes, dependent: :destroy has_many :hack_user_codes, dependent: :destroy
has_one :hack_user_debug has_one :hack_user_debug
scope :mine, ->(author_id){ find_by(user_id: author_id) } scope :mine, ->(author_id){ where(user_id: author_id).first }
scope :mine_hack, ->(author_id){ where(user_id: author_id) } scope :mine_hack, ->(author_id){ where(user_id: author_id) }
scope :passed, -> {where(status: 1)} scope :passed, -> {where(status: 1)}

@ -72,6 +72,7 @@ const Otherlogin=Loadable({
loading: Loading, loading: Loading,
}) })
const Otherloginstart=Loadable({ const Otherloginstart=Loadable({
loader: () => import('./modules/login/Otherloginstart'), loader: () => import('./modules/login/Otherloginstart'),
loading: Loading, loading: Loading,

@ -58,15 +58,6 @@ class TPMBanner extends Component {
} }
} }
// star_info:[0, 0, 0, 0, 0, 0],
// star_infos:[0, 0, 0, 0, 0, 0],
// shixunsDetails:{},
// shixunId: undefined,
// componentWillReceiveProps(newProps, newContext){
// this.setState({
// shixunsDetails: newProps.shixunsDetails
// });
// }
IEVersion = () => { IEVersion = () => {
var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串 var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
@ -141,8 +132,11 @@ class TPMBanner extends Component {
}) })
} }
} }
} }
} }
componentDidMount() { componentDidMount() {
let thiisie = this.IEVersion(); let thiisie = this.IEVersion();
@ -155,6 +149,7 @@ class TPMBanner extends Component {
isIE: false isIE: false
}) })
} }
} }
/* /*
@ -784,7 +779,8 @@ class TPMBanner extends Component {
}; };
// //
// console.log(this.props.shixunsDetails&&this.props.shixunsDetails.is_jupyter) // console.log(this.props.shixunsDetails&&this.props.shixunsDetails.is_jupyter)
console.log(this.props)
console.log(this.state)
return ( return (
shixunsDetails === undefined ? "" : shixunsDetails === undefined ? "" :

@ -207,6 +207,7 @@ class TPMIndex extends Component {
propaedeutics:response.data.propaedeutics, propaedeutics:response.data.propaedeutics,
status: response.data.shixun_status, status: response.data.shixun_status,
secret_repository: response.data.secret_repository, secret_repository: response.data.secret_repository,
public:response.data.public,
is_jupyter:response.data.is_jupyter=== undefined||response.data.is_jupyter===null?false:response.data.is_jupyter, is_jupyter:response.data.is_jupyter=== undefined||response.data.is_jupyter===null?false:response.data.is_jupyter,
}); });
@ -295,10 +296,6 @@ class TPMIndex extends Component {
// this.getnavdatas() // this.getnavdatas()
} }
// componentDidUpdate=()=>{
// this.getnavdatas()
// }
setLoadingContent = (isLoadingContent) => { setLoadingContent = (isLoadingContent) => {
this.setState({ loadingContent: isLoadingContent }) this.setState({ loadingContent: isLoadingContent })
} }
@ -307,9 +304,6 @@ class TPMIndex extends Component {
getnavdatas=()=>{ getnavdatas=()=>{
let selectedKeys; let selectedKeys;
const {location} = this.props; const {location} = this.props;
console.log(location.pathname)
if(location.pathname.indexOf('/challenges')!=-1){ if(location.pathname.indexOf('/challenges')!=-1){
selectedKeys="1" selectedKeys="1"
}else if(location.pathname.indexOf('/propaedeutics')!=-1){ }else if(location.pathname.indexOf('/propaedeutics')!=-1){

@ -53,6 +53,13 @@ class Challenges extends Component {
ChallengesDataList: response.data, ChallengesDataList: response.data,
sumidtype: false, sumidtype: false,
}); });
if(response.data.description=== ""||response.data.description===null||response.data.description===undefined){
this.setState({
isopentitletype:"Less",
})
}
} }
} }
}).catch((error) => { }).catch((error) => {
@ -72,7 +79,7 @@ class Challenges extends Component {
let box=document.getElementById("shixunchallengesid"); let box=document.getElementById("shixunchallengesid");
if(box){ if(box){
boxoffsetHeigh=box.offsetHeight boxoffsetHeigh=box.offsetHeight
if(boxoffsetHeigh<260){ if(boxoffsetHeigh<300){
this.setState({ this.setState({
isopentitletype:"Less", isopentitletype:"Less",
boxoffsetHeigh:boxoffsetHeigh boxoffsetHeigh:boxoffsetHeigh
@ -338,6 +345,7 @@ class Challenges extends Component {
} }
let id = this.props.match.params.shixunId; let id = this.props.match.params.shixunId;
const antIcon = <Icon type="loading" style={{ fontSize: 24 }} spin />; const antIcon = <Icon type="loading" style={{ fontSize: 24 }} spin />;
return ( return (
<React.Fragment> <React.Fragment>
{AccountProfiletype===true?<AccountProfile {AccountProfiletype===true?<AccountProfile
@ -411,7 +419,7 @@ class Challenges extends Component {
{ {
` `
#shixunchallengesid{ #shixunchallengesid{
max-height: 260px; max-height: 300px;
overflow: hidden; overflow: hidden;
} }
` `
@ -431,11 +439,18 @@ class Challenges extends Component {
<div className="justify break_full_word new_li " <div className="justify break_full_word new_li "
id="challenge_editorMd_description"> id="challenge_editorMd_description">
<p id="ReactMarkdown" style={{overflow:'hidden'}}> {ChallengesDataList === undefined || ChallengesDataList&&ChallengesDataList.description=== ""||ChallengesDataList&&ChallengesDataList.description===null||ChallengesDataList&&ChallengesDataList.description===undefined?
<div className="edu-tab-con-box clearfix edu-txt-center">
{this.props.identity < 5?<img className="newedu-nodata-img mb20"
src={getImageUrl("images/educoder/shixunnodata.png")} />:<img className="edu-nodata-img mb20"
src={getImageUrl("images/educoder/nodata.png")} />}
<p className="edu-nodata-p mb80">暂时还没有相关数据哦</p>
</div>
:<p id="ReactMarkdown" style={{overflow:'hidden'}}>
{ChallengesDataList === undefined ? "" :ChallengesDataList&&ChallengesDataList.description===null?"": {ChallengesDataList === undefined ? "" :ChallengesDataList&&ChallengesDataList.description===null?"":
<div className={"markdown-body"} dangerouslySetInnerHTML={{__html: markdownToHTML(ChallengesDataList.description).replace(/▁/g,"▁▁▁")}}></div> <div className={"markdown-body"} dangerouslySetInnerHTML={{__html: markdownToHTML(ChallengesDataList.description).replace(/▁/g,"▁▁▁")}}></div>
} }
</p> </p>}
</div> </div>
</div> </div>

@ -1,6 +1,6 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import { markdownToHTML, configShareForCustom} from 'educoder' import { markdownToHTML, configShareForCustom,getImageUrl} from 'educoder'
import { Divider, Tooltip } from 'antd'; import { Divider, Tooltip } from 'antd';
import LoadingSpin from '../../../../common/LoadingSpin'; import LoadingSpin from '../../../../common/LoadingSpin';
import 'antd/lib/pagination/style/index.css'; import 'antd/lib/pagination/style/index.css';
@ -23,7 +23,8 @@ class Challengesjupyter extends Component {
booljupyterurls:false, booljupyterurls:false,
loading:false, loading:false,
boxoffsetHeigh:0, boxoffsetHeigh:0,
opentitletype:true opentitletype:true,
isopentitletype:"Less",
} }
} }
@ -41,6 +42,11 @@ class Challengesjupyter extends Component {
ChallengesDataList: response.data, ChallengesDataList: response.data,
sumidtype: false, sumidtype: false,
}); });
if(response.data.description=== ""||response.data.description===null||response.data.description===undefined){
this.setState({
isopentitletype:"Less",
})
}
} }
} }
}).catch((error) => { }).catch((error) => {
@ -55,13 +61,15 @@ class Challengesjupyter extends Component {
let box=document.getElementById("shixunchallengesid"); let box=document.getElementById("shixunchallengesid");
if(box){ if(box){
boxoffsetHeigh=box.offsetHeight boxoffsetHeigh=box.offsetHeight
if(boxoffsetHeigh<260){ if(boxoffsetHeigh<300){
this.setState({ this.setState({
opentitletype:false, isopentitletype:"Less",
boxoffsetHeigh:boxoffsetHeigh boxoffsetHeigh:boxoffsetHeigh
}) })
}else{ }else{
this.setState({ this.setState({
isopentitletype:"greater",
opentitletype:true,
boxoffsetHeigh:boxoffsetHeigh boxoffsetHeigh:boxoffsetHeigh
}) })
} }
@ -229,7 +237,7 @@ class Challengesjupyter extends Component {
{ {
` `
#shixunchallengesid{ #shixunchallengesid{
max-height: 260px; max-height: 300px;
overflow: hidden; overflow: hidden;
} }
` `
@ -239,9 +247,22 @@ class Challengesjupyter extends Component {
<div className={"pd20"} id={"shixunchallengesid"}> <div className={"pd20"} id={"shixunchallengesid"}>
<p id="ReactMarkdown" style={{overflow:'hidden'}}> <p id="ReactMarkdown" style={{overflow:'hidden'}}>
{ChallengesDataList === undefined ? "" :ChallengesDataList&&ChallengesDataList.description===null?"": {/*{ChallengesDataList === undefined ? "" :ChallengesDataList&&ChallengesDataList.description===null?"":*/}
<div className={"markdown-body"} dangerouslySetInnerHTML={{__html: markdownToHTML(ChallengesDataList.description).replace(/▁/g,"▁▁▁")}}></div> {/* <div className={"markdown-body"} dangerouslySetInnerHTML={{__html: markdownToHTML(ChallengesDataList.description).replace(/▁/g,"▁▁▁")}}></div>*/}
} {/*}*/}
{ChallengesDataList === undefined || ChallengesDataList&&ChallengesDataList.description=== ""||ChallengesDataList&&ChallengesDataList.description===null||ChallengesDataList&&ChallengesDataList.description===undefined?
<div className="edu-tab-con-box clearfix edu-txt-center">
{this.props.identity < 5?<img className="newedu-nodata-img mb20"
src={getImageUrl("images/educoder/shixunnodata.png")} />:<img className="edu-nodata-img mb20"
src={getImageUrl("images/educoder/nodata.png")} />}
<p className="edu-nodata-p mb80">暂时还没有相关数据哦</p>
</div>
:<p id="ReactMarkdown" style={{overflow:'hidden'}}>
{ChallengesDataList === undefined ? "" :ChallengesDataList&&ChallengesDataList.description===null?"":
<div className={"markdown-body"} dangerouslySetInnerHTML={{__html: markdownToHTML(ChallengesDataList.description).replace(/▁/g,"▁▁▁")}}></div>
}
</p>}
</p> </p>
{ {
booljupyterurls===true? booljupyterurls===true?
@ -259,7 +280,7 @@ class Challengesjupyter extends Component {
} }
</div> </div>
{this.state.opentitletype===true?<Divider dashed={true} onClick={()=>this.opentitle()} className={"pointer Breadcrumbfont color-grey-9 "}> {this.state.isopentitletype==="Less"?"":this.state.opentitletype===true?<Divider dashed={true} onClick={()=>this.opentitle()} className={"pointer Breadcrumbfont color-grey-9 "}>
<a className={"font-14 color-grey-9"}>阅读全文 <i className={"iconfont icon-jiantou9 font-14"}></i></a> <a className={"font-14 color-grey-9"}>阅读全文 <i className={"iconfont icon-jiantou9 font-14"}></i></a>
</Divider>:<Divider dashed={true} onClick={()=>this.opentitle()} className={"pointer Breadcrumbfont color-grey-9 "}> </Divider>:<Divider dashed={true} onClick={()=>this.opentitle()} className={"pointer Breadcrumbfont color-grey-9 "}>
<a className={"font-14 color-grey-9"}>收起全文 <i className={"iconfont icon-changyongtubiao-xianxingdaochu-zhuanqu- font-14"}></i></a> <a className={"font-14 color-grey-9"}>收起全文 <i className={"iconfont icon-changyongtubiao-xianxingdaochu-zhuanqu- font-14"}></i></a>

@ -656,7 +656,7 @@ class Collaborators extends Component {
<a href={item.user.user_url} target="_blank" className="mr20 fl edu-position"> <a href={item.user.user_url} target="_blank" className="mr20 fl edu-position">
<img alt="用户头像" className="radius" height="48" src={getImageUrl("images/" + item.user.image_url)} <img alt="用户头像" className="radius" height="48" src={getImageUrl("images/" + item.user.image_url)}
width="48"/> width="48"/>
<span className={item && item.user && item.user.shixun_manager === true&&this.props.power === true ? "ml20 yslusercjz newyslusercjz" : "none "} <span className={item && item.user && item.user.shixun_manager === true? "ml20 yslusercjz newyslusercjz" : "none "}
// style={{display: this.props.power === false ? "none" : "inline-block"}} // style={{display: this.props.power === false ? "none" : "inline-block"}}
> >
<p className="yslusercjztest newyslusercjztest">{item.user.shixun_manager === true ? "创建者" : ""}</p></span> <p className="yslusercjztest newyslusercjztest">{item.user.shixun_manager === true ? "创建者" : ""}</p></span>

Loading…
Cancel
Save