From 0a9e69c47dd88f7f2b551ab5b0507d46cb5dc252 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 28 十月 2022 15:44:21 +0800
Subject: [PATCH] 2022-10-28

---
 src/menu/components/card/cardcellcomponent/dragaction/card.jsx   |    2 
 src/menu/components/card/cardcellcomponent/formconfig.jsx        |   56 ++++++----------------------
 src/tabviews/custom/components/card/cardcellList/index.jsx       |   17 ++++++--
 src/menu/picturecontroller/index.jsx                             |   18 ++++++++-
 src/menu/components/card/cardcellcomponent/elementform/index.jsx |    4 +-
 src/menu/picturecontroller/index.scss                            |    8 ++++
 6 files changed, 51 insertions(+), 54 deletions(-)

diff --git a/src/menu/components/card/cardcellcomponent/dragaction/card.jsx b/src/menu/components/card/cardcellcomponent/dragaction/card.jsx
index 0410a0b..92e5b0e 100644
--- a/src/menu/components/card/cardcellcomponent/dragaction/card.jsx
+++ b/src/menu/components/card/cardcellcomponent/dragaction/card.jsx
@@ -89,7 +89,7 @@
         <div className={'ant-mk-text line' + (card.height || '')} style={{height: card.innerHeight || 'auto'}}>{val}</div>
       )
     } else if (card.eleType === 'icon') {
-      return (<MkIcon style={{height: card.innerHeight || 'auto'}} className="ant-mk-icon" type={card.icon}/>)
+      return (<MkIcon style={{height: card.innerHeight || 'auto'}} className="ant-mk-icon" type={card.icon || 'bell'}/>)
     } else if (card.eleType === 'slider') {
       let val = card.value ? (card.value / card.maxValue) * 100 : 30
       return <MkProgress value={val} config={card}/>
diff --git a/src/menu/components/card/cardcellcomponent/elementform/index.jsx b/src/menu/components/card/cardcellcomponent/elementform/index.jsx
index fa8a097..ab2b5f7 100644
--- a/src/menu/components/card/cardcellcomponent/elementform/index.jsx
+++ b/src/menu/components/card/cardcellcomponent/elementform/index.jsx
@@ -19,7 +19,7 @@
   number: ['eleType', 'datatype', 'width', 'height', 'prefix', 'postfix', 'noValue', 'fixStyle'],
   picture: ['eleType', 'datatype', 'width', 'lenWidRadio', 'maxWidth', 'link', 'noValue'],
   video: ['eleType', 'datatype', 'width', 'aspectRatio', 'autoPlay', 'loop', 'startTime', 'noValue', 'posterType'],
-  icon: ['eleType', 'icon', 'datatype', 'width'],
+  icon: ['eleType', 'datatype', 'width', 'tooltip'],
   slider: ['eleType', 'datatype', 'width', 'color', 'maxValue', 'showInfo', 'showType', 'strokeWidth', 'strokeLinecap', 'trailColor'],
   splitline: ['eleType', 'color', 'width', 'borderWidth'],
   barcode: ['eleType', 'datatype', 'width', 'barHeight', 'displayValue', 'interval', 'noValue'],
@@ -144,7 +144,7 @@
       if (datatype === 'dynamic') {
         _options.push('field')
       } else {
-        _options.push('tooltip')
+        _options.push('icon')
       }
     }
     if (_options.includes('fixStyle') && fixStyle === 'alone') {
diff --git a/src/menu/components/card/cardcellcomponent/formconfig.jsx b/src/menu/components/card/cardcellcomponent/formconfig.jsx
index a9be7fa..0475028 100644
--- a/src/menu/components/card/cardcellcomponent/formconfig.jsx
+++ b/src/menu/components/card/cardcellcomponent/formconfig.jsx
@@ -32,22 +32,10 @@
   } else if (card.eleType === 'sequence') { // 鎷栨嫿娣诲姞绫诲瀷杞崲
     card.eleType = 'text'
   }
