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 | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 102 insertions(+), 13 deletions(-) diff --git a/src/mob/mobshell/index.jsx b/src/mob/mobshell/index.jsx index 1b95799..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,13 +67,10 @@ }) } - let uuids = MenuUtils.getDelButtonIds(card) - confirm({ title: `纭畾鍒犻櫎${card.name ? `銆�${card.name}銆媊 : '缁勪欢'}鍚楋紵`, content: hasComponent ? '褰撳墠缁勪欢涓惈鏈夊瓙缁勪欢锛�' : '', onOk() { - MKEmitter.emit('delButtons', uuids) const _cards = cards.filter(item => item.uuid !== card.uuid) handleList({...menu, components: _cards}) setCards(_cards) @@ -73,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, @@ -91,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 @@ -118,6 +157,13 @@ form: '琛ㄥ崟', card: '鍗$墖', navbar: '瀵艰埅鏍�', + menubar: '鑿滃崟鏍�', + balcony: '娴姩鍗�', + timeline: '鏃堕棿杞�', + officialAccount: '鍏虫敞鍏紬鍙�', + sharecode: '鍒嗕韩鐮�', + map: '鍦板浘', + iframe: 'iframe', login: '鐧诲綍' } let i = 1 @@ -136,9 +182,7 @@ subtype: item.subtype, config: item.config, width: item.width || 24, - dataName: Utils.getdataName(), name: name, - floor: 1, // 缁勪欢鐨勫眰绾� isNew: true // 鏂版坊鍔犳爣蹇楋紝鐢ㄤ簬鍒濆鍖� } @@ -172,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} @@ -187,14 +275,15 @@ card={card} moveCard={moveCard} delCard={deleteCard} + unGroup={unGroup} findCard={findCard} updateConfig={updateConfig} /> ))} + {cards.length === 0 ? + <Empty description="璇锋坊鍔犵粍浠�" /> : null + } </div> - {cards.length === 0 ? - <Empty description="璇锋坊鍔犵粍浠�" /> : null - } </div> ) } -- Gitblit v1.8.0