chromesetting
杨树林 5 years ago
parent 0439a9a505
commit b9cf999c69

@ -8,6 +8,7 @@ import TPMNav from './component/TPMNav';
import axios from 'axios'; import axios from 'axios';
import './tpmmodel/tpmmodel.css' import './tpmmodel/tpmmodel.css'
import {getUploadActionUrl} from 'educoder'; import {getUploadActionUrl} from 'educoder';
import moment from 'moment';
const confirm = Modal.confirm; const confirm = Modal.confirm;
@ -24,10 +25,10 @@ class TPMDataset extends Component {
key: 'number', key: 'number',
align: 'left', align: 'left',
className: " font-14 wenjiantit", className: " font-14 wenjiantit",
width: '300px', width: '200px',
render: (text, record) => ( render: (text, record) => (
<div> <div>
文件名字 {record.title}
</div> </div>
) )
}, },
@ -37,10 +38,10 @@ class TPMDataset extends Component {
key: 'number', key: 'number',
align: 'center', align: 'center',
className: "edu-txt-center font-14 zuihoushijian", className: "edu-txt-center font-14 zuihoushijian",
width: '125px', width: '150px',
render: (text, record) => ( render: (text, record) => (
<div> <div>
2019-08-12 12:30 {record.timedata}
</div> </div>
) )
}, },
@ -52,7 +53,7 @@ class TPMDataset extends Component {
className: "edu-txt-center font-14 ", className: "edu-txt-center font-14 ",
render: (text, record) => ( render: (text, record) => (
<div> <div>
张大大 {record.author}
</div> </div>
) )
}, },
@ -64,7 +65,7 @@ class TPMDataset extends Component {
className: "edu-txt-center font-14 ", className: "edu-txt-center font-14 ",
render: (text, record) => ( render: (text, record) => (
<div> <div>
1.88kb {record.filesize}
</div> </div>
) )
}, },
@ -76,7 +77,9 @@ class TPMDataset extends Component {
collaboratorList:[], collaboratorList:[],
fileList:[], fileList:[],
file:null, file:null,
datalist:[],
data_sets_count:0,
selectedRowKeysdata:[],
} }
} }
@ -88,9 +91,22 @@ class TPMDataset extends Component {
mysonChange = (e) => { mysonChange = (e) => {
console.log(`全选checked = ${e.target.checked}`); console.log(`全选checked = ${e.target.checked}`);
if (e.target.checked === true) { if (e.target.checked === true) {
let mydata=[];
let datas=[];
for(let i=0;i<this.state.collaboratorList.data_sets.length;i++){
mydata.push(this.state.collaboratorList.data_sets[i].id);
datas.push(i);
}
this.setState({ this.setState({
selectedRowKeys: this.state.datas, selectedRowKeysdata:mydata,
selectedRowKeys: datas,
}) })
console.log(mydata);
console.log(datas);
} else { } else {
this.setState({ this.setState({
selectedRowKeys: [], selectedRowKeys: [],
@ -108,8 +124,22 @@ class TPMDataset extends Component {
if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { if (response.data.status === 403||response.data.status === 401||response.data.status === 500) {
}else{ }else{
for(let i=0;i<response.data.data_sets.length;i++){
const datas=response.data.data_sets;
var timedata = moment(datas[i].created_on).format('YYYY-MM-DD HH:mm');
this.state.datalist.push({
timedata:timedata,
author:datas[i].author,
filesize:datas[i].filesize,
id:datas[i].id,
title:datas[i].title,
})
}
this.setState({ this.setState({
collaboratorList: response.data collaboratorList: response.data,
data_sets_count:response.data.data_sets_count,
datalist:this.state.datalist,
}); });
} }
@ -144,6 +174,17 @@ class TPMDataset extends Component {
selectedRowKeys selectedRowKeys
} }
); );
let mydata=[];
for(let i=0;i<selectedRows.length;i++){
mydata.push(selectedRows[i].id);
}
this.setState({
selectedRowKeysdata:mydata,
})
console.log(mydata);
} }
rowClassName = (record, index) => { rowClassName = (record, index) => {
@ -191,6 +232,25 @@ class TPMDataset extends Component {
} }
deleteRemovedata(){
console.log("删除");
const url = `/attachements/destroy_files.json`;
axios.delete(url, {
id:this.state.mydata,
})
.then((response) => {
if (response.data) {
const { status } = response.data;
if (status == 0) {
this.props.showNotification(`删除成功`);
this.getdatas()
}
}
})
.catch(function (error) {
console.log(error);
});
}
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
@ -226,7 +286,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} = this.state; const {columns, datas, page, limit, selectedRowKeys,mylistansum,fileList,datalist,data_sets_count} = this.state;
const rowSelection = { const rowSelection = {
selectedRowKeys, selectedRowKeys,
onChange: this.onSelectChange, onChange: this.onSelectChange,
@ -316,8 +376,8 @@ class TPMDataset extends Component {
{ {
mylistansum>0? mylistansum>0?
<div <div
className={selectedRowKeys.length > 0 ? "deletebutomtextcode intermediatecenter mr21" : "deletebutom intermediatecenter mr21"}> className={selectedRowKeys.length > 0 ? "deletebutomtextcode intermediatecenter mr21" : "deletebutom intermediatecenter mr21"} onClick={()=>this.deleteRemovedata()}>
<p className="deletebutomtext">删除</p></div> <p className="deletebutomtext" >删除</p></div>
:"" :""
} }
</div> </div>
@ -381,7 +441,7 @@ class TPMDataset extends Component {
} }
<div className="edu-table edu-back-white ysltableowss"> <div className="edu-table edu-back-white ysltableowss">
<Table <Table
dataSource={datas} dataSource={datalist}
columns={columns} columns={columns}
pagination={false} pagination={false}
className="mysjysltable4" className="mysjysltable4"
@ -394,7 +454,7 @@ class TPMDataset extends Component {
<div className="edu-txt-center mt40 mb20"> <div className="edu-txt-center mt40 mb20">
<Pagination showQuickJumper current={page} <Pagination showQuickJumper current={page}
onChange={this.paginationonChanges} pageSize={limit} onChange={this.paginationonChanges} pageSize={limit}
total={mylistansum} total={data_sets_count}
></Pagination> ></Pagination>
</div> </div>
:"" :""

@ -143,12 +143,11 @@ class Challengesjupyter extends Component {
// console.log("domain",parentDomain); //localhost // console.log("domain",parentDomain); //localhost
// document.domain = data; // document.domain = data;
// document.domain = 'https://47519.test-jupyter.educoder.net'; // document.domain = 'https://47519.test-jupyter.educoder.net';
var ifr = document.getElementById("ifr1"); // window.parent.document.contents().find("#ifr1")[0].contentWindow.iframefunction();
const iframe = document.getElementById('iframe');
console.log("modifyjupyter"); console.log("modifyjupyter");
console.log(ifr); // const frameWindow = iframe.contentWindow;
const iframe = document.getElementById('ifr1'); const frameWindow = iframe.contentWindow.postMessage('setLocation,' + null + "," + null, '*');
console.log("modifyjupyter");
const frameWindow = iframe.contentWindow;
console.log(frameWindow); console.log(frameWindow);
const frameDocument = frameWindow.document; const frameDocument = frameWindow.document;
console.log(frameDocument); console.log(frameDocument);
@ -344,7 +343,7 @@ class Challengesjupyter extends Component {
{/*https://48888.jupyter.educoder.net/tree?*/} {/*https://48888.jupyter.educoder.net/tree?*/}
<div className="pb47"> <div className="pb47">
<iframe src="http://121.41.4.83:48888/notebooks/Untitled.ipynb?kernel_name=python3" sandbox="allow-same-origin allow-scripts allow-top-navigation " scrolling="no" id="ifr1" name="frame" width="100%" height="700" frameborder="0" <iframe src="https://47524.jupyter.educoder.net/notebooks/data/workspace/myshixun_tpm3575/01.ipynb" sandbox="allow-same-origin allow-scripts allow-top-navigation " scrolling="no" id="frame" name="framename" width="100%" height="700" frameborder="0"
></iframe> ></iframe>

Loading…
Cancel
Save