From 1f5c6ac307a134dfa45b64c5723f2481ead9f213 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期日, 16 七月 2023 16:23:09 +0800
Subject: [PATCH] 2023-07-16

---
 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 569fc8d..2d197f7 100644
--- a/src/menu/components/share/sourcecomponent/index.jsx
+++ b/src/menu/components/share/sourcecomponent/index.jsx
@@ -1,7 +1,8 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
-import { Radio, Icon, Modal } from 'antd'
+import { Radio, Modal } from 'antd'
+import { PaperClipOutlined, DeleteOutlined } from '@ant-design/icons'
 
 import InputForm from './inputform'
 import './index.scss'
@@ -19,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 || ''
     }
@@ -60,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">
@@ -68,10 +72,19 @@
           <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 && type === 'video' ? <div className="mk-source-item-info">
+          <PaperClipOutlined />
           <a target="_blank" rel="noopener noreferrer" href={url}>{name}</a>
-          <Icon title="鍒犻櫎鏂囦欢" type="delete" onClick={this.deleteUrl}/>
+          <DeleteOutlined title="鍒犻櫎鏂囦欢" onClick={this.deleteUrl}/>
+        </div> : null}
+        {url && type !== 'video' && url !== '@icon@' ? <div className="mk-source-item-info picture">
+          <img src={url.replace(/@mywebsite@\//ig, window.GLOB.baseurl)} 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}

--
Gitblit v1.8.0