From f3d4db769ba9b51b799d981511a710fd443d0e08 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 21 四月 2025 12:18:03 +0800
Subject: [PATCH] Merge branch 'master' into positec

---
 src/mob/mobshell/index.jsx |  110 ++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 97 insertions(+), 13 deletions(-)

diff --git a/src/mob/mobshell/index.jsx b/src/mob/mobshell/index.jsx
index 6d14bee..de4fabb 100644
--- a/src/mob/mobshell/index.jsx
+++ b/src/mob/mobshell/index.jsx
@@ -4,8 +4,6 @@
 import { Empty, notification, Modal } from 'antd'
 
 import Utils from '@/utils/utils.js'
-import MKEmitter from '@/utils/events.js'
-import MenuUtils from '@/utils/utils-custom.js'
 import Card from './card'
 import './index.scss'
 
@@ -38,6 +36,25 @@
     setCards(_cards)
   }
 
+  const unGroup = (id) => {
+    let { card, index } = findCard(`${id}`)
+    let components = [...card.components].map(item => {
+      if (item.wrap) {
+        item.wrap.width = card.width
+        item.width = card.width
+      } else if (item.plot) {
+        item.plot.width = card.width
+        item.width = card.width
+      }
+      return item
+    })
+    card.components = []
+
+    const _cards = update(cards, { $splice: [[index, 1, card, ...components]] })
+
+    handleList({...menu, components: _cards})
+  }
+
   const deleteCard = (id) => {
     const { card } = findCard(id)
 
@@ -50,8 +67,6 @@
       })
     }
 
-    let uuids = MenuUtils.getDelButtonIds(card)
-
     confirm({
       title: `纭畾鍒犻櫎${card.name ? `銆�${card.name}銆媊 : '缁勪欢'}鍚楋紵`,
       content: hasComponent ? '褰撳墠缁勪欢涓惈鏈夊瓙缁勪欢锛�' : '',
@@ -59,10 +74,6 @@
         const _cards = cards.filter(item => item.uuid !== card.uuid)
         handleList({...menu, components: _cards})
         setCards(_cards)
-
-        if (uuids.length === 0) return
-        
-        MKEmitter.emit('delButtons', uuids)
       },
       onCancel() {}
     })
@@ -76,7 +87,17 @@
         return
       }
 
+      let style = null
+
       if (item.component === 'search') { // 鎼滅储缁勪欢涓嶅彲閲嶅娣诲姞
+        if (cards.filter(card => card.type === 'topbar' && card.wrap.type !== 'navbar').length > 0) {
+          notification.warning({
+            top: 92,
+            message: '瀵艰埅鏍忎娇鐢ㄤ簡鎼滅储锛屼笉鍙坊鍔犳悳绱㈢粍浠讹紒',
+            duration: 5
+          })
+          return
+        }
         if (cards.filter(card => card.type === 'search').length > 0) {
           notification.warning({
             top: 92,
@@ -94,11 +115,26 @@
           })
           return
         }
+        if (!menu.style.paddingBottom) {
+          style = {...menu.style, paddingBottom: '50px'}
+        }
       } else if (item.component === 'topbar') {
         if (cards.filter(card => card.type === 'topbar').length > 0) {
           notification.warning({
             top: 92,
             message: '瀵艰埅鏍忎笉鍙噸澶嶆坊鍔狅紒',
+            duration: 5
+          })
+          return
+        }
+        if (!menu.style.paddingTop) {
+          style = {...menu.style, paddingTop: '50px'}
+        }
+      } else if (item.component === 'officialAccount') {
+        if (cards.filter(card => card.type === 'officialAccount').length > 0) {
+          notification.warning({
+            top: 92,
+            message: '鍏虫敞缁勪欢涓嶅彲閲嶅娣诲姞锛�',
             duration: 5
           })
           return
@@ -123,6 +159,11 @@
         navbar: '瀵艰埅鏍�',
         menubar: '鑿滃崟鏍�',
         balcony: '娴姩鍗�',
+        timeline: '鏃堕棿杞�',
+        officialAccount: '鍏虫敞鍏紬鍙�',
+        sharecode: '鍒嗕韩鐮�',
+        map: '鍦板浘',
+        iframe: 'iframe',
         login: '鐧诲綍'
       }
       let i = 1
@@ -141,9 +182,7 @@
         subtype: item.subtype,
         config: item.config,
         width: item.width || 24,
-        dataName: Utils.getdataName(),
         name: name,
-        floor: 1,   // 缁勪欢鐨勫眰绾�
         isNew: true // 鏂版坊鍔犳爣蹇楋紝鐢ㄤ簬鍒濆鍖�
       }
       
@@ -177,14 +216,58 @@
         _cards.push(Navbar)
       }
 
-      handleList({...menu, components: _cards})
-      setCards(_cards)
+      if (item.component === 'navbar') {
+        let appMenus = sessionStorage.getItem('appViewList')
+        if (appMenus) {
+          try {
+            appMenus = JSON.parse(appMenus)
+            appMenus = appMenus.filter(item => item.keys_type === 'navbar')
+          } catch (e) {
+            appMenus = []
+          }
+        } else {
+          appMenus = []
+        }
+
+        if (appMenus.length) {
+          confirm({
+            title: '濡傞渶浣跨敤褰撳墠搴旂敤涓凡鏈夌殑鑿滃崟鏍忥紝璇风偣鍑诲彸渚у叧鑱旇彍鍗曟爮锛屽闇�鏂板璇风偣纭畾銆�',
+            onOk() {
+              if (style) {
+                handleList({...menu, style, components: _cards})
+              } else {
+                handleList({...menu, components: _cards})
+              }
+              setCards(_cards)
+            },
+            onCancel() {}
+          })
+        } else {
+          if (style) {
+            handleList({...menu, style, components: _cards})
+          } else {
+            handleList({...menu, components: _cards})
+          }
+          setCards(_cards)
+        }
+      } else {
+        if (style) {
+          handleList({...menu, style, components: _cards})
+        } else {
+          handleList({...menu, components: _cards})
+        }
+        setCards(_cards)
+      }
     }
   })
 
+  let style = JSON.stringify(menu.style || {})
+  style = style.replace(/@mywebsite@\//ig, window.GLOB.baseurl)
+  style = JSON.parse(style)
+
   return (
     <div ref={drop} className="mob-shell-inner" id="menu-shell-inner">
-      <div className="ant-row" style={menu.style}>
+      <div className="ant-row" style={style}>
         {cards.map(card => (
           <Card
             id={card.uuid}
@@ -192,6 +275,7 @@
             card={card}
             moveCard={moveCard}
             delCard={deleteCard}
+            unGroup={unGroup}
             findCard={findCard}
             updateConfig={updateConfig}
           />

--
Gitblit v1.8.0