From a8cb7f9d75066bbc5de24dfc2efeec0f8d6b8d86 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 27 Dec 2019 15:20:17 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AF=AD=E8=A8=80?= =?UTF-8?q?=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/hacks_controller.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/controllers/hacks_controller.rb b/app/controllers/hacks_controller.rb index fec768a19..1bc1c9d61 100644 --- a/app/controllers/hacks_controller.rb +++ b/app/controllers/hacks_controller.rb @@ -232,6 +232,11 @@ class HacksController < ApplicationController hacks = hacks.where(category: params[:category]) 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_direction = params[:sort_direction] || "desc" From ad2c5212a3952571cfb71d0c19e348d2697eff52 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 27 Dec 2019 15:23:28 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=B6=88=E6=81=AF=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/discuss.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/discuss.rb b/app/models/discuss.rb index 4491a886c..54ceb46be 100644 --- a/app/models/discuss.rb +++ b/app/models/discuss.rb @@ -53,11 +53,11 @@ class Discuss < ApplicationRecord def send_tiding 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' challenge_id = challenge_id 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' challenge_id = dis_id end @@ -65,6 +65,6 @@ class Discuss < ApplicationRecord 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' } - tidings.create!(base_attrs.merge(user_id: user_id)) + tidings.create!(base_attrs.merge(user_id: send_user_id)) end end From 8e66555c85c4f94a1c26fabedc2a256889f076e2 Mon Sep 17 00:00:00 2001 From: tangjiang <465264938@qq.com> Date: Fri, 27 Dec 2019 15:25:54 +0800 Subject: [PATCH 3/4] upagte style --- .../src/modules/developer/DeveloperHome.js | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/public/react/src/modules/developer/DeveloperHome.js b/public/react/src/modules/developer/DeveloperHome.js index b2c473861..ae230677a 100644 --- a/public/react/src/modules/developer/DeveloperHome.js +++ b/public/react/src/modules/developer/DeveloperHome.js @@ -9,7 +9,7 @@ import './index.scss'; 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 actions from '../../redux/actions'; import MultipTags from './components/multiptags'; @@ -46,9 +46,24 @@ const maps = { ], 'languageMenu': [ { - 'key': 'c', - 'name': 'C语言', - 'value': 'c' + 'key': 'C', + 'name': 'C', + 'value': 'C' + }, + { + 'key': 'C++', + 'name': 'C++', + 'value': 'C++' + }, + { + 'key': 'Python', + 'name': 'Python', + 'value': 'Python' + }, + { + 'key': 'Java', + 'name': 'Java', + 'value': 'Java' } ], 'difficultMenu': [ From 83616139ee0889deb71940d8944f312143126eb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 27 Dec 2019 15:27:25 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/TPMDataset.js | 43 +++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/tpm/TPMDataset.js b/public/react/src/modules/tpm/TPMDataset.js index b70bc457c..6894c4a69 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,Button} from 'antd'; +import {List, Typography, Tag, Modal, Radio, Checkbox, Table,message, Pagination,Upload,Button} from 'antd'; import { NoneData } from 'educoder' import TPMRightSection from './component/TPMRightSection'; @@ -12,7 +12,29 @@ import moment from 'moment'; import Tpmdatasetmodel from "./tpmmodel/Tpmdatasetmodel"; 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 { constructor(props) { super(props) @@ -69,6 +91,23 @@ class TPMDataset extends Component { ) }, + { + title: '操作', + dataIndex: 'operation', + key: 'operation', + align: 'center', + className: "edu-txt-center font-14 ", + render: (text, record) => ( +
{ + jsCopy("file_path"+record.id) + }}> + 复制 + +
+ ) + }, ], page: 1, limit: 10, @@ -148,6 +187,7 @@ class TPMDataset extends Component { filesize:datas[i].filesize, id:datas[i].id, title:datas[i].title, + file_path:datas[i].file_path, }) } this.setState({ @@ -203,6 +243,7 @@ class TPMDataset extends Component { filesize:datas[i].filesize, id:datas[i].id, title:datas[i].title, + file_path:datas[i].file_path, }) } this.setState({