king
2020-07-20 2dc12c551cd60f2e3c976ed608d260b1d78ce759
mob init
6个文件已修改
17个文件已添加
6个文件已删除
18970 ■■■■■ 已修改文件
config-overrides.js 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package-lock.json 17229 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package.json 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/README.txt 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/fastclick.js 841 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/index.html 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/logo192.png 补丁 | 查看 | 原始文档 | blame | 历史
public/logo512.png 补丁 | 查看 | 原始文档 | blame | 历史
public/manifest.json 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/options.json 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/robots.txt 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/App.css 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/App.js 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/App.test.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/login/login-1/index.jsx 110 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/login/login-1/index.scss 170 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/index.css 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/index.js 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/logo.svg 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/page/404/index.jsx 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/page/404/index.scss 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/page/main/index.jsx 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/page/main/index.scss 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/router/index.js 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/action-type.js 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/action.js 120 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/index.js 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/reducer.js 133 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/asyncPage/index.jsx 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
config-overrides.js
New file
@@ -0,0 +1,12 @@
const { override, fixBabelImports, addWebpackAlias } = require('customize-cra');
const path = require("path");
module.exports = override(
  fixBabelImports('import', {
    libraryName: 'antd-mobile',
    style: 'css',
  }),
  addWebpackAlias({ //路径别名
    '@': path.resolve(__dirname, 'src'),
  })
);
package-lock.json
New file
Diff too large
package.json
@@ -6,14 +6,24 @@
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.3.2",
    "@testing-library/user-event": "^7.1.2",
    "antd-mobile": "^2.3.3",
    "immutable": "^4.0.0-rc.12",
    "node-sass": "^4.14.1",
    "prop-types": "^15.7.2",
    "rc-form": "^2.4.11",
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "react-scripts": "3.4.1"
    "react-redux": "^7.2.0",
    "react-router-dom": "^5.2.0",
    "react-scripts": "3.4.1",
    "redux": "^4.0.5",
    "redux-thunk": "^2.3.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "start": "react-app-rewired start",
    "dev": "react-app-rewired start",
    "build": "react-app-rewired build",
    "test": "react-app-rewired test --env=jsdom",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
