zhouna пре 5 година
родитељ
комит
d46487e174

+ 0 - 15
src/common/components/Modal/body/ModalBody.jsx

@@ -1,15 +0,0 @@
-import styles from "./index.less";
-
-const ModalBody = (props) => {
-  const  {overflow, children} = props;
-  let bodyStyle = {
-      overflowY: overflow ? "auto": "hide"
-  };
-  return (
-      <div className={styles['modal-body']} style={bodyStyle}>
-          {children ? children : <div className="paragraph"> </div>}
-      </div>
-  );
-}
-
-export default ModalBody;

+ 0 - 10
src/common/components/Modal/body/index.less

@@ -1,10 +0,0 @@
-@media print {
-    .modal-body{
-        overflow-y: visible!important;
-        page-break-after:always;
-    }
-}
-.modal-body {
-    padding: 10px 20px 0 20px;
-    height: 85%;
-}

+ 0 - 31
src/common/components/Modal/footer/ModalFooter.jsx

@@ -1,31 +0,0 @@
-import React, {Component} from "react";
-import classNames from 'classnames';
-
-import styles from "./index.less";
-
-
-class ModalFooter extends Component {
-
-
-    render() {
-        const {btnName, handleCancel, handleConfirm} = this.props;
-        const cancelClass = {
-            overflow: "hidden",
-            position: "relative",
-            'WebkitTransition':'color .2s linear,background-color .3s linear',
-            'transition': 'color .2s linear,background-color .3s linear',
-            'color':'#8e8e93',
-            'backgroundColor': 'transparent'
-        }
-        const btnClass = classNames(`${styles.btn} ${styles[btnName] || styles['primary']}`);
-
-        return (
-            <div className={styles['modal-footer']}>
-                <button className={btnClass} onClick={handleConfirm}>确定</button>
-                <button className={btnClass} style={cancelClass} onClick={handleCancel}>取消</button>
-            </div>
-        );
-    }
-}
-
-export default ModalFooter;

+ 0 - 31
src/common/components/Modal/footer/index.less

@@ -1,31 +0,0 @@
-
-.modal-footer {
-    position: absolute;
-    bottom: 20px;
-    right: 30px;
-}
-.primary {
-    overflow: hidden;
-    position: relative;
-    color: #fff;
-    background-color: #34c3ff;
-}
-
-.btn {
-    display: inline-block;
-    margin-bottom: 0;
-    font-weight: 400;
-    text-align: center;
-    vertical-align: middle;
-    outline: 0!important;
-    white-space: nowrap;
-    border: none;
-    -webkit-user-select: none;
-    -moz-user-select: none;
-    -ms-user-select: none;
-    user-select: none;
-    padding: 8px 12px;
-    font-size: 14px;
-    line-height: 1.42857143;
-    border-radius: 6px;
-}

+ 0 - 38
src/common/components/Modal/header/ModalHeader.jsx

@@ -1,38 +0,0 @@
-import React, {Component} from "react";
-import { findDOMNode } from 'react-dom';
-import classNames from 'classnames';
-import $ from 'jquery'
-
-import styles from "./index.less";
-
-class ModalHeader extends Component {
-    constructor(props) {
-        super(props);
-        this.handleClickClose = this.handleClickClose.bind(this);
-    }
-    handleClickClose() {
-        const {handleClose} = this.props;
-        if(handleClose) {
-            handleClose();
-        }
-		if($('#stateShow').length) {
-			$("#stateShow").css("display","none");
-		}
-		$(".src-modules-pageLeft-1SHS6").css("z-index","8")
-    }
-    render() {
-        const {title} = this.props;
-
-        return (
-            
-            <div className={styles['modal-header']}>
-                <button type="button" className={styles['close']} aria-label="Close" onClick={this.handleClickClose}>
-                    <span aria-hidden="true">X</span>
-                </button>
-                {title ? <h4 className={styles['title']}>{title}</h4>: null}
-            </div>
-        );
-    }
-}
-
-export default ModalHeader;

+ 0 - 46
src/common/components/Modal/header/index.less

