Merge remote-tracking branch 'origin/dev_jupyter' into dev_jupyter

chromesetting
杨树明 6 years ago
commit 180046e74e

@ -3,7 +3,7 @@ class GamesController < ApplicationController
before_action :find_game, except: [:jupyter] before_action :find_game, except: [:jupyter]
before_action :find_shixun, only: [:show, :answer, :rep_content, :choose_build, :game_build, :game_status] before_action :find_shixun, only: [:show, :answer, :rep_content, :choose_build, :game_build, :game_status]
before_action :allowed before_action :allowed, except: [:jupyter]
#require 'iconv' #require 'iconv'
@ -95,6 +95,9 @@ class GamesController < ApplicationController
def jupyter def jupyter
# Jupyter没有challenge # Jupyter没有challenge
@myshixun = Myshixun.find_by_identifier params[:identifier] @myshixun = Myshixun.find_by_identifier params[:identifier]
unless current_user.id == @myshixun.user_id || current_user.admin_or_business?
raise Educoder::TipException.new(403, "..")
end
@shixun = @myshixun.shixun @shixun = @myshixun.shixun
# 判断tpm是否修改了 # 判断tpm是否修改了
begin begin

@ -1,4 +1,3 @@
require 'net/http'
class JupytersController < ApplicationController class JupytersController < ApplicationController
include JupyterService include JupyterService
@ -6,8 +5,8 @@ class JupytersController < ApplicationController
before_action :shixun, only: [:open, :open1, :test, :save] before_action :shixun, only: [:open, :open1, :test, :save]
def save_with_tpi def save_with_tpi
game = Game.find_by(identifier: params[:identifier]) myshixun = Myshixun.find_by(identifier: params[:identifier])
jupyter_save_with_game(game, params[:jupyter_port]) jupyter_save_with_game(myshixun, params[:jupyter_port])
render json: {status: 0} render json: {status: 0}
end end
@ -18,9 +17,9 @@ class JupytersController < ApplicationController
end end
def get_info_with_tpi def get_info_with_tpi
game = Game.find_by(identifier: params[:identifier]) myshixun = Myshixun.find_by(identifier: params[:identifier])
url = jupyter_url_with_game(game) url = jupyter_url_with_game(myshixun)
port = jupyter_port_with_game(game) port = jupyter_port_with_game(myshixun)
render json: {status: 0, url: url, port: port} render json: {status: 0, url: url, port: port}
end end
@ -32,89 +31,4 @@ class JupytersController < ApplicationController
end end
private
def open
#打开tpm - juypter接口
shixun = @shixun
shixun_tomcat = edu_setting('cloud_bridge')
uri = "#{shixun_tomcat}/bridge/jupyter/get"
tpiID = "tpm#{shixun.id}"
params = {tpiID: tpiID, :containers => "#{Base64.urlsafe_encode64(shixun_container_limit(shixun))}"}
logger.info "test_juypter: uri->#{uri}, params->#{params}"
res = uri_post uri, params
logger.info "test_juypter: #{res}"
render plain: "https://#{res['port']}.jupyter.educoder.net/notebooks/data/workspace/myshixun_#{tpiID}/01.ipynb"
end
def open1
## 打开tpi
game = Game.find(2170158)
shixun = game.myshixun.shixun
shixun_tomcat = edu_setting('cloud_bridge')
uri = "#{shixun_tomcat}/bridge/jupyter/get"
tpiID = game.myshixun.id
params = {tpiID: tpiID, :containers => "#{Base64.urlsafe_encode64(shixun_container_limit(shixun))}"}
res = uri_post uri, params
logger.info "test_juypter: #{res}"
if res && res['code'].to_i != 0
raise("实训云平台繁忙繁忙等级99")
end
repo_save_path = game.myshixun.repo_save_path
render plain: "https://#{res['port']}.jupyter.educoder.net/notebooks/data/workspace/myshixun_#{tpiID}/#{repo_save_path}/01.ipynb"
end
def test
render plain: 'test'
end
def save()
# 保存01.ipy
author_name = current_user.real_name
author_email = current_user.git_mail
message = "User submitted"
#https://47526.jupyter.educoder.net/nbconvert/notebook/data/workspace/myshixun_570461/f2ef5p798r20191210163135/01.ipynb?download=true
src_url = URI("https://47519.jupyter.educoder.net/nbconvert/notebook/data/workspace/myshixun_tpm3575/01.ipynb?download=true")
response = Net::HTTP.get_response(src_url)
if response.code.to_i != 200
raise("获取文件内容失败:#{response.code}")
end
content = response.body
c = GitService.update_file(repo_path: @shixun.repo_path,
file_path: "01.ipynb",
message: message,
content: content,
author_name: author_name,
author_email: author_email)
render plain: 'save: #{c.size}'
end
private
def shixun
@shixun = Shixun.find(3575)
end
end end