@@ -30,5 +40,10 @@
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "babel-plugin-import": "^1.13.0",
    "customize-cra": "^1.0.0",
    "react-app-rewired": "^2.1.6"
  }
}
public/README.txt
New file
@@ -0,0 +1 @@
public/fastclick.js
New file
@@ -0,0 +1,841 @@
;(function () {
    'use strict';
    /**
     * @preserve FastClick: polyfill to remove click delays on browsers with touch UIs.
     *
     * @codingstandard ftlabs-jsv2
     * @copyright The Financial Times Limited [All Rights Reserved]
     * @license MIT License (see LICENSE.txt)
     */
    /*jslint browser:true, node:true*/
    /*global define, Event, Node*/
    /**
     * Instantiate fast-clicking listeners on the specified layer.
     *
     * @constructor
     * @param {Element} layer The layer to listen on
     * @param {Object} [options={}] The options to override the defaults
     */
    function FastClick(layer, options) {
        var oldOnClick;
        options = options || {};
        /**
         * Whether a click is currently being tracked.
         *
         * @type boolean
         */
        this.trackingClick = false;
        /**
         * Timestamp for when click tracking started.
         *
         * @type number
         */
        this.trackingClickStart = 0;
        /**
         * The element being tracked for a click.
         *
         * @type EventTarget
         */
        this.targetElement = null;
        /**
         * X-coordinate of touch start event.
         *
         * @type number
         */
        this.touchStartX = 0;
        /**
         * Y-coordinate of touch start event.
         *
         * @type number
         */
        this.touchStartY = 0;
        /**
         * ID of the last touch, retrieved from Touch.identifier.
         *
         * @type number
         */
        this.lastTouchIdentifier = 0;
        /**
         * Touchmove boundary, beyond which a click will be cancelled.
         *
         * @type number
         */
        this.touchBoundary = options.touchBoundary || 10;
        /**
         * The FastClick layer.
         *
         * @type Element
         */
        this.layer = layer;
        /**
         * The minimum time between tap(touchstart and touchend) events
         *
         * @type number
         */
        this.tapDelay = options.tapDelay || 200;
        /**
         * The maximum time for a tap
         *
         * @type number
         */
        this.tapTimeout = options.tapTimeout || 700;
        if (FastClick.notNeeded(layer)) {
            return;
        }
        // Some old versions of Android don't have Function.prototype.bind
        function bind(method, context) {
            return function() { return method.apply(context, arguments); };
        }
        var methods = ['onMouse', 'onClick', 'onTouchStart', 'onTouchMove', 'onTouchEnd', 'onTouchCancel'];
        var context = this;
        for (var i = 0, l = methods.length; i < l; i++) {
            context[methods[i]] = bind(context[methods[i]], context);
        }
        // Set up event handlers as required
        if (deviceIsAndroid) {
            layer.addEventListener('mouseover', this.onMouse, true);
            layer.addEventListener('mousedown', this.onMouse, true);
            layer.addEventListener('mouseup', this.onMouse, true);
        }
        layer.addEventListener('click', this.onClick, true);
        layer.addEventListener('touchstart', this.onTouchStart, false);
        layer.addEventListener('touchmove', this.onTouchMove, false);
        layer.addEventListener('touchend', this.onTouchEnd, false);
        layer.addEventListener('touchcancel', this.onTouchCancel, false);
        // Hack is required for browsers that don't support Event#stopImmediatePropagation (e.g. Android 2)
        // which is how FastClick normally stops click events bubbling to callbacks registered on the FastClick
        // layer when they are cancelled.
        if (!Event.prototype.stopImmediatePropagation) {
            layer.removeEventListener = function(type, callback, capture) {
                var rmv = Node.prototype.removeEventListener;
                if (type === 'click') {
                    rmv.call(layer, type, callback.hijacked || callback, capture);
                } else {
                    rmv.call(layer, type, callback, capture);
                }
            };
            layer.addEventListener = function(type, callback, capture) {
                var adv = Node.prototype.addEventListener;
                if (type === 'click') {
                    adv.call(layer, type, callback.hijacked || (callback.hijacked = function(event) {
                        if (!event.propagationStopped) {
                            callback(event);
                        }
                    }), capture);
                } else {
                    adv.call(layer, type, callback, capture);
                }
            };
        }
        // If a handler is already declared in the element's onclick attribute, it will be fired before
        // FastClick's onClick handler. Fix this by pulling out the user-defined handler function and
        // adding it as listener.
        if (typeof layer.onclick === 'function') {
            // Android browser on at least 3.2 requires a new reference to the function in layer.onclick
            // - the old one won't work if passed to addEventListener directly.
            oldOnClick = layer.onclick;
            layer.addEventListener('click', function(event) {
                oldOnClick(event);
            }, false);
            layer.onclick = null;
        }
    }
    /**
    * Windows Phone 8.1 fakes user agent string to look like Android and iPhone.
    *
    * @type boolean
    */
    var deviceIsWindowsPhone = navigator.userAgent.indexOf("Windows Phone") >= 0;
    /**
     * Android requires exceptions.
     *
     * @type boolean
     */
    var deviceIsAndroid = navigator.userAgent.indexOf('Android') > 0 && !deviceIsWindowsPhone;
    /**
     * iOS requires exceptions.
     *
     * @type boolean
     */
    var deviceIsIOS = /iP(ad|hone|od)/.test(navigator.userAgent) && !deviceIsWindowsPhone;
    /**
     * iOS 4 requires an exception for select elements.
     *
     * @type boolean
     */
    var deviceIsIOS4 = deviceIsIOS && (/OS 4_\d(_\d)?/).test(navigator.userAgent);
    /**
     * iOS 6.0-7.* requires the target element to be manually derived
     *
     * @type boolean
     */
    var deviceIsIOSWithBadTarget = deviceIsIOS && (/OS [6-7]_\d/).test(navigator.userAgent);
    /**
     * BlackBerry requires exceptions.
     *
     * @type boolean
     */
    var deviceIsBlackBerry10 = navigator.userAgent.indexOf('BB10') > 0;
    /**
     * Determine whether a given element requires a native click.
     *
     * @param {EventTarget|Element} target Target DOM element
     * @returns {boolean} Returns true if the element needs a native click
     */
    FastClick.prototype.needsClick = function(target) {
        switch (target.nodeName.toLowerCase()) {
        // Don't send a synthetic click to disabled inputs (issue #62)
        case 'button':
        case 'select':
        case 'textarea':
            if (target.disabled) {
                return true;
            }
            break;
        case 'input':
            // File inputs need real clicks on iOS 6 due to a browser bug (issue #68)
            if ((deviceIsIOS && target.type === 'file') || target.disabled) {
                return true;
            }
            break;
        case 'label':
        case 'iframe': // iOS8 homescreen apps can prevent events bubbling into frames
        case 'video':
            return true;
        }
        return (/\bneedsclick\b/).test(target.className);
    };
    /**
     * Determine whether a given element requires a call to focus to simulate click into element.
     *
     * @param {EventTarget|Element} target Target DOM element
     * @returns {boolean} Returns true if the element requires a call to focus to simulate native click.
     */
    FastClick.prototype.needsFocus = function(target) {
        switch (target.nodeName.toLowerCase()) {
        case 'textarea':
            return true;
        case 'select':
            return !deviceIsAndroid;
        case 'input':
            switch (target.type) {
            case 'button':
            case 'checkbox':
            case 'file':
            case 'image':
            case 'radio':
            case 'submit':
                return false;
            }
            // No point in attempting to focus disabled inputs
            return !target.disabled && !target.readOnly;
        default:
            return (/\bneedsfocus\b/).test(target.className);
        }
    };
    /**
     * Send a click event to the specified element.
     *
     * @param {EventTarget|Element} targetElement
     * @param {Event} event
     */
    FastClick.prototype.sendClick = function(targetElement, event) {
        var clickEvent, touch;
        // On some Android devices activeElement needs to be blurred otherwise the synthetic click will have no effect (#24)
        if (document.activeElement && document.activeElement !== targetElement) {
            document.activeElement.blur();
        }
        touch = event.changedTouches[0];
        // Synthesise a click event, with an extra attribute so it can be tracked
        clickEvent = document.createEvent('MouseEvents');
        clickEvent.initMouseEvent(this.determineEventType(targetElement), true, true, window, 1, touch.screenX, touch.screenY, touch.clientX, touch.clientY, false, false, false, false, 0, null);
        clickEvent.forwardedTouchEvent = true;
        targetElement.dispatchEvent(clickEvent);
    };
    FastClick.prototype.determineEventType = function(targetElement) {
        //Issue #159: Android Chrome Select Box does not open with a synthetic click event
        if (deviceIsAndroid && targetElement.tagName.toLowerCase() === 'select') {
            return 'mousedown';
        }
        return 'click';
    };
    /**
     * @param {EventTarget|Element} targetElement
     */
    FastClick.prototype.focus = function(targetElement) {
        var length;
        // Issue #160: on iOS 7, some input elements (e.g. date datetime month) throw a vague TypeError on setSelectionRange. These elements don't have an integer value for the selectionStart and selectionEnd properties, but unfortunately that can't be used for detection because accessing the properties also throws a TypeError. Just check the type instead. Filed as Apple bug #15122724.
        if (deviceIsIOS && targetElement.setSelectionRange && targetElement.type.indexOf('date') !== 0 && targetElement.type !== 'time' && targetElement.type !== 'month' && targetElement.type !== 'email') {
            length = targetElement.value.length;
            targetElement.setSelectionRange(length, length);
        } else {
            targetElement.focus();
        }
    };
    /**
     * Check whether the given target element is a child of a scrollable layer and if so, set a flag on it.
     *
     * @param {EventTarget|Element} targetElement
     */
    FastClick.prototype.updateScrollParent = function(targetElement) {
        var scrollParent, parentElement;
        scrollParent = targetElement.fastClickScrollParent;
        // Attempt to discover whether the target element is contained within a scrollable layer. Re-check if the
        // target element was moved to another parent.
        if (!scrollParent || !scrollParent.contains(targetElement)) {
            parentElement = targetElement;
            do {
                if (parentElement.scrollHeight > parentElement.offsetHeight) {
                    scrollParent = parentElement;
                    targetElement.fastClickScrollParent = parentElement;
                    break;
                }
                parentElement = parentElement.parentElement;
            } while (parentElement);
        }
        // Always update the scroll top tracker if possible.
        if (scrollParent) {
            scrollParent.fastClickLastScrollTop = scrollParent.scrollTop;
        }
    };
    /**
     * @param {EventTarget} targetElement
     * @returns {Element|EventTarget}
     */
    FastClick.prototype.getTargetElementFromEventTarget = function(eventTarget) {
        // On some older browsers (notably Safari on iOS 4.1 - see issue #56) the event target may be a text node.
        if (eventTarget.nodeType === Node.TEXT_NODE) {
            return eventTarget.parentNode;
        }
        return eventTarget;
    };
    /**
     * On touch start, record the position and scroll offset.
     *
     * @param {Event} event
     * @returns {boolean}
     */
    FastClick.prototype.onTouchStart = function(event) {
        var targetElement, touch, selection;
        // Ignore multiple touches, otherwise pinch-to-zoom is prevented if both fingers are on the FastClick element (issue #111).
        if (event.targetTouches.length > 1) {
            return true;
        }
        targetElement = this.getTargetElementFromEventTarget(event.target);
        touch = event.targetTouches[0];
        if (deviceIsIOS) {
            // Only trusted events will deselect text on iOS (issue #49)
            selection = window.getSelection();
            if (selection.rangeCount && !selection.isCollapsed) {
                return true;
            }
            if (!deviceIsIOS4) {
                // Weird things happen on iOS when an alert or confirm dialog is opened from a click event callback (issue #23):
                // when the user next taps anywhere else on the page, new touchstart and touchend events are dispatched
                // with the same identifier as the touch event that previously triggered the click that triggered the alert.
                // Sadly, there is an issue on iOS 4 that causes some normal touch events to have the same identifier as an
                // immediately preceeding touch event (issue #52), so this fix is unavailable on that platform.
                // Issue 120: touch.identifier is 0 when Chrome dev tools 'Emulate touch events' is set with an iOS device UA string,
                // which causes all touch events to be ignored. As this block only applies to iOS, and iOS identifiers are always long,
                // random integers, it's safe to to continue if the identifier is 0 here.
                if (touch.identifier && touch.identifier === this.lastTouchIdentifier) {
                    event.preventDefault();
                    return false;
                }
                this.lastTouchIdentifier = touch.identifier;
                // If the target element is a child of a scrollable layer (using -webkit-overflow-scrolling: touch) and:
                // 1) the user does a fling scroll on the scrollable layer
                // 2) the user stops the fling scroll with another tap
                // then the event.target of the last 'touchend' event will be the element that was under the user's finger
                // when the fling scroll was started, causing FastClick to send a click event to that layer - unless a check
                // is made to ensure that a parent layer was not scrolled before sending a synthetic click (issue #42).
                this.updateScrollParent(targetElement);
            }
        }
        this.trackingClick = true;
        this.trackingClickStart = event.timeStamp;
        this.targetElement = targetElement;
        this.touchStartX = touch.pageX;
        this.touchStartY = touch.pageY;
        // Prevent phantom clicks on fast double-tap (issue #36)
        if ((event.timeStamp - this.lastClickTime) < this.tapDelay) {
            event.preventDefault();
        }
        return true;
    };
    /**
     * Based on a touchmove event object, check whether the touch has moved past a boundary since it started.
     *
     * @param {Event} event
     * @returns {boolean}
     */
    FastClick.prototype.touchHasMoved = function(event) {
        var touch = event.changedTouches[0], boundary = this.touchBoundary;
        if (Math.abs(touch.pageX - this.touchStartX) > boundary || Math.abs(touch.pageY - this.touchStartY) > boundary) {
            return true;
        }
        return false;
    };
    /**
     * Update the last position.
     *
     * @param {Event} event
     * @returns {boolean}
     */
    FastClick.prototype.onTouchMove = function(event) {
        if (!this.trackingClick) {
            return true;
        }
        // If the touch has moved, cancel the click tracking
        if (this.targetElement !== this.getTargetElementFromEventTarget(event.target) || this.touchHasMoved(event)) {
            this.trackingClick = false;
            this.targetElement = null;
        }
        return true;
    };
    /**
     * Attempt to find the labelled control for the given label element.
     *
     * @param {EventTarget|HTMLLabelElement} labelElement
     * @returns {Element|null}
     */
    FastClick.prototype.findControl = function(labelElement) {
        // Fast path for newer browsers supporting the HTML5 control attribute
        if (labelElement.control !== undefined) {
            return labelElement.control;
        }
        // All browsers under test that support touch events also support the HTML5 htmlFor attribute
        if (labelElement.htmlFor) {
            return document.getElementById(labelElement.htmlFor);
        }
        // If no for attribute exists, attempt to retrieve the first labellable descendant element
        // the list of which is defined here: http://www.w3.org/TR/html5/forms.html#category-label
        return labelElement.querySelector('button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea');
    };
    /**
     * On touch end, determine whether to send a click event at once.
     *
     * @param {Event} event
     * @returns {boolean}
     */
    FastClick.prototype.onTouchEnd = function(event) {
        var forElement, trackingClickStart, targetTagName, scrollParent, touch, targetElement = this.targetElement;
        if (!this.trackingClick) {
            return true;
        }
        // Prevent phantom clicks on fast double-tap (issue #36)
        if ((event.timeStamp - this.lastClickTime) < this.tapDelay) {
            this.cancelNextClick = true;
            return true;
        }
        if ((event.timeStamp - this.trackingClickStart) > this.tapTimeout) {
            return true;
        }
        // Reset to prevent wrong click cancel on input (issue #156).
        this.cancelNextClick = false;
        this.lastClickTime = event.timeStamp;
        trackingClickStart = this.trackingClickStart;
        this.trackingClick = false;
        this.trackingClickStart = 0;
        // On some iOS devices, the targetElement supplied with the event is invalid if the layer
        // is performing a transition or scroll, and has to be re-detected manually. Note that
        // for this to function correctly, it must be called *after* the event target is checked!
        // See issue #57; also filed as rdar://13048589 .
        if (deviceIsIOSWithBadTarget) {
            touch = event.changedTouches[0];
            // In certain cases arguments of elementFromPoint can be negative, so prevent setting targetElement to null
            targetElement = document.elementFromPoint(touch.pageX - window.pageXOffset, touch.pageY - window.pageYOffset) || targetElement;
            targetElement.fastClickScrollParent = this.targetElement.fastClickScrollParent;
        }
        targetTagName = targetElement.tagName.toLowerCase();
        if (targetTagName === 'label') {
            forElement = this.findControl(targetElement);
            if (forElement) {
                this.focus(targetElement);
                if (deviceIsAndroid) {
                    return false;
                }
                targetElement = forElement;
            }
        } else if (this.needsFocus(targetElement)) {
            // Case 1: If the touch started a while ago (best guess is 100ms based on tests for issue #36) then focus will be triggered anyway. Return early and unset the target element reference so that the subsequent click will be allowed through.
            // Case 2: Without this exception for input elements tapped when the document is contained in an iframe, then any inputted text won't be visible even though the value attribute is updated as the user types (issue #37).
            if ((event.timeStamp - trackingClickStart) > 100 || (deviceIsIOS && window.top !== window && targetTagName === 'input')) {
                this.targetElement = null;
                return false;
            }
            this.focus(targetElement);
            this.sendClick(targetElement, event);
            // Select elements need the event to go through on iOS 4, otherwise the selector menu won't open.
            // Also this breaks opening selects when VoiceOver is active on iOS6, iOS7 (and possibly others)
            if (!deviceIsIOS || targetTagName !== 'select') {
                this.targetElement = null;
                event.preventDefault();
            }
            return false;
        }
        if (deviceIsIOS && !deviceIsIOS4) {
            // Don't send a synthetic click event if the target element is contained within a parent layer that was scrolled
            // and this tap is being used to stop the scrolling (usually initiated by a fling - issue #42).
            scrollParent = targetElement.fastClickScrollParent;
            if (scrollParent && scrollParent.fastClickLastScrollTop !== scrollParent.scrollTop) {
                return true;
            }
        }
        // Prevent the actual click from going though - unless the target node is marked as requiring
        // real clicks or if it is in the allowlist in which case only non-programmatic clicks are permitted.
        if (!this.needsClick(targetElement)) {
            event.preventDefault();
            this.sendClick(targetElement, event);
        }
        return false;
    };
    /**
     * On touch cancel, stop tracking the click.
     *
     * @returns {void}
     */
    FastClick.prototype.onTouchCancel = function() {
        this.trackingClick = false;
        this.targetElement = null;
    };
    /**
     * Determine mouse events which should be permitted.
     *
     * @param {Event} event
     * @returns {boolean}
     */
    FastClick.prototype.onMouse = function(event) {
        // If a target element was never set (because a touch event was never fired) allow the event
        if (!this.targetElement) {
            return true;
        }
        if (event.forwardedTouchEvent) {
            return true;
        }
        // Programmatically generated events targeting a specific element should be permitted
        if (!event.cancelable) {
            return true;
        }
        // Derive and check the target element to see whether the mouse event needs to be permitted;
        // unless explicitly enabled, prevent non-touch click events from triggering actions,
        // to prevent ghost/doubleclicks.
        if (!this.needsClick(this.targetElement) || this.cancelNextClick) {
            // Prevent any user-added listeners declared on FastClick element from being fired.
            if (event.stopImmediatePropagation) {
                event.stopImmediatePropagation();
            } else {
                // Part of the hack for browsers that don't support Event#stopImmediatePropagation (e.g. Android 2)
                event.propagationStopped = true;
            }
            // Cancel the event
            event.stopPropagation();
            event.preventDefault();
            return false;
        }
        // If the mouse event is permitted, return true for the action to go through.
        return true;
    };
    /**
     * On actual clicks, determine whether this is a touch-generated click, a click action occurring
     * naturally after a delay after a touch (which needs to be cancelled to avoid duplication), or
     * an actual click which should be permitted.
     *
     * @param {Event} event
     * @returns {boolean}
     */
    FastClick.prototype.onClick = function(event) {
        var permitted;
        // It's possible for another FastClick-like library delivered with third-party code to fire a click event before FastClick does (issue #44). In that case, set the click-tracking flag back to false and return early. This will cause onTouchEnd to return early.
        if (this.trackingClick) {
            this.targetElement = null;
            this.trackingClick = false;
            return true;
        }
        // Very odd behaviour on iOS (issue #18): if a submit element is present inside a form and the user hits enter in the iOS simulator or clicks the Go button on the pop-up OS keyboard the a kind of 'fake' click event will be triggered with the submit-type input element as the target.
        if (event.target.type === 'submit' && event.detail === 0) {
            return true;
        }
        permitted = this.onMouse(event);
        // Only unset targetElement if the click is not permitted. This will ensure that the check for !targetElement in onMouse fails and the browser's click doesn't go through.
        if (!permitted) {
            this.targetElement = null;
        }
        // If clicks are permitted, return true for the action to go through.
        return permitted;
    };
    /**
     * Remove all FastClick's event listeners.
     *
     * @returns {void}
     */
    FastClick.prototype.destroy = function() {
        var layer = this.layer;
        if (deviceIsAndroid) {
            layer.removeEventListener('mouseover', this.onMouse, true);
            layer.removeEventListener('mousedown', this.onMouse, true);
            layer.removeEventListener('mouseup', this.onMouse, true);
        }
        layer.removeEventListener('click', this.onClick, true);
        layer.removeEventListener('touchstart', this.onTouchStart, false);
        layer.removeEventListener('touchmove', this.onTouchMove, false);
        layer.removeEventListener('touchend', this.onTouchEnd, false);
        layer.removeEventListener('touchcancel', this.onTouchCancel, false);
    };
    /**
     * Check whether FastClick is needed.
     *
     * @param {Element} layer The layer to listen on
     */
    FastClick.notNeeded = function(layer) {
        var metaViewport;
        var chromeVersion;
        var blackberryVersion;
        var firefoxVersion;
        // Devices that don't support touch don't need FastClick
        if (typeof window.ontouchstart === 'undefined') {
            return true;
        }
        // Chrome version - zero for other browsers
        chromeVersion = +(/Chrome\/([0-9]+)/.exec(navigator.userAgent) || [,0])[1];
        if (chromeVersion) {
            if (deviceIsAndroid) {
                metaViewport = document.querySelector('meta[name=viewport]');
                if (metaViewport) {
                    // Chrome on Android with user-scalable="no" doesn't need FastClick (issue #89)
                    if (metaViewport.content.indexOf('user-scalable=no') !== -1) {
                        return true;
                    }
                    // Chrome 32 and above with width=device-width or less don't need FastClick
                    if (chromeVersion > 31 && document.documentElement.scrollWidth <= window.outerWidth) {
                        return true;
                    }
                }
            // Chrome desktop doesn't need FastClick (issue #15)
            } else {
                return true;
            }
        }
        if (deviceIsBlackBerry10) {
            blackberryVersion = navigator.userAgent.match(/Version\/([0-9]*)\.([0-9]*)/);
            // BlackBerry 10.3+ does not require Fastclick library.
            // https://github.com/ftlabs/fastclick/issues/251
            if (blackberryVersion[1] >= 10 && blackberryVersion[2] >= 3) {
                metaViewport = document.querySelector('meta[name=viewport]');
                if (metaViewport) {
                    // user-scalable=no eliminates click delay.
                    if (metaViewport.content.indexOf('user-scalable=no') !== -1) {
                        return true;
                    }
                    // width=device-width (or less than device-width) eliminates click delay.
                    if (document.documentElement.scrollWidth <= window.outerWidth) {
                        return true;
                    }
                }
            }
        }
        // IE10 with -ms-touch-action: none or manipulation, which disables double-tap-to-zoom (issue #97)
        if (layer.style.msTouchAction === 'none' || layer.style.touchAction === 'manipulation') {
            return true;
        }
        // Firefox version - zero for other browsers
        firefoxVersion = +(/Firefox\/([0-9]+)/.exec(navigator.userAgent) || [,0])[1];
        if (firefoxVersion >= 27) {
            // Firefox 27+ does not have tap delay if the content is not zoomable - https://bugzilla.mozilla.org/show_bug.cgi?id=922896
            metaViewport = document.querySelector('meta[name=viewport]');
            if (metaViewport && (metaViewport.content.indexOf('user-scalable=no') !== -1 || document.documentElement.scrollWidth <= window.outerWidth)) {
                return true;
            }
        }
        // IE11: prefixed -ms-touch-action is no longer supported and it's recomended to use non-prefixed version
        // http://msdn.microsoft.com/en-us/library/windows/apps/Hh767313.aspx
        if (layer.style.touchAction === 'none' || layer.style.touchAction === 'manipulation') {
            return true;
        }
        return false;
    };
    /**
     * Factory method for creating a FastClick object
     *
     * @param {Element} layer The layer to listen on
     * @param {Object} [options={}] The options to override the defaults
     */
    FastClick.attach = function(layer, options) {
        return new FastClick(layer, options);
    };
    if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {
        // AMD. Register as an anonymous module.
        define(function() {
            return FastClick;
        });
    } else if (typeof module !== 'undefined' && module.exports) {
        module.exports = FastClick.attach;
        module.exports.FastClick = FastClick;
    } else {
        window.FastClick = FastClick;
    }
}());
public/index.html
@@ -2,42 +2,26 @@
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="theme-color" content="#000000" />
    <meta
      name="description"
      content="Web site created using create-react-app"
    />
    <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
    <!--
      manifest.json provides metadata used when your web app is installed on a
      user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
    -->
    <meta name="description" content="Web site created using create-react-app" />
    <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
    <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
    <!--
      Notice the use of %PUBLIC_URL% in the tags above.
      It will be replaced with the URL of the `public` folder during the build.
      Only files inside the `public` folder can be referenced from the HTML.
      Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
      work correctly both with client-side routing and a non-root public URL.
      Learn how to configure a non-root public URL by running `npm run build`.
    -->
    <script src="%PUBLIC_URL%/fastclick.js"></script>
    <title>React App</title>
  </head>
  <body>
    <noscript>You need to enable JavaScript to run this app.</noscript>
    <div id="root"></div>
    <!--
      This HTML file is a template.
      If you open it directly in the browser, you will see an empty page.
      You can add webfonts, meta tags, or analytics to this file.
      The build step will place the bundled scripts into the <body> tag.
      To begin the development, run `npm start` or `yarn start`.
      To create a production bundle, use `npm run build` or `yarn build`.
    -->
    <script>
      if ('addEventListener' in document) {
        document.addEventListener('DOMContentLoaded', function() {
          FastClick.attach(document.body);
        }, false);
      }
      if(!window.Promise) {
        document.writeln('<script src="https://as.alipayobjects.com/g/component/es6-promise/3.2.2/es6-promise.min.js"><\/script>');
      }
    </script>
  </body>