@@ -1,46 +0,0 @@
-@import "~@less/variables.less";
-
-@media print{
-    .modal-header{
-        .close{
-            display: none;
-        }
-    }
-}
-
-.modal-header {
-    padding:0 20px;   
-    padding:10px 20px 0px 20px\0;
-    min-height: 40px;
-    line-height: 40px;
-    background: #e5e5e5;
-    border-top-left-radius: @border-radius;
-    border-top-right-radius: @border-radius;
-    .close{
-        outline: 0;
-        position: absolute;
-        right: 20px;
-        top: 10px;
-        font-size: 12px;
-        line-height: 1.66666667;
-        color: #272c36;
-        width: 20px;
-        padding: 0 4px;
-        background: none;
-        border-style: none;
-    }
-    .title {
-        display: block;
-        color: #272c36;
-        overflow: hidden;
-        text-overflow: ellipsis;
-        white-space: nowrap;
-        width: 100%;
-        line-height: 0\0;  //ie8打印修正
-    }
-}
-@media screen and(-ms-high-contrast:active),(-ms-high-contrast:none) {
-    .modal-header{
-        padding:5px 20px 0px;
-    }
-}

+ 0 - 130
src/common/components/Modal/index.jsx

@@ -1,130 +0,0 @@
-/**
- * 模态框
- * Created by DELL on 2018/4/24.
- */
-import React, {Component} from "react";
-/*import PropTypes from 'prop-types';*/
-import { findDOMNode } from 'react-dom';
-import classNames from 'classnames';
-import {$$} from '@lib';
-
-// import $ from "jquery";
-import ModalHeader from "./header/ModalHeader.jsx";
-import ModalBody from "./body/ModalBody.jsx";
-import ModalFooter from "./footer/ModalFooter.jsx";
-
-import styles from "./index.less";
-
-/*const propTypes = {
-    autoResizeHeight: PropTypes.bool,
-    overflow: PropTypes.bool,
-    onClickCancel: PropTypes.func,
-    onClickConfirm: PropTypes.func,
-    onClickClose: PropTypes.func
-}
-const defaultProps = {
-    overflow: true,
-    autoResizeHeight: true
-};*/
-
-class Modal extends Component {
-    constructor(props) {
-        super(props);
-        this.state = {
-            modalStyle : {},
-            bodyStyles: {},
-            maxHeight: null,
-            overflow: null,
-            show: this.props.show || true
-        }
-        
-        this.handleConfirm = this.handleConfirm.bind(this);
-        this.handleCancel = this.handleCancel.bind(this);
-        this.handleClose = this.handleClose.bind(this);
-        
-        this.handleWindowResize = this.handleWindowResize.bind(this);
-        this.getStyles = this.getStyles.bind(this);
-    }
-    handleConfirm() {
-        this.setState({
-            show: false
-        });
-        const {onClickConfirm} = this.props;
-        onClickConfirm && onClickConfirm();
-    }
-    handleCancel() {
-        this.setState({
-            show: false
-        });
-        const {onClickCancel} = this.props;
-        onClickCancel && onClickCancel();
-        
-    }
-    handleClose() {
-
-        const that = this;
-        const {onClickClose} = this.props;
-        onClickClose && onClickClose(function () {
-            that.setState({
-                show: false
-            });
-        });
-    }
-    getStyles() {
-        const styles = {};
-        const {autoResizeHeight} = this.props;
-        if (autoResizeHeight) {
-            const excludeHeight = 150;
-            const contentHeight = $$.getHeight(window) - excludeHeight;
-
-            styles.bodyStyles = {
-              maxHeight: contentHeight
-            };
-        }
-        return styles;
-    }
-    handleWindowResize() {
-        this.setState(this.getStyles());
-    }
-    componentDidMount() {
-       this.setState(this.getStyles());
-       $$.$window.on("resize", this.handleWindowResize);
-    }
-    render() {
-        const {
-            width,
-            title,
-            overflow,
-            noFooter,
-            children
-        } = this.props;
-        
-        this.state.modalStyle= {
-            display: this.state.show ? "block" : "none",
-            padding: "0 20px"
-        };
-
-        let maxHeight = this.state.bodyStyles.maxHeight;
-        
-        let contentClass = classNames(`${styles['content']}`);
-        return (
-            <div style={this.state.modalStyle} ref={(ref) => {this.dialog = ref;}} >
-                <div className={styles['backdrop']}></div>
-                <div className={contentClass} style={{width,  height:maxHeight}} >
-                    <ModalHeader title={title||"title"} handleClose={this.handleClose}/>
-                    <ModalBody children={children} overflow={overflow}/>
-                    {noFooter ? null : <ModalFooter handleCancel={this.handleCancel} handleConfirm={this.handleConfirm}/>}
-                </div>
-            </div>
-        );
-    }
-}
-
-/*Modal.propTypes = propTypes;
-Modal.defaultProps = defaultProps;*/
-
-Modal.header = ModalHeader;
-Modal.body = ModalBody;
-Modal.footer = ModalFooter;
-
-export default Modal;

