bxs-tools-ui 3.2.0 → 3.3.0

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.
Files changed (148) hide show
  1. package/README.md +20 -20
  2. package/es/add-and-take/index.css +1 -1
  3. package/es/add-and-take/index.js +283 -64
  4. package/es/adjust-baoe/index.css +1 -1
  5. package/es/adjust-baoe/index.js +444 -195
  6. package/es/business-card/index.css +1 -1
  7. package/es/business-card/index.js +1 -0
  8. package/es/canvas-poster/index.css +1 -1
  9. package/es/canvas-poster/index.js +1 -0
  10. package/es/index.css +1 -1
  11. package/es/index.js +936 -824
  12. package/es/insure-calculate/index.css +1 -1
  13. package/es/insure-calculate/index.js +438 -265
  14. package/es/person-info/index.css +1 -1
  15. package/es/person-info/index.js +296 -1370
  16. package/es/product-info/index.css +1 -1
  17. package/es/product-info/index.js +644 -548
  18. package/es/share-sheet/index.css +1 -1
  19. package/es/share-sheet/index.js +313 -21
  20. package/es/utils/index.js +530 -429
  21. package/lib/add-and-take/index.css +1 -1
  22. package/lib/add-and-take/index.js +283 -64
  23. package/lib/adjust-baoe/index.css +1 -1
  24. package/lib/adjust-baoe/index.js +441 -194
  25. package/lib/business-card/index.css +1 -1
  26. package/lib/business-card/index.js +1 -0
  27. package/lib/canvas-poster/index.css +1 -1
  28. package/lib/canvas-poster/index.js +1 -0
  29. package/lib/index.css +1 -1
  30. package/lib/index.js +939 -826
  31. package/lib/insure-calculate/index.css +1 -1
  32. package/lib/insure-calculate/index.js +438 -268
  33. package/lib/person-info/index.css +1 -1
  34. package/lib/person-info/index.js +295 -1372
  35. package/lib/product-info/index.css +1 -1
  36. package/lib/product-info/index.js +645 -550
  37. package/lib/share-sheet/index.css +1 -1
  38. package/lib/share-sheet/index.js +313 -25
  39. package/lib/utils/index.js +531 -433
  40. package/package.json +9 -7
  41. package/packages/add-and-take/components/interest-form.less +144 -0
  42. package/packages/add-and-take/components/interest-form.vue +179 -179
  43. package/packages/add-and-take/components/interest-items.less +87 -0
  44. package/packages/add-and-take/components/interest-items.vue +67 -80
  45. package/packages/add-and-take/components/interest-table.less +111 -0
  46. package/packages/add-and-take/components/interest-table.vue +31 -31
  47. package/packages/add-and-take/constant.ts +2 -2
  48. package/packages/add-and-take/demo/index.vue +89 -86
  49. package/packages/add-and-take/handler.ts +52 -57
  50. package/packages/add-and-take/index.less +69 -0
  51. package/packages/add-and-take/index.vue +156 -156
  52. package/packages/add-and-take/readme.md +87 -98
  53. package/packages/adjust-baoe/demo/index.vue +37 -47
  54. package/packages/adjust-baoe/index.less +125 -0
  55. package/packages/adjust-baoe/index.vue +134 -147
  56. package/packages/adjust-baoe/readme.md +35 -45
  57. package/packages/business-card/demo/index.vue +7 -7
  58. package/packages/business-card/index.less +100 -0
  59. package/packages/business-card/index.vue +18 -21
  60. package/packages/business-card/readme.md +46 -53
  61. package/packages/bxs-utils/demo/index.vue +2 -2
  62. package/packages/bxs-utils/index.ts +5 -5
  63. package/packages/bxs-utils/planbook/common.ts +56 -92
  64. package/packages/bxs-utils/planbook/index.ts +4 -4
  65. package/packages/bxs-utils/planbook/insurance.ts +137 -127
  66. package/packages/bxs-utils/planbook/person.ts +143 -147
  67. package/packages/bxs-utils/planbook/product.ts +473 -509
  68. package/packages/bxs-utils/readme.md +94 -84
  69. package/packages/bxs-utils/trade/index.js +1 -1
  70. package/packages/bxs-utils/trade/insureCalculate.js +91 -204
  71. package/packages/canvas-poster/demo/index.vue +9 -13
  72. package/packages/canvas-poster/index.less +5 -0
  73. package/packages/canvas-poster/index.vue +68 -79
  74. package/packages/canvas-poster/readme.md +106 -109
  75. package/packages/index.ts +1 -1
  76. package/packages/insure-calculate/demo/index.vue +20 -20
  77. package/packages/insure-calculate/index.less +366 -0
  78. package/packages/insure-calculate/index.vue +305 -329
  79. package/packages/insure-calculate/readme.md +99 -106
  80. package/packages/person-info/crm-popup.vue +81 -80
  81. package/packages/person-info/demo/index.vue +25 -37
  82. package/packages/person-info/index-inline.less +11 -0
  83. package/packages/person-info/index.vue +53 -83
  84. package/packages/person-info/readme.md +109 -115
  85. package/packages/planbook-input/components/footer.less +54 -0
  86. package/packages/planbook-input/components/footer.vue +8 -64
  87. package/packages/planbook-input/components/handler.js +33 -44
  88. package/packages/planbook-input/components/product-table.less +235 -0
  89. package/packages/planbook-input/components/product-table.vue +114 -108
  90. package/packages/planbook-input/demo/index.vue +3 -3
  91. package/packages/planbook-input/helper.js +852 -465
  92. package/packages/planbook-input/index.less +30 -0
  93. package/packages/planbook-input/index.vue +86 -103
  94. package/packages/planbook-input/readme.md +72 -90
  95. package/packages/product-info/demo/constant.js +1 -1
  96. package/packages/product-info/demo/index.vue +31 -43
  97. package/packages/product-info/index.less +271 -0
  98. package/packages/product-info/index.vue +198 -210
  99. package/packages/product-info/readme.md +72 -75
  100. package/packages/share-sheet/constant.js +4 -4
  101. package/packages/share-sheet/demo/index.vue +10 -10
  102. package/packages/share-sheet/handler.js +14 -14
  103. package/packages/share-sheet/index.less +201 -0
  104. package/packages/share-sheet/index.vue +39 -39
  105. package/packages/share-sheet/readme.md +121 -127
  106. package/src/api/add-and-take.js +45 -0
  107. package/src/api/adjust-baoe.js +16 -0
  108. package/src/api/index.js +6 -0
  109. package/src/api/planbook.js +93 -0
  110. package/src/api/request.js +211 -0
  111. package/src/api/trade.js +56 -0
  112. package/src/api/user.js +18 -0
  113. package/src/components/common/common-age-birthday.less +66 -0
  114. package/src/components/common/common-age-birthday.vue +27 -95
  115. package/src/components/common/common-popup.less +81 -0
  116. package/src/components/common/common-popup.vue +12 -96
  117. package/src/components/common/common-radio.less +75 -0
  118. package/src/components/common/common-radio.vue +13 -91
  119. package/src/components/common/common-select.less +13 -0
  120. package/src/components/common/common-select.vue +21 -38
  121. package/src/components/common/common-title.less +115 -0
  122. package/src/components/common/common-title.vue +24 -24
  123. package/src/js/loading.js +6 -6
  124. package/src/js/md5Token.js +38 -44
  125. package/src/js/utils.js +45 -53
  126. package/src/js/variables.js +47 -25
  127. package/src/style/base.less +18 -0
  128. package/src/style/color.less +40 -0
  129. package/src/style/variables.less +21 -42
  130. package/packages/add-and-take/api.ts +0 -70
  131. package/packages/add-and-take/components/interest-form.css +0 -146
  132. package/packages/add-and-take/components/interest-items.css +0 -87
  133. package/packages/add-and-take/components/interest-table.css +0 -113
  134. package/packages/add-and-take/index.css +0 -70
  135. package/packages/adjust-baoe/index.css +0 -123
  136. package/packages/business-card/index.css +0 -101
  137. package/packages/canvas-poster/index.css +0 -5
  138. package/packages/insure-calculate/index.css +0 -368
  139. package/packages/planbook-input/api.js +0 -29
  140. package/packages/planbook-input/components/product-table.css +0 -236
  141. package/packages/planbook-input/index.css +0 -31
  142. package/packages/product-info/index.css +0 -264
  143. package/packages/share-sheet/index.css +0 -203
  144. package/src/components/common/common-title.css +0 -116
  145. package/src/js/request.js +0 -64
  146. package/src/style/apply.css +0 -25
  147. package/src/style/base.css +0 -36
  148. package/src/style/color.css +0 -74
