ソースを参照

初始化项目

fuwei 5 年 前
コミット
661f846a76

+ 2 - 1
ghs/.env

@@ -1,2 +1,3 @@
 VUE_APP_MODE=dev
-VUE_APP_BASEHOST=https://test.evshine.net
+
+VUE_APP_BASEHOST=https://api.ghs.huaml.com

+ 2 - 1
ghs/.env.line

@@ -1,2 +1,3 @@
 VUE_APP_MODE=line
-VUE_APP_BASEHOST=https://www.evshine.cn
+
+VUE_APP_BASEHOST=https://api.ghs.huaml.com

+ 1 - 1
ghs/.env.test

@@ -1,2 +1,2 @@
 VUE_APP_MODE=test
-VUE_APP_BASEHOST=https://test.evshine.net
+VUE_APP_BASEHOST=https://api.ghs.huaml.com

+ 2 - 0
ghs/.eslintrc.js

@@ -40,6 +40,8 @@ module.exports = {
     //     vue: "never",
     //   },
     // ],
+    "import/no-named-as-default-member": "off",
+    "import/no-named-as-default": "off",
     "no-shadow": "off",
     "import/prefer-default-export": "off",
     "array-callback-return": "off",

ファイルの差分が大きいため隠しています
+ 0 - 0
ghs/dist/dev/.sourcemap/mp-weixin/common/vendor.js.map


+ 795 - 11
ghs/dist/dev/mp-weixin/common/vendor.js

@@ -7906,6 +7906,10 @@ var _vue = _interopRequireDefault(__webpack_require__(/*! vue */ 2));
 
 var _vuex = _interopRequireDefault(__webpack_require__(/*! vuex */ 10));
 
+var _vuexPersist = _interopRequireDefault(__webpack_require__(/*! vuex-persist */ 22));
+
+var _index = _interopRequireDefault(__webpack_require__(/*! ../utils/Storage/index */ 34));
+
 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
 
 function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
@@ -7914,7 +7918,6 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
 
 function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
 
-// import createPersistedState from "vuex-persistedstate";
 _vue.default.use(_vuex.default);
 
 var modules = {};
@@ -7924,19 +7927,22 @@ var context = __webpack_require__(20);
 context.keys().map(function (key) {
   modules = _objectSpread(_objectSpread({}, modules), context(key));
 });
+var vuexLocal = new _vuexPersist.default({
+  storage: _index.default,
+  reducer: function reducer(state) {
+    return {
+      common: {
+        pageCount: state.common.pageCount
+      }
+    };
+  }
+});
 var store = new _vuex.default.Store({
   modules: modules,
   state: {},
   getters: {},
   mutations: {},
-  plugins: [// createPersistedState({
-    //   reducer(state) {
-    //     //     return {
-    //     //       //   user: state,
-    //     //     };
-    //   },
-    // }),
-  ]
+  plugins: [vuexLocal.plugin]
 });
 var _default = store;
 exports.default = _default;
@@ -9272,7 +9278,289 @@ var demo = {
 exports.demo = demo;
 
 /***/ }),