@ -716,7 +716,7 @@ class ShixunsController < ApplicationController
project_fork(@myshixun, @repo_path, current_user.login) project_fork(@myshixun, @repo_path, current_user.login)
rep_url = Base64.urlsafe_encode64(repo_ip_url @repo_path) rep_url = Base64.urlsafe_encode64(repo_ip_url @repo_path)
uri = "#{cloud_bridge}/bridge/game/openGameInstance" uri = "#{cloud_bridge}/bridge/game/openGameInstance"
params = {tpiID: "#{myshixun.id}", tpmGitURL: rep_url, tpiRepoName: myshixun.repo_name.split("/").last} params = {tpiID: "#{@myshixun.id}", tpmGitURL: rep_url, tpiRepoName: @myshixun.repo_name.split("/").last}
interface_post uri, params, 83, "实训云平台繁忙繁忙等级83" interface_post uri, params, 83, "实训云平台繁忙繁忙等级83"
end end
end end

@ -36,15 +36,15 @@ module JupyterService
end end
def _open_game_jupyter(game) def _open_game_jupyter(myshixun)
## 打开tpi ## 打开tpi
shixun = game.myshixun.shixun shixun = myshixun.shixun
if shixun.is_jupyter? if shixun.is_jupyter?
shixun_tomcat = edu_setting('cloud_bridge') shixun_tomcat = edu_setting('cloud_bridge')
uri = "#{shixun_tomcat}/bridge/jupyter/get" uri = "#{shixun_tomcat}/bridge/jupyter/get"
tpiID = game.myshixun.id tpiID = myshixun.id
params = {tpiID: tpiID, :containers => "#{Base64.urlsafe_encode64(shixun_container_limit(shixun))}"} params = {tpiID: tpiID, :containers => "#{Base64.urlsafe_encode64(shixun_container_limit(shixun))}"}
res = uri_post uri, params res = uri_post uri, params
@ -56,20 +56,20 @@ module JupyterService
@game_jupyter_port = res['port'] @game_jupyter_port = res['port']
repo_save_path = game.myshixun.repo_save_path repo_save_path = myshixun.repo_save_path
"https://#{res['port']}.jupyter.educoder.net/notebooks/data/workspace/myshixun_#{tpiID}/#{repo_save_path}/01.ipynb" "https://#{res['port']}.jupyter.educoder.net/notebooks/data/workspace/myshixun_#{tpiID}/#{repo_save_path}/01.ipynb"
end end
end end
def jupyter_url_with_game(game) def jupyter_url_with_game(myshixun)
_open_game_jupyter(game) _open_game_jupyter(myshixun)
end end
def jupyter_port_with_game(game) def jupyter_port_with_game(myshixun)
if @game_jupyter_port.to_i <=0 if @game_jupyter_port.to_i <=0
_open_game_jupyter(shixun) _open_game_jupyter(myshixun)
end end
@game_jupyter_port @game_jupyter_port
end end
@ -82,11 +82,11 @@ module JupyterService
tpiID = "tpm#{shixun.id}" tpiID = "tpm#{shixun.id}"
#https://47526.jupyter.educoder.net/nbconvert/notebook/data/workspace/myshixun_570461/f2ef5p798r20191210163135/01.ipynb?download=true #https://47526.jupyter.educoder.net/nbconvert/notebook/data/workspace/myshixun_570461/f2ef5p798r20191210163135/01.ipynb?download=true
src_url = URI("https://#{jupyter_port}.jupyter.educoder.net/nbconvert/notebook/data/workspace/myshixun_#{tpiID}/01.ipynb?download=true") src_url = "https://#{jupyter_port}.jupyter.educoder.net/nbconvert/notebook/data/workspace/myshixun_#{tpiID}/01.ipynb?download=true"
response = Net::HTTP.get_response(src_url) response = Faraday.get(src_url)
if response.code.to_i != 200 if response.status.to_i != 200
raise("获取文件内容失败:#{response.code}") raise("获取文件内容失败:#{response.status}")
end end
content = response.body content = response.body
@ -101,25 +101,25 @@ module JupyterService
return c.size return c.size
end end
def jupyter_save_with_game(game,jupyter_port) def jupyter_save_with_game(myshixun,jupyter_port)
author_name = current_user.real_name author_name = current_user.real_name
author_email = current_user.git_mail author_email = current_user.git_mail
message = "User submitted" message = "User submitted"
tpiID = game.myshixun.id tpiID = myshixun.id
repo_save_path = game.myshixun.repo_save_path repo_save_path = myshixun.repo_save_path
src_url = URI("https://#{jupyter_port}.jupyter.educoder.net/nbconvert/notebook/data/workspace/myshixun_#{tpiID}/#{repo_save_path}/01.ipynb?download=true") src_url = "https://#{jupyter_port}.jupyter.educoder.net/nbconvert/notebook/data/workspace/myshixun_#{tpiID}/#{repo_save_path}/01.ipynb?download=true"
response = Net::HTTP.get_response(src_url) response = Faraday.get(src_url)
if response.code.to_i != 200 if response.status.to_i != 200
raise("获取文件内容失败:#{response.code}") raise("获取文件内容失败:#{response.status}")
end end
content = response.body content = response.body
c = GitService.update_file(repo_path: game.myshixun.repo_path, c = GitService.update_file(repo_path: myshixun.repo_path,
file_path: "01.ipynb", file_path: "01.ipynb",
message: message, message: message,
content: content, content: content,

@ -4005,7 +4005,7 @@ class Listofworksstudentone extends Component {
height: 58px; height: 58px;
} }
.ysltableows .ant-table-thead > tr > th, .ant-table-tbody > tr > td { .ysltableows .ant-table-thead > tr > th, .ant-table-tbody > tr > td {
padding: 9px; padding: 9px;
} }
` `
} }