</html>
public/logo192.png
Binary files differ
public/logo512.png
Binary files differ
public/manifest.json
@@ -6,16 +6,6 @@
      "src": "favicon.ico",
      "sizes": "64x64 32x32 24x24 16x16",
      "type": "image/x-icon"
    },
    {
      "src": "logo192.png",
      "type": "image/png",
      "sizes": "192x192"
    },
    {
      "src": "logo512.png",
      "type": "image/png",
      "sizes": "512x512"
    }
  ],
  "start_url": ".",
public/options.json
New file
@@ -0,0 +1,6 @@
{
  "appId": "201912040924165801464FF1788654BC5AC73",
  "appkey": "20191106103859640976D6E924E464D029CF0",
  "mainSystemApi": "http://cloud.mk9h.cn/webapi/dostars",
  "filter": "false"
}
public/robots.txt
File was deleted
src/App.css
File was deleted
src/App.js
File was deleted
src/App.test.js
@@ -1,6 +1,6 @@
import React from 'react';
import { render } from '@testing-library/react';
import App from './App';
import App from './page/main';
test('renders learn react link', () => {
  const { getByText } = render(<App />);
src/components/login/login-1/index.jsx
New file
@@ -0,0 +1,110 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { is, fromJS } from 'immutable'
import { InputItem, Icon, Checkbox, List, Button, Picker } from 'antd-mobile'
import { createForm } from 'rc-form'
import './index.scss'
const CheckboxItem = Checkbox.CheckboxItem
class MobLogin extends Component {
  static propTpyes = {
    config: PropTypes.object
  }
  state = {
    langs: [
      {value: 'zh-CN', label: '简体中文'},
      {value: 'en-US', label: 'English'}
    ],
    lang: 'zh-CN',
    rember: true
  }
  UNSAFE_componentWillMount () {
  }
  shouldComponentUpdate (nextProps, nextState) {
    return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState))
  }
  onChange = (e) => {
    const { rember } = this.state
    e.stopPropagation()
    this.setState({
      rember: !rember
    })
  }
  onChangeLang = (value) => {
    this.setState({
      lang: value
    })
  }
  render () {
    const { config } = this.props
    const { getFieldProps } = this.props.form
    const { rember, langs, lang } = this.state
    return (
      <div className="mob-login-1" style={config.box.style}>
        <div className="mob-login-body">
          {config.logo ? <div className="logo" style={config.logo.style}>
            <img src={config.logo.content} alt=""/>
          </div> : null}
          {config.title ? <div className="plat-name" style={config.title.style}>
            {config.title.content}
          </div> : null}
          <InputItem
            placeholder="UserName"
            prefixListCls="mk-login-item am-list"
            {...getFieldProps('userName', {
              initialValue: '',
            })}
            disabled={true}
          >
            <Icon type="check-circle-o" />
          </InputItem>
          <InputItem
            placeholder="Password"
            prefixListCls="mk-login-item am-list"
            {...getFieldProps('password', {
              initialValue: '',
            })}
            type={'password'}
            disabled={true}
          >
            <Icon type="check-circle" />
          </InputItem>
          <div className="other-setting">
            <CheckboxItem checked={rember} onChange={this.onChange}>
              <span onClick={this.onChange}>记住密码</span>
            </CheckboxItem>
            <Picker data={langs} value={lang} cols={1} onChange={this.onChangeLang} className="forss">
              <List.Item>{lang}</List.Item>
            </Picker>
            <div className="clear-both"></div>
          </div>
          <Button
            type="primary"
            className="login"
            onDoubleClick={() => this.props.doubleClickconfig(config.login)}
            style={config.login.style}
            onClick={this.editLogin}
          >
            {config.login.content}
          </Button>
        </div>
        {config.copyright ? <div className="company-msg" style={config.copyright.style}>
          {config.copyright.content}
        </div> : null}
      </div>
    )
  }
}
export default createForm()(MobLogin)
src/components/login/login-1/index.scss
New file
@@ -0,0 +1,170 @@
.mob-login-1 {
  position: relative;
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center center;
  .mob-login-body {
    border-top: 1px solid transparent;
    margin-bottom: 20px;
  }
  .logo {
    position: relative;
    font-size: 14px;
    max-width: 280px;
    min-height: 10px;
    margin: 0 auto;
    margin-bottom: 15px;
    text-align: center;
    line-height: 1.5;
    margin-top: 17vh;
    img {
      max-width: 100%;
    }
  }
  .plat-name {
    position: relative;
    max-width: 280px;
    min-height: 10px;
    margin: 0 auto;
    margin-top: 15px;
    margin-bottom: 30px;
    text-align: center;
    line-height: 1.5;
    font-size: 20px;
    color: #ffffff;
    font-weight: bold;
    letter-spacing: 0px;
  }
  .mk-login-item.am-list-item {
    position: relative;
    z-index: 1;
    width: 245px;
    font-size: 14px;
    max-width: 270px;
    line-height: 1.5;
    margin: 0 auto;
    margin-bottom: 10px;
    border-radius: 30px;
    background-color: rgba(255, 255, 255, 0.3);
    .am-input-label {
      width: 30px;
      color: inherit;
      padding-top: 10px;
    }
    input {
      color: inherit;
    }
    input::-webkit-input-placeholder {
      color: inherit;
    }
    input:-moz-placeholder {
      color: inherit;
    }
    input::-moz-placeholder {
      color: inherit;
    }
    input:-ms-input-placeholder {
      color: inherit;
    }
    .am-input-control input:disabled {
      background-color: transparent;
    }
  }
  // .am-list-item:not(:last-child) .am-list-line {
  //   border: none;
  // }
  .other-setting {
    position: relative;
    z-index: 1;
    font-size: 14px;
    width: 245px;
    max-width: 270px;
    line-height: 1.5;
    margin: 0 auto;
    margin-bottom: 10px;
    .am-list-item {
      float: left;
      background: transparent;
      width: 50%;
      padding: 0;
      .am-list-thumb:first-child {
        margin-right: 5px;
        cursor: pointer;
        .am-checkbox-inner {
          width: 18px;
          height: 18px;
        }
        .am-checkbox-inner:after {
          width: 5px;
          height: 9px;
        }
      }
      .am-list-line .am-list-content {
        font-size: 14px;
        color: inherit;
        cursor: pointer;
      }
      .am-list-extra {
        display: none;
      }
      .am-list-line::after {
        height: 0!important;
      }
    }
    .am-list-item.lang {
      float: right;
      .am-list-line {
        padding-right: 10px;
        .am-list-content {
          text-align: right;
          cursor: default;
        }
      }
    }
  }
  .am-button {
    position: relative;
    z-index: 1;
    width: 245px;
    max-width: 270px;
    margin: 0 auto;
    overflow: visible;
    letter-spacing: 0px;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center center;
    span {
      font-style: inherit;
      font-weight: inherit;
    }
  }
  .am-button::before {
    border: 0!important;
  }
  .company-msg {
    width: 88%;
    min-height: 10px;
    margin-left: 6%;
    font-size: 12px;
    color: #fafafa;
    text-align: center;
    line-height: 1.5;
    letter-spacing: 0px;
  }
}
.clear-both {
  float: none!important;
  clear: both;
}
src/index.css
@@ -7,7 +7,7 @@
  -moz-osx-font-smoothing: grayscale;
}
code {
  font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
    monospace;
.config-error {
  text-align: center;
  margin-top: 40vh;
}
src/index.js
@@ -1,17 +1,36 @@
import React from 'react';
import ReactDOM from 'react-dom';
import {Provider} from 'react-redux'
import Route from './router'
import store from '@/store'
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
const render  = Component => {
ReactDOM.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
    <Provider store={store}>
      <Component/>
    </Provider>,
  document.getElementById('root')
);
  )
}
// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
fetch(`./${process.env.NODE_ENV === 'production' ? 'build/' : ''}options.json`)
  .then(response => response.json())
  .catch(() => {
    document.getElementById('root').innerHTML = '系统配置信息获取失败,请联系管理员!'
    document.getElementById('root').className = 'config-error'
  })
  .then(config => {
    if (!config) return
    window.GLOB = {}
    window.GLOB.appId = config.appId || ''
    window.GLOB.lineColor = config.lineColor || ''
    window.GLOB.filter = config.filter || ''
    window.GLOB.appkey = config.appkey
    render(Route)
  })
