From 332164ec19e980b407b1e70a45280b1a91f20863 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 09 一月 2025 17:55:11 +0800 Subject: [PATCH] 2025-01-09 --- src/menu/components/share/sourcecomponent/inputform/index.scss | 7 +++ src/menu/components/share/sourcecomponent/inputform/index.jsx | 87 +++++++++++++++++++------------------------ src/assets/css/design.scss | 19 +++++++++ src/menu/components/share/sourcecomponent/index.jsx | 3 + 4 files changed, 66 insertions(+), 50 deletions(-) diff --git a/src/assets/css/design.scss b/src/assets/css/design.scss index c252031..ceaad14 100644 --- a/src/assets/css/design.scss +++ b/src/assets/css/design.scss @@ -77,6 +77,25 @@ } } +// 鑷畾涔夋粴鍔ㄦ牱寮� +.mk-scrollbar { + overflow-y: auto; +} +.mk-scrollbar::-webkit-scrollbar { + width: 7px; +} +.mk-scrollbar::-webkit-scrollbar-thumb { + box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.13); + background: rgba(0, 0, 0, 0.13); + border-radius: 5px; +} +.mk-scrollbar::-webkit-scrollbar-track { + box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05); + border: 1px solid rgba(0, 0, 0, 0.07); + background: rgba(0, 0, 0, 0); + border-radius: 3px; +} + .ant-modal { .ant-radio-group { white-space: nowrap; diff --git a/src/menu/components/share/sourcecomponent/index.jsx b/src/menu/components/share/sourcecomponent/index.jsx index f14a7bb..68b42cb 100644 --- a/src/menu/components/share/sourcecomponent/index.jsx +++ b/src/menu/components/share/sourcecomponent/index.jsx @@ -102,9 +102,10 @@ </div> : null} <Modal visible={!!visible} - width={visible !== 'system' ? 650 : 1000} + width={visible !== 'system' ? 650 : 1200} closable={false} maskClosable={false} + centered={visible === 'system'} okText="纭畾" cancelText="鍙栨秷" onOk={this.popSubmit} diff --git a/src/menu/components/share/sourcecomponent/inputform/index.jsx b/src/menu/components/share/sourcecomponent/inputform/index.jsx index 0a06300..4881a3f 100644 --- a/src/menu/components/share/sourcecomponent/inputform/index.jsx +++ b/src/menu/components/share/sourcecomponent/inputform/index.jsx @@ -1,7 +1,7 @@ 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 { Input, Form, Row, Col, Empty, Button, Modal, notification } from 'antd' import { PlusOutlined } from '@ant-design/icons' import Api from '@/api' @@ -23,12 +23,8 @@ state = { url: '', - originlist: [], list: [], - pagelist: [], searchKey: '', - pageSize: 12, - pageIndex: 1, selectId: '', editvisible: false, card: null @@ -88,28 +84,11 @@ } init = (originlist) => { - let list = originlist - let pagelist = list.filter((item, index) => index < this.state.pageSize) - - this.setState({originlist, list, url: '', searchKey: '', pageIndex: 1, 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}) + this.setState({list: originlist, url: '', searchKey: ''}) } 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 = (val) => { @@ -170,43 +149,53 @@ render () { const { type, keyword } = this.props - const { list, url, pagelist, searchKey, pageIndex, pageSize, selectId, editvisible, card } = this.state + const { list, url, searchKey, selectId, editvisible, card } = this.state - return ( - <div className="mk-source-pop-wrap"> - {keyword === 'input' ? <Form.Item label="鍦板潃" help="鍙娇鐢ˊmywebsite@浠f浛鍩熷悕锛堝惈铏氭嫙鐩綍锛夛紝濡傦細@mywebsite@/Content/images/xxx.jpg" labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={{xs: { span: 24 }, sm: { span: 20 }}}> + if (keyword === 'input') { + return <div className="mk-source-pop-wrap"> + <Form.Item label="鍦板潃" help="鍙娇鐢ˊmywebsite@浠f浛鍩熷悕锛堝惈铏氭嫙鐩綍锛夛紝濡傦細@mywebsite@/Content/images/xxx.jpg" 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 }}}> + </Form.Item> + </div> + } else if (keyword === 'upload') { + return <div className="mk-source-pop-wrap"> + <Form.Item label="涓婁紶" labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={{xs: { span: 24 }, sm: { span: 20 }}}> <FileUpload config={{ initval: '', suffix: type === 'video' ? '.mp4,.webm,.ogg' : '.jpg,.png,.gif,.pjp,.pjpeg,.jpeg,.jfif,.webp,.ico', maxfile: 1, fileType: type === 'video' ? 'text' : 'picture' }} onChange={this.changeFile} /> - </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" onClick={() => this.handleSource({typecharone: type})}> + </Form.Item> + </div> + } + + let pagelist = list + + if (searchKey) { + pagelist = list.filter(item => item.remark && item.remark.indexOf(searchKey) > -1) + } + + return ( + <div className="mk-source-pop-wrap"> + <Search value={searchKey} placeholder="" onChange={(e) => this.setState({searchKey: e.target.value})}/> + <Button className="picture-plus mk-green" onClick={() => this.handleSource({typecharone: type})}> <PlusOutlined /> 娣诲姞 - </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> + </Button> + <Row gutter={16} className="mk-scrollbar"> + {pagelist.map(item => ( + <Col span={3} 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} /> : <Video value={item.linkurl} />} </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} + </div> + </Col> + ))} + {!pagelist.length ? <Empty description={null}/> : null} + </Row> <Modal - title={'鏂板缓'} + title="鏂板缓" wrapClassName="picture-edit-model" visible={editvisible} width={600} diff --git a/src/menu/components/share/sourcecomponent/inputform/index.scss b/src/menu/components/share/sourcecomponent/inputform/index.scss index fc5b77f..4904113 100644 --- a/src/menu/components/share/sourcecomponent/inputform/index.scss +++ b/src/menu/components/share/sourcecomponent/inputform/index.scss @@ -54,6 +54,13 @@ margin-top: 5px; word-break: break-all; } + + .mk-scrollbar { + padding: 5px 0px; + min-height: 300px; + max-height: calc(100vh - 250px); + clear: both; + } } .picture-edit-model { .ant-modal { -- Gitblit v1.8.0