-/* 22 */,
+/* 22 */
+/*!*****************************************************!*\
+  !*** ./node_modules/vuex-persist/dist/esm/index.js ***!
+  \*****************************************************/
+/*! exports provided: default, MockStorage, VuexPersistence */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MockStorage", function() { return MockStorage; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VuexPersistence", function() { return VuexPersistence; });
+/* harmony import */ var deepmerge__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! deepmerge */ 32);
+/* harmony import */ var deepmerge__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(deepmerge__WEBPACK_IMPORTED_MODULE_0__);
+
+
+/**
+ * Created by championswimmer on 22/07/17.
+ */
+let MockStorage;
+// @ts-ignore
+{
+    MockStorage = class {
+        get length() {
+            return Object.keys(this).length;
+        }
+        key(index) {
+            return Object.keys(this)[index];
+        }
+        setItem(key, data) {
+            this[key] = data.toString();
+        }
+        getItem(key) {
+            return this[key];
+        }
+        removeItem(key) {
+            delete this[key];
+        }
+        clear() {
+            for (let key of Object.keys(this)) {
+                delete this[key];
+            }
+        }
+    };
+}
+
+// tslint:disable: variable-name
+class SimplePromiseQueue {
+    constructor() {
+        this._queue = [];
+        this._flushing = false;
+    }
+    enqueue(promise) {
+        this._queue.push(promise);
+        if (!this._flushing) {
+            return this.flushQueue();
+        }
+        return Promise.resolve();
+    }
+    flushQueue() {
+        this._flushing = true;
+        const chain = () => {
+            const nextTask = this._queue.shift();
+            if (nextTask) {
+                return nextTask.then(chain);
+            }
+            else {
+                this._flushing = false;
+            }
+        };
+        return Promise.resolve(chain());
+    }
+}
+
+const options = {
+    replaceArrays: {
+        arrayMerge: (destinationArray, sourceArray, options) => sourceArray
+    },
+    concatArrays: {
+        arrayMerge: (target, source, options) => target.concat(...source)
+    }
+};
+function merge(into, from, mergeOption) {
+    return deepmerge__WEBPACK_IMPORTED_MODULE_0___default()(into, from, options[mergeOption]);
+}
+
+let FlattedJSON = JSON;
+/**
+ * A class that implements the vuex persistence.
+ * @type S type of the 'state' inside the store (default: any)
+ */
+class VuexPersistence {
+    /**
+     * Create a {@link VuexPersistence} object.
+     * Use the <code>plugin</code> function of this class as a
+     * Vuex plugin.
+     * @param {PersistOptions} options
+     */
+    constructor(options) {
+        // tslint:disable-next-line:variable-name
+        this._mutex = new SimplePromiseQueue();
+        /**
+         * Creates a subscriber on the store. automatically is used
+         * when this is used a vuex plugin. Not for manual usage.
+         * @param store
+         */
+        this.subscriber = (store) => (handler) => store.subscribe(handler);
+        if (typeof options === 'undefined')
+            options = {};
+        this.key = ((options.key != null) ? options.key : 'vuex');
+        this.subscribed = false;
+        this.supportCircular = options.supportCircular || false;
+        if (this.supportCircular) {
+            FlattedJSON = __webpack_require__(/*! flatted */ 33);
+        }
+        this.mergeOption = options.mergeOption || 'replaceArrays';
+        let localStorageLitmus = true;
+        try {
+            window.localStorage.getItem('');
+        }
+        catch (err) {
+            localStorageLitmus = false;
+        }
+        /**
+         * 1. First, prefer storage sent in optinos
+         * 2. Otherwise, use window.localStorage if available
+         * 3. Finally, try to use MockStorage
+         * 4. None of above? Well we gotta fail.
+         */
+        if (options.storage) {
+            this.storage = options.storage;
+        }
+        else if (localStorageLitmus) {
+            this.storage = window.localStorage;
+        }
+        else if (MockStorage) {
+            this.storage = new MockStorage();
+        }
+        else {
+            throw new Error("Neither 'window' is defined, nor 'MockStorage' is available");
+        }
+        /**
+         * How this works is -
+         *  1. If there is options.reducer function, we use that, if not;
+         *  2. We check options.modules;
+         *    1. If there is no options.modules array, we use entire state in reducer
+         *    2. Otherwise, we create a reducer that merges all those state modules that are
+         *        defined in the options.modules[] array
+         * @type {((state: S) => {}) | ((state: S) => S) | ((state: any) => {})}
+         */
+        this.reducer = ((options.reducer != null)
+            ? options.reducer
+            : ((options.modules == null)
+                ? ((state) => state)
+                : ((state) => options.modules.reduce((a, i) => merge(a, { [i]: state[i] }, this.mergeOption), { /* start empty accumulator*/}))));
+        this.filter = options.filter || ((mutation) => true);
+        this.strictMode = options.strictMode || false;
+        this.RESTORE_MUTATION = function RESTORE_MUTATION(state, savedState) {
+            const mergedState = merge(state, savedState || {}, this.mergeOption);
+            for (const propertyName of Object.keys(mergedState)) {
+                this._vm.$set(state, propertyName, mergedState[propertyName]);
+            }
+        };
+        this.asyncStorage = options.asyncStorage || false;
+        if (this.asyncStorage) {
+            /**
+             * Async {@link #VuexPersistence.restoreState} implementation
+             * @type {((key: string, storage?: Storage) =>
+             *      (Promise<S> | S)) | ((key: string, storage: AsyncStorage) => Promise<any>)}
+             */
+            this.restoreState = ((options.restoreState != null)
+                ? options.restoreState
+                : ((key, storage) => (storage).getItem(key)
+                    .then((value) => typeof value === 'string' // If string, parse, or else, just return
+                    ? (this.supportCircular
+                        ? FlattedJSON.parse(value || '{}')
+                        : JSON.parse(value || '{}'))
+                    : (value || {}))));
+            /**
+             * Async {@link #VuexPersistence.saveState} implementation
+             * @type {((key: string, state: {}, storage?: Storage) =>
+             *    (Promise<void> | void)) | ((key: string, state: {}, storage?: Storage) => Promise<void>)}
+             */
+            this.saveState = ((options.saveState != null)
+                ? options.saveState
+                : ((key, state, storage) => (storage).setItem(key, // Second argument is state _object_ if asyc storage, stringified otherwise
+                // do not stringify the state if the storage type is async
+                (this.asyncStorage
+                    ? merge({}, state || {}, this.mergeOption)
+                    : (this.supportCircular
+                        ? FlattedJSON.stringify(state)
+                        : JSON.stringify(state))))));
+            /**
+             * Async version of plugin
+             * @param {Store<S>} store
+             */
+            this.plugin = (store) => {
+                /**
+                 * For async stores, we're capturing the Promise returned
+                 * by the `restoreState()` function in a `restored` property
+                 * on the store itself. This would allow app developers to
+                 * determine when and if the store's state has indeed been
+                 * refreshed. This approach was suggested by GitHub user @hotdogee.
+                 * See https://github.com/championswimmer/vuex-persist/pull/118#issuecomment-500914963
+                 * @since 2.1.0
+                 */
+                store.restored = (this.restoreState(this.key, this.storage)).then((savedState) => {
+                    /**
+                     * If in strict mode, do only via mutation
+                     */
+                    if (this.strictMode) {
+                        store.commit('RESTORE_MUTATION', savedState);
+                    }
+                    else {
+                        store.replaceState(merge(store.state, savedState || {}, this.mergeOption));
+                    }
+                    this.subscriber(store)((mutation, state) => {
+                        if (this.filter(mutation)) {
+                            this._mutex.enqueue(this.saveState(this.key, this.reducer(state), this.storage));
+                        }
+                    });
+                    this.subscribed = true;
+                });
+            };
+        }
+        else {
+            /**
+             * Sync {@link #VuexPersistence.restoreState} implementation
+             * @type {((key: string, storage?: Storage) =>
+             *    (Promise<S> | S)) | ((key: string, storage: Storage) => (any | string | {}))}
+             */
+            this.restoreState = ((options.restoreState != null)
+                ? options.restoreState
+                : ((key, storage) => {
+                    const value = (storage).getItem(key);
+                    if (typeof value === 'string') { // If string, parse, or else, just return
+                        return (this.supportCircular
+                            ? FlattedJSON.parse(value || '{}')
+                            : JSON.parse(value || '{}'));
+                    }
+                    else {
+                        return (value || {});
+                    }
+                }));
+            /**
+             * Sync {@link #VuexPersistence.saveState} implementation
+             * @type {((key: string, state: {}, storage?: Storage) =>
+             *     (Promise<void> | void)) | ((key: string, state: {}, storage?: Storage) => Promise<void>)}
+             */
+            this.saveState = ((options.saveState != null)
+                ? options.saveState
+                : ((key, state, storage) => (storage).setItem(key, // Second argument is state _object_ if localforage, stringified otherwise
+                (this.supportCircular
+                    ? FlattedJSON.stringify(state)
+                    : JSON.stringify(state)))));
+            /**
+             * Sync version of plugin
+             * @param {Store<S>} store
+             */
+            this.plugin = (store) => {
+                const savedState = this.restoreState(this.key, this.storage);
+                if (this.strictMode) {
+                    store.commit('RESTORE_MUTATION', savedState);
+                }
+                else {
+                    store.replaceState(merge(store.state, savedState || {}, this.mergeOption));
+                }
+                this.subscriber(store)((mutation, state) => {
+                    if (this.filter(mutation)) {
+                        this.saveState(this.key, this.reducer(state), this.storage);
+                    }
+                });
+                this.subscribed = true;
+            };
+        }
+    }
+}
+
+/* harmony default export */ __webpack_exports__["default"] = (VuexPersistence);
+
+//# sourceMappingURL=index.js.map
+
+
+/***/ }),
 /* 23 */
 /*!******************************!*\
   !*** ./src/mixins/common.js ***!
@@ -9305,9 +9593,21 @@ exports.default = _default;
   !*** ./src/config/global.js ***!
   \******************************/
 /*! no static exports found */