+ 0 - 31
src/common/components/Modal/index.less

@@ -1,31 +0,0 @@
-
-@import "~@less/variables.less";
-
-.backdrop {
-    position: fixed;
-    top: 0;
-    right: 0;
-    bottom: 0;
-    left: 0;
-    z-index: 1001;
-    background-color: #272c36;
-    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=60)"; /*IE8*/
-    // filter:progid:DXImageTransform.Microsoft.Alpha(opacity=70);//兼容ie8及以下/
-    filter: alpha(opacity=60);  /*IE5、IE5.5、IE6、IE7*/
-    opacity: .6;
-}
-.content {
-    background: #fff;
-    height: 485px;
-    min-height: 400px;
-    width: 720px;
-    min-width: 666px;
-    margin: 0 auto;
-    margin-top: 65px;
-    overflow-y: auto;
-
-    position: relative;
-    max-width: 720px;
-    z-index: 1050;
-    border-radius: @border-radius;
-}

+ 0 - 2
src/common/components/index.js

@@ -2,7 +2,6 @@ import Banner from "./Banner";
 import Button from "./Button";
 import Loading from "./Loading";
 import Message from "./Message";
-import Modal from "./Modal";
 import Radio from "./Radio/index";
 import CheckBtn from './CheckBtn';
 import InlineTag from './InlineTag';
