From b7f88963beda80537353d542572787e0978f1ad0 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Thu, 5 Sep 2019 19:40:44 +0800 Subject: [PATCH] git_url --- public/react/src/modules/page/VNCContainer.js | 38 +++++++++++++++---- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/public/react/src/modules/page/VNCContainer.js b/public/react/src/modules/page/VNCContainer.js index 054dc2ce8..8b76c4b74 100644 --- a/public/react/src/modules/page/VNCContainer.js +++ b/public/react/src/modules/page/VNCContainer.js @@ -1,6 +1,7 @@ import React, { Component } from 'react'; import axios from 'axios' import { Spin } from 'antd' +import ClipboardJS from 'clipboard' import VNCDisplay from './VNCDisplay' import FloatButton from './component/FloatButton' @@ -20,7 +21,13 @@ class VNCContainer extends Component { } } componentDidMount() { - + if (!this.clipboard) { + const clipboard = new ClipboardJS('.copybtn'); + clipboard.on('success', (e) => { + this.props.showSnackbar('复制成功') + }); + this.clipboard = clipboard + } } getSecondDrawerWidth = () => { @@ -64,7 +71,7 @@ class VNCContainer extends Component { }).catch(error =>{ console.log(error) this.setState({ readingCodeLoading: false }); - showSnackbar(`服务端异常,请联系管理员!`); + this.props.showSnackbar(`服务端异常,请联系管理员!`); }) } onTreeSelect = (selectedKeys, info) => { @@ -82,7 +89,7 @@ class VNCContainer extends Component { if (filetype == 'jpg' || filetype == 'png' || filetype == 'gif' || filetype == 'jpeg' || filetype == 'jar' || filetype == 'doc' || filetype == 'pdf' || filetype == 'xsl' || filetype == 'ppt') { - showSnackbar(`不支持加载${filetype}类型的文件。`) + this.props.showSnackbar(`不支持加载${filetype}类型的文件。`) return; } this.fetchReadRepositoryCode(nodePath); @@ -96,7 +103,7 @@ class VNCContainer extends Component { onSelect={onTreeSelect} */ render() { - const { challenge, vnc_url } = this.props + const { challenge, vnc_url, git_url } = this.props const secondDrawerChildren = this.renderSecondDrawerChildren(); return ( @@ -113,27 +120,44 @@ class VNCContainer extends Component { secondDrawerClassName="codeInDrawer" > +