-
-  let appMenus = []
-  const isApp = sessionStorage.getItem('appType') === 'pc'
-
-  if (isApp) {
-    appMenus = sessionStorage.getItem('appMenus')
-    if (appMenus) {
-      try {
-        appMenus = JSON.parse(appMenus)
-      } catch (e) {
-        appMenus = []
-      }
-    } else {
-      appMenus = []
-    }
+  if (card.eleType === 'icon' && card.datatype === 'dynamic' && !card.field) { // 鎷栨嫿娣诲姞绫诲瀷杞崲
+    card.datatype = 'static'
   }
+  let appType = sessionStorage.getItem('appType')
 
   let tooltip = ''
   if (cardCell.$cardType === 'extendCard') {
@@ -62,13 +50,6 @@
       initVal: card.eleType,
       required: true,
       options: _options
-    },
-    {
-      type: 'icon',
-      key: 'icon',
-      label: '鍥炬爣',
-      initVal: card.icon,
-      required: true
     },
     {
       type: 'radio',
@@ -89,6 +70,13 @@
       initVal: card.field || '',
       required: true,
       options: []
+    },
+    {
+      type: 'icon',
+      key: 'icon',
+      label: '鍥炬爣',
+      initVal: card.icon,
+      required: true
     },
     {
       type: 'text',
@@ -234,7 +222,8 @@
       key: 'tooltip',
       label: '鎻愮ず淇℃伅',
       initVal: card.tooltip || '',
-      tooltip: '榧犳爣鎮诞鏃舵樉绀恒��',
+      tooltip: '榧犳爣鎮诞鏃舵樉绀恒�傛敞锛氬浣跨敤鍔ㄦ�佷俊鎭紝璇峰湪姝ゅ濉啓鐩稿簲鐨勫瓧娈靛悕銆�',
+      forbid: appType === 'mob',
       required: false
     },
     {
@@ -508,27 +497,6 @@
         { value: 'true', text: '鍙互' }
       ]
     },
-    {
-      type: 'select',
-      key: 'linkmenu',
-      label: '鍏宠仈鑿滃崟',
-      initVal: card.linkmenu || '',
-      required: true,
-      forbid: !isApp,
-      options: appMenus
-    },
-    // {
-    //   type: 'radio',
-    //   key: 'open',
-    //   label: '鎵撳紑鏂瑰紡',
-    //   initVal: card.open || 'blank',
-    //   required: false,
-    //   forbid: !isApp,
-    //   options: [
-    //     { value: 'blank', text: '鏂伴〉闈�' },
-    //     { value: 'self', text: '褰撳墠椤甸潰' }
-    //   ]
-    // },
     {
       type: 'select',
       key: 'linkurl',
diff --git a/src/menu/picturecontroller/index.jsx b/src/menu/picturecontroller/index.jsx
index 3fa98d4..997e7a0 100644
--- a/src/menu/picturecontroller/index.jsx
+++ b/src/menu/picturecontroller/index.jsx
@@ -1,15 +1,18 @@
 import React, {Component} from 'react'
-import { Modal, Button, Row, Col, Input, message, Tabs, Empty, Pagination, notification } from 'antd'
+import { Modal, Button, Row, Col, Input, message, Tabs, Empty, Pagination, notification, Typography } from 'antd'
 import { PlusOutlined, CopyOutlined, EditOutlined, DeleteOutlined, PictureOutlined } from '@ant-design/icons'
 
 import Api from '@/api'
 import Utils from '@/utils/utils.js'
 import asyncComponent from '@/utils/asyncComponent'
+import { minkeIconSystem } from '@/utils/option.js'
+import MkIcon from '@/components/mk-icon'
 import './index.scss'
 
 const { Search } = Input
 const { confirm } = Modal
 const { TabPane } = Tabs
+const { Paragraph } = Typography
 
 const EditForm = asyncComponent(() => import('./editform'))
 const Video = asyncComponent(() => import('./video'))
@@ -30,6 +33,7 @@
     colorlist: [],
     piclist: [],
     vidlist: [],
+    iconlist: [...minkeIconSystem.direction, ...minkeIconSystem.edit, ...minkeIconSystem.normal, ...minkeIconSystem.data, ...minkeIconSystem.hint],
     picIndex: 1,
     vidIndex: 1,
   }