serviceWorker.unregister();
src/logo.svg
File was deleted
src/page/404/index.jsx
New file
@@ -0,0 +1,12 @@
import React from 'react';
import './index.scss';
function NotFound() {
  return (
    <div className="page-not-found">
      当前页面不存在
    </div>
  );
}
export default NotFound;
src/page/404/index.scss
New file
@@ -0,0 +1,7 @@
.page-not-found {
  text-align: center;
  height: 100vh;
  line-height: 90vh;
  pointer-events: none;
}
src/page/main/index.jsx
New file
@@ -0,0 +1,29 @@
import React, {Component} from 'react';
import asyncComponent from '@/utils/asyncPage'
import './index.scss';
const Login1 = asyncComponent(() => import('@/components/login/login-1'))
class Main extends Component {
  render () {
    const config = {
      type: 'login',
      subtype: 'mob-login-1',
      box: { eleType: 'box', style: {color: '#ffffff', backgroundImage: 'linear-gradient(#378DBE, #46C29E, #48A9D6)'}},
      logo: { eleType: 'img', style: {} },
      title: { eleType: 'text', content: '明科商业智能开放平台', style: {fontSize: '20px', fontWeight: 'bold', color: '#ffffff', textAlign: 'center', marginTop: '15px', marginBottom: '30px'}},
      login: { eleType: 'button', content: '登录', style: {fontSize: '18px', color: '#ffffff', textAlign: 'center', lineHeight: 2.4, borderRadius: '25px'}},
      copyright: { eleType: 'textarea', content: 'Copyright©2017  所有相关版权归  北京明科普华信息技术有限公司', style: {fontSize: '12px', color: '#ffffff', textAlign: 'center'} }
    }
    return (
      <div className="main-page">
        <Login1 config={config} />
      </div>
    );
  }
}
export default Main;
src/page/main/index.scss
New file
@@ -0,0 +1,5 @@
.main-page {
  width: 100vw;
  height: 100vh;
}
src/router/index.js
New file
@@ -0,0 +1,20 @@
import React, {Component} from 'react'
import {HashRouter, Switch, Route, Redirect} from 'react-router-dom'
import asyncComponent from '@/utils/asyncPage'
const MainComponent = asyncComponent(() => import('@/page/main'))
const NotFound = asyncComponent(() => import('@/page/404'))
export default class RouteConfig extends Component {
  render () {
    return (
      <HashRouter>
        <Switch>
          <Route path="/main/:viewId" name="main" exact component={MainComponent}/>
          <Route component={NotFound}/>
          <Redirect exact from="/" to="main"/>
        </Switch>
      </HashRouter>
    )
  }
}
src/store/action-type.js
New file
@@ -0,0 +1,44 @@
// 切换主菜单
export const MODIFY_MAINMENU = 'MODIFY_MAINMENU'
// 展开合并菜单栏
export const Toggle_COLLAPSE = 'Toggle_COLLAPSE'
// 修改导航栏菜单
export const MODIFY_TABVIEW = 'MODIFY_TABVIEW'
// 修改窗口样式,区分iframe与正常页面
export const TOGGLE_ISIFRAME = 'TOGGLE_ISIFRAME'
// 退出系统时参数重置
export const RESET_STATE = 'RESET_STATE'
// 修改编辑模式
export const RESET_DEBUG = 'RESET_DEBUG'
// 刷新tab页面
export const REFRESH_TABVIEW = 'REFRESH_TABVIEW'
// 重置编辑状态
export const RESET_EDITSTATE = 'RESET_EDITSTATE'
// 重置编辑级别
export const RESET_EDITLEVEL = 'RESET_EDITLEVEL'
// 初始化按钮权限
export const INIT_ACTIONPERMISSION = 'INIT_ACTIONPERMISSION'
// 初始化角色列表及创建存储过程可用字段
export const INIT_PERMISSION = 'INIT_PERMISSION'
// 初始化菜单权限
export const INIT_MENUPERMISSION = 'INIT_MENUPERMISSION'
// 修改会员等级
export const MODIFY_MEMBERLEVEL = 'MODIFY_MEMBERLEVEL'
// 修改数据权限
export const MODIFY_DATAMANAGER = 'MODIFY_DATAMANAGER'
// 退出
export const LOGOUT = 'LOGOUT'
src/store/action.js
New file
@@ -0,0 +1,120 @@
import * as user from './action-type'
// 展开合并菜单栏
export const toggleCollapse = (collapse) => {
  return {
    type: user.Toggle_COLLAPSE,
    collapse
  }
}
// 切换主菜单
export const modifyMainMenu = (selectedMainMenu) => {
  return {
    type: user.MODIFY_MAINMENU,
    selectedMainMenu
  }
}
// 修改导航栏菜单
export const modifyTabview = (tabviews) => {
  return {
    type: user.MODIFY_TABVIEW,
    tabviews
  }
}
// 修改窗口样式,区分iframe与正常页面
export const toggleIsiframe = (isiframe) => {
  return {
    type: user.TOGGLE_ISIFRAME,
    isiframe
  }
}
// 退出系统时参数重置
export const resetState = () => {
  return {
    type: user.RESET_STATE
  }
}
// 退出系统时参数重置
export const resetDebug = () => {
  return {
    type: user.RESET_DEBUG
  }
}
// 刷新tab页面
export const refreshTabView = (refreshTab) => {
  return {
    type: user.REFRESH_TABVIEW,
    refreshTab
  }
}
// 重置编辑状态
export const resetEditState = (editState) => {
  return {
    type: user.RESET_EDITSTATE,
    editState
  }
}
// 重置编辑级别
export const resetEditLevel = (editLevel) => {
  return {
    type: user.RESET_EDITLEVEL,
    editLevel
  }
}
// 初始化按钮权限
export const initActionPermission = (permRoles, permAction) => {
  return {
    type: user.INIT_ACTIONPERMISSION,
    permRoles: permRoles,
    permAction: permAction
  }
}
// 初始化角色列表及创建存储过程可用字段
export const initPermission = (sysRoles, permFuncField) => {
  return {
    type: user.INIT_PERMISSION,
    sysRoles: sysRoles,
    permFuncField: permFuncField
  }
}
// 初始化菜单权限
export const initMenuPermission = (permMenus) => {
  return {
    type: user.INIT_MENUPERMISSION,
    permMenus: permMenus
  }
}
// 初始化菜单权限
export const modifyMemberLevel = (memberLevel) => {
  return {
    type: user.MODIFY_MEMBERLEVEL,
    memberLevel: memberLevel
  }
}
// 初始数据权限
export const modifyDataManager = (dataManager) => {
  return {
    type: user.MODIFY_DATAMANAGER,
    dataManager: dataManager
  }
}
// 退出重置
export const logout = () => {
  return {
    type: user.LOGOUT
  }
}
src/store/index.js
New file
@@ -0,0 +1,10 @@
import {createStore, applyMiddleware} from 'redux'
import userReducer from './reducer'
import thunk from 'redux-thunk'
let store = createStore(
  userReducer,
  applyMiddleware(thunk)
)
export default store
src/store/reducer.js
New file
@@ -0,0 +1,133 @@
import * as Type from './action-type'
let defaultState = {
  selectedMainMenu: '', // 已选主菜单
  tabviews: [],         // 导航栏
  isiframe: false,      // 是否为iframe窗口
  debug: false,         // 知否可以复制菜单参数, 是否可进入编辑模式
  editState: false,     // 是否为编辑状态,值为false、true
  editLevel: null,      // 编辑菜单级别,值为level1、level2、level3、HS
  refreshTab: null,     // 刷新tabview页面信息
  permRoles: [],        // 用户角色列表
  permAction: {},       // 用户按钮权限
  permMenus: {},        // 用户三级菜单权限
  permFuncField: [],    // 系统模块
  sysRoles: [],         // 系统角色列表
  dataManager: false,   // 数据管理员
  memberLevel: 10   // 会员等级
}
// 用户消息
export default (state = defaultState, action = {}) => {
  switch (action.type) {
    case Type.Toggle_COLLAPSE:
    // 切换菜单栏展开合并状态
      return {
        ...state,
        collapse: action.collapse
      }
    case Type.MODIFY_MAINMENU:
    // 切换主菜单
      return {
        ...state,
        selectedMainMenu: action.selectedMainMenu
      }
    case Type.MODIFY_TABVIEW:
    // tab页改变
      return {
        ...state,
        tabviews: action.tabviews
      }
    case Type.TOGGLE_ISIFRAME:
    // 切换是否为iframe状态
      return {
        ...state,
        isiframe: action.isiframe
      }
    case Type.RESET_STATE:
    // 重置默认参数(退出时)
      return {
        ...state,
        ...{
          selectedMainMenu: '',
          tabviews: [],
          collapse: false,
          isiframe: false
        }
      }
    case Type.RESET_DEBUG:
    // 切换debug状态
      return {
        ...state,
        debug: true
      }
    case Type.REFRESH_TABVIEW:
    // 刷新tab页面
      return {
        ...state,
        refreshTab: action.refreshTab
      }
    case Type.RESET_EDITSTATE:
    // 重置编辑状态
      return {
        ...state,
        editState: action.editState,
        collapse: false
      }
    case Type.RESET_EDITLEVEL:
    // 重置编辑级别
      return {
        ...state,
        editLevel: action.editLevel
      }
    case Type.INIT_ACTIONPERMISSION:
    // 初始化按钮权限
      return {
        ...state,
        permRoles: action.permRoles,
        permAction: action.permAction
      }
    case Type.INIT_PERMISSION:
      // 初始化角色列表及创建存储过程可用字段
      return {
        ...state,
        sysRoles: action.sysRoles,
        permFuncField: action.permFuncField
      }
    case Type.INIT_MENUPERMISSION:
    // 初始化三级菜单权限
      return {
        ...state,
        permMenus: action.permMenus
      }
    case Type.MODIFY_MEMBERLEVEL:
      // 修改会员等级
      return {
        ...state,
        memberLevel: action.memberLevel
      }
    case Type.MODIFY_DATAMANAGER:
      // 修改数据权限
      return {
        ...state,
        dataManager: action.dataManager
      }
    case Type.LOGOUT:
      return {
        selectedMainMenu: '',
        tabviews: [],
        collapse: localStorage.getItem('collapse') === 'true',
        isiframe: false,
        debug: false,
        editState: false,
        editLevel: null,
        refreshTab: null,
        permAction: {},
        permFuncField: [],
        sysRoles: [],
        permMenus: {}
      }
    default:
      return state
  }
}
src/utils/asyncPage/index.jsx
New file
@@ -0,0 +1,29 @@
import React, {Component} from 'react'
/**
 * @description 异步加载模块
 * @param {*} importComponent
 */
export default function asyncComponent(importComponent) {
  return class extends Component {
    constructor(props) {
      super(props)
      this.state = {
        component: null
      }
    }
    async componentDidMount() {
      const {default: component} = await importComponent()
      this.setState({component})
    }
    render() {
      const C = this.state.component
      return C ? <C {...this.props} /> : null
    }
  }
}