@smart100/spu-web-plugin 1.0.25-beta.2 → 1.0.25-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- var version = "1.0.25-beta.2";
1
+ var version = "1.0.25-beta.3";
2
2
 
3
3
  /** Detect free variable `global` from Node.js. */
4
4
  var freeGlobal$2 = typeof global == 'object' && global && global.Object === Object && global;
@@ -18768,6 +18768,8 @@ var getDistance = /*#__PURE__*/function () {
18768
18768
  }();
18769
18769
 
18770
18770
  var modulekey = '';
18771
+ var customerid = '';
18772
+ var customertype = '';
18771
18773
  var SpuConfig = /*#__PURE__*/function () {
18772
18774
  function SpuConfig() {
18773
18775
  _classCallCheck$1(this, SpuConfig);
@@ -18779,40 +18781,54 @@ var SpuConfig = /*#__PURE__*/function () {
18779
18781
  key: "getFun",
18780
18782
  value: function () {
18781
18783
  var _getFun = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee() {
18782
- var res, _res$data;
18784
+ var _res$data, _res$data2, res, _res$data3, _res$data4;
18783
18785
  return _regeneratorRuntime$1().wrap(function _callee$(_context) {
18784
18786
  while (1) switch (_context.prev = _context.next) {
18785
18787
  case 0:
18786
18788
  if (this.isload) {
18787
- _context.next = 12;
18789
+ _context.next = 14;
18788
18790
  break;
18789
18791
  }
18790
18792
  _context.prev = 1;
18791
18793
  _context.next = 4;
18792
18794
  return spuAxios.post('/lifecycle/getconfigdata', {
18793
18795
  // modulekey: 'litheformspu'
18794
- modulekey: modulekey
18796
+ modulekey: modulekey,
18797
+ customerid: customerid,
18798
+ customertype: customertype
18795
18799
  });
18796
18800
  case 4:
18797
18801
  res = _context.sent;
18802
+ // TODO 9.3.3后 res.data中增加extend字段记录额外的数据,也需要返回,这里需要做一个兼容的数据格式
18803
+ if (!(res !== null && res !== void 0 && (_res$data = res.data) !== null && _res$data !== void 0 && _res$data.configs)) {
18804
+ res.data.configs = [];
18805
+ }
18806
+ if (res !== null && res !== void 0 && (_res$data2 = res.data) !== null && _res$data2 !== void 0 && _res$data2.extend) {
18807
+ res.data.configs.push({
18808
+ descr: 'getconfigdata接口的extend字段信息',
18809
+ dataid: '__system_getconfigdata_extend',
18810
+ type: 'json',
18811
+ context: JSON.stringify((res === null || res === void 0 || (_res$data3 = res.data) === null || _res$data3 === void 0 ? void 0 : _res$data3.extend) || {})
18812
+ });
18813
+ }
18798
18814
  // console.log(res)
18799
18815
  // debugger
18800
18816
  if (res.code === 200) {
18801
- this.cache = (res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.configs) || [];
18817
+ this.cache = (res === null || res === void 0 || (_res$data4 = res.data) === null || _res$data4 === void 0 ? void 0 : _res$data4.configs) || [];
18802
18818
  }
18803
- _context.next = 11;
18819
+ _context.next = 13;
18804
18820
  break;
18805
- case 8:
18806
- _context.prev = 8;
18821
+ case 10:
18822
+ _context.prev = 10;
18807
18823
  _context.t0 = _context["catch"](1);
18808
18824
  console.error(_context.t0);
18809
- case 11:
18825
+ case 13:
18810
18826
  this.isload = true;
18811
- case 12:
18827
+ case 14:
18812
18828
  case "end":
18813
18829
  return _context.stop();
18814
18830
  }
18815
- }, _callee, this, [[1, 8]]);
18831
+ }, _callee, this, [[1, 10]]);
18816
18832
  }));
18817
18833
  function getFun() {
18818
18834
  return _getFun.apply(this, arguments);
@@ -18875,6 +18891,8 @@ var SpuConfig = /*#__PURE__*/function () {
18875
18891
  }();
18876
18892
  function installSpuConfig(options) {
18877
18893
  modulekey = options.modulekey;
18894
+ customerid = options.customerid;
18895
+ customertype = options.customertype;
18878
18896
  }
18879
18897
  var spuConfig = new SpuConfig();
18880
18898
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smart100/spu-web-plugin",
3
- "version": "1.0.25-beta.2",
3
+ "version": "1.0.25-beta.3",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "dev": "npm run build:types && rollup -c -w",
package/src/spuConfig.ts CHANGED
@@ -2,6 +2,8 @@ import { spuAxios } from './axios'
2
2
  import { cloneDeep } from 'lodash-es'
3
3
 
4
4
  let modulekey = ''
5
+ let customerid = ''
6
+ let customertype = ''
5
7
 
6
8
  class SpuConfig {
7
9
  private isload = false
@@ -13,8 +15,23 @@ class SpuConfig {
13
15
  try {
14
16
  const res = await spuAxios.post('/lifecycle/getconfigdata', {
15
17
  // modulekey: 'litheformspu'
16
- modulekey: modulekey
18
+ modulekey: modulekey,
19
+ customerid: customerid,
20
+ customertype: customertype
17
21
  })
22
+
23
+ // TODO 9.3.3后 res.data中增加extend字段记录额外的数据,也需要返回,这里需要做一个兼容的数据格式
24
+ if (!res?.data?.configs) {
25
+ res.data.configs = []
26
+ }
27
+ if (res?.data?.extend) {
28
+ res.data.configs.push({
29
+ descr: 'getconfigdata接口的extend字段信息',
30
+ dataid: '__system_getconfigdata_extend',
31
+ type: 'json',
32
+ context: JSON.stringify(res?.data?.extend || {})
33
+ })
34
+ }
18
35
  // console.log(res)
19
36
  // debugger
20
37
  if (res.code === 200) {
@@ -99,6 +116,8 @@ class SpuConfig {
99
116
 
100
117
  function installSpuConfig(options: any) {
101
118
  modulekey = options.modulekey
119
+ customerid = options.customerid
120
+ customertype = options.customertype
102
121
  }
103
122
 
104
123
  const spuConfig = new SpuConfig()