From f36141f3075edf9d41928d64f759ad6bd1b1ac60 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 14 七月 2020 17:43:34 +0800 Subject: [PATCH] 2020-07-14 --- src/mob/components/login/mob-login-2/index.jsx | 78 +++++++++++++++++++++++++++++++++++++-- 1 files changed, 74 insertions(+), 4 deletions(-) diff --git a/src/mob/components/login/mob-login-2/index.jsx b/src/mob/components/login/mob-login-2/index.jsx index d9a4653..6a9e31f 100644 --- a/src/mob/components/login/mob-login-2/index.jsx +++ b/src/mob/components/login/mob-login-2/index.jsx @@ -2,6 +2,7 @@ import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' import { InputItem, Button } from 'antd-mobile' +import { Icon } from 'antd' import zhCN from '@/locales/zh-CN/mob.js' import enUS from '@/locales/en-US/mob.js' @@ -31,8 +32,15 @@ login: { uuid: Utils.getuuid(), eleType: 'button', content: '鐧诲綍', style: {fontSize: '16px', color: '#ffffff', textAlign: 'center', lineHeight: 2.4, backgroundColor: '#44a8f2'}}, phone: { uuid: Utils.getuuid(), eleType: 'button', content: '鎵嬫満鐭俊鐧诲綍/娉ㄥ唽', style: {fontSize: '16px', color: '#44a8f2', textAlign: 'center', lineHeight: 2.4, border: '1px solid #44a8f2'}}, lose: { uuid: Utils.getuuid(), eleType: 'text', content: '蹇樿瀵嗙爜锛�', style: {fontSize: '12px', color: '#44a8f2', textAlign: 'right', textDecoration: 'underline'}}, - register: { uuid: Utils.getuuid(), eleType: 'text', content: '娉ㄥ唽鏄庣璐﹀彿', style: {fontSize: '16px', color: '#44a8f2', textAlign: 'center', marginTop: '20px', marginBottom: '30px'}}, - copyright: { uuid: Utils.getuuid(), eleType: 'textarea', content: 'Copyright漏2017 鎵�鏈夌浉鍏崇増鏉冨綊 鍖椾含鏄庣鏅崕淇℃伅鎶�鏈湁闄愬叕鍙�', style: {fontSize: '12px', textAlign: 'center'} } + register: { uuid: Utils.getuuid(), eleType: 'text', subItems: [ + {type: 'qq', icon: 'qq', label: 'QQ'}, + {type: 'wechat', icon: 'wechat', label: '寰俊'}, + ], content: '鍏朵粬鐧诲綍鏂瑰紡', style: {fontSize: '14px', color: '#bcbcbc', textAlign: 'center', marginTop: '30px', marginBottom: '20px'}}, + copyright: { uuid: Utils.getuuid(), eleType: 'textarea', content: 'Copyright漏2017 鎵�鏈夌浉鍏崇増鏉冨綊 鍖椾含鏄庣鏅崕淇℃伅鎶�鏈湁闄愬叕鍙�', style: {fontSize: '12px', textAlign: 'center'} }, + links: { uuid: Utils.getuuid(), eleType: 'link', substyle: false, subItems: [ + {eleType: 'link', content: '闅愮鏀跨瓥', url: '', uuid: Utils.getuuid()}, + {eleType: 'link', content: '浣跨敤鏉℃', url: '', uuid: Utils.getuuid()}, + ], style: {fontSize: '12px', textAlign: 'center', color: '#44a8f2', textDecoration: 'underline'} } } } @@ -79,6 +87,19 @@ ...fromJS(card.copyright.style).toJS(), componentId: card.uuid, uuid: card.copyright.uuid, + items: ['font'], + } + this.props.triggerEdit(element) + } + + editLinks = (e, item) => { + const { card } = this.props + e.stopPropagation() + let element = { + ...fromJS(card.links.style).toJS(), + componentId: card.uuid, + classId: card.links.uuid, + uuid: item.uuid, items: ['font'], } this.props.triggerEdit(element) @@ -132,7 +153,39 @@ this.props.triggerEdit(element) } + linkItemAdd = (e) => { + let card = fromJS(this.props.card).toJS() + e.stopPropagation() + + card.links.subItems.push({ + eleType: 'link', + content: 'link', + url: '', + uuid: Utils.getuuid() + }) + + this.props.updateConfig(card) + } + updateContent = (card) => { + this.props.updateConfig(card) + } + + updateLinkItem = (val, item) => { + let card = fromJS(this.props.card).toJS() + + if (!val) { + card.links.subItems = card.links.subItems.filter(cell => cell.uuid !== item.uuid) + } else { + card.links.subItems = card.links.subItems.map(cell => { + if (cell.uuid === item.uuid) { + return val + } else { + return cell + } + }) + } + this.props.updateConfig(card) } @@ -155,7 +208,7 @@ if (view === 'account') return ( <div className="mob-login-2" onClick={this.editBox} style={card.box.style}> <div className="mob-login-body"> - {card.title ? <div className={'plat-name ' + (editId === card.title.uuid ? 'editing' : '')} style={card.title.style} onClick={this.editTitle}> + {card.title ? <div className={'plat-name ' + (editId === card.title.uuid ? 'editing' : '')} style={titleStyle} onClick={this.editTitle}> <ContentUpdate element={card.title} updateContent={(ele) => this.updateContent({...card, title: ele})}/> {card.title.content} </div> : null} @@ -183,7 +236,7 @@ style={card.phone.style} onClick={(e) => this.editLogin(e, 'phone')} > - <ContentUpdate element={card.phone} deletable={false} updateContent={(ele) => this.updateContent({...card, phone: ele})}/> + <ContentUpdate element={card.phone} updateContent={(ele) => this.updateContent({...card, phone: ele})}/> {card.phone.content} </Button> {card.lose ? <div className={'plat-name ' + (editId === card.lose.uuid ? 'editing' : '')} style={card.lose.style} onClick={this.editLose}> @@ -194,11 +247,28 @@ <ContentUpdate element={card.register} updateContent={(ele) => this.updateContent({...card, register: ele})}/> {card.register.content} </div> : null} + {card.register ? <div className="other-register"> + {card.register.subItems.map(cell => ( + <span key={cell.type}> + <Icon type={cell.icon} /> + <p>{cell.label}</p> + </span> + ))} + </div> : null} </div> {card.copyright ? <div className={'company-msg ' + (editId === card.copyright.uuid ? 'editing' : '')} style={card.copyright.style} onClick={this.editMsg}> <ContentUpdate element={card.copyright} updateContent={(ele) => this.updateContent({...card, copyright: ele})}/> {card.copyright.content} </div> : null} + {card.links ? <div className="links" style={card.links.style}> + {card.links.subItems.map(item => ( + <span className={(editId === item.uuid ? 'editing' : '')} key={item.uuid} onClick={(e) => this.editLinks(e, item)}> + <ContentUpdate element={item} updateContent={(val) => this.updateLinkItem(val, item)}/> + {item.content} + </span> + ))} + <Icon type="plus" onClick={this.linkItemAdd} /> + </div> : null} </div> ) } -- Gitblit v1.8.0