@ -334,6 +334,33 @@ class ShixunsHome extends Component {
.square-Item:nth-child(4n+0) { .square-Item:nth-child(4n+0) {
margin-right: 25px; margin-right: 25px;
} }
.tag-org{
position: absolute;
left: 0px;
top: 20px;
}
.tag-org-name{
width:66px;
height:28px;
background:#FF6802;
width:66px;
height:28px;
border-radius:0px 20px 20px 0px;
}
.tag-org-name-test{
width:45px;
height:23px;
font-size:14px;
color:#FFFFFF;
line-height:19px;
margin-right: 6px;
}
.intermediatecenter{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
` `
} }
</style> </style>
@ -345,7 +372,13 @@ class ShixunsHome extends Component {
<span className="tag-name"> {item.tag_name}</span> <span className="tag-name"> {item.tag_name}</span>
{/*<img style={{display:item.tag_name===null?"none":'block'}} src={require(`./tag2.png`)}/>*/} {/*<img style={{display:item.tag_name===null?"none":'block'}} src={require(`./tag2.png`)}/>*/}
</div> </div>
{
item.is_jupyter===true?
<div className="tag-org">
<p className="tag-org-name intermediatecenter"> <span className="tag-org-name-test">Jupyter</span></p>
{/*<img style={{display:'block',height: '28px'}} src={require(`./shixunCss/tag2.png`)}/>*/}
</div>
:""}
<div className={item.power === false ? "closeSquare" : "none"}> <div className={item.power === false ? "closeSquare" : "none"}>
<img src={getImageUrl("images/educoder/icon/lockclose.svg")} <img src={getImageUrl("images/educoder/icon/lockclose.svg")}
className="mt80 mb25"/> className="mt80 mb25"/>

@ -16,7 +16,6 @@ class TPMDataset extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
datas: [0, 1, 2, 3, 4, 5],
value: undefined, value: undefined,
columns: [ columns: [
{ {
@ -80,10 +79,15 @@ class TPMDataset extends Component {
datalist:[], datalist:[],
data_sets_count:0, data_sets_count:0,
selectedRowKeysdata:[], selectedRowKeysdata:[],
loadingstate:false,
checked: false,
} }
} }
componentDidMount() { componentDidMount() {
this.setState({
loadingstate:true,
})
this.getdatas() this.getdatas()
} }
@ -98,18 +102,20 @@ class TPMDataset extends Component {
datas.push(i); datas.push(i);
} }
this.setState({ this.setState({
selectedRowKeysdata:mydata, selectedRowKeysdata:mydata,
selectedRowKeys: datas, selectedRowKeys: datas,
checked:true,
}) })
// console.log(mydata); // console.log(mydata);
// console.log(datas); // console.log(datas);
} else { } else {
this.setState({ this.setState({
selectedRowKeysdata:[],
selectedRowKeys: [], selectedRowKeys: [],
checked:false,
}) })
} }
} }
@ -143,11 +149,26 @@ class TPMDataset extends Component {
collaboratorList: response.data, collaboratorList: response.data,
data_sets_count:response.data.data_sets_count, data_sets_count:response.data.data_sets_count,
datalist:datalists, datalist:datalists,
selectedRowKeysdata:[],
selectedRowKeys: [],
checked:false,
}); });
} }
} }
setTimeout(() => {
this.setState({
loadingstate:false,
})
}, 500)
}).catch((error)=>{ }).catch((error)=>{
setTimeout(() => {
this.setState({
loadingstate:false,
})
}, 500)
console.log(error) console.log(error)
}); });
@ -181,34 +202,39 @@ class TPMDataset extends Component {
collaboratorList: response.data, collaboratorList: response.data,
data_sets_count:response.data.data_sets_count, data_sets_count:response.data.data_sets_count,
datalist:datalists, datalist:datalists,
selectedRowKeysdata:[],
selectedRowKeys: [],
checked:false,
}); });
} }
} }
setTimeout(() => {
this.setState({
loadingstate:false,
})
}, 500)
}).catch((error)=>{ }).catch((error)=>{
setTimeout(() => {
this.setState({
loadingstate:false,
})
}, 500)
console.log(error) console.log(error)
}); });
} }
showModal = (id, status) => {
};
handleOk = (id, editid) => {
};
handleCancel = (e) => {
};
paginationonChanges = (pageNumber) => { paginationonChanges = (pageNumber) => {
// //console.log('Page: '); // //console.log('Page: ');
this.setState({ this.setState({
page: pageNumber, page: pageNumber,
loadingstate:true,
}) })
this.getdatastwo(pageNumber,10); this.getdatastwo(pageNumber,10);
} }
onSelectChange = (selectedRowKeys, selectedRows) => { onSelectChange = (selectedRowKeys, selectedRows) => {
console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows); console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
this.setState( this.setState(
@ -241,22 +267,33 @@ class TPMDataset extends Component {
let {fileList} = this.state; let {fileList} = this.state;
if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') { if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
console.log("handleChange1"); console.log("handleChange1fileLists");
// if(fileList.length===0){ // if(fileList.length===0){
let fileLists = info.fileList; let fileLists = info.fileList;
// console.log(fileLists);
this.setState({ this.setState({
// fileList:appendFileSizeToUploadFileAll(fileList), // fileList:appendFileSizeToUploadFileAll(fileList),
fileList: fileLists, fileList: fileLists,
deleteisnot: false deleteisnot: false
}); });
}
if(info.file.status === 'done'){
//done 成功就会调用这个方法
this.getdatas(); this.getdatas();
// } // this.props.showNotification(`上传文件成功`);
}else if(info.file.status === 'removed'){
// this.props.showNotification(`上传文件失败`);
}else if(info.file.status === 'uploading'){
// this.props.showNotification(`正在上传文件中`);
} }
} }
} }
onAttachmentRemove = (file) => { onAttachmentRemove = (file) => {
debugger // debugger
if(!file.percent || file.percent == 100){ if(!file.percent || file.percent == 100){
confirm({ confirm({
title: '确定要删除这个附件吗?', title: '确定要删除这个附件吗?',
@ -277,28 +314,46 @@ class TPMDataset extends Component {
} }
deleteRemovedata(){ deleteRemovedata(){
debugger if(this.state.selectedRowKeysdata===undefined || this.state.selectedRowKeysdata===null ||this.state.selectedRowKeysdata.length===0){
console.log("删除");
console.log(this.state.selectedRowKeysdata); this.props.showNotification(`请选择要删除的文件`);
const url = `/attachments/destroy_files.json`;
axios.delete(url, { return
id:this.state.selectedRowKeysdata, }
}) confirm({
.then((response) => { title: '确定要删除文件吗?',
if (response.data) { okText: '确定',
const { status } = response.data; cancelText: '取消',
if (status == 0) { // content: 'Some descriptions',
this.props.showNotification(`删除成功`); onOk: () => {
this.getdatas() const url = `/attachments/destroy_files.json`;
} axios.delete(url,
} { params: {
}) id:this.state.selectedRowKeysdata,
.catch(function (error) { }}
console.log(error); )
}); .then((response) => {
if (response.data) {
const { status } = response.data;
if (status == 0) {
this.props.showNotification(`删除成功`);
this.getdatas()
}
}
})
.catch(function (error) {
console.log(error);
});
},
onCancel() {
console.log('Cancel');
},
});
} }
deleteAttachment = (file) => { deleteAttachment = (file) => {
console.log(file); // console.log(file);
let id=file.response ==undefined ? file.id : file.response.id let id=file.response ==undefined ? file.id : file.response.id
const url = `/attachements/destroy_files.json` const url = `/attachements/destroy_files.json`
axios.delete(url, { axios.delete(url, {
@ -332,7 +387,7 @@ class TPMDataset extends Component {
render() { render() {
const {tpmLoading, shixun, user, match} = this.props; const {tpmLoading, shixun, user, match} = this.props;
const {columns, datas, page, limit, selectedRowKeys,mylistansum,fileList,datalist,data_sets_count} = this.state; const {columns, page, limit, selectedRowKeys,mylistansum,fileList,datalist,data_sets_count,loadingstate} = this.state;
const rowSelection = { const rowSelection = {
selectedRowKeys, selectedRowKeys,
onChange: this.onSelectChange, onChange: this.onSelectChange,
@ -371,7 +426,6 @@ class TPMDataset extends Component {
message: '提示', message: '提示',
description: description:
'文件大小必须小于50MB', '文件大小必须小于50MB',
} }
) )
} }
@ -385,8 +439,6 @@ class TPMDataset extends Component {
file:file file:file
}) })
} }
console.log("handleChange2");
return isLt150M; return isLt150M;
}, },
} }
@ -407,7 +459,7 @@ class TPMDataset extends Component {
<div className="padding20 edu-back-white mt20 " style={{minHeight: '463px'}}> <div className="padding20 edu-back-white mt20 " style={{minHeight: '463px'}}>
<div className="sortinxdirection"> <div className="sortinxdirection">
<div className="tpmwidth"> <div className="tpmwidth">
<Checkbox onChange={this.mysonChange}>全选</Checkbox> <Checkbox checked={this.state.checked} onChange={this.mysonChange}>全选</Checkbox>
</div> </div>
<div className="tpmwidth xaxisreverseorder"> <div className="tpmwidth xaxisreverseorder">
<style> <style>
@ -506,6 +558,8 @@ class TPMDataset extends Component {
className="mysjysltable4" className="mysjysltable4"
rowSelection={rowSelection} rowSelection={rowSelection}
rowClassName={this.rowClassName} rowClassName={this.rowClassName}
loading={loadingstate}
/> />
</div> </div>
} }

@ -53,20 +53,44 @@ class TPMNav extends Component {
{/*jupyter*/} {/*jupyter*/}
{ {
this.props.is_jupyter===true? this.props.is_jupyter===true?
<Link to={`/shixuns/${shixunId}/dataset`} (
className={`${match.url.indexOf('dataset') != -1 ? 'active' : ''} fl mr40`}>数据集</Link> is_teacher===true?
<Link to={`/shixuns/${shixunId}/dataset`}
className={`${match.url.indexOf('dataset') != -1 ? 'active' : ''} fl mr40`}>数据集</Link>
:""
)
:"" :""
} }
{
this.props.is_jupyter === false ?
<Link to={`/shixuns/${shixunId}/shixun_discuss`}
className={`${match.url.indexOf('shixun_discuss') != -1 ? 'active' : ''} fl mr40`}>评论</Link>
:""
}
{
this.props.is_jupyter === false ?
<Link to={`/shixuns/${shixunId}/ranking_list`}
className={`${match.url.indexOf('ranking_list') != -1 ? 'active' : ''} fl mr40`}>排行榜</Link>:""
}
<Link to={`/shixuns/${shixunId}/shixun_discuss`} {this.props.identity >2||this.props.identity===undefined?"":
className={`${match.url.indexOf('shixun_discuss') != -1 ? 'active' : ''} fl mr40`}>评论</Link> (this.props.is_jupyter === false?
<Link to={`/shixuns/${shixunId}/audit_situation`}
className={`${match.url.indexOf('audit_situation') != -1 ? 'active' : ''} fl`}>审核情况</Link>
:
is_teacher===true?
<Link to={`/shixuns/${shixunId}/audit_situation`}
className={`${match.url.indexOf('audit_situation') != -1 ? 'active' : ''} fl`}>审核情况</Link>
:
""
)
<Link to={`/shixuns/${shixunId}/ranking_list`}
className={`${match.url.indexOf('ranking_list') != -1 ? 'active' : ''} fl mr40`}>排行榜</Link>
{this.props.identity >2||this.props.identity===undefined?"":<Link to={`/shixuns/${shixunId}/audit_situation`}
className={`${match.url.indexOf('audit_situation') != -1 ? 'active' : ''} fl`}>审核情况</Link>} }
{this.props.identity >4||this.props.identity===undefined ? "":<Link to={`/shixuns/${shixunId}/settings`} className="edu-default-btn edu-blueline-btn ml20 fr" {this.props.identity >4||this.props.identity===undefined ? "":<Link to={`/shixuns/${shixunId}/settings`} className="edu-default-btn edu-blueline-btn ml20 fr"
>配置</Link>} >配置</Link>}

@ -206,7 +206,7 @@ class Challengesjupyter extends Component {
// // _iframe.style.display= "none"; //修改样式 // // _iframe.style.display= "none"; //修改样式
// } // }
const is_teacher = this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false;
@ -257,16 +257,22 @@ class Challengesjupyter extends Component {
this.state.jupyter_url === null || this.state.jupyter_url === undefined ? this.state.jupyter_url === null || this.state.jupyter_url === undefined ?
"" ""
: :
<div className="sortinxdirection mt60"> (
<div className="renwuxiangssi sortinxdirection"> is_teacher===true?
<div><p className="renwuxiangqdiv">任务详情</p></div> <div className="sortinxdirection mt60">
<div><p className="renwuxiangqdivtest ml24">请将实训题目写在下方</p></div> <div className="renwuxiangssi sortinxdirection">
</div> <div><p className="renwuxiangqdiv">任务详情</p></div>
<div className="renwuxiangssit xaxisreverseorder"> <div><p className="renwuxiangqdivtest ml24">请将实训题目写在下方</p></div>
<div className="challenbaocun" onClick={() => this.modifyjupyter(this.state)}><p </div>
className="challenbaocuntest">应用到实训</p></div> <div className="renwuxiangssit xaxisreverseorder">
</div> <div className="challenbaocun" onClick={() => this.modifyjupyter(this.state)}><p
</div> className="challenbaocuntest">应用到实训</p></div>
</div>
</div>
:
""
)
} }
<style> <style>
@ -290,21 +296,25 @@ class Challengesjupyter extends Component {
` `
} }
</style> </style>
<div className="mt35"> {
{/*https://48888.jupyter.educoder.net/tree?*/} is_teacher===true?
<div className="mt35">
<div className="pb47"> {/*https://48888.jupyter.educoder.net/tree?*/}
{
this.state.jupyter_url===null || this.state.jupyter_url===undefined? <div className="pb47">
"" {
: this.state.jupyter_url===null || this.state.jupyter_url===undefined?
<iframe src={this.state.jupyter_url} ""
sandbox="allow-same-origin allow-scripts allow-top-navigation " scrolling="no" id="frame" :
name="framename" width="100%" height="700" frameBorder="0" <iframe src={this.state.jupyter_url}
></iframe> sandbox="allow-same-origin allow-scripts allow-top-navigation " scrolling="no" id="frame"
} name="framename" width="100%" height="700" frameBorder="0"
</div> ></iframe>
</div> }
</div>
</div>
:""
}
</div> </div>
</div> </div>

@ -275,10 +275,10 @@ render() {
} }
<div className="fl pr shaiAllItem mt1"> <div className="fl pr shaiAllItem mt1">
<li className={this.state.diff===0?"shaiItems shixun_repertoire active":"shaiItems shixun_repertoire"} onClick={()=>this.diff_search(0)}>全部难度</li> <li className={this.state.diff===0?"shaiItems shixun_repertoire active":"shaiItems shixun_repertoire"} onClick={()=>this.diff_search(0)}>全部难度</li>
<li className={this.state.diff===1?"shaiItems shixun_repertoire active":"shaiItems shixun_repertoire"} onClick={()=>this.diff_search(1)}>初级学员</li> <li className={this.state.diff===1?"shaiItems shixun_repertoire active":"shaiItems shixun_repertoire"} onClick={()=>this.diff_search(1)}>初级</li>
<li className={this.state.diff===2?"shaiItems shixun_repertoire active":"shaiItems shixun_repertoire"} onClick={()=>this.diff_search(2)}>中级学员</li> <li className={this.state.diff===2?"shaiItems shixun_repertoire active":"shaiItems shixun_repertoire"} onClick={()=>this.diff_search(2)}>中级</li>
<li className={this.state.diff===3?"shaiItems shixun_repertoire active":"shaiItems shixun_repertoire"} onClick={()=>this.diff_search(3)}>高级学员</li> <li className={this.state.diff===3?"shaiItems shixun_repertoire active":"shaiItems shixun_repertoire"} onClick={()=>this.diff_search(3)}>高级</li>
<li className={this.state.diff===4?"shaiItems shixun_repertoire active":"shaiItems shixun_repertoire"} onClick={()=>this.diff_search(4)}>顶级学员</li> <li className={this.state.diff===4?"shaiItems shixun_repertoire active":"shaiItems shixun_repertoire"} onClick={()=>this.diff_search(4)}>高级</li>
</div> </div>
</div> </div>

@ -329,6 +329,34 @@ class InfosShixun extends Component{
bottom: 100px; bottom: 100px;
} }
.square-list{width: 100%;box-sizing: border-box;margin-top:10px} .square-list{width: 100%;box-sizing: border-box;margin-top:10px}
.tag-org{
position: absolute;
left: 0px;
top: 20px;
}
.tag-org-name{
width:66px;
height:28px;
background:#FF6802;
width:66px;
height:28px;
border-radius:0px 20px 20px 0px;
}
.tag-org-name-test{
width:45px;
height:23px;
font-size:14px;
color:#FFFFFF;
line-height:19px;
margin-right: 6px;
}
.intermediatecenter{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
` `
} }
</style> </style>
@ -350,6 +378,15 @@ class InfosShixun extends Component{
{/*<img className="fl" src={setImagesUrl("images/educoder/tag2.png")}/>*/} {/*<img className="fl" src={setImagesUrl("images/educoder/tag2.png")}/>*/}
</div> </div>
} }
{
item.is_jupyter===true?
<div className="tag-org">
<p className="tag-org-name intermediatecenter"> <span className="tag-org-name-test">Jupyter</span></p>
{/*<img style={{display:'block',height: '28px'}} src={require(`./shixunCss/tag2.png`)}/>*/}
</div>
:""}
<a href="javascript:void(0)" className="square-img"> <a href="javascript:void(0)" className="square-img">
<img src={setImagesUrl(`${item.image_url}`)}/> <img src={setImagesUrl(`${item.image_url}`)}/>
</a> </a>

Loading…
Cancel
Save