@@ -2,8 +2,11 @@ import 'vant/lib/toast/index.css';
2
2
  import _Toast from 'vant/lib/toast';
3
3
  import Vue from 'vue';
4
4
  import { memoize, get as get$3 } from 'lodash';
5
+ import 'md5';
6
+ import 'crypto-js';
7
+ import 'vant/lib/dialog/index.css';
8
+ import _Dialog from 'vant/lib/dialog';
5
9
  import QS from 'qs';
6
- import axios from 'axios';
7
10
 
8
11
  function asyncGeneratorStep(n, t, e, r, o, a, c) {
9
12
  try {
@@ -905,6 +908,49 @@ function Prop(options) {
905
908
  };
906
909
  }
907
910
 
911
+ /**转换时间字符串
912
+ * @Author Lizh
913
+ * @DateTime 2020-04-16
914
+ * @param {[type]} time [description]
915
+ * @param {[type]} cFormat [description]
916
+ * @return {[type]} [description]
917
+ */
918
+ function parseTime(time, cFormat) {
919
+ if (arguments.length === 0) {
920
+ return null;
921
+ }
922
+ var format = cFormat;
923
+ var date;
924
+ if (time === null) {
925
+ return;
926
+ } else if (_typeof$2(time) === 'object') {
927
+ date = time;
928
+ } else {
929
+ if (('' + time).length === 10) time = parseInt(time) * 1000;
930
+ date = new Date(time);
931
+ }
932
+ var formatObj = {
933
+ y: date.getFullYear(),
934
+ m: date.getMonth() + 1,
935
+ d: date.getDate(),
936
+ h: date.getHours(),
937
+ i: date.getMinutes(),
938
+ s: date.getSeconds(),
939
+ a: date.getDay()
940
+ };
941
+ var timeStr = format.replace(/{(y|m|d|h|i|s|a)+}/g, function (result, key) {
942
+ var value = formatObj[key];
943
+ if (key === 'a') {
944
+ return ['日', '一', '二', '三', '四', '五', '六'][value];
945
+ }
946
+ if (result.length > 0 && value < 10) {
947
+ value = '0' + value;
948
+ }
949
+ return value || 0;
950
+ });
951
+ return timeStr;
952
+ }
953
+
908
954
  var jax$1 = {exports: {}};
909
955
 
910
956
  var dayjs_min$1 = {exports: {}};
@@ -8873,12 +8919,27 @@ var jaxExports = requireJax();
8873
8919
  const Jax = /*@__PURE__*/getDefaultExportFromCjs(jaxExports);
8874
8920
 
8875
8921
  var getStandardOrigin = Jax.urlUtil.getStandardOrigin;
8922
+ var _Jax$parseUaString = Jax.parseUaString();
8923
+ _Jax$parseUaString.isApp;
8924
+ _Jax$parseUaString.appType;
8925
+ _Jax$parseUaString.appVersion;
8926
+ _Jax$parseUaString.isAndroid;
8927
+ _Jax$parseUaString.isIos;
8928
+ _Jax$parseUaString.isBxsApp;
8929
+ _Jax$parseUaString.isBaoXiaoZhuApp;
8930
+ _Jax$parseUaString.isBrokerApp;
8931
+ _Jax$parseUaString.isYjjApp;
8932
+ _Jax$parseUaString.isToBApp;
8933
+ _Jax$parseUaString.isRongYiBaoApp;
8934
+ _Jax$parseUaString.isWeChat;
8935
+ _Jax$parseUaString.appScheme;
8876
8936
  var hostname = window && window.location && window.location.hostname || '';
8877
8937
  /** 当前页 host 为 cppoc- 前缀时,请求 loading 使用 Vant Toast,否则走 appBridge */
8878
8938
  var IS_CPPOC_HOST = hostname.startsWith('cppoc-');
8879
8939
  var IS_PRODUCT_ENV = hostname.search(/(winbaoxian|ai-baoxiaozhu)\.com/) !== -1;
8880
8940
  hostname.search(/(winbaoxian|ai-baoxiaozhu)\.cn/) !== -1;
8881
8941
  hostname.search(/localhost|192\.168|127\.0\.0\.1|dev\.winbaoxian\.cn/) !== -1;
8942
+ var IS_LOCALHOST_IP_ENV = hostname.search(/192\.168/) !== -1;
8882
8943
  var IS_UAT_ENV = hostname.includes("pbf-uat.");
8883
8944
  var IS_ENABLE_DEBUG = !IS_PRODUCT_ENV;
8884
8945
  if (IS_ENABLE_DEBUG) {
@@ -8886,6 +8947,9 @@ if (IS_ENABLE_DEBUG) {
8886
8947
  }
8887
8948
  hostname.includes('ai-baoxiaozhu') ? 'ai-baoxiaozhu' : 'winbaoxian';
8888
8949
  function getFullOrigin(data) {
8950
+ if (IS_LOCALHOST_IP_ENV) {
8951
+ return "https://".concat(data, ".winbaoxian.cn");
8952
+ }
8889
8953
  var _prefixDomain = IS_CPPOC_HOST ? 'cppoc-' : '';
8890
8954
  if (typeof data === 'string') {
8891
8955
  return getStandardOrigin("".concat(_prefixDomain).concat(data));
@@ -8901,6 +8965,8 @@ function getFullOrigin(data) {
8901
8965
  var APP_HOSTNAME = getFullOrigin('app');
8902
8966
  getFullOrigin('pbf');
8903
8967
  var PLANBOOK_API_HOSTNAME = getFullOrigin("bxs-planbook-api".concat(IS_UAT_ENV ? '-uat' : ''));
8968
+ /** 险种试算等 trade 接口(insurance2a-api) */
8969
+ var INSURANCE2A_API_HOSTNAME = "https://insurance2a-api.wyins.net".concat(IS_PRODUCT_ENV ? '' : '.cn');
8904
8970
  getUrlParams();
8905
8971
  function getUrlParams(url) {
8906
8972
  var _url = location.search || '';
@@ -8908,47 +8974,328 @@ function getUrlParams(url) {
8908
8974
  return _searchStr ? QS.parse(_searchStr) : {};
8909
8975
  }
8910
8976
 
8911
- /**转换时间字符串
8912
- * @Author Lizh
8913
- * @DateTime 2020-04-16
8914
- * @param {[type]} time [description]
8915
- * @param {[type]} cFormat [description]
8916
- * @return {[type]} [description]
8917
- */
8918
- function parseTime(time, cFormat) {
8919
- if (arguments.length === 0) {
8920
- return null;
8977
+ function showLoading() {
8978
+ if (IS_CPPOC_HOST) {
8979
+ _Toast.loading({
8980
+ message: '加载中...',
8981
+ forbidClick: true
8982
+ });
8983
+ } else if (window.appBridge && window.appBridge.showLoading) {
8984
+ window.appBridge.showLoading();
8921
8985
  }
8922
- var format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}';
8923
- var date;
8924
- if (time === null) {
8925
- return;
8926
- } else if (_typeof$2(time) === 'object') {
8927
- date = time;
8928
- } else {
8929
- if (('' + time).length === 10) time = parseInt(time) * 1000;
8930
- date = new Date(time);
8986
+ }
8987
+ function hideLoading() {
8988
+ if (IS_CPPOC_HOST) {
8989
+ _Toast.clear();
8990
+ } else if (window.appBridge && window.appBridge.hideLoading) {
8991
+ window.appBridge.hideLoading();
8931
8992
  }
8932
- var formatObj = {
8933
- y: date.getFullYear(),
8934
- m: date.getMonth() + 1,
8935
- d: date.getDate(),
8936
- h: date.getHours(),
8937
- i: date.getMinutes(),
8938
- s: date.getSeconds(),
8939
- a: date.getDay()
8993
+ }
8994
+
8995
+ function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
8996
+ function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), true).forEach(function (r) { _defineProperty$1(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
8997
+ var options$1 = {
8998
+ baseURL: PLANBOOK_API_HOSTNAME,
8999
+ withCredentials: true,
9000
+ timeout: 10000,
9001
+ headers: {
9002
+ 'X-Requested-With': 'XMLHttpRequest'
9003
+ }
9004
+ };
9005
+ var loadingTimer = null;
9006
+ var showRequestLoading = function showRequestLoading() {
9007
+ if (loadingTimer) {
9008
+ clearTimeout(loadingTimer);
9009
+ }
9010
+ loadingTimer = setTimeout(function () {
9011
+ showLoading();
9012
+ }, 300);
9013
+ };
9014
+ var hideRequestLoading = function hideRequestLoading() {
9015
+ if (loadingTimer) {
9016
+ hideLoading();
9017
+ }
9018
+ if (loadingTimer) {
9019
+ clearTimeout(loadingTimer);
9020
+ }
9021
+ };
9022
+ var normalizeMethod = function normalizeMethod(method) {
9023
+ return (method || 'get').toUpperCase();
9024
+ };
9025
+ var serializeParams = function serializeParams(params) {
9026
+ if (!params) {
9027
+ return '';
9028
+ }
9029
+ var queryParts = [];
9030
+ Object.keys(params).forEach(function (key) {
9031
+ var value = params[key];
9032
+ if (value === undefined || value === null) {
9033
+ return;
9034
+ }
9035
+ if (Array.isArray(value)) {
9036
+ value.forEach(function (item) {
9037
+ queryParts.push("".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(item)));
9038
+ });
9039
+ return;
9040
+ }
9041
+ queryParts.push("".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(value)));
9042
+ });
9043
+ return queryParts.join('&');
9044
+ };
9045
+ var isAbsoluteUrl = function isAbsoluteUrl(url) {
9046
+ return /^https?:\/\//.test(url);
9047
+ };
9048
+ var buildUrl = function buildUrl(baseURL, url, params) {
9049
+ var queryString = serializeParams(params);
9050
+ var requestUrl = isAbsoluteUrl(url) ? url : "".concat(baseURL).concat(url);
9051
+ if (!queryString) {
9052
+ return requestUrl;
9053
+ }
9054
+ return "".concat(requestUrl).concat(requestUrl.includes('?') ? '&' : '?').concat(queryString);
9055
+ };
9056
+ var isPlainObject = function isPlainObject(value) {
9057
+ return Object.prototype.toString.call(value) === '[object Object]';
9058
+ };
9059
+ var buildBody = function buildBody(data, headers) {
9060
+ if (data === undefined || data === null) {
9061
+ return undefined;
9062
+ }
9063
+ if (data instanceof FormData || data instanceof Blob || typeof data === 'string') {
9064
+ return data;
9065
+ }
9066
+ if (isPlainObject(data) || Array.isArray(data)) {
9067
+ if (!headers['Content-Type']) {
9068
+ headers['Content-Type'] = 'application/json';
9069
+ }
9070
+ return JSON.stringify(data);
9071
+ }
9072
+ return data;
9073
+ };
9074
+ var parseResponse = /*#__PURE__*/function () {
9075
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(response) {
9076
+ var contentType, text;
9077
+ return _regeneratorRuntime.wrap(function (_context) {
9078
+ while (1) switch (_context.prev = _context.next) {
9079
+ case 0:
9080
+ contentType = response.headers.get('content-type') || '';
9081
+ if (!contentType.includes('application/json')) {
9082
+ _context.next = 1;
9083
+ break;
9084
+ }
9085
+ return _context.abrupt("return", response.json());
9086
+ case 1:
9087
+ _context.next = 2;
9088
+ return response.text();
9089
+ case 2:
9090
+ text = _context.sent;
9091
+ if (text) {
9092
+ _context.next = 3;
9093
+ break;
9094
+ }
9095
+ return _context.abrupt("return", {});
9096
+ case 3:
9097
+ _context.prev = 3;
9098
+ return _context.abrupt("return", JSON.parse(text));
9099
+ case 4:
9100
+ _context.prev = 4;
9101
+ _context["catch"](3);
9102
+ return _context.abrupt("return", {
9103
+ data: text
9104
+ });
9105
+ case 5:
9106
+ case "end":
9107
+ return _context.stop();
9108
+ }
9109
+ }, _callee, null, [[3, 4]]);
9110
+ }));
9111
+ return function parseResponse(_x) {
9112
+ return _ref.apply(this, arguments);
8940
9113
  };
8941
- var timeStr = format.replace(/{(y|m|d|h|i|s|a)+}/g, function (result, key) {
8942
- var value = formatObj[key];
8943
- if (key === 'a') {
8944
- return ['日', '', '二', '三', '四', '五', '六'][value];
9114
+ }();
9115
+ var createTimeoutError = function createTimeoutError(timeout) {
9116
+ var error = new Error("timeout of ".concat(timeout, "ms exceeded"));
9117
+ error.name = 'TimeoutError';
9118
+ return error;
9119
+ };
9120
+ var request = /*#__PURE__*/function () {
9121
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(config) {
9122
+ var url, _config$baseURL, baseURL, _config$method, method, params, data, _config$headers, headers, isIgnoreLoading, _config$timeout, timeout, _config$withCredentia, withCredentials, returnFullResponse, requestHeaders, timeoutId, fetchPromise, response, res, error, code, messageMap, message, _t2;
9123
+ return _regeneratorRuntime.wrap(function (_context2) {
9124
+ while (1) switch (_context2.prev = _context2.next) {
9125
+ case 0:
9126
+ url = config.url, _config$baseURL = config.baseURL, baseURL = _config$baseURL === void 0 ? options$1.baseURL : _config$baseURL, _config$method = config.method, method = _config$method === void 0 ? 'get' : _config$method, params = config.params, data = config.data, _config$headers = config.headers, headers = _config$headers === void 0 ? {} : _config$headers, isIgnoreLoading = config.isIgnoreLoading, _config$timeout = config.timeout, timeout = _config$timeout === void 0 ? options$1.timeout : _config$timeout, _config$withCredentia = config.withCredentials, withCredentials = _config$withCredentia === void 0 ? options$1.withCredentials : _config$withCredentia, returnFullResponse = config.returnFullResponse;
9127
+ if (!isIgnoreLoading) {
9128
+ showRequestLoading();
9129
+ }
9130
+ requestHeaders = _objectSpread$1(_objectSpread$1({}, options$1.headers), headers);
9131
+ timeoutId = null;
9132
+ _context2.prev = 1;
9133
+ fetchPromise = fetch(buildUrl(baseURL, url, params), {
9134
+ method: normalizeMethod(method),
9135
+ headers: requestHeaders,
9136
+ body: normalizeMethod(method) === 'GET' ? undefined : buildBody(data, requestHeaders),
9137
+ credentials: withCredentials ? 'include' : 'same-origin'
9138
+ });
9139
+ _context2.next = 2;
9140
+ return Promise.race([fetchPromise, new Promise(function (resolve, reject) {
9141
+ timeoutId = setTimeout(function () {
9142
+ reject(createTimeoutError(timeout));
9143
+ }, timeout);
9144
+ })]);
9145
+ case 2:
9146
+ response = _context2.sent;
9147
+ _context2.next = 3;
9148
+ return parseResponse(response);
9149
+ case 3:
9150
+ res = _context2.sent;
9151
+ if (response.ok) {
9152
+ _context2.next = 4;
9153
+ break;
9154
+ }
9155
+ error = new Error("Request failed with status code ".concat(response.status));
9156
+ error.response = {
9157
+ status: response.status,
9158
+ data: res
9159
+ };
9160
+ throw error;
9161
+ case 4:
9162
+ code = res.code;
9163
+ if (!['002012', '002013', '002015'].includes(code)) {
9164
+ _context2.next = 5;
9165
+ break;
9166
+ }
9167
+ messageMap = {
9168
+ m002012: '当前账号因操作频繁被限制,请明天再试。感谢理解',
9169
+ m002013: '您的操作频率较高,已达到今日生成上限。请稍后再试或明天继续使用,感谢您的理解!',
9170
+ m002015: '您今天做了太多计划书了,休息一下,明天再来吧'
9171
+ };
9172
+ message = messageMap["m".concat(code)];
9173
+ if (message) {
9174
+ _Dialog.alert({
9175
+ message: message,
9176
+ confirmButtonText: '知道了',
9177
+ confirmButtonColor: '#0A64FE'
9178
+ });
9179
+ }
9180
+ return _context2.abrupt("return", Promise.reject({
9181
+ code: code,
9182
+ message: message
9183
+ }));
9184
+ case 5:
9185
+ if (!(code === 401 || res.status === 401)) {
9186
+ _context2.next = 6;
9187
+ break;
9188
+ }
9189
+ gotoLogin();
9190
+ return _context2.abrupt("return", Promise.reject('status: 401'));
9191
+ case 6:
9192
+ if (!(res.success && res.data === -1)) {
9193
+ _context2.next = 7;
9194
+ break;
9195
+ }
9196
+ gotoLogin();
9197
+ return _context2.abrupt("return", Promise.reject('login: -1'));
9198
+ case 7:
9199
+ return _context2.abrupt("return", returnFullResponse ? res : res.data);
9200
+ case 8:
9201
+ _context2.prev = 8;
9202
+ _t2 = _context2["catch"](1);
9203
+ if (_t2.response && _t2.response.status == 401) {
9204
+ gotoLogin();
9205
+ }
9206
+ return _context2.abrupt("return", Promise.reject(_t2));
9207
+ case 9:
9208
+ _context2.prev = 9;
9209
+ if (timeoutId) {
9210
+ clearTimeout(timeoutId);
9211
+ }
9212
+ hideRequestLoading();
9213
+ return _context2.finish(9);
9214
+ case 10:
9215
+ case "end":
9216
+ return _context2.stop();
9217
+ }
9218
+ }, _callee2, null, [[1, 8, 9, 10]]);
9219
+ }));
9220
+ return function request(_x2) {
9221
+ return _ref2.apply(this, arguments);
9222
+ };
9223
+ }();
9224
+
9225
+ function getCommonCurrentUser(params) {
9226
+ return request({
9227
+ url: '/planBook/common/currentUser',
9228
+ method: 'get',
9229
+ params: params,
9230
+ isIgnoreLoading: false
9231
+ });
9232
+ }
9233
+
9234
+ function getPlanbookInsuranceVerifyData(params) {
9235
+ return request({
9236
+ baseURL: APP_HOSTNAME,
9237
+ url: '/planBook/input/insurance/verifyData',
9238
+ method: 'post',
9239
+ data: params,
9240
+ headers: {
9241
+ Accept: 'application/json, text/plain, */*',
9242
+ 'Content-Type': 'application/json;'
8945
9243
  }
8946
- if (result.length > 0 && value < 10) {
8947
- value = '0' + value;
9244
+ });
9245
+ }
9246
+
9247
+ /**
9248
+ * C 端地区码(POST `…/api/product/data/getAreaCode`)
9249
+ * @param {object} data 如 `{ pageType, productId }`
9250
+ * @param {string} [userUuid] 有则拼到 query(与原先 `getApiUrl(getAreaCodeApi)` 行为一致)
9251
+ */
9252
+ function getAddress(data, userUuid) {
9253
+ var url = "".concat(INSURANCE2A_API_HOSTNAME, "/api/product/data/getAreaCode");
9254
+ if (userUuid && url.indexOf('userUuid') === -1) {
9255
+ if (url.indexOf('?') === -1) {
9256
+ url += "?userUuid=".concat(encodeURIComponent(userUuid));
9257
+ } else {
9258
+ url += "&userUuid=".concat(encodeURIComponent(userUuid));
8948
9259
  }
8949
- return value || 0;
9260
+ }
9261
+ return request({
9262
+ url: url,
9263
+ method: 'post',
9264
+ data: data,
9265
+ headers: {
9266
+ Accept: 'application/json, text/plain, */*',
9267
+ 'Content-Type': 'application/json'
9268
+ },
9269
+ isIgnoreLoading: false,
9270
+ returnFullResponse: true
9271
+ });
9272
+ }
9273
+
9274
+ /**
9275
+ * 险种保费试算 `/api/product/data/calculate`
9276
+ */
9277
+ function postProductDataCalculate(urlParams, postParams) {
9278
+ var path = '/api/product/data/calculate';
9279
+ if (urlParams && urlParams.uuid) {
9280
+ path += "?userUuid=".concat(encodeURIComponent(urlParams.uuid));
9281
+ } else if (urlParams && urlParams.openId) {
9282
+ path += "?userUuid=".concat(encodeURIComponent(urlParams.openId));
9283
+ }
9284
+ if (urlParams && urlParams.appid) {
9285
+ path += path.includes('?') ? "&appId=".concat(encodeURIComponent(urlParams.appid)) : "?appId=".concat(encodeURIComponent(urlParams.appid));
9286
+ }
9287
+ return request({
9288
+ baseURL: INSURANCE2A_API_HOSTNAME,
9289
+ url: path,
9290
+ method: 'post',
9291
+ data: postParams,
9292
+ headers: {
9293
+ Accept: 'application/json, text/plain, */*',
9294
+ 'Content-Type': 'application/json'
9295
+ },
9296
+ isIgnoreLoading: false,
9297
+ returnFullResponse: true
8950
9298
  });
8951
- return timeStr;
8952
9299
  }
8953
9300
 
8954
9301
  /*!
@@ -13960,7 +14307,7 @@ Schema.warning = warning;
13960
14307
  Schema.messages = messages;
13961
14308
  Schema.validators = validators;
13962
14309
 
13963
- /*! bxs-vue-ui v4.2.1 */
14310
+ /*! bxs-vue-ui v4.2.4 */
13964
14311
 
13965
14312
  var fails = function (exec) {
13966
14313
  try {
@@ -33301,12 +33648,21 @@ var TASK_STATUS = {
33301
33648
  FAILED: '上传失败'
33302
33649
  }; // 本地开发环境上传代理
33303
33650
 
33304
- var PROXY_URL = 'http://192.168.180.194:9673/oss/upload';
33651
+ var PROXY_URL = 'http://192.168.180.194:9673/oss/upload'; // 科技侧 OSS 鉴权(含 cppoc POC 环境:在 hostname 加 cppoc- 前缀)
33652
+
33653
+ var OSS_TECH_AUTH = {
33654
+ authUrlTest: 'https://management.winbaoxian.cn/oss/getAuthInfo',
33655
+ authUrlProd: 'https://management.winbaoxian.com/oss/getAuthInfo'
33656
+ };
33657
+ var OSS_TECH_AUTH_CPPOC = {
33658
+ authUrlTest: 'https://cppoc-management.zytst.cn/oss/getAuthInfo',
33659
+ authUrlProd: 'https://cppoc-management.zytst.com/oss/getAuthInfo'
33660
+ };
33305
33661
  var OSS_INFO_LIST = [{
33306
33662
  type: 1,
33307
33663
  // 微易科技
33308
- authUrlTest: 'https://test.winbaoxian.com/management/oss/getAuthInfo',
33309
- authUrlProd: 'https://management.winbaoxian.com/oss/getAuthInfo'
33664
+ authUrlTest: OSS_TECH_AUTH.authUrlTest,
33665
+ authUrlProd: OSS_TECH_AUTH.authUrlProd
33310
33666
  }, {
33311
33667
  type: 2,
33312
33668
  // 微易保险经纪
@@ -34279,22 +34635,29 @@ var script$J = create({
34279
34635
  }) || {};
34280
34636
  },
34281
34637
  authUrl: function authUrl() {
34638
+ var _context;
34639
+
34282
34640
  var hostName = window.location.hostname;
34641
+ var isProd = /^.*\.com$/.test(hostName) && hostName !== 'test.winbaoxian.com' || /^.*\.net$/.test(hostName); // 访问域名含 cppoc 时统一走科技侧鉴权(带 cppoc- 前缀),与 ossType 无关
34283
34642
 
34284
- if (/^.*\.com$/.test(hostName) && hostName !== 'test.winbaoxian.com' || /^.*\.net$/.test(hostName)) {
34643
+ if (indexOf$4(_context = window.location.href).call(_context, 'cppoc') > -1) {
34644
+ return isProd ? OSS_TECH_AUTH_CPPOC.authUrlProd : OSS_TECH_AUTH_CPPOC.authUrlTest;
34645
+ }
34646
+
34647
+ if (isProd) {
34285
34648
  return this.ossInfo.authUrlProd;
34286
34649
  }
34287
34650
 
34288
34651
  return this.ossInfo.authUrlTest;
34289
34652
  },
34290
34653
  message: function message() {
34291
- var _context;
34654
+ var _context2;
34292
34655
 
34293
34656
  if (this.errorMessage) {
34294
34657
  return this.errorMessage;
34295
34658
  }
34296
34659
 
34297
- var failedImages = filter$2(_context = this.images).call(_context, function (item) {
34660
+ var failedImages = filter$2(_context2 = this.images).call(_context2, function (item) {
34298
34661
  return item.status === TASK_STATUS.FAILED;
34299
34662
  });
34300
34663
 
@@ -34682,9 +35045,9 @@ var script$J = create({
34682
35045
 
34683
35046
  this.addTasks(files);
34684
35047
  this.getAuthInfo().then(function (authInfo) {
34685
- var _context2;
35048
+ var _context3;
34686
35049
 
34687
- forEach$2(_context2 = _this6.tasks).call(_context2, function (task) {
35050
+ forEach$2(_context3 = _this6.tasks).call(_context3, function (task) {
34688
35051
  if (task.status === TASK_STATUS.READY) {
34689
35052
  _this6.taskStart(task);
34690
35053
 
@@ -34755,7 +35118,7 @@ var script$J = create({
34755
35118
  task.host = authInfo.host;
34756
35119
  var file = this.handleFile ? task.newFile : this.getBlobByDataURI(task);
34757
35120
  this.getSuffix(task.file.name, file).then(function (suffix) {
34758
- var _context3;
35121
+ var _context4;
34759
35122
 
34760
35123
  var key = "" + authInfo.dir + new Date().getTime() + "_" + _this8.randomString(15) + suffix;
34761
35124
  var formData = new FormData();
@@ -34764,7 +35127,7 @@ var script$J = create({
34764
35127
  formData.append('policy', authInfo.policy);
34765
35128
  formData.append('OSSAccessKeyId', authInfo.accessid);
34766
35129
  formData.append('key', key);
34767
- var protocol = indexOf$4(_context3 = authInfo.cdnMediaHost).call(_context3, '//') === 0 ? 'https:' : '';
35130
+ var protocol = indexOf$4(_context4 = authInfo.cdnMediaHost).call(_context4, '//') === 0 ? 'https:' : '';
34768
35131
  task.imageUrl = protocol + authInfo.cdnMediaHost + key;
34769
35132
  formData.append('file', file);
34770
35133
  task.formData = formData;
@@ -34931,9 +35294,9 @@ var script$J = create({
34931
35294
  image.content = null;
34932
35295
  this.$set(this.images, index, image);
34933
35296
  } else {
34934
- var _context4;
35297
+ var _context5;
34935
35298
 
34936
- splice$2(_context4 = this.images).call(_context4, index, 1);
35299
+ splice$2(_context5 = this.images).call(_context5, index, 1);
34937
35300
  }
34938
35301
 
34939
35302
  this.$emit('delete', {
@@ -37360,151 +37723,11 @@ document && document.cookie && document.cookie.match('ENABLE_LIZHAO_DEBUG=1');
37360
37723
  * @returns {Promise<any>} 产品下所有险种的费率
37361
37724
  */
37362
37725
  memoize(function (params) {
37363
- var url = "".concat(APP_HOSTNAME, "/planBook/input/insurance/verifyData");
37364
- return fetch(url, {
37365
- method: 'POST',
37366
- credentials: 'include',
37367
- headers: {
37368
- Accept: 'application/json, text/plain, */*',
37369
- 'Content-Type': 'application/json;'
37370
- },
37371
- body: JSON.stringify(params)
37372
- }).then(function (response) {
37373
- return response.json();
37374
- }).then(function (_ref) {
37375
- var success = _ref.success,
37376
- data = _ref.data;
37377
- if (!success || !data) {
37378
- return Promise.reject();
37379
- }
37380
- return Promise.resolve(data);
37381
- }).catch(function () {});
37726
+ return getPlanbookInsuranceVerifyData(params).catch(function () {});
37382
37727
  }, function (params) {
37383
37728
  return QS.stringify(params);
37384
37729
  });
37385
37730
 
37386
- function showLoading() {
37387
- if (IS_CPPOC_HOST) {
37388
- _Toast.loading({
37389
- message: '加载中...',
37390
- forbidClick: true
37391
- });
37392
- } else if (window.appBridge && window.appBridge.showLoading) {
37393
- window.appBridge.showLoading();
37394
- }
37395
- }
37396
- function hideLoading() {
37397
- if (IS_CPPOC_HOST) {
37398
- _Toast.clear();
37399
- } else if (window.appBridge && window.appBridge.hideLoading) {
37400
- window.appBridge.hideLoading();
37401
- }
37402
- }
37403
-
37404
- // 创建axios实例
37405
- var service = axios.create({
37406
- baseURL: APP_HOSTNAME,
37407
- withCredentials: true,
37408
- timeout: 10000,
37409
- // 请求超时时间
37410
- headers: {
37411
- 'X-Requested-With': 'XMLHttpRequest'
37412
- }
37413
- });
37414
- var loadingTimer = null;
37415
- var loading = function loading(show) {
37416
- if (show) {
37417
- showLoading();
37418
- } else {
37419
- hideLoading();
37420
- }
37421
- };
37422
-
37423
- // request拦截器
37424
- service.interceptors.request.use(function (config) {
37425
- if (loadingTimer) clearTimeout(loadingTimer);
37426
- loadingTimer = setTimeout(function () {
37427
- loading(true);
37428
- }, 300);
37429
- return config;
37430
- }, function (error) {
37431
- // Do something with request error
37432
- console.log(error); // for debug
37433
- Promise.reject(error);
37434
- });
37435
-
37436
- // respone拦截器
37437
- service.interceptors.response.use(function (response) {
37438
- if (loadingTimer) clearTimeout(loadingTimer);
37439
- loading(false);
37440
- var res = response.data;
37441
- if (res.code === 401 || res.status === 401) {
37442
- // gotoLogin()
37443
- return Promise.reject('login');
37444
- }
37445
- return res;
37446
- }, function (error) {
37447
- if (loadingTimer) clearTimeout(loadingTimer);
37448
- loading(false);
37449
- if (error.response && error.response.status == 401) {
37450
- // gotoLogin()
37451
- return Promise.reject('login');
37452
- }
37453
- console.log('err' + error); // for debug
37454
- return Promise.reject(error);
37455
- });
37456
-
37457
- var baseURL = "https://insurance2a-api.wyins.net".concat(IS_PRODUCT_ENV ? '' : '.cn');
37458
-
37459
- /**
37460
- * **获取地址信息**
37461
- * @ignore
37462
- * @author watson
37463
- * @date 2022-04-26
37464
- * @param {string} fetchUrl api url
37465
- * @param {object} data 接口传参
37466
- * @returns {object} addressData
37467
- */
37468
- function getAddress(fetchUrl, data) {
37469
- return new Promise(function (resolve, reject) {
37470
- service({
37471
- baseURL: fetchUrl,
37472
- url: undefined,
37473
- method: 'POST',
37474
- urlParams: undefined,
37475
- data: data
37476
- }).then(function (res) {
37477
- resolve(res);
37478
- }).catch(function (err) {
37479
- reject(err);
37480
- });
37481
- });
37482
- }
37483
-
37484
- /**
37485
- * **获取用户信息**
37486
- * @ignore
37487
- * @author watson
37488
- * @date 2022-04-26
37489
- * @param {string} fetchUrl api url
37490
- * @returns {promise}
37491
- */
37492
- function getUuid(fetchUrl) {
37493
- return new Promise(function (resolve, reject) {
37494
- service({
37495
- baseURL: fetchUrl,
37496
- url: undefined,
37497
- method: 'GET',
37498
- urlParams: undefined,
37499
- data: null
37500
- }).then(function (res) {
37501
- resolve(res);
37502
- }).catch(function (err) {
37503
- reject(err);
37504
- });
37505
- });
37506
- }
37507
-
37508
37731
  /**
37509
37732
  * **计划书初始化参数**
37510
37733
  * @ignore
@@ -37722,55 +37945,31 @@ function insureCalculate(urlParams, postParams, planParams) {
37722
37945
  if (postParams && !postParams.scenario) {
37723
37946
  postParams.scenario = 'h5Widget';
37724
37947
  }
37725
- var url = '/api/product/data/calculate';
37726
- if (urlParams && urlParams.uuid) {
37727
- url += "?userUuid=".concat(urlParams.uuid);
37728
- } else if (urlParams && urlParams.openId) {
37729
- url += "?userUuid=".concat(urlParams.openId);
37730
- }
37731
- if (urlParams && urlParams.appid) {
37732
- if (url.indexOf('?') > -1) {
37733
- url += "&appId=".concat(urlParams.appid);
37734
- } else {
37735
- url += "?appId=".concat(urlParams.appid);
37736
- }
37737
- }
37738
37948
  if (hasPlanParams(planParams) && postParams.current_data) {
37739
37949
  postParams.current_data = tranlateCurrentData(postParams.current_data, planParams);
37740
37950
  }
37741
- return new Promise(function (resolve, reject) {
37742
- service({
37743
- baseURL: baseURL,
37744
- url: url,
37745
- method: 'POST',
37746
- urlParams: urlParams,
37747
- data: postParams
37748
- }).then(function (res) {
37749
- if (res.code === 200) {
37750
- var data = JSON.parse(JSON.stringify(res.data));
37751
- if (hasPlanParams(planParams)) {
37752
- var widgets = data.widgets;
37753
- var currentData = data.current_data;
37754
- translatePlanData(widgets, currentData, planParams);
37755
- }
37756
- var cData = {
37757
- widgets: data.widgets,
37758
- total_premium: data.total_premium,
37759
- terms: data.terms,
37760
- product_id: data.product_id,
37761
- current_data: data.current_data,
37762
- risk_premiums: data.risk_premiums
37763
- };
37764
- resolve({
37765
- code: 200,
37766
- data: cData
37767
- });
37768
- } else {
37769
- reject(res);
37770
- }
37771
- }).catch(function (err) {
37772
- reject(err);
37773
- });
37951
+ return postProductDataCalculate(urlParams, postParams).then(function (res) {
37952
+ if (res.code === 200) {
37953
+ var data = JSON.parse(JSON.stringify(res.data));
37954
+ if (hasPlanParams(planParams)) {
37955
+ var widgets = data.widgets;
37956
+ var currentData = data.current_data;
37957
+ translatePlanData(widgets, currentData, planParams);
37958
+ }
37959
+ var cData = {
37960
+ widgets: data.widgets,
37961
+ total_premium: data.total_premium,
37962
+ terms: data.terms,
37963
+ product_id: data.product_id,
37964
+ current_data: data.current_data,
37965
+ risk_premiums: data.risk_premiums
37966
+ };
37967
+ return {
37968
+ code: 200,
37969
+ data: cData
37970
+ };
37971
+ }
37972
+ return Promise.reject(res);
37774
37973
  });
37775
37974
  }
37776
37975
 
@@ -37857,9 +38056,6 @@ var InsureCalculate = (_dec = Component({
37857
38056
  args[_key] = arguments[_key];
37858
38057
  }
37859
38058
  _this = _callSuper(this, InsureCalculate, [].concat(args));
37860
- _defineProperty$1(_this, "getCalculateApi", '');
37861
- _defineProperty$1(_this, "getAreaCodeApi", '');
37862
- _defineProperty$1(_this, "getUuidApi", '');
37863
38059
  _defineProperty$1(_this, "widgets", []);
37864
38060
  _defineProperty$1(_this, "originData", {});
37865
38061
  _defineProperty$1(_this, "hasCalculateData", false);
@@ -37929,7 +38125,7 @@ var InsureCalculate = (_dec = Component({
37929
38125
  }
37930
38126
  _context.prev = 1;
37931
38127
  _context.next = 2;
37932
- return getUuid(vm.getUuidApi);
38128
+ return getCommonCurrentUser();
37933
38129
  case 2:
37934
38130
  userInfo = _context.sent;
37935
38131
  if (userInfo && userInfo.data && userInfo.data.uuid) {
@@ -38097,7 +38293,7 @@ var InsureCalculate = (_dec = Component({
38097
38293
  key: "showAddress",
38098
38294
  value: function () {
38099
38295
  var _showAddress = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(item) {
38100
- var vm, url, data, addressData, _t2;
38296
+ var vm, data, addressData, _t2;
38101
38297
  return _regeneratorRuntime.wrap(function (_context2) {
38102
38298
  while (1) switch (_context2.prev = _context2.next) {
38103
38299
  case 0:
@@ -38107,13 +38303,12 @@ var InsureCalculate = (_dec = Component({
38107
38303
  vm.returnClassify = item.values ? JSON.parse(item.values) : [];
38108
38304
  _context2.prev = 1;
38109
38305
  // 获取地址信息
38110
- url = vm.getApiUrl(vm.getAreaCodeApi);
38111
38306
  data = {
38112
38307
  pageType: 'detail',
38113
38308
  productId: String(vm.productId)
38114
38309
  };
38115
38310
  _context2.next = 2;
38116
- return getAddress(url, data);
38311
+ return getAddress(data, vm.getU());
38117
38312
  case 2:
38118
38313
  addressData = _context2.sent;
38119
38314
  if (addressData && addressData.code === 200) {
@@ -38671,19 +38866,6 @@ var InsureCalculate = (_dec = Component({
38671
38866
  value: function getU() {
38672
38867
  return this.uuid || this.uuidFromApi;
38673
38868
  }
38674
- }, {
38675
- key: "getApiUrl",
38676
- value: function getApiUrl(url) {
38677
- var u = url;
38678
- if (this.getU() && u.indexOf('userUuid') === -1) {
38679
- if (u.indexOf('?') === -1) {
38680
- u += "?userUuid=".concat(this.getU());
38681
- } else {
38682
- u += "&userUuid=".concat(this.getU());
38683
- }
38684
- }
38685
- return u;
38686
- }
38687
38869
  }, {
38688
38870
  key: "setIsDevelop",
38689
38871
  value: function setIsDevelop() {
@@ -38695,15 +38877,6 @@ var InsureCalculate = (_dec = Component({
38695
38877
  if (this.isDev === true || this.isDev === false) {
38696
38878
  this.isDevelop = this.isDev;
38697
38879
  }
38698
- if (this.isDevelop) {
38699
- this.getCalculateApi = 'https://insurance2a-api.wyins.net.cn/api/product/data/calculate';
38700
- this.getAreaCodeApi = 'https://insurance2a-api.wyins.net.cn/api/product/data/getAreaCode';
38701
- this.getUuidApi = "".concat(PLANBOOK_API_HOSTNAME, "/planBook/common/currentUser");
38702
- } else {
38703
- this.getCalculateApi = 'https://insurance2a-api.wyins.net/api/product/data/calculate';
38704
- this.getAreaCodeApi = 'https://insurance2a-api.wyins.net/api/product/data/getAreaCode';
38705
- this.getUuidApi = "".concat(PLANBOOK_API_HOSTNAME, "/planBook/common/currentUser");
38706
- }
38707
38880
  }
38708
38881
  }]);
38709
38882
  }(Vue), _descriptor = _applyDecoratedDescriptor(_class2.prototype, "showHeader", [_dec2], {