From b23db4e1b9e8bc813b4b3b95d35552e5e2e980c6 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 01 二月 2021 18:51:00 +0800 Subject: [PATCH] 2021-02-01 --- src/components/tabview/index.jsx | 2 src/components/tabview/index.scss | 9 src/menu/picturecontroller/index.jsx | 18 + src/assets/css/viewstyle.scss | 10 src/menu/components/share/sourcecomponent/inputform/index.jsx | 212 +++++++++++++++++++++ src/components/header/index.jsx | 4 src/components/sidemenu/index.scss | 8 src/menu/picturecontroller/editform/index.scss | 11 + src/menu/components/share/sourcecomponent/index.jsx | 47 +++- src/views/main/index.jsx | 2 src/menu/components/card/cardcellcomponent/elementform/index.jsx | 23 +- src/menu/picturecontroller/index.scss | 8 src/views/main/index.scss | 2 /dev/null | 49 ---- src/menu/components/card/cardcellcomponent/formconfig.jsx | 2 src/menu/components/share/sourcecomponent/inputform/index.scss | 60 ++++++ src/menu/picturecontroller/editform/index.jsx | 2 src/tabviews/custom/index.jsx | 28 +- src/menu/components/share/sourcecomponent/index.scss | 7 src/tabviews/zshare/fileupload/index.jsx | 62 ++--- src/components/sidemenu/index.jsx | 4 src/menu/components/card/cardcellcomponent/elementform/index.scss | 3 src/assets/css/main.scss | 2 23 files changed, 426 insertions(+), 149 deletions(-) diff --git a/src/assets/css/main.scss b/src/assets/css/main.scss index adbf21b..3d90a6e 100644 --- a/src/assets/css/main.scss +++ b/src/assets/css/main.scss @@ -71,7 +71,7 @@ background-color: unset; color: unset; } -.side-menu.ant-menu-dark .ant-menu-item.ant-menu-item-selected { +.mk-side-menu.ant-menu-dark .ant-menu-item.ant-menu-item-selected { background-color: unset; color: unset; } diff --git a/src/assets/css/viewstyle.scss b/src/assets/css/viewstyle.scss index 008f8d2..7b2ad40 100644 --- a/src/assets/css/viewstyle.scss +++ b/src/assets/css/viewstyle.scss @@ -53,7 +53,7 @@ } } - #root > .main-view { + #root > .mk-main-view { > .header-container { background: $bg1; color: $font1; @@ -86,7 +86,7 @@ } } } - > .side-menu { + > .mk-side-menu { border-right: 1px solid #d9d9d9; background: $bg1; > .ant-menu { @@ -122,7 +122,7 @@ } } } - > .side-menu:not(.edit) { + > .mk-side-menu:not(.edit) { > .ant-menu { > .ant-menu-submenu { > .ant-menu-sub { @@ -137,7 +137,7 @@ } } } - >.content-box { + >.mk-tabview-wrap { >.content-header { >.ant-tabs { >.ant-tabs-bar { @@ -321,7 +321,7 @@ } @mixin bgblack() { - #root > .main-view { + #root > .mk-main-view { > .header-container { box-shadow: none; > .header-menu { diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx index 5d9c7b7..f4a77de 100644 --- a/src/components/header/index.jsx +++ b/src/components/header/index.jsx @@ -771,9 +771,9 @@ {this.props.editLevel === 'HS' ? <Button className="level4-close" type="primary" onClick={this.exitManage}>閫�鍑�</Button> : null} {/* 杩涘叆缂栬緫鎸夐挳 */} {this.props.editState && !this.props.editLevel ? <Icon onClick={this.enterEdit} className="edit-check" type="edit" /> : null} - {/* {this.props.editState && !this.props.editLevel && options.sysType === 'local' && window.GLOB.systemType !== 'production' ? + {this.props.editState && !this.props.editLevel && options.sysType === 'local' && window.GLOB.systemType !== 'production' ? <a href="#/mobmanage" target="_blank" className="mobile" type="edit"> 搴旂敤绠$悊 <Icon type="arrow-right" /></a> : null - } */} + } {/* window.btoa(window.encodeURIComponent(JSON.stringify({ MenuType: 'home', MenuId: 'home_page_id', MenuName: '棣栭〉' }))) */} {this.props.editState && !this.props.editLevel && window.GLOB.systemType !== 'production' && this.props.memberLevel >= 20 ? <a className="home-edit" href={`#/menudesign/JTdCJTIyTWVudVR5cGUlMjIlM0ElMjJob21lJTIyJTJDJTIyTWVudUlkJTIyJTNBJTIyaG9tZV9wYWdlX2lkJTIyJTJDJTIyTWVudU5hbWUlMjIlM0ElMjIlRTklQTYlOTYlRTklQTElQjUlMjIlN0Q=`} target="_blank" rel="noopener noreferrer"> diff --git a/src/components/sidemenu/index.jsx b/src/components/sidemenu/index.jsx index fcc7c46..fe1c20f 100644 --- a/src/components/sidemenu/index.jsx +++ b/src/components/sidemenu/index.jsx @@ -281,10 +281,10 @@ const { mainMenu } = this.props const editShow = (this.props.editState && !this.props.editLevel) || false - if (mainMenu === '') return (<span className="side-menu-hidden"></span>) + if (mainMenu === '') return (<span className="mk-side-menu-hidden"></span>) return ( - <aside className={"side-menu ant-menu-dark" + (this.props.collapse ? ' side-menu-collapsed' : '') + (this.props.isiframe ? ' iframe' : '') + (this.props.editState ? ' edit' : '')}> + <aside id="mk-sidemenu-wrap" className={'mk-side-menu ant-menu-dark' + (this.props.collapse ? ' collapsed' : '') + (this.props.isiframe ? ' mk-iframe' : '') + (this.props.editState ? ' mk-edit' : '')}> {!(this.props.editLevel === 'level2' || this.props.editLevel === 'level3') && <Menu openKeys={this.state.openKeys} onOpenChange={this.onOpenChange} mode="inline" theme="dark" inlineCollapsed={this.props.collapse}> {editShow && <li className="sup-menu"><Icon onClick={this.enterSubEdit} className="edit-check" type="edit" /></li>} diff --git a/src/components/sidemenu/index.scss b/src/components/sidemenu/index.scss index 947f373..e0c6a33 100644 --- a/src/components/sidemenu/index.scss +++ b/src/components/sidemenu/index.scss @@ -1,7 +1,7 @@ @import '../../assets/css/iconfont.css'; @import '../../assets/css/global.scss'; -.side-menu { +.mk-side-menu { flex: 0 0 235px; width: 235px; padding: 48px 0 40px; @@ -94,7 +94,7 @@ left: 187px; } } -.side-menu.edit { // 缂栬緫鏃舵帶鍒惰彍鍗曞簳鑹� +.mk-side-menu.mk-edit { // 缂栬緫鏃舵帶鍒惰彍鍗曞簳鑹� .ant-menu-sub.ant-menu-inline { > .ant-menu-item.ant-menu-item-selected { background: unset; @@ -104,14 +104,14 @@ } } } -.side-menu.iframe { // tab椤典腑涓篿frame鏃� +.mk-side-menu.mk-iframe { // tab椤典腑涓篿frame鏃� max-height: 100vh; overflow-y: scroll; &::-webkit-scrollbar { display: none; } } -.side-menu.side-menu-collapsed { // 宸︿晶鑿滃崟鍚堝苟鏃� +.mk-side-menu.collapsed { // 宸︿晶鑿滃崟鍚堝苟鏃� flex: 0 0 80px; width: 80px; } diff --git a/src/components/tabview/index.jsx b/src/components/tabview/index.jsx index b9afa22..01abafb 100644 --- a/src/components/tabview/index.jsx +++ b/src/components/tabview/index.jsx @@ -213,7 +213,7 @@ const { tabviews, activeId } = this.state return ( - <section className={'flex-container content-box' + (this.props.collapse ? ' collapsed' : '')}> + <section id="mk-tabview-wrap" className={'mk-tabview-wrap' + (this.props.collapse ? ' collapsed' : '')}> <div className="content-header"> {tabviews && tabviews.length > 0 && <Tabs activeKey={activeId}> diff --git a/src/components/tabview/index.scss b/src/components/tabview/index.scss index 69617f6..24f4644 100644 --- a/src/components/tabview/index.scss +++ b/src/components/tabview/index.scss @@ -1,4 +1,7 @@ -.content-box { +.mk-tabview-wrap { + display: flex; + flex: auto; + min-height: 100%; padding-top: 48px; max-width: calc(100% - 235px); transition: max-width 0.2s; @@ -105,10 +108,10 @@ right: 30px; } } -.content-box.collapsed { +.mk-tabview-wrap.collapsed { max-width: calc(100% - 80px); } -.side-menu-hidden + .content-box, .side-menu-hidden + .content-box.collapsed { +.mk-side-menu-hidden + .mk-tabview-wrap, .mk-side-menu-hidden + .mk-tabview-wrap.collapsed { max-width: 100%; >.content-header >.ant-tabs >.ant-tabs-bar { display: none; diff --git a/src/menu/components/card/cardcellcomponent/elementform/index.jsx b/src/menu/components/card/cardcellcomponent/elementform/index.jsx index 7ffdfb7..f3507e3 100644 --- a/src/menu/components/card/cardcellcomponent/elementform/index.jsx +++ b/src/menu/components/card/cardcellcomponent/elementform/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { fromJS } from 'immutable' -import { Form, Row, Col, Input, Select, Icon, Radio, Tooltip, InputNumber, notification } from 'antd' +import { Form, Row, Col, Input, Select, Icon, Radio, Tooltip, InputNumber } from 'antd' import { formRule } from '@/utils/option.js' import asyncComponent from '@/utils/asyncComponent' @@ -40,7 +40,6 @@ link: '' } - UNSAFE_componentWillMount () { const { card, config } = this.props let _options = this.getOptions(card.eleType, card.datatype, card.link) @@ -76,6 +75,8 @@ } else if (card.eleType === 'number') { item.options = item.oriOptions.filter(op => op.value !== 'YYYY-MM-DD') } + } else if (item.key === 'url') { + item.required = card.eleType !== 'qrcode' } if (item.key === 'linkurl') { item.type = card.link === 'dynamic' ? 'select' : 'text' @@ -157,6 +158,8 @@ } else if (value === 'number') { item.options = item.oriOptions.filter(op => op.value !== 'YYYY-MM-DD') } + } else if (item.key === 'url') { + item.required = value !== 'qrcode' } return item @@ -388,14 +391,14 @@ values.uuid = this.props.card.uuid values.marks = this.props.card.marks || null - if (values.eleType === 'picture' && values.datatype === 'static' && !values.url) { - notification.warning({ - top: 92, - message: '灏氭湭娣诲姞鍥剧墖鎴栧浘鐗囦笂浼犲け璐ワ紝璇烽噸鏂版坊鍔狅紒', - duration: 5 - }) - return - } + // if (values.eleType === 'picture' && values.datatype === 'static' && !values.url) { + // notification.warning({ + // top: 92, + // message: '灏氭湭娣诲姞鍥剧墖鎴栧浘鐗囦笂浼犲け璐ワ紝璇烽噸鏂版坊鍔狅紒', + // duration: 5 + // }) + // return + // } resolve(values) } else { diff --git a/src/menu/components/card/cardcellcomponent/elementform/index.scss b/src/menu/components/card/cardcellcomponent/elementform/index.scss index 166f28c..58fef06 100644 --- a/src/menu/components/card/cardcellcomponent/elementform/index.scss +++ b/src/menu/components/card/cardcellcomponent/elementform/index.scss @@ -21,4 +21,7 @@ } } } + .ant-form-explain, .ant-form-extra { + font-size: 13px; + } } \ No newline at end of file diff --git a/src/menu/components/card/cardcellcomponent/formconfig.jsx b/src/menu/components/card/cardcellcomponent/formconfig.jsx index 189bab3..c103921 100644 --- a/src/menu/components/card/cardcellcomponent/formconfig.jsx +++ b/src/menu/components/card/cardcellcomponent/formconfig.jsx @@ -109,7 +109,7 @@ label: '鍥剧墖/鏂囦欢', initVal: card.url || '', maxfile: 1, - required: false + required: true }, { type: 'radio', diff --git a/src/menu/components/share/sourcecomponent/index.jsx b/src/menu/components/share/sourcecomponent/index.jsx index 8f1f40c..a5ed3e6 100644 --- a/src/menu/components/share/sourcecomponent/index.jsx +++ b/src/menu/components/share/sourcecomponent/index.jsx @@ -1,9 +1,9 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Popover, Button, Icon } from 'antd' +import { Radio, Icon, Modal } from 'antd' -import PopSource from './popsource' +import InputForm from './inputform' import './index.scss' class CopyComponent extends Component { @@ -14,7 +14,8 @@ } state = { - url: this.props.value + url: this.props.value, + visible: '' } UNSAFE_componentWillMount () { @@ -30,30 +31,48 @@ this.props.onChange('') } - changePopover = (visible) => { - if (!visible && this.SourceWrap.state.url) { - this.setState({url: this.SourceWrap.state.url}) - this.props.onChange(this.SourceWrap.state.url) - } else if (visible && this.SourceWrap) { - this.SourceWrap.init() + handleChange = (key) => { + this.setState({visible: key}) + } + + popSubmit = () => { + let url = '' + if (this.inputWrap && this.inputWrap.state.url) { + url = this.inputWrap.state.url } + + this.setState({visible: '', url}) + this.props.onChange(url) } render () { - const { url } = this.state - const { type, placement } = this.props + const { url, visible } = this.state + const { type } = this.props let name = url ? url.slice(url.lastIndexOf('/') + 1) : '' return ( <div className="mk-source-wrap"> - {!url ? <Popover overlayClassName="mk-source-manage" placement={placement || 'top'} content={<PopSource type={type} ref={dom => { this.SourceWrap = dom }} />} trigger="click" onVisibleChange={this.changePopover}> - <Button icon="upload">鐐瑰嚮娣诲姞</Button> - </Popover> : null} + {!url ? <Radio.Group> + <Radio.Button value="input" size="small" onClick={() => this.handleChange('input')}>杈撳叆</Radio.Button> + <Radio.Button value="upload" size="small" onClick={() => this.handleChange('upload')}>涓婁紶</Radio.Button> + <Radio.Button value="system" size="small" onClick={() => this.handleChange('system')}>绯荤粺</Radio.Button> + </Radio.Group> : null} {url ? <div className="mk-source-item-info"> <Icon type="paper-clip" /> <a target="_blank" rel="noopener noreferrer" href={url}>{name}</a> <Icon title="鍒犻櫎鏂囦欢" type="delete" onClick={this.deleteUrl}/> </div> : null} + <Modal + visible={!!visible} + width={visible !== 'system' ? 600 : 1000} + closable={false} + maskClosable={false} + onOk={this.popSubmit} + onCancel={() => {this.setState({visible: ''})}} + destroyOnClose + > + <InputForm type={type === 'picture' ? 'image' : type} keyword={visible} ref={dom => { this.inputWrap = dom }} /> + </Modal> </div> ) } diff --git a/src/menu/components/share/sourcecomponent/index.scss b/src/menu/components/share/sourcecomponent/index.scss index 6a2b87f..f270254 100644 --- a/src/menu/components/share/sourcecomponent/index.scss +++ b/src/menu/components/share/sourcecomponent/index.scss @@ -34,8 +34,9 @@ display: inline-block; } } -} -.mk-source-manage { - z-index: 1170 !important; + .ant-radio-button-wrapper { + height: 28px; + line-height: 26px; + } } diff --git a/src/menu/components/share/sourcecomponent/inputform/index.jsx b/src/menu/components/share/sourcecomponent/inputform/index.jsx new file mode 100644 index 0000000..0312024 --- /dev/null +++ b/src/menu/components/share/sourcecomponent/inputform/index.jsx @@ -0,0 +1,212 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import { is, fromJS } from 'immutable' +import { Input, Form, Row, Col, Pagination, Empty, Button, Modal, notification } from 'antd' + +import Api from '@/api' +import Utils from '@/utils/utils.js' +import asyncComponent from '@/utils/asyncComponent' +import './index.scss' + +const { TextArea } = Input +const { Search } = Input +const FileUpload = asyncComponent(() => import('@/tabviews/zshare/fileupload')) +const Video = asyncComponent(() => import('@/menu/picturecontroller/video')) +const Image = asyncComponent(() => import('@/components/Image')) +const EditForm = asyncComponent(() => import('@/menu/picturecontroller/editform')) + +class PopSource extends Component { + static propTpyes = { + btnlog: PropTypes.array, + keyword: PropTypes.string, + handlelog: PropTypes.func + } + + state = { + url: '', + originlist: [], + list: [], + pagelist: [], + fileList: [], + searchKey: '', + pageSize: 12, + pageIndex: 1, + selectId: '', + editvisible: false, + card: null + } + + UNSAFE_componentWillMount () { + if (this.props.keyword === 'system') { + this.init() + } + } + + componentDidMount() { + try { + let _form = document.getElementById('source-input') + + if (_form && _form.focus) { + _form.focus() + } + } catch {} + } + + shouldComponentUpdate (nextProps, nextState) { + return !is(fromJS(this.state), fromJS(nextState)) + } + + init = () => { + const { type } = this.props + + let originlist = [] + if (type === 'video') { + let videos = sessionStorage.getItem('app_videos') + try { + originlist = JSON.parse(videos) + } catch { + originlist = [] + } + } else { + let pictures = sessionStorage.getItem('app_pictures') + try { + originlist = JSON.parse(pictures) + } catch { + originlist = [] + } + } + + let list = originlist + let pagelist = list.filter((item, index) => index < this.state.pageSize) + + this.setState({originlist, list, url: '', searchKey: '', pageIndex: 1, fileList: [], pagelist}) + } + + changeSearch = () => { + const { originlist, pageSize, searchKey } = this.state + let list = originlist.filter(item => item.remark.indexOf(searchKey) > -1) + let pagelist = list.filter((item, index) => index < pageSize) + + this.setState({list, pagelist, pageIndex: 1}) + } + + changeValue = (e) => { + this.setState({url: e.target.value}) + } + + changeSize = (page) => { + const { list, pageSize } = this.state + let pagelist = list.filter((item, index) => index < pageSize * page && index >= pageSize * (page - 1)) + this.setState({pageIndex: page, pagelist}) + } + + changeFile = (vals) => { + this.setState({fileList: vals}) + + if (vals && vals[0] && vals[0].status === 'done' && vals[0].response) { + this.setState({url: vals[0].response}) + } + } + + selectItem = (item) => { + if (item.linkurl) { + this.setState({url: item.linkurl, selectId: item.id}) + } + } + + handleSource = (item) => { + this.setState({ + editvisible: true, + card: item + }) + } + + save = () => { + const { card } = this.state + this.editFormRef.handleConfirm().then(res => { + res = {...card, ...res} + + if (!res.id) { + res.id = Utils.getuuid() + } + + Api.getSystemConfig({ + func: 's_url_db_adduptdel', + id: res.id, + PageIndex: 0, // 0 浠h〃鍏ㄩ儴 + PageSize: 0, // 0 浠h〃鍏ㄩ儴 + remark: res.remark || '', + linkurl: res.linkurl, + typecharone: card.typecharone, + type: 'add' + }).then(result => { + if (result.status) { + if (card.typecharone === 'image') { + sessionStorage.setItem('app_pictures', JSON.stringify(result.data || [])) + this.init() + } else { + sessionStorage.setItem('app_videos', JSON.stringify(result.data || [])) + this.init() + } + this.setState({editvisible: false}) + } else { + notification.warning({ + top: 92, + message: result.message, + duration: 5 + }) + } + }) + }) + } + + render () { + const { type, keyword } = this.props + const { list, url, pagelist, fileList, searchKey, pageIndex, pageSize, selectId, editvisible, card } = this.state + + return ( + <div className="mk-source-pop-wrap"> + {keyword === 'input' ? <Form.Item label="鍦板潃" labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={{xs: { span: 24 }, sm: { span: 20 }}}> + <TextArea id="source-input" value={url} rows={4} onChange={this.changeValue}/> + </Form.Item> : null} + {keyword === 'upload' ? <Form.Item label="涓婁紶" labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={{xs: { span: 24 }, sm: { span: 20 }}}> + <FileUpload value={fileList} onChange={this.changeFile} accept={type === 'video' ? '.mp4,.webm,.ogg' : '.jpg,.png,.gif,.pjp,.pjpeg,.jpeg,.jfif,.webp'} maxFile={1} fileType={type === 'video' ? 'text' : 'picture'} /> + </Form.Item> : null} + {keyword === 'system' ? + <Search value={searchKey} placeholder="" onChange={(e) => this.setState({searchKey: e.target.value})} onSearch={this.changeSearch} enterButton/> : null} + {keyword === 'system' ? <Button className="picture-plus mk-green" icon="plus" onClick={() => this.handleSource({typecharone: type})}> + 娣诲姞 + </Button> : null} + {keyword === 'system' && list.length ? + <Row gutter={16} style={{minHeight: '250px'}}> + {pagelist.map(item => ( + <Col span={4} key={item.id}> + <div className={'image-video-box' + (selectId === item.id ? ' active' : '')} onClick={() => this.selectItem(item)}> + <div className="image-video-box-body"> + {type !== 'video' ? <Image url={item.linkurl} /> : null} + {type === 'video' ? <Video value={item.linkurl} /> : null} + </div> + </div> + </Col> + ))} + </Row> : null} + {keyword === 'system' && list.length === 0 ? <Empty description={null}/> : null} + {keyword === 'system' && list.length > pageSize ? <Pagination size="small" current={pageIndex} pageSize={pageSize} onChange={this.changeSize} total={list.length} /> : null} + <Modal + title={'鏂板缓'} + wrapClassName="picture-edit-model" + visible={editvisible} + width={600} + maskClosable={false} + onOk={this.save} + onCancel={() => {this.setState({editvisible: false})}} + destroyOnClose + > + <EditForm card={card} wrappedComponentRef={(inst) => this.editFormRef = inst} inputSubmit={this.save}/> + </Modal> + </div> + ) + } +} + +export default PopSource \ No newline at end of file diff --git a/src/menu/components/share/sourcecomponent/inputform/index.scss b/src/menu/components/share/sourcecomponent/inputform/index.scss new file mode 100644 index 0000000..576da5d --- /dev/null +++ b/src/menu/components/share/sourcecomponent/inputform/index.scss @@ -0,0 +1,60 @@ +.mk-source-pop-wrap { + padding: 20px 10px 15px; + min-height: 150px; + + .image-video-box { + position: relative; + padding-top: 75%; + cursor: pointer; + margin-bottom: 16px; + transition: all 0.3s; + .image-video-box-body { + position: absolute; + top: 0px; + left: 0px; + right: 0px; + bottom: 0px; + .video-react-big-play-button { + display: none; + } + .video-react-control-bar { + display: none; + } + } + .image-video-box-body::after { + content: ''; + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + } + } + .image-video-box.active { + box-shadow: 0px 0px 8px #1890ff; + } + .ant-input-search { + width: 300px; + position: relative; + top: -15px; + } + .ant-empty { + height: 250px; + padding-top: 50px; + } + .ant-pagination { + text-align: right; + } + .picture-plus { + float: right; + position: relative; + top: -15px; + } +} +.picture-edit-model { + .ant-modal { + .ant-modal-body { + min-height: 200px; + } + } +} \ No newline at end of file diff --git a/src/menu/components/share/sourcecomponent/popsource/index.jsx b/src/menu/components/share/sourcecomponent/popsource/index.jsx deleted file mode 100644 index 812da24..0000000 --- a/src/menu/components/share/sourcecomponent/popsource/index.jsx +++ /dev/null @@ -1,131 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { is, fromJS } from 'immutable' -import { Input, Form, Row, Col, Pagination } from 'antd' - -import asyncComponent from '@/utils/asyncComponent' -import './index.scss' - -const { TextArea } = Input -const { Search } = Input -const FileUpload = asyncComponent(() => import('@/tabviews/zshare/fileupload')) -const Video = asyncComponent(() => import('@/menu/picturecontroller/video')) -const Image = asyncComponent(() => import('@/components/Image')) - -class PopSource extends Component { - static propTpyes = { - btnlog: PropTypes.array, - handlelog: PropTypes.func - } - - state = { - url: '', - originlist: [], - list: [], - pagelist: [], - fileList: [], - searchKey: '', - pageSize: 12, - pageIndex: 1 - } - - UNSAFE_componentWillMount () { - this.init() - } - - shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.state), fromJS(nextState)) - } - - init = () => { - const { type } = this.props - - let originlist = [] - if (type === 'video') { - let videos = sessionStorage.getItem('app_videos') - try { - originlist = JSON.parse(videos) - } catch { - originlist = [] - } - } else { - let pictures = sessionStorage.getItem('app_pictures') - try { - originlist = JSON.parse(pictures) - } catch { - originlist = [] - } - } - - let list = originlist - let pagelist = list.filter((item, index) => index < this.state.pageSize) - - this.setState({originlist, list, url: '', searchKey: '', pageIndex: 1, fileList: [], pagelist}) - } - - changeSearch = () => { - const { originlist, pageSize, searchKey } = this.state - let list = originlist.filter(item => item.remark.indexOf(searchKey) > -1) - let pagelist = list.filter((item, index) => index < pageSize) - - this.setState({list, pagelist, pageIndex: 1}) - } - - changeValue = (e) => { - this.setState({url: e.target.value}) - } - - changeSize = (page) => { - const { list, pageSize } = this.state - let pagelist = list.filter((item, index) => index < pageSize * page && index >= pageSize * (page - 1)) - this.setState({pageIndex: page, pagelist}) - } - - changeFile = (vals) => { - this.setState({fileList: vals}) - - if (vals && vals[0] && vals[0].status === 'done' && vals[0].response) { - this.setState({url: vals[0].response}) - } - } - - selectItem = (item) => { - if (item.linkurl) { - this.setState({url: item.linkurl}) - } - } - - render () { - const { type } = this.props - const { list, url, pagelist, fileList, searchKey, pageIndex, pageSize } = this.state - - return ( - <div className="mk-source-pop-wrap"> - <Form.Item label="鍦板潃" labelCol={{xs: { span: 24 }, sm: { span: 3 }}} wrapperCol={{xs: { span: 24 }, sm: { span: 21 }}}> - <TextArea value={url} rows={2} onChange={this.changeValue}/> - </Form.Item> - <Form.Item label="涓婁紶" labelCol={{xs: { span: 24 }, sm: { span: 3 }}} wrapperCol={{xs: { span: 24 }, sm: { span: 21 }}}> - <FileUpload value={fileList} onChange={this.changeFile} accept={type === 'video' ? '.mp4,.webm,.ogg' : '.jpg,.png,.gif,.pjp,.pjpeg,.jpeg,.jfif,.webp'} maxFile={1} fileType={'text'} /> - </Form.Item> - {list.length ? <Form.Item label="绯荤粺" labelCol={{xs: { span: 24 }, sm: { span: 3 }}} wrapperCol={{xs: { span: 24 }, sm: { span: 21 }}}> - <Search value={searchKey} placeholder="" onChange={(e) => this.setState({searchKey: e.target.value})} onSearch={this.changeSearch}/> - <Row gutter={10}> - {pagelist.map(item => ( - <Col span={4} key={item.id}> - <div className="image-video-box" onClick={() => this.selectItem(item)}> - <div className="image-video-box-body"> - {type !== 'video' ? <Image url={item.linkurl} /> : null} - {type === 'video' ? <Video value={item.linkurl} /> : null} - </div> - </div> - </Col> - ))} - </Row> - {list.length > pageSize ? <Pagination size="small" current={pageIndex} pageSize={pageSize} onChange={this.changeSize} total={list.length} /> : null} - </Form.Item> : null} - </div> - ) - } -} - -export default PopSource \ No newline at end of file diff --git a/src/menu/components/share/sourcecomponent/popsource/index.scss b/src/menu/components/share/sourcecomponent/popsource/index.scss deleted file mode 100644 index 3ff92bd..0000000 --- a/src/menu/components/share/sourcecomponent/popsource/index.scss +++ /dev/null @@ -1,49 +0,0 @@ -.mk-source-pop-wrap { - width: 500px; - padding: 15px 10px; - - .image-video-box { - position: relative; - padding-top: 75%; - cursor: pointer; - margin-bottom: 10px; - .image-video-box-body { - position: absolute; - top: 0px; - left: 0px; - right: 0px; - bottom: 0px; - .video-react-big-play-button { - display: none; - } - .video-react-control-bar { - display: none; - } - } - .image-video-box-body::after { - content: ''; - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - } - } - .fileupload-form-container { - display: inline-block; - width: 50%; - } - .ant-input-search { - position: absolute; - width: 150px; - right: 0px; - top: -40px; - input.ant-input { - height: 25px; - border-color: #eeeeee; - } - } - .ant-pagination { - text-align: right; - } -} \ No newline at end of file diff --git a/src/menu/picturecontroller/editform/index.jsx b/src/menu/picturecontroller/editform/index.jsx index b0671af..0d4db6b 100644 --- a/src/menu/picturecontroller/editform/index.jsx +++ b/src/menu/picturecontroller/editform/index.jsx @@ -97,7 +97,7 @@ } ] })( - <FileUpload accept=".jpg,.png,.gif,.pjp,.pjpeg,.jpeg,.jfif,.webp" maxFile={1} fileType={'text'} /> + <FileUpload accept=".jpg,.png,.gif,.pjp,.pjpeg,.jpeg,.jfif,.webp" maxFile={1} fileType={'picture'} /> )} </Form.Item> </Col> : null} diff --git a/src/menu/picturecontroller/editform/index.scss b/src/menu/picturecontroller/editform/index.scss index 46604b7..0074b74 100644 --- a/src/menu/picturecontroller/editform/index.scss +++ b/src/menu/picturecontroller/editform/index.scss @@ -1,3 +1,14 @@ .picture-edit-model-form { min-height: 150px; + .ant-input:read-only { + background: #fafafa; + resize: none; + } + .ant-input:read-only:hover, .ant-input:read-only:focus { + border-color: #d9d9d9; + box-shadow: none; + } + .ant-form-explain, .ant-form-extra { + font-size: 13px; + } } \ No newline at end of file diff --git a/src/menu/picturecontroller/index.jsx b/src/menu/picturecontroller/index.jsx index 12cabfa..7d887b7 100644 --- a/src/menu/picturecontroller/index.jsx +++ b/src/menu/picturecontroller/index.jsx @@ -1,5 +1,5 @@ import React, {Component} from 'react' -import { Modal, Button, Row, Col, Input, Icon, message, Tabs, Empty, Pagination } from 'antd' +import { Modal, Button, Row, Col, Input, Icon, message, Tabs, Empty, Pagination, notification } from 'antd' import Api from '@/api' import Utils from '@/utils/utils.js' @@ -100,6 +100,12 @@ this.resetVideo(result.data || []) } this.setState({editvisible: false}) + } else { + notification.warning({ + top: 92, + message: result.message, + duration: 5 + }) } }) }) @@ -144,6 +150,12 @@ sessionStorage.setItem('app_videos', JSON.stringify(res.data || [])) _this.resetVideo(res.data || []) } + } else { + notification.warning({ + top: 92, + message: res.message, + duration: 5 + }) } resolve() }) @@ -230,7 +242,7 @@ <Search placeholder="" value={imageKey} onChange={(e) => this.setState({imageKey: e.target.value})} onSearch={this.filterPicture} enterButton /> </Col> <Col span={16}> - <Button className="picture-plus" type="link" icon="plus" onClick={() => this.handleSource({typecharone: 'image'})}> + <Button className="picture-plus mk-green" icon="plus" onClick={() => this.handleSource({typecharone: 'image'})}> 娣诲姞 </Button> </Col> @@ -261,7 +273,7 @@ <Search placeholder="" value={videoKey} onChange={e => this.setState({videoKey: e.target.value})} onSearch={this.filterVideo} enterButton /> </Col> <Col span={16}> - <Button className="picture-plus" type="link" icon="plus" onClick={() => this.handleSource({typecharone: 'video'})}> + <Button className="picture-plus mk-green" icon="plus" onClick={() => this.handleSource({typecharone: 'video'})}> 娣诲姞 </Button> </Col> diff --git a/src/menu/picturecontroller/index.scss b/src/menu/picturecontroller/index.scss index 86430f0..35b9200 100644 --- a/src/menu/picturecontroller/index.scss +++ b/src/menu/picturecontroller/index.scss @@ -14,7 +14,6 @@ .picture-plus { float: right; font-size: 16px; - color: rgb(38, 194, 129); } .image-video-box { position: relative; @@ -79,4 +78,11 @@ .ant-pagination { text-align: right; } +} +.picture-edit-model { + .ant-modal { + .ant-modal-body { + min-height: 200px; + } + } } \ No newline at end of file diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index 98e030c..f6c7e40 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -259,18 +259,18 @@ } } - loadOutResource = (params) => { - let setting = params.shift() + loadOutResource = (inters) => { + let setting = inters.shift() let param = UtilsDM.getPrevQueryParams(setting, [], this.state.BID, this.props.menuType) Api.genericInterface(param).then(res => { if (res.status) { if (res.mk_ex_invoke === 'false') { - if (params.length > 0) { - this.loadOutResource(params) + if (inters.length > 0) { + this.loadOutResource(inters) } } else { - this.customOuterRequest(res, setting, params) + this.customOuterRequest(res, setting, inters) } } else { notification.error({ @@ -282,7 +282,7 @@ }) } - customOuterRequest = (result, setting, params) => { + customOuterRequest = (result, setting, inters) => { let url = '' if (window.GLOB.systemType === 'production') { @@ -321,10 +321,10 @@ $ErrMesg: error } - this.customCallbackRequest(_result, setting, params) + this.customCallbackRequest(_result, setting, inters) } else { res.mk_api_key = mkey - this.customCallbackRequest(res, setting, params) + this.customCallbackRequest(res, setting, inters) } }, (e) => { let _result = { @@ -333,11 +333,11 @@ $ErrMesg: e && e.statusText ? e.statusText : '' } - this.customCallbackRequest(_result, setting, params) + this.customCallbackRequest(_result, setting, inters) }) } - customCallbackRequest = (result, setting, params) => { + customCallbackRequest = (result, setting, inters) => { let errSql = '' if (result.$ErrCode === 'E') { errSql = ` @@ -371,8 +371,8 @@ } else { param.func = 's_ex_result_back' param.s_ex_result = lines.map((item, index) => ({ - MenuID: this.props.MenuID, - MenuName: this.props.MenuName, + MenuID: this.props.MenuID || '', + MenuName: this.props.MenuName || '', TableName: item.table, LongText: window.btoa(window.encodeURIComponent(`${item.insert} ${item.selects.join(` union all `)}`)), Sort: index + 1 @@ -391,8 +391,8 @@ Api.genericInterface(param).then(res => { if (res.status) { - if (params.length > 0) { - this.loadOutResource(params) + if (inters.length > 0) { + this.loadOutResource(inters) } } else { notification.error({ diff --git a/src/tabviews/zshare/fileupload/index.jsx b/src/tabviews/zshare/fileupload/index.jsx index 428fa2b..e8cf594 100644 --- a/src/tabviews/zshare/fileupload/index.jsx +++ b/src/tabviews/zshare/fileupload/index.jsx @@ -24,12 +24,18 @@ state = { percent: 0, - showprogress: false + showprogress: false, + filelist: [] + } + + UNSAFE_componentWillMount () { + const { value } = this.props + if (!value) return + + this.setState({filelist: fromJS(value).toJS()}) } onChange = ({ fileList }) => { - const { onChange } = this.props - fileList = fileList.map(item => { if (item.status === 'error' && /^<!DOCTYPE html>/.test(item.response)) { item.response = '' @@ -37,45 +43,35 @@ return item }) - if (onChange) { - onChange([...fileList]) - } + this.setState({filelist: fileList}) + this.props.onChange(fileList) } onRemove = file => { - const { value, onChange } = this.props + const files = this.state.filelist.filter(v => v.uid !== file.uid) - const files = value.filter(v => v.url !== file.url) - - if (onChange) { - onChange(files) - } + this.setState({filelist: files}) + this.props.onChange(files) } onUpdate = (url) => { - const { value, onChange } = this.props + let filelist = fromJS(this.state.filelist).toJS() - let filelist = fromJS(value).toJS() - filelist[filelist.length -1].status = 'done' - filelist[filelist.length -1].response = url - filelist[filelist.length -1].origin = false - - if (onChange) { - onChange([...filelist]) + if (filelist[filelist.length -1]) { + filelist[filelist.length -1].status = 'done' + filelist[filelist.length -1].response = url + filelist[filelist.length -1].origin = false } + + this.setState({filelist}) + this.props.onChange(filelist) } onDelete = (msg) => { - const { value, onChange } = this.props - let filelist = value.filter(v => !v.url && !v.response) + let filelist = this.state.filelist.filter(v => !v.url && !v.response) - if (onChange) { - onChange([...filelist]) - } - - this.setState({ - showprogress: false - }) + this.setState({filelist, showprogress: false}) + this.props.onChange(filelist) notification.warning({ top: 92, @@ -269,12 +265,12 @@ } render() { - const { value, maxFile, fileType, accept } = this.props - const { showprogress, percent } = this.state + const { maxFile, fileType, accept } = this.props + const { showprogress, percent, filelist } = this.state let uploadable = 'fileupload-form-container ' - if (maxFile && maxFile > 0 && value && value.length >= maxFile) { + if (maxFile && maxFile > 0 && filelist.length >= maxFile) { uploadable += 'limit-fileupload' } @@ -282,7 +278,7 @@ name: 'file', disabled: showprogress, listType: fileType, - fileList: value, + fileList: filelist, action: null, accept: accept || '', method: 'post', diff --git a/src/views/main/index.jsx b/src/views/main/index.jsx index 1e0d7ea..718f936 100644 --- a/src/views/main/index.jsx +++ b/src/views/main/index.jsx @@ -15,7 +15,7 @@ class Main extends Component { render () { return ( - <div className="flex-container main-view"> + <div className="mk-main-view"> <ConfigProvider locale={_locale}> <Header key="header"/> <Sidemenu key="sidemenu"/> diff --git a/src/views/main/index.scss b/src/views/main/index.scss index 0493020..c14dc8e 100644 --- a/src/views/main/index.scss +++ b/src/views/main/index.scss @@ -1,4 +1,4 @@ -.flex-container { +.mk-main-view { display: flex; flex: auto; min-height: 100%; -- Gitblit v1.8.0