-/***/ (function(module, exports) {
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
 
 
+Object.defineProperty(exports, "__esModule", {
+  value: true
+});
+exports.APP_NAME = exports.IMG_URL = exports.API_URL = void 0;
+var API_URL = "https://test.evshine.net";
+exports.API_URL = API_URL;
+var IMG_URL = "https://img.huaml.com";
+exports.IMG_URL = IMG_URL;
+var APP_NAME = "供货商app";
+exports.APP_NAME = APP_NAME;
 
 /***/ }),
 /* 25 */
@@ -10841,6 +11141,490 @@ var common = {
 };
 exports.common = common;
 
+/***/ }),
+/* 32 */
+/*!********************************************!*\
+  !*** ./node_modules/deepmerge/dist/cjs.js ***!
+  \********************************************/
+/*! no static exports found */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var isMergeableObject = function isMergeableObject(value) {
+	return isNonNullObject(value)
+		&& !isSpecial(value)
+};
+
+function isNonNullObject(value) {
+	return !!value && typeof value === 'object'
+}
+
+function isSpecial(value) {
+	var stringValue = Object.prototype.toString.call(value);
+
+	return stringValue === '[object RegExp]'
+		|| stringValue === '[object Date]'
+		|| isReactElement(value)
+}
+
+// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
+var canUseSymbol = typeof Symbol === 'function' && Symbol.for;
+var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;
+
+function isReactElement(value) {
+	return value.$$typeof === REACT_ELEMENT_TYPE
+}
+
+function emptyTarget(val) {
+    return Array.isArray(val) ? [] : {}
+}
+
+function cloneIfNecessary(value, optionsArgument) {
+    var clone = optionsArgument && optionsArgument.clone === true;
+    return (clone && isMergeableObject(value)) ? deepmerge(emptyTarget(value), value, optionsArgument) : value
+}
+
+function defaultArrayMerge(target, source, optionsArgument) {
+    var destination = target.slice();
+    source.forEach(function(e, i) {
+        if (typeof destination[i] === 'undefined') {
+            destination[i] = cloneIfNecessary(e, optionsArgument);
+        } else if (isMergeableObject(e)) {
+            destination[i] = deepmerge(target[i], e, optionsArgument);
+        } else if (target.indexOf(e) === -1) {
+            destination.push(cloneIfNecessary(e, optionsArgument));
+        }
+    });
+    return destination
+}
+
+function mergeObject(target, source, optionsArgument) {
+    var destination = {};
+    if (isMergeableObject(target)) {
+        Object.keys(target).forEach(function(key) {
+            destination[key] = cloneIfNecessary(target[key], optionsArgument);
+        });
+    }
+    Object.keys(source).forEach(function(key) {
+        if (!isMergeableObject(source[key]) || !target[key]) {
+            destination[key] = cloneIfNecessary(source[key], optionsArgument);
+        } else {
+            destination[key] = deepmerge(target[key], source[key], optionsArgument);
+        }
+    });
+    return destination
+}
+
+function deepmerge(target, source, optionsArgument) {
+    var sourceIsArray = Array.isArray(source);
+    var targetIsArray = Array.isArray(target);
+    var options = optionsArgument || { arrayMerge: defaultArrayMerge };
+    var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
+
+    if (!sourceAndTargetTypesMatch) {
+        return cloneIfNecessary(source, optionsArgument)
+    } else if (sourceIsArray) {
+        var arrayMerge = options.arrayMerge || defaultArrayMerge;
+        return arrayMerge(target, source, optionsArgument)
+    } else {
+        return mergeObject(target, source, optionsArgument)
+    }
+}
+
+deepmerge.all = function deepmergeAll(array, optionsArgument) {
+    if (!Array.isArray(array) || array.length < 2) {
+        throw new Error('first argument should be an array with at least two elements')
+    }
+
+    // we are sure there are at least 2 values, so it is safe to have no initial value
+    return array.reduce(function(prev, next) {
+        return deepmerge(prev, next, optionsArgument)
+    })
+};
+
+var deepmerge_1 = deepmerge;
+
+module.exports = deepmerge_1;
+
+
+/***/ }),
+/* 33 */
+/*!*******************************************!*\
+  !*** ./node_modules/flatted/esm/index.js ***!
+  \*******************************************/
+/*! exports provided: default, parse, stringify */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parse", function() { return parse; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "stringify", function() { return stringify; });
+var Flatted = (function (Primitive, primitive) {
+
+  /*!
+   * ISC License
+   *
+   * Copyright (c) 2018, Andrea Giammarchi, @WebReflection
+   *
+   * Permission to use, copy, modify, and/or distribute this software for any
+   * purpose with or without fee is hereby granted, provided that the above
+   * copyright notice and this permission notice appear in all copies.
+   *
+   * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+   * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+   * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+   * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+   * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+   * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+   * PERFORMANCE OF THIS SOFTWARE.
+   */
+
+  var Flatted = {
+
+    parse: function parse(text, reviver) {
+      var input = JSON.parse(text, Primitives).map(primitives);
+      var value = input[0];
+      var $ = reviver || noop;
+      var tmp = typeof value === 'object' && value ?
+                  revive(input, new Set, value, $) :
+                  value;
+      return $.call({'': tmp}, '', tmp);
+    },
+
+    stringify: function stringify(value, replacer, space) {
+      for (var
+        firstRun,
+        known = new Map,
+        input = [],
+        output = [],
+        $ = replacer && typeof replacer === typeof input ?
+              function (k, v) {
+                if (k === '' || -1 < replacer.indexOf(k)) return v;
+              } :
+              (replacer || noop),
+        i = +set(known, input, $.call({'': value}, '', value)),
+        replace = function (key, value) {
+          if (firstRun) {
+            firstRun = !firstRun;
+            return value;
+          }
+          var after = $.call(this, key, value);
+          switch (typeof after) {
+            case 'object':
+              if (after === null) return after;
+            case primitive:
+              return known.get(after) || set(known, input, after);
+          }
+          return after;
+        };
+        i < input.length; i++
+      ) {
+        firstRun = true;
+        output[i] = JSON.stringify(input[i], replace, space);
+      }
+      return '[' + output.join(',') + ']';
+    }
+
+  };
+
+  return Flatted;
+
+  function noop(key, value) {
+    return value;
+  }
+
+  function revive(input, parsed, output, $) {
+    return Object.keys(output).reduce(
+      function (output, key) {
+        var value = output[key];
+        if (value instanceof Primitive) {
+          var tmp = input[value];
+          if (typeof tmp === 'object' && !parsed.has(tmp)) {
+            parsed.add(tmp);
+            output[key] = $.call(output, key, revive(input, parsed, tmp, $));
+          } else {
+            output[key] = $.call(output, key, tmp);
+          }
+        } else
+          output[key] = $.call(output, key, value);
+        return output;
+      },
+      output
+    );
+  }
+
+  function set(known, input, value) {
+    var index = Primitive(input.push(value) - 1);
+    known.set(value, index);
+    return index;
+  }
+
+  // the two kinds of primitives
+  //  1. the real one
+  //  2. the wrapped one
+
+  function primitives(value) {
+    return value instanceof Primitive ? Primitive(value) : value;
+  }
+
+  function Primitives(key, value) {
+    return typeof value === primitive ? new Primitive(value) : value;
+  }
+
+}(String, 'string'));
+/* harmony default export */ __webpack_exports__["default"] = (Flatted);
+var parse = Flatted.parse;
+var stringify = Flatted.stringify;
+
+
+/***/ }),
+/* 34 */
+/*!************************************!*\
+  !*** ./src/utils/Storage/index.js ***!
+  \************************************/
+/*! no static exports found */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/* WEBPACK VAR INJECTION */(function(uni) {
+
+Object.defineProperty(exports, "__esModule", {
+  value: true
+});
+exports.default = void 0;
+
+var _Cookies = __webpack_require__(/*! ../Cookies */ 35);
+
+function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
+
+function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
+
+var DB_PREFIX = "company_";
+DB_PREFIX = "wx_company_";
+
+var localStore = /*#__PURE__*/function () {
+  function localStore() {
+    _classCallCheck(this, localStore);
+
+    this.prefix = DB_PREFIX;
+  }
+
+  _createClass(localStore, [{
+    key: "setItem",
+    value: function setItem(key, value, fn) {
+      try {
+        if (typeof value != "string") {
+          value = JSON.stringify(value);
+        }
+
+        uni.setStorage({
+          key: this.prefix + key,
+          data: value,
+          success: function success() {
+            fn && fn();
+          }
+        });
+      } catch (e) {}
+    }
+  }, {
+    key: "getItem",
+    value: function getItem(key, fn) {
+      if (!key) {
+        throw new Error("没有找到key。");
+        return;
+      }
+
+      if (_typeof(key) === "object") {
+        throw new Error("key不能是一个对象。");
+        return;
+      }
+
+      try {
+        var value = uni.getStorageSync(this.prefix + key);
+
+        if (value !== null) {
+          try {
+            value = JSON.parse(value);
+          } catch (e) {}
+        }
+
+        return value;
+      } catch (e) {// error
+      }
+    }
+  }, {
+    key: "removeItem",
+    value: function removeItem(key) {
+      try {
+        uni.removeStorageSync(this.prefix + key);
+      } catch (e) {// error
+      }
+    }
+  }, {
+    key: "clear",
+    value: function clear() {
+      try {
+        uni.clearStorageSync();
+      } catch (e) {// error
+      }
+    }
+  }]);
+
+  return localStore;
+}();
+
+var _default = new localStore();
+
+exports.default = _default;
+/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))
+
+/***/ }),
+/* 35 */
+/*!************************************!*\
+  !*** ./src/utils/Cookies/index.js ***!
+  \************************************/
+/*! no static exports found */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+  value: true
+});
+Object.defineProperty(exports, "Cookies", {
+  enumerable: true,
+  get: function get() {
+    return _cookies.Cookies;
+  }
+});
+
+var _cookies = __webpack_require__(/*! ./cookies.js */ 36);
+
+/***/ }),
+/* 36 */
+/*!**************************************!*\
+  !*** ./src/utils/Cookies/cookies.js ***!
+  \**************************************/
+/*! no static exports found */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+  value: true
+});
+exports.Cookies = void 0;
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
+
+function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
+
+var cookies = /*#__PURE__*/function () {
+  function cookies() {
+    _classCallCheck(this, cookies);
+  }
+
+  _createClass(cookies, [{
+    key: "put",
+
+    /* 初始化 */
+    // eslint-disable-next-line no-useless-constructor
+    // constructor() {}
+
+    /**
+     * @param name cookie名称
+     * @param value cookie值
+     * @param expires 过期时间(单位:秒)
+     * 设置cookie
+     */
+    value: function put(name, value, expires) {
+      expires = (expires || 30 * 24 * 60 * 60) * 1000; // 默认30天
+
+      var exp = new Date();
+      exp.setTime(exp.getTime() + expires);
+
+      try {
+        value = JSON.stringify(value); // eslint-disable-next-line no-empty
+      } catch (e) {}
+
+      document.cookie = "".concat(name, "=").concat(escape(value), ";path=/;expires=").concat(exp.toGMTString());
+    }
+    /**
+     * 获取cookie
+     * @param name
+     * @returns {null}
+     */
+
+  }, {
+    key: "get",
+    value: function get(name) {
+      // var arr, reg = new RegExp("(^| )" + this.prefix+'_'+name + "=([^;]*)(;|$)");
+      var arr;
+      var reg = new RegExp("(^| )".concat(name, "=([^;]*)(;|$)")); // eslint-disable-next-line no-cond-assign
+
+      if (arr = document.cookie.match(reg)) {
+        var result = unescape(arr[2]);
+
+        try {
+          return JSON.parse(result); // eslint-disable-next-line no-empty
+        } catch (e) {}
+
+        return result;
+      }
+
+      return null;
+    }
+    /**
+     * 删除cookie
+     * @param name
+     */
+
+  }, {
+    key: "remove",
+    value: function remove(name) {
+      var exp = new Date();
+      exp.setTime(exp.getTime() - 1);
+      var cval = this.get(name);
+
+      if (cval != null) {
+        document.cookie = "".concat(name, "=").concat(cval, ";path=/;expires=").concat(exp.toGMTString());
+      }
+    } // eslint-disable-next-line class-methods-use-this
+
+  }, {
+    key: "clear",
+    value: function clear() {
+      // eslint-disable-next-line no-useless-escape
+      var keys = document.cookie.match(/[^ =;]+(?=\=)/g);
+
+      if (keys) {
+        // eslint-disable-next-line no-plusplus
+        for (var i = keys.length; i--;) {
+          var date = new Date();
+          date.setTime(date.getTime() - 1);
+          document.cookie = "".concat(keys[i], "=; path=/expire=").concat(date.toGMTString());
+        }
+      }
+    }
+  }]);
+
+  return cookies;
+}(); // eslint-disable-next-line new-cap
+
+
+var Cookies = new cookies();
+exports.Cookies = Cookies;
+
 /***/ })
 ]]);
 //# sourceMappingURL=../../.sourcemap/mp-weixin/common/vendor.js.map

