diff --git a/package.json b/package.json index 4b370ca6d2b91b6e0553c6587393488eba685d78..03ec7e393227a28dd605b263d180ec1189533f94 100755 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "qs": "^6.5.2", "rc-drawer": "^1.5.2", "react-container-query": "^0.11.0", + "react-copy-to-clipboard": "^5.0.1", "react-document-title": "^2.0.3", "react-fittext": "^1.0.0", "rollbar": "^2.3.4", diff --git a/src/components/SettingDarwer/index.js b/src/components/SettingDarwer/index.js index d395029458ae0b39652cc8e8de7caa0b5b4da691..891e37de04d577b59a2e9fc6a260cacc5d251df4 100644 --- a/src/components/SettingDarwer/index.js +++ b/src/components/SettingDarwer/index.js @@ -1,6 +1,7 @@ import React, { PureComponent } from 'react'; import { Select, message, List, Switch, Divider, Icon } from 'antd'; import DrawerMenu from 'rc-drawer'; +import { CopyToClipboard } from 'react-copy-to-clipboard'; import { connect } from 'dva'; import styles from './index.less'; import ThemeColor from './ThemeColor'; @@ -145,108 +146,117 @@ class SettingDarwer extends PureComponent { }; render() { - const { - setting: { collapse, silderTheme, themeColor, layout, colorWeak }, - } = this.props; + const { setting } = this.props; + const { collapse, silderTheme, themeColor, layout, colorWeak } = setting; return ( -
- - {!collapse ? ( - - ) : ( - - )} -
- } - placement="right" - width="336px" - style={{ - zIndex: 999, - }} - onMaskClick={this.togglerContent} - > -
- - this.changeSetting('silderTheme', value)} + + {!collapse ? ( + - - - + ) : ( + + )} +
+ } + placement="right" + width="336px" + style={{ + zIndex: 999, + }} + onMaskClick={this.togglerContent} + > +
+ message.success('copy success')} + > +
+ Copy To Clipboard +
+
+ + this.changeSetting('silderTheme', value)} + /> + - + - - this.changeSetting('layout', value)} - /> - + - {item.title}} + + this.changeSetting('layout', value)} /> + - + {item.title}} + /> - - this.changeSetting('colorWeak', checked)} - />, - ]} - > - 色弱模式 - - -
- - + + + + this.changeSetting('colorWeak', checked)} + />, + ]} + > + 色弱模式 + + + + ); } } diff --git a/src/components/SettingDarwer/index.less b/src/components/SettingDarwer/index.less index 972a909153523a44aae6ef07debbb31d070e557c..4a21f99920ea508d09d62a6d0168f66378b2511e 100644 --- a/src/components/SettingDarwer/index.less +++ b/src/components/SettingDarwer/index.less @@ -5,6 +5,15 @@ min-height: 100%; padding: 24px; background: #fff; + position: relative; + .clipboard { + position: absolute; + top: 10px; + right: 10px; + cursor: pointer; + width: 16px; + height: 16px; + } } .blockChecbox {