@@ -241,7 +245,7 @@
   }
   
   render() {
-    const { visible, editvisible, card, filpictures, filvideos, piclist, vidlist, imageKey, videoKey, pageSize, picIndex, vidIndex, colorlist } = this.state
+    const { visible, editvisible, card, filpictures, filvideos, piclist, vidlist, imageKey, videoKey, pageSize, picIndex, vidIndex, colorlist, iconlist } = this.state
 
     return (
       <div style={{display: 'inline-block'}}>
@@ -348,6 +352,16 @@
                 {!colorlist.length ? <Empty description={null}/> : null}
               </Row>
             </TabPane>
+            <TabPane tab="鍥炬爣搴�" key="icon">
+              <Row gutter={16}>
+                {iconlist.map(item => (
+                  <Col className="icon-wrap" span={4} key={item}>
+                    <MkIcon type={item} />
+                    <Paragraph copyable={{ text: item }}>{item}</Paragraph>
+                  </Col>
+                ))}
+              </Row>
+            </TabPane>
           </Tabs>
         </Modal>
         <Modal
diff --git a/src/menu/picturecontroller/index.scss b/src/menu/picturecontroller/index.scss
index bfd7271..d143734 100644
--- a/src/menu/picturecontroller/index.scss
+++ b/src/menu/picturecontroller/index.scss
@@ -70,6 +70,14 @@
   .ant-pagination {
     text-align: right;
   }
+  .icon-wrap {
+    text-align: center;
+    margin-bottom: 24px;
+    >.anticon {
+      font-size: 34px;
+      margin-bottom: 5px;
+    }
+  }
 }
 .picture-edit-model {
   .ant-modal {
diff --git a/src/tabviews/custom/components/card/cardcellList/index.jsx b/src/tabviews/custom/components/card/cardcellList/index.jsx
index 94cf90b..0fa2b24 100644
--- a/src/tabviews/custom/components/card/cardcellList/index.jsx
+++ b/src/tabviews/custom/components/card/cardcellList/index.jsx
@@ -454,7 +454,14 @@
         )
       } else if (card.eleType === 'icon') {
         let val = ''
+        let icon = ''
         let height = card.innerHeight
+
+        if (card.datatype === 'dynamic') {
+          icon = data[card.field] || ''
+        } else {
+          icon = card.icon
+        }
 
         if (!height) { // 鍏煎
           let fontSize = 14
@@ -470,18 +477,18 @@
           height = fontSize * lineHeight
         }
   
-        if (card.datatype === 'static') {
+        if (data.hasOwnProperty(card.tooltip)) {
+          val = data[card.tooltip]
+        } else {
           val = card.tooltip
-        } else if (data.hasOwnProperty(card.field)) {
-          val = data[card.field]
         }
   
         contents.push(
           <Col key={card.uuid} span={card.width}>
             <div style={card.style}>
               {val ? <Tooltip title={val}>
-                <MkIcon className="ant-mk-icon" style={{height: height}} type={card.icon}/>
-              </Tooltip> : <MkIcon className="ant-mk-icon" style={{height: height}} type={card.icon}/>}
+                <MkIcon className="ant-mk-icon" style={{height: height}} type={icon}/>
+              </Tooltip> : <MkIcon className="ant-mk-icon" style={{height: height}} type={icon}/>}
             </div>
           </Col>
         )

--
Gitblit v1.8.0