+ 15 - 10
ghs/package-lock.json

@@ -5562,6 +5562,11 @@
         "whatwg-url": "^7.0.0"
       }
     },
+    "dayjs": {
+      "version": "1.10.3",
+      "resolved": "https://registry.npm.taobao.org/dayjs/download/dayjs-1.10.3.tgz?cache=0&sync_timestamp=1610178181125&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fdayjs%2Fdownload%2Fdayjs-1.10.3.tgz",
+      "integrity": "sha1-zzNXyOf1CEMoJjcWcuvzdst9YZs="
+    },
     "de-indent": {
       "version": "1.0.2",
       "resolved": "https://registry.npm.taobao.org/de-indent/download/de-indent-1.0.2.tgz",
@@ -14310,11 +14315,6 @@
       "dev": true,
       "optional": true
     },
-    "shvl": {
-      "version": "2.0.1",
-      "resolved": "https://registry.npm.taobao.org/shvl/download/shvl-2.0.1.tgz",
-      "integrity": "sha1-5Jwht/IjBB3TkSxc6avyR0tp5oA="
-    },
     "signal-exit": {
       "version": "3.0.3",
       "resolved": "https://registry.npm.taobao.org/signal-exit/download/signal-exit-3.0.3.tgz",
@@ -15941,19 +15941,24 @@
       "resolved": "https://registry.npm.taobao.org/vuex/download/vuex-3.5.1.tgz",
       "integrity": "sha1-8bjc6mSbwlJUz09DWAgdv12hiz0="
     },
