From 8ddee469e059fe68119226b14f884b9309c84c1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=87=AA=E5=B8=A6=E5=A4=A7=E4=BD=AC=E6=B0=94=E5=9C=BA?= <188633308@qq.com> Date: Mon, 14 Jun 2021 10:36:16 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E6=90=AC=E8=BF=81icon-selector?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Api/Ewide.Application/Ewide.Application.xml | 4 +- web-react/src/components/ant-icon/index.jsx | 2 - .../src/components/icon-selector/icons.js | 34 ++++++++ .../src/components/icon-selector/index.jsx | 83 ++++++++++++++++++- web-react/src/pages/system/app/form.jsx | 25 +++++- 5 files changed, 139 insertions(+), 9 deletions(-) create mode 100644 web-react/src/components/icon-selector/icons.js diff --git a/Api/Ewide.Application/Ewide.Application.xml b/Api/Ewide.Application/Ewide.Application.xml index 15120ae..523ac69 100644 --- a/Api/Ewide.Application/Ewide.Application.xml +++ b/Api/Ewide.Application/Ewide.Application.xml @@ -773,14 +773,14 @@ 获取人员允许绑定的房屋编码列表 - + 获取人员已经绑定的房屋编码列表 - + diff --git a/web-react/src/components/ant-icon/index.jsx b/web-react/src/components/ant-icon/index.jsx index 759e800..62e0e47 100644 --- a/web-react/src/components/ant-icon/index.jsx +++ b/web-react/src/components/ant-icon/index.jsx @@ -4,7 +4,6 @@ import * as Icon from '@ant-design/icons' export default class AntIcon extends Component { render() { - const type = (this.props.type || '').toUpperCase() if (type) { @@ -19,7 +18,6 @@ export default class AntIcon extends Component { return } } - return <> } } \ No newline at end of file diff --git a/web-react/src/components/icon-selector/icons.js b/web-react/src/components/icon-selector/icons.js new file mode 100644 index 0000000..55567bf --- /dev/null +++ b/web-react/src/components/icon-selector/icons.js @@ -0,0 +1,34 @@ +const icons = [ + { + key: 'directional', + title: '方向性图标', + icons: ['step-backward', 'step-forward', 'fast-backward', 'fast-forward', 'shrink', 'arrows-alt', 'down', 'up', 'left', 'right', 'caret-up', 'caret-down', 'caret-left', 'caret-right', 'up-circle', 'down-circle', 'left-circle', 'right-circle', 'double-right', 'double-left', 'vertical-left', 'vertical-right', 'forward', 'backward', 'rollback', 'enter', 'retweet', 'swap', 'swap-left', 'swap-right', 'arrow-up', 'arrow-down', 'arrow-left', 'arrow-right', 'play-circle', 'up-square', 'down-square', 'left-square', 'right-square', 'login', 'logout', 'menu-fold', 'menu-unfold', 'border-bottom', 'border-horizontal', 'border-inner', 'border-left', 'border-right', 'border-top', 'border-verticle', 'pic-center', 'pic-left', 'pic-right', 'radius-bottomleft', 'radius-bottomright', 'radius-upleft', 'fullscreen', 'fullscreen-exit'] + }, + { + key: 'suggested', + title: '提示建议性图标', + icons: ['question', 'question-circle', 'plus', 'plus-circle', 'pause', 'pause-circle', 'minus', 'minus-circle', 'plus-square', 'minus-square', 'info', 'info-circle', 'exclamation', 'exclamation-circle', 'close', 'close-circle', 'close-square', 'check', 'check-circle', 'check-square', 'clock-circle', 'warning', 'issues-close', 'stop'] + }, + { + key: 'editor', + title: '编辑类图标', + icons: ['edit', 'form', 'copy', 'scissor', 'delete', 'snippets', 'diff', 'highlight', 'align-center', 'align-left', 'align-right', 'bg-colors', 'bold', 'italic', 'underline', 'strikethrough', 'redo', 'undo', 'zoom-in', 'zoom-out', 'font-colors', 'font-size', 'line-height', 'column-height', 'dash', 'small-dash', 'sort-ascending', 'sort-descending', 'drag', 'ordered-list', 'radius-setting'] + }, + { + key: 'data', + title: '数据类图标', + icons: ['area-chart', 'pie-chart', 'bar-chart', 'dot-chart', 'line-chart', 'radar-chart', 'heat-map', 'fall', 'rise', 'stock', 'box-plot', 'fund', 'sliders'] + }, + { + key: 'brand_logo', + title: '网站通用图标', + icons: ['lock', 'unlock', 'bars', 'book', 'calendar', 'cloud', 'cloud-download', 'code', 'copy', 'credit-card', 'delete', 'desktop', 'download', 'ellipsis', 'file', 'file-text', 'file-unknown', 'file-pdf', 'file-word', 'file-excel', 'file-jpg', 'file-ppt', 'file-markdown', 'file-add', 'folder', 'folder-open', 'folder-add', 'hdd', 'frown', 'meh', 'smile', 'inbox', 'laptop', 'appstore', 'link', 'mail', 'mobile', 'notification', 'paper-clip', 'picture', 'poweroff', 'reload', 'search', 'setting', 'share-alt', 'shopping-cart', 'tablet', 'tag', 'tags', 'to-top', 'upload', 'user', 'video-camera', 'home', 'loading', 'loading-3-quarters', 'cloud-upload', 'star', 'heart', 'environment', 'eye', 'camera', 'save', 'team', 'solution', 'phone', 'filter', 'exception', 'export', 'customer-service', 'qrcode', 'scan', 'like', 'dislike', 'message', 'pay-circle', 'calculator', 'pushpin', 'bulb', 'select', 'switcher', 'rocket', 'bell', 'disconnect', 'database', 'compass', 'barcode', 'hourglass', 'key', 'flag', 'layout', 'printer', 'sound', 'usb', 'skin', 'tool', 'sync', 'wifi', 'car', 'schedule', 'user-add', 'user-delete', 'usergroup-add', 'usergroup-delete', 'man', 'woman', 'shop', 'gift', 'idcard', 'medicine-box', 'red-envelope', 'coffee', 'copyright', 'trademark', 'safety', 'wallet', 'bank', 'trophy', 'contacts', 'global', 'shake', 'api', 'fork', 'dashboard', 'table', 'profile', 'alert', 'audit', 'branches', 'build', 'border', 'crown', 'experiment', 'fire', 'money-collect', 'property-safety', 'read', 'reconciliation', 'rest', 'security-scan', 'insurance', 'interaction', 'safety-certificate', 'project', 'thunderbolt', 'block', 'cluster', 'deployment-unit', 'dollar', 'euro', 'pound', 'file-done', 'file-exclamation', 'file-protect', 'file-search', 'file-sync', 'gateway', 'gold', 'robot', 'shopping'] + }, + { + key: 'application', + title: '品牌和标识', + icons: ['android', 'apple', 'windows', 'ie', 'chrome', 'github', 'aliwangwang', 'dingding', 'weibo-square', 'weibo-circle', 'taobao-circle', 'html5', 'weibo', 'twitter', 'wechat', 'youtube', 'alipay-circle', 'taobao', 'skype', 'qq', 'medium-workmark', 'gitlab', 'medium', 'linkedin', 'google-plus', 'dropbox', 'facebook', 'codepen', 'code-sandbox', 'amazon', 'google', 'codepen-circle', 'alipay', 'ant-design', 'aliyun', 'zhihu', 'slack', 'slack-square', 'behance', 'behance-square', 'dribbble', 'dribbble-square', 'instagram', 'yuque', 'alibaba', 'yahoo'] + } +] + +export default icons \ No newline at end of file diff --git a/web-react/src/components/icon-selector/index.jsx b/web-react/src/components/icon-selector/index.jsx index 7689c21..ee65369 100644 --- a/web-react/src/components/icon-selector/index.jsx +++ b/web-react/src/components/icon-selector/index.jsx @@ -1,11 +1,86 @@ import React, { Component } from 'react' +import { Card, Drawer, Tabs } from 'antd' +import { AntIcon } from 'components' +import icons from './icons' export default class IconSelector extends Component { - render() { - return ( -
-
+ state = { + visible: false, + activeKey: icons[0].key, + selected: '' + } + + open(icon) { + if (icon) { + const activeKey = (icons.find(p => p.icons.includes(icon)) || icons[0]).key + this.setState({ + visible: true, + activeKey, + selected: icon + }) + } else { + this.setState({ visible: true }) + } + } + + close() { + this.setState({ visible: false }) + } + + onSelectIcon(icon) { + if (this.props.onSelect) { + this.props.onSelect(icon) + } + this.close() + } + + render() { + + const { visible, activeKey, selected } = this.state + + return ( + this.close()} + > + + { + icons.map(iconGroup => { + return ( + + + { + iconGroup.icons.map(icon => { + return ( + this.onSelectIcon(icon)} + > + + {icon} + + ) + }) + } + + + ) + }) + } + + ) } } diff --git a/web-react/src/pages/system/app/form.jsx b/web-react/src/pages/system/app/form.jsx index 1c5f440..45ec668 100644 --- a/web-react/src/pages/system/app/form.jsx +++ b/web-react/src/pages/system/app/form.jsx @@ -1,6 +1,6 @@ import React, { Component } from 'react' import { Form, Input, InputNumber, Spin } from 'antd' -import { AntIcon } from 'components' +import { AntIcon, IconSelector } from 'components' import { cloneDeep } from 'lodash' const initialValues = { @@ -17,6 +17,8 @@ export default class form extends Component { // 表单实例 form = React.createRef() + iconSelector = React.createRef() + // 初始化数据 record = {} @@ -74,6 +76,7 @@ export default class form extends Component {
}>
@@ -83,6 +86,23 @@ export default class form extends Component { + + + this + .iconSelector + .current + .open(this.form.current.getFieldValue('icon')) + } + /> + } + /> +
+ this.form.current.setFieldsValue({ + icon + })} /> ) }