From c98e45bfac25e9110ad0383faac54a54d98ea9d5 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 18 十一月 2021 20:47:04 +0800
Subject: [PATCH] 2021-11-18
---
src/menu/components/share/sourcecomponent/index.jsx | 23 ++++++++++++++++++-----
1 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/src/menu/components/share/sourcecomponent/index.jsx b/src/menu/components/share/sourcecomponent/index.jsx
index a5ed3e6..a2f45e3 100644
--- a/src/menu/components/share/sourcecomponent/index.jsx
+++ b/src/menu/components/share/sourcecomponent/index.jsx
@@ -6,7 +6,7 @@
import InputForm from './inputform'
import './index.scss'
-class CopyComponent extends Component {
+class SourceComponent extends Component {
static propTpyes = {
type: PropTypes.string,
placement: PropTypes.any,
@@ -14,12 +14,23 @@
}
state = {
- url: this.props.value,
+ url: '',
visible: ''
}
UNSAFE_componentWillMount () {
+ const { value } = this.props
+ let val = ''
+ if (value) {
+ val = value
+ } else if (this.props['data-__meta']) {
+ val = this.props['data-__meta'].initialValue || ''
+ }
+
+ this.setState({
+ url: val,
+ })
}
shouldComponentUpdate (nextProps, nextState) {
@@ -57,8 +68,8 @@
<Radio.Button value="upload" size="small" onClick={() => this.handleChange('upload')}>涓婁紶</Radio.Button>
<Radio.Button value="system" size="small" onClick={() => this.handleChange('system')}>绯荤粺</Radio.Button>
</Radio.Group> : null}
- {url ? <div className="mk-source-item-info">
- <Icon type="paper-clip" />
+ {url ? <div className={'mk-source-item-info' + (type !== 'video' ? ' picture' : '')}>
+ {type === 'video' ? <Icon type="paper-clip" /> : <img src={url} alt="" />}
<a target="_blank" rel="noopener noreferrer" href={url}>{name}</a>
<Icon title="鍒犻櫎鏂囦欢" type="delete" onClick={this.deleteUrl}/>
</div> : null}
@@ -67,6 +78,8 @@
width={visible !== 'system' ? 600 : 1000}
closable={false}
maskClosable={false}
+ okText="纭畾"
+ cancelText="鍙栨秷"
onOk={this.popSubmit}
onCancel={() => {this.setState({visible: ''})}}
destroyOnClose
@@ -78,4 +91,4 @@
}
}
-export default CopyComponent
\ No newline at end of file
+export default SourceComponent
\ No newline at end of file
--
Gitblit v1.8.0