-    "vuex-persistedstate": {
-      "version": "4.0.0-beta.2",
-      "resolved": "https://registry.npm.taobao.org/vuex-persistedstate/download/vuex-persistedstate-4.0.0-beta.2.tgz",
-      "integrity": "sha1-cKxPh4xw//R0lrT6NlryoW1Cr1A=",
+    "vuex-persist": {
+      "version": "3.1.3",
+      "resolved": "https://registry.npm.taobao.org/vuex-persist/download/vuex-persist-3.1.3.tgz",
+      "integrity": "sha1-UYxyKiyjAmvO5XMvmdJPdc7g87Y=",
       "requires": {
         "deepmerge": "^4.2.2",
-        "shvl": "^2.0.0"
+        "flatted": "^3.0.5"
       },
       "dependencies": {
         "deepmerge": {
           "version": "4.2.2",
           "resolved": "https://registry.npm.taobao.org/deepmerge/download/deepmerge-4.2.2.tgz",
           "integrity": "sha1-RNLqNnm49NT/ujPwPYZfwee/SVU="
+        },
+        "flatted": {
+          "version": "3.1.0",
+          "resolved": "https://registry.npm.taobao.org/flatted/download/flatted-3.1.0.tgz?cache=0&sync_timestamp=1601444280913&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fflatted%2Fdownload%2Fflatted-3.1.0.tgz",
+          "integrity": "sha1-pdBrSosB46Y3cdqly3oZA+LlcGc="
         }
       }
     },

+ 4 - 1
ghs/package.json

@@ -14,6 +14,8 @@
     "build:mp-qq": "cross-env NODE_ENV=production UNI_PLATFORM=mp-qq vue-cli-service uni-build",
     "build:mp-toutiao": "cross-env NODE_ENV=production UNI_PLATFORM=mp-toutiao vue-cli-service uni-build",
     "build:mp-weixin": "cross-env NODE_ENV=production UNI_PLATFORM=mp-weixin vue-cli-service uni-build",
+    "build:mp-weixin:test": "cross-env NODE_ENV=production UNI_PLATFORM=mp-weixin vue-cli-service uni-build --mode test",
+    "build:mp-weixin:line": "cross-env NODE_ENV=production UNI_PLATFORM=mp-weixin vue-cli-service uni-build --mode line",
     "build:quickapp-native": "cross-env NODE_ENV=production UNI_PLATFORM=quickapp-native vue-cli-service uni-build",
     "build:quickapp-webview": "cross-env NODE_ENV=production UNI_PLATFORM=quickapp-webview vue-cli-service uni-build",
     "build:quickapp-webview-huawei": "cross-env NODE_ENV=production UNI_PLATFORM=quickapp-webview-huawei vue-cli-service uni-build",
@@ -53,11 +55,12 @@
     "@dcloudio/uni-quickapp-webview": "^2.0.0-28320200727001",
     "@dcloudio/uni-stat": "^2.0.0-28320200727001",
     "core-js": "^3.6.5",
+    "dayjs": "^1.10.3",
     "flyio": "^0.6.2",
     "regenerator-runtime": "^0.12.1",
     "vue": "^2.6.11",
     "vuex": "^3.2.0",
-    "vuex-persistedstate": "^4.0.0-beta.2"
+    "vuex-persist": "^3.1.3"
   },
   "devDependencies": {
     "@dcloudio/types": "*",

+ 4 - 0
ghs/src/config/global.js

@@ -0,0 +1,4 @@
+export const API_URL = process.env.VUE_APP_BASEHOST;
+export const IMG_URL = "https://img.huaml.com";
+
+export const APP_NAME = "供货商app";

+ 12 - 10
ghs/src/store/index.js

@@ -1,6 +1,7 @@
 import Vue from "vue";
 import Vuex from "vuex";
-// import createPersistedState from "vuex-persistedstate";
+import VuexPersistence from "vuex-persist";
+import Storage from "../utils/Storage/index";
 
 Vue.use(Vuex);
 
@@ -9,20 +10,21 @@ const context = require.context("./modules/", true, /\.js$/);
 context.keys().map((key) => {
   modules = { ...modules, ...context(key) };
 });
+
+const vuexLocal = new VuexPersistence({
+  storage: Storage,
+  reducer: (state) => ({
+    common: {
+      pageCount: state.common.pageCount,
+    },
+  }),
+});
 const store = new Vuex.Store({
   modules,
   state: {},
   getters: {},
   mutations: {},
-  plugins: [
-    // createPersistedState({
-    //   reducer(state) {
-    //     //     return {
-    //     //       //   user: state,
-    //     //     };
-    //   },
-    // }),
-  ],
+  plugins: [vuexLocal.plugin],
 });
 
 export default store;

+ 1 - 0
ghs/vue.config.js

@@ -44,4 +44,5 @@ module.exports = {
       },
     },
   },
+  transpileDependencies: ["vuex-persist"],
 };

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません