Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_item_bank

yslnewtiku
杨树林 5 years ago
commit f17ecbfd92

@ -132,6 +132,11 @@ class HacksController < ApplicationController
def destroy
@hack.destroy
base_attrs = {
user_id: user_id, viewed: 0, tiding_type: 'System', trigger_user_id: current_user.id,
parent_container_type: "HackDelete"
}
@hack.tidings.create!(base_attrs)
render_ok
end

@ -23,8 +23,6 @@ class Hack < ApplicationRecord
scope :opening, -> {where(open_or_not: 1)}
scope :mine, -> (author_id){ where(user_id: author_id) }
after_destroy :send_delete_tiding
def language
if hack_codes.count == 1
hack_codes.first.language
@ -53,13 +51,4 @@ class Hack < ApplicationRecord
user_id == user.id || user.admin_or_business?
end
private
def send_delete_tiding
base_attrs = {
user_id: user_id, viewed: 0, tiding_type: 'System', trigger_user_id: User.current.id,
parent_container_type: "HackDelete"
}
tidings.create!(base_attrs)
end
end

@ -423,22 +423,24 @@ class TPMIndex extends Component {
{ this.state.is_jupyter===false? <Menu.Item key="8" className={"competitionmr50"}>
<span className={"tpmbannernavstyler"}>排行榜</span>
</Menu.Item>:""}
{this.state.identity >4||this.state.identity===undefined ? "":
<Menu.Item key="9" className={"competitionmr50"}>
<Popover
<span>
<Popover
content={
<pre className={"bannerpd201"}>
<div>更多设置在这里点击配置看一看~</div>
<div className={"wechatcenter mt15"}><Button type="primary" onClick={this.openknow} >我知道了</Button></div>
</pre>
<div>更多设置在这里点击配置看一看~</div>
<div className={"wechatcenter mt15"}><Button type="primary" onClick={this.openknow} >我知道了</Button></div>
</pre>
}
trigger="click"
placement="top"
visible={this.state.openknows}
>
</Popover>
</span>
{this.state.identity >4||this.state.identity===undefined ? "":
<Menu.Item key="9" className={"competitionmr50"}>
<span className={"tpmbannernavstyler"}>配置</span>
</Popover>
</Menu.Item>
}

@ -311,7 +311,7 @@ export default class Shixuninformation extends Component {
</div>}
<div className="edu-back-white mb10 ml30 mt20">
{this.props&&this.props.status>1&&this.state.use_scope===0&&this.props&&this.props.identity>7||this.props&&this.props.public===2&&this.state.use_scope===0&&this.props&&this.props.identity>7?"":<div>
{this.props&&this.props.status>1&&this.state.use_scope===0&&this.props&&this.props.identity>2||this.props&&this.props.public===2&&this.state.use_scope===0&&this.props&&this.props.identity>2?"":<div>
<span className="color-grey-6 mt5 fl font-16" style={{minWidth: '45px'}}>公开程度:</span>
<span className="fl mt8 ml20">
<RadioGroup onChange={this.SelectOpenpublic} value={this.state.use_scope}>

@ -332,12 +332,12 @@ function JupyterTPI (props) {
</p>
<p className="jupyter_btn">
{/*sync | poweroff */}
<Button
className="btn_common"
type="link"
icon="history"
onClick={handleClickResetTpi}
>重置实训</Button>
{/*<Button*/}
{/* className="btn_common"*/}
{/* type="link"*/}
{/* icon="history"*/}
{/* onClick={handleClickResetTpi}*/}
{/*>重置实训</Button>*/}
<Button
className="btn_common"

@ -1,23 +1,13 @@
import React, { Component } from 'react';
import { Link } from "react-router-dom";
import { markdownToHTML, configShareForCustom,getImageUrl,getUploadActionUrlthree,appendFileSizeToUploadFileAll} from 'educoder'
import { Divider, Tooltip,Upload,Modal} from 'antd';
import { Divider, Tooltip,Upload,Modal,Spin} from 'antd';
import LoadingSpin from '../../../../common/LoadingSpin';
import 'antd/lib/pagination/style/index.css';
import '../shixunchildCss/Challenges.css';
import axios from 'axios';
const $ = window.$;
function handleClickResetTpisync_code(id){
const url = `/jupyters/reset_with_tpm.json`;
axios.post(url,{
identifier:id
}).then((response) => {
if(response.data.status===0){
return response
}
})
}
class Challengesjupyter extends Component {
constructor(props) {
super(props)
@ -326,9 +316,31 @@ class Challengesjupyter extends Component {
}
}
handleClickResetTpisync_code=(id)=>{
this.setState({
jupyter_url : null,
booljupyterurls:false,
})
const url = `/jupyters/reset_with_tpm.json`;
axios.get(url,{params:{
identifier:id
}}).then((response) => {
if(response.data.status===0){
setTimeout(()=>{
this.setState({
jupyter_url :response.data.url,
booljupyterurls:true,
})
},1000);
this.props.showNotification('重置实训成功!');
}
});
}
// 重置实训
handleClickResetTpi = () => {
let id=this.props.match.params.shixunId;
let that=this;
Modal.confirm({
title: '重置实训',
content: (
@ -340,7 +352,7 @@ class Challengesjupyter extends Component {
okText: '确定',
cancelText: '取消',
onOk () {
console.log(handleClickResetTpisync_code(id))
that.handleClickResetTpisync_code(id)
},
onCancel() {
@ -549,7 +561,7 @@ class Challengesjupyter extends Component {
<p className="challenbaocuntest" type="upload" >导入</p>
</div>
</Upload>
<button type="button" className="ant-btn deletebuttom chongzhistyles" onClick={this.handleClickResetTpi}><span>重置实训</span></button>
{/*<button type="button" className="ant-btn deletebuttom chongzhistyles" onClick={this.handleClickResetTpi}><span>重置实训</span></button>*/}
</div>

@ -525,9 +525,9 @@ class Collaborators extends Component {
<div className="clearfix mb15 edu-bg-light-blue edu-max-h200">
<ul className="">
<li className={Collaboratorslist&&Collaboratorslist.length===0?"centertop20 clearfix":"clearfix"}>
<span>
{Collaboratorslist&&Collaboratorslist.length===0?<span>
请先将新的管理员通过 <a className={"color-blue"} onClick={() => this.showCollaboratorsvisible("cooperation")}>"添加合作者"</a>
</span>
</span>:""}
<RadioGroup onChange={this.onChange} value={this.state.value}>
{
Collaboratorslist.length === 0 ? "" : Collaboratorslist.map((item, key) => {

Loading…
Cancel
Save