@@ -28,7 +27,6 @@ import WrapModalContainer from "./WrapModalContainer";
 
 module.exports = {
     Banner,
-    Modal,
     Radio,
     CheckBtn,
     Loading,

+ 0 - 55
src/lib/dom-lib.js

@@ -1,55 +0,0 @@
-
-import $ from "jquery";
-const $window = $(window);
-const $doc = $(document);
-
-const $$ = {
-    $window: $window,
-    $doc: $doc,
-    getHeight: function (node) {
-        return $(node).innerHeight();
-    },
-    getWidth: function (node) {
-        return $(node).innerWidth();
-    },
-    animate: {
-        left: function (el, left) {
-            
-        },
-        top: function (el, top) {
-            
-        },
-        slideDown: function ($el, cb) {
-            let h = $el.height();
-            let cacheH = 0;
-            let timer = setInterval(function () {
-                $el.height(cacheH);
-                cacheH++;
-                if(cacheH >= h) {
-                    clearInterval(timer);
-                    cb && cb();
-                }
-            }, 20);
-           
-        },
-        slideUp: function ($el, cb) {
-            let h = $el.height();
-            
-            let cacheH = 0;
-            let timer = setInterval(function () {
-                $el.height(cacheH);
-                cacheH--;
-                if(cacheH <= 0) {
-                    clearInterval(timer);
-                    $el.height(h);
-                    cb && cb();
-                }
-            }, 20);
-            
-        }
-
-    }
-}
-
-
-module.exports = $$;

+ 0 - 7
src/lib/index.js

@@ -1,7 +0,0 @@
-import $$ from "./dom-lib";
-import tools from "./tools";
-
-module.exports = {
-    $$: $$,
-    tools: tools
-}

+ 0 - 158
src/lib/tools.js

@@ -1,158 +0,0 @@
-const ARR = "Array";
-const NUMBER = "Number";
-const STRING = "String";
-const OBJECT = "Object";
-const UNDEFINED = "Undefined";
-const NULL = "Null";
-const BOOLEAN = "Boolean";
-
-//  数据类型判断
-const Type = {
-    typeConstent: {
-        'array': ARR,
-        'number': NUMBER,
-        'string': STRING,
-        'object': OBJECT,
-        'undefined': UNDEFINED,
-        'null': NULL,
-        'boolean': BOOLEAN
-    },
-    tolower: (str)=> {
-        if(typeof str !== "string") {
-            return "";
-        }
-        return str.toLowerCase();
-    },
-    checkType: (el, type)=> {
-        type = Type.tolower(type);
-        type = Type.typeConstent[type];
-        return Object.prototype.toString.call(el) === "[object "+ type +"]";
-    }
-}
-
-// 判断字符串长度
-const regexp = {
-    ch: (str)=> {//匹配中文
-        if(typeof str !== "string") {
-            return "";
-        }
-        return str.match(/[\u4e00-\u9fa5]/g) || "";
-    },
-    chLen: function (str) {//中文长度
-        return this.ch(str).length;
-    },
-    strLen: function (str) {//字符串长度(一个中文当作两个英文字母)
-        if(typeof str !== "string") {
-            return 0;
-        }
-        return str.length + this.chLen(str);
-    }
-}
-
-//广度遍历整个数据,递归查找pid
-function findNode(data, pid, parentData) {
-    const travelWidely = (roots) => {
-        const queue = [...roots];
-        while (queue.length) {
-            const node = queue.shift();
-            //打印被遍历的一个节点
-            if (node.id === pid) {
-                //记录到
-                parentData.push(node)
-                return node;
-            }
-            if (node === undefined) {
-                return;
-            };
-            if (node.children && node.children.length) {
-                queue.push(...node.children)
-            }
-        }
-    }
-    return travelWidely(data)
-}
-function findAllParentByPid(data, pid, parentData) {
-    let thisParent = findNode(data, pid, parentData)
-    if (thisParent.hasOwnProperty("pid")) {
-        findAllParentByPid(data, thisParent.pid, parentData)
-    }
-}
-
-const clone = {
-    getType: function(obj){
-        //tostring会返回对应不同的标签的构造函数
-        var toString = Object.prototype.toString;
-        var map = {
-           '[object Boolean]'  : 'boolean', 
-           '[object Number]'   : 'number', 
-           '[object String]'   : 'string', 
-           '[object Function]' : 'function', 
-           '[object Array]'    : 'array', 
-           '[object Date]'     : 'date', 
-           '[object RegExp]'   : 'regExp', 
-           '[object Undefined]': 'undefined',
-           '[object Null]'     : 'null', 
-           '[object Object]'   : 'object'
-       };
-       if(obj instanceof Element) {
-            return 'element';
-       }
-       return map[toString.call(obj)];
-    },
-    deep: function(data){
-        var type = clone.getType(data);
-        var obj = null;
-        if(type === 'array'){
-            obj = [];
-        } else if(type === 'object'){
-            obj = {};
-        } else {
-            //不再具有下一层次
-            return data;
-        }
-        if(type === 'array'){
-            for(var i = 0, len = data.length; i < len; i++){
-                obj.push(clone.deep(data[i]));
-            }
-        } else if(type === 'object'){
-            for(var key in data){
-                obj[key] = clone.deep(data[key]);
-            }
-        }
-        return obj;
-    }
-}
-
-const isUndefined = function (str) {
-    if(str === 0 || str === "") {
-        return false;
-    }
-    return (Type.checkType(str, 'null') || Type.checkType(str, 'undefined'));
-   
-}
-
-const Storage = {
-    session: {
-        get: function (name) {
-            return JSON.parse(sessionStorage.getItem(name));
-        },
-        set: function (name, data) {
-            sessionStorage.setItem(name, JSON.stringify(data));
-        },
-        remove: function (name) {
-            sessionStorage.removeItem(name);
-        },
-        clear: function () {
-            sessionStorage.clear();
-        }
-    }
-}
-
-module.exports = {
-    checkType: Type.checkType,
-    regexp,
-    findAllParentByPid,
-    clone,
-    isUndefined,
-    Storage
-}