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] =?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({