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

dev_jupyter
杨树明 5 years ago
commit ab90fd9a37

@ -232,6 +232,11 @@ class HacksController < ApplicationController
hacks = hacks.where(category: params[:category]) hacks = hacks.where(category: params[:category])
end end
# 语言
if params[:language]
hacks = hacks.joins(:hack_codes).where(hack_codes: {language: params[:language]})
end
# 排序 # 排序
sort_by = params[:sort_by] || "hack_user_lastest_codes_count" sort_by = params[:sort_by] || "hack_user_lastest_codes_count"
sort_direction = params[:sort_direction] || "desc" sort_direction = params[:sort_direction] || "desc"

@ -53,11 +53,11 @@ class Discuss < ApplicationRecord
def send_tiding def send_tiding
if dis_type == 'Shixun' if dis_type == 'Shixun'
user_id = has_parent? ? parent.user_id : Challenge.find(challenge_id).user_id send_user_id = has_parent? ? parent.user_id : Challenge.find(challenge_id).user_id
parent_container_type = 'Challenge' parent_container_type = 'Challenge'
challenge_id = challenge_id challenge_id = challenge_id
elsif dis_type == 'Hack' elsif dis_type == 'Hack'
user_id = has_parent? ? parent.user_id : Hack.find(dis_id).user_id send_user_id = has_parent? ? parent.user_id : Hack.find(dis_id).user_id
parent_container_type = 'Hack' parent_container_type = 'Hack'
challenge_id = dis_id challenge_id = dis_id
end end
@ -65,6 +65,6 @@ class Discuss < ApplicationRecord
trigger_user_id: user_id, parent_container_id: challenge_id, parent_container_type: parent_container_type, trigger_user_id: user_id, parent_container_id: challenge_id, parent_container_type: parent_container_type,
belong_container_id: dis_id, belong_container_type: dis_type, viewed: 0, tiding_type: 'Comment' belong_container_id: dis_id, belong_container_type: dis_type, viewed: 0, tiding_type: 'Comment'
} }
tidings.create!(base_attrs.merge(user_id: user_id)) tidings.create!(base_attrs.merge(user_id: send_user_id))
end end
end end

@ -9,7 +9,7 @@
import './index.scss'; import './index.scss';
import React from 'react'; import React from 'react';
import { Table, Button, Dropdown, Icon, Menu, Card, Input, Select, Tag, Modal } from 'antd'; import { Table, Button, Dropdown, Icon, Menu, Card, Input, Select, Tag } from 'antd';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import actions from '../../redux/actions'; import actions from '../../redux/actions';
import MultipTags from './components/multiptags'; import MultipTags from './components/multiptags';
@ -46,9 +46,24 @@ const maps = {
], ],
'languageMenu': [ 'languageMenu': [
{ {
'key': 'c', 'key': 'C',
'name': 'C语言', 'name': 'C',
'value': 'c' 'value': 'C'
},
{
'key': 'C++',
'name': 'C++',
'value': 'C++'
},
{
'key': 'Python',
'name': 'Python',
'value': 'Python'
},
{
'key': 'Java',
'name': 'Java',
'value': 'Java'
} }
], ],
'difficultMenu': [ 'difficultMenu': [

@ -1,6 +1,6 @@
import React, {Component} from 'react'; import React, {Component} from 'react';
import {Redirect} from 'react-router'; import {Redirect} from 'react-router';
import {List, Typography, Tag, Modal, Radio, Checkbox, Table, Pagination,Upload,Button} from 'antd'; import {List, Typography, Tag, Modal, Radio, Checkbox, Table,message, Pagination,Upload,Button} from 'antd';
import { NoneData } from 'educoder' import { NoneData } from 'educoder'
import TPMRightSection from './component/TPMRightSection'; import TPMRightSection from './component/TPMRightSection';
@ -12,7 +12,29 @@ import moment from 'moment';
import Tpmdatasetmodel from "./tpmmodel/Tpmdatasetmodel"; import Tpmdatasetmodel from "./tpmmodel/Tpmdatasetmodel";
const confirm = Modal.confirm; const confirm = Modal.confirm;
function clearSlct() {
if("getSelection" in window){
window.getSelection().removeAllRanges();
}else{
document.selection.empty();
};
}
function jsCopy(s) {
clearSlct();
const copyEle = document.getElementById(s);
copyEle.select();
const copyStatus=document.execCommand("Copy");
// 对成功与否定进行提示
copyStatuss(copyStatus)
}
function copyStatuss(copyStatus){
if (copyStatus) {
message.success('复制成功');
} else {
message.error('复制失败');
}
}
class TPMDataset extends Component { class TPMDataset extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
@ -69,6 +91,23 @@ class TPMDataset extends Component {
</div> </div>
) )
}, },
{
title: '操作',
dataIndex: 'operation',
key: 'operation',
align: 'center',
className: "edu-txt-center font-14 ",
render: (text, record) => (
<div style={{
cursor:"pointer",
}} onClick={() => {
jsCopy("file_path"+record.id)
}}>
复制
<input id={"file_path"+record.id} className={"file_path_input"} value={record.file_path}/>
</div>
)
},
], ],
page: 1, page: 1,
limit: 10, limit: 10,
@ -148,6 +187,7 @@ class TPMDataset extends Component {
filesize:datas[i].filesize, filesize:datas[i].filesize,
id:datas[i].id, id:datas[i].id,
title:datas[i].title, title:datas[i].title,
file_path:datas[i].file_path,
}) })
} }
this.setState({ this.setState({
@ -203,6 +243,7 @@ class TPMDataset extends Component {
filesize:datas[i].filesize, filesize:datas[i].filesize,
id:datas[i].id, id:datas[i].id,
title:datas[i].title, title:datas[i].title,
file_path:datas[i].file_path,
}) })
} }
this.setState({ this.setState({

Loading…
Cancel
Save