From 1ea9fe09a611dea3a05131e349a8e8dd46adcf6a Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 01 四月 2022 22:50:33 +0800
Subject: [PATCH] 2022-04-01

---
 src/templates/modalconfig/dragelement/card.jsx |   27 +++++++++++++++++----------
 1 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/templates/modalconfig/dragelement/card.jsx b/src/templates/modalconfig/dragelement/card.jsx
index 16f8b77..01ad1e7 100644
--- a/src/templates/modalconfig/dragelement/card.jsx
+++ b/src/templates/modalconfig/dragelement/card.jsx
@@ -1,11 +1,12 @@
 import React from 'react'
 import { useDrag, useDrop } from 'react-dnd'
 import { Select, DatePicker, Input, InputNumber, Button, Popover, Switch, Radio, Checkbox, Form, Rate } from 'antd'
-import { QuestionCircleOutlined, UploadOutlined, EditOutlined, CopyOutlined, CloseOutlined, StarFilled } from '@ant-design/icons'
+import { QuestionCircleOutlined, UploadOutlined, EditOutlined, CopyOutlined, CloseOutlined, StarFilled, FontColorsOutlined } from '@ant-design/icons'
 import moment from 'moment'
 
 import asyncComponent from '@/utils/asyncComponent'
 import MkIcon from '@/components/mk-icon'
+import MKEmitter from '@/utils/events.js'
 import './index.scss'
 
 const { MonthPicker } = DatePicker
@@ -49,6 +50,12 @@
 
   const copy = () => {
     copyCard(id)
+  }
+
+  const changeStyle = () => {
+    let options = ['font']
+
+    MKEmitter.emit('changeStyle', ['form', card.uuid], options, card.style || {})
   }
 
   let selectval = ''
@@ -123,24 +130,23 @@
       <Checkbox value="D">D</Checkbox>
     </Checkbox.Group>)
   } else if (card.type === 'hint') {
-    formItem = <div style={{marginTop: '10px', color: 'rgba(0, 0, 0, 0.85)', lineHeight: '1.5'}}>{card.message}</div>
+    formItem = <div style={{marginTop: '10px', color: 'rgba(0, 0, 0, 0.85)', lineHeight: '1.5', ...card.style}}>{card.message}</div>
   } else if (card.type === 'split') {
-    formItem = <div className="split-line">{card.label}</div>
+    formItem = <div className="split-line" style={card.style}>{card.label}</div>
   } else if (card.type === 'checkcard') {
     className += ' checkcard'
     formItem = <CheckCard config={card} />
   }
 
-  let _label = card.label
-  let colon = !!card.label
+  let _label = <span className="mk-form-label" style={card.style}>{card.label}</span>
+
   if (card.tooltip) {
-    _label = <span><QuestionCircleOutlined className="mk-form-tip" />{card.label}</span>
+    _label = <><QuestionCircleOutlined className="mk-form-tip" /><span className="mk-form-label" style={card.style}>{card.label}</span></>
   }
   if (card.type === 'brafteditor' && card.hidelabel === 'true') {
     _label = null
-    colon = false
-  } else if (card.type === 'hint') {
-    _label = _label || ' '
+  } else if (card.type === 'hint' && !card.label) {
+    _label = ' '
   }
 
   return (
@@ -148,6 +154,7 @@
       <div className="mk-popover-control">
         <EditOutlined className="edit" onClick={edit} />
         <CopyOutlined className="copy" onClick={copy} />
+        <FontColorsOutlined className="style" onClick={changeStyle} />
         <CloseOutlined className="close" onClick={close} />
       </div>
     } trigger="hover">
@@ -155,7 +162,7 @@
         <div ref={node => drag(drop(node))} onDoubleClick={edit}>
           {card.type === 'split' ? formItem : <Form.Item
             className={className}
-            colon={colon}
+            colon={false}
             label={_label}
             required={card.required === 'true'}
             extra={card.extra || null}

--
Gitblit v1.8.0