diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index 851567c92..850886e68 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -32,9 +32,9 @@ class CommentsController < ApplicationController # 列表 def index - disscusses = @hack.disscusses.where(:root_id => nil) - @disscuss_count = disscusses.count - @disscusses= paginate disscusses + discusses = @hack.discusses.where(root_id: nil) + @discusses_count = discusses.count + @discusses= paginate discusses end # 删除 @@ -46,7 +46,7 @@ class CommentsController < ApplicationController private def find_hack - @hack = Hack.find_by_identifier params[:identifier] + @hack = Hack.find_by_identifier(params[:hack_identifier]) end def comment_params diff --git a/app/views/comments/index.json.jbuilder b/app/views/comments/index.json.jbuilder index 399b144d9..b176d00b9 100644 --- a/app/views/comments/index.json.jbuilder +++ b/app/views/comments/index.json.jbuilder @@ -1,4 +1,4 @@ -json.disscuss_count @disscuss_count +json.disscuss_count @discusses_count json.comments @discusses do |discuss| json.partial! 'comments/discuss', locals: { discuss: discuss} json.children discuss.child_discuss(current_user) do |c_d| diff --git a/public/react/src/modules/tpm/TPMDataset.js b/public/react/src/modules/tpm/TPMDataset.js index 55cd8c746..9569c5174 100644 --- a/public/react/src/modules/tpm/TPMDataset.js +++ b/public/react/src/modules/tpm/TPMDataset.js @@ -1,6 +1,6 @@ import React, {Component} from 'react'; import {Redirect} from 'react-router'; -import {List, Typography, Tag, Modal, Radio, Checkbox, Table, Pagination,Upload,notification} from 'antd'; +import {List, Typography, Tag, Modal, Radio, Checkbox, Table, Pagination,Upload,Button} from 'antd'; import { NoneData } from 'educoder' import TPMRightSection from './component/TPMRightSection'; @@ -85,6 +85,7 @@ class TPMDataset extends Component { checked: false, showmodel:false, itemtypebool:false, + Buttonloading:false } } @@ -295,8 +296,12 @@ class TPMDataset extends Component { handleChange = (info) => { // console.log("handleChange123123"); // console.log(info); -// debugger + //debugger + this.setState({ + Buttonloading:true + }) if(info.file.status == "done" || info.file.status == "uploading" || info.file.status === 'removed'){ + let fileList = info.fileList; this.setState({ fileList: appendFileSizeToUploadFileAll(fileList), @@ -309,7 +314,10 @@ class TPMDataset extends Component { }else{ this.getdatas(); - + this.setState({ + Buttonloading:false + }) + // this.props.showNotification(`上传成功`); } } } @@ -329,9 +337,13 @@ class TPMDataset extends Component { showmodel:true, tittest:info.file.response.message, itemtypebool:itemtype>-1?true:itemtype<=-1?false:false, + Buttonloading:false }) - }else{ + }else{ + this.setState({ + Buttonloading:false + }) } } @@ -445,7 +457,12 @@ class TPMDataset extends Component { showmodel: false, }) } - + ButtonloadinghandleChange=()=>{ + // this.props.showNotification(`zhzzzzz`); + // this.setState({ + // Buttonloading:true + // }) + } render() { const {tpmLoading, shixun, user, match} = this.props; const {columns, page, limit, selectedRowKeys,mylistansum,fileList,datalist,data_sets_count,loadingstate} = this.state; @@ -473,11 +490,16 @@ class TPMDataset extends Component { beforeUpload: (file) => { //上传前的操作 // console.log('beforeUpload', file.name); - const isLt150M = file.size / 1024 / 1024 < 150; - if (!isLt150M) { - this.props.showNotification('文件大小必须小于150MB!'); + this.props.showNotification(`文件上传中`); + const isLt300M = file.size / 1024 / 1024 <= 300; + + if (!isLt300M) { + this.setState({ + Buttonloading:false + }) + this.props.showNotification('文件大小必须小于等于300MB!'); } - return isLt150M; + return isLt300M; }, }; // console.log("showmodelshowmodel"); @@ -514,12 +536,20 @@ class TPMDataset extends Component { .ant-upload-list{ display:none } + .deletebuttom{ + color: #fff !important; + } + .deletebuttom:hover{ + color: #fff !important; + background: #29BD8B !important; + } ` } -

- - 上传文件

+
+ + +
{ data_sets_count>0?

- {/* sync | poweroff */} + {/*sync | poweroff */} {/*