From 4c52785eafd803c6725afb2f28f116dba754ffad Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期六, 06 八月 2022 02:08:30 +0800 Subject: [PATCH] 2022-08-06 --- src/menu/components/share/sourcecomponent/index.jsx | 18 +++++++++++++++--- 1 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/menu/components/share/sourcecomponent/index.jsx b/src/menu/components/share/sourcecomponent/index.jsx index 012c84e..ae5a6eb 100644 --- a/src/menu/components/share/sourcecomponent/index.jsx +++ b/src/menu/components/share/sourcecomponent/index.jsx @@ -20,11 +20,13 @@ } UNSAFE_componentWillMount () { - const { value } = this.props + const { value, initialValue } = this.props let val = '' if (value) { val = value + } else if (initialValue) { + val = initialValue } else if (this.props['data-__meta']) { val = this.props['data-__meta'].initialValue || '' } @@ -61,6 +63,7 @@ const { url, visible } = this.state const { type } = this.props let name = url ? url.slice(url.lastIndexOf('/') + 1) : '' + // url !== '@icon@' return ( <div className="mk-source-wrap"> @@ -69,11 +72,20 @@ <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' + (type !== 'video' ? ' picture' : '')}> - {type === 'video' ? <PaperClipOutlined /> : <img src={url} alt="" />} + {url && type === 'video' ? <div className="mk-source-item-info"> + <PaperClipOutlined /> <a target="_blank" rel="noopener noreferrer" href={url}>{name}</a> <DeleteOutlined title="鍒犻櫎鏂囦欢" onClick={this.deleteUrl}/> </div> : null} + {url && type !== 'video' && url !== '@icon@' ? <div className="mk-source-item-info picture"> + <img src={url} alt="" /> + <a target="_blank" rel="noopener noreferrer" href={url}>{name}</a> + <DeleteOutlined title="鍒犻櫎鏂囦欢" onClick={this.deleteUrl}/> + </div> : null} + {url && type !== 'video' && url === '@icon@' ? <div className="mk-source-item-info avatar"> + <span className="mk-avatar">{name}</span> + <DeleteOutlined title="鍒犻櫎鏂囦欢" onClick={this.deleteUrl}/> + </div> : null} <Modal visible={!!visible} width={visible !== 'system' ? 600 : 1000} -- Gitblit v1.8.0