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
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vant/lib/toast/index.css'), require('vant/lib/toast'), require('vue'), require('lodash'), require('qs'), require('axios')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'vant/lib/toast/index.css', 'vant/lib/toast', 'vue', 'lodash', 'qs', 'axios'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.BXT = {}, null, global._Toast, global.Vue, global._, global.QS, global.axios));
5
- })(this, (function (exports, index_css, _Toast, Vue, lodash, QS, axios) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vant/lib/toast/index.css'), require('vant/lib/toast'), require('vue'), require('lodash'), require('md5'), require('crypto-js'), require('vant/lib/dialog/index.css'), require('vant/lib/dialog'), require('qs')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'vant/lib/toast/index.css', 'vant/lib/toast', 'vue', 'lodash', 'md5', 'crypto-js', 'vant/lib/dialog/index.css', 'vant/lib/dialog', 'qs'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.BXT = {}, null, global._Toast, global.Vue, global._, global.md5, global.CryptoJS, null, global._Dialog, global.QS));
5
+ })(this, (function (exports, index_css, _Toast, Vue, lodash, MD5, CryptoJS, index_css$1, _Dialog, QS) { 'use strict';
6
6
 
7
7
  function asyncGeneratorStep(n, t, e, r, o, a, c) {
8
8
  try {
@@ -904,6 +904,49 @@
904
904
  };
905
905
  }
906
906
 
907
+ /**转换时间字符串
908
+ * @Author Lizh
909
+ * @DateTime 2020-04-16
910
+ * @param {[type]} time [description]
911
+ * @param {[type]} cFormat [description]
912
+ * @return {[type]} [description]
913
+ */
914
+ function parseTime(time, cFormat) {
915
+ if (arguments.length === 0) {
916
+ return null;
917
+ }
918
+ var format = cFormat;
919
+ var date;
920
+ if (time === null) {
921
+ return;
922
+ } else if (_typeof$2(time) === 'object') {
923
+ date = time;
924
+ } else {
925
+ if (('' + time).length === 10) time = parseInt(time) * 1000;
926
+ date = new Date(time);
927
+ }
928
+ var formatObj = {
929
+ y: date.getFullYear(),
930
+ m: date.getMonth() + 1,
931
+ d: date.getDate(),
932
+ h: date.getHours(),
933
+ i: date.getMinutes(),
934
+ s: date.getSeconds(),
935
+ a: date.getDay()
936
+ };
937
+ var timeStr = format.replace(/{(y|m|d|h|i|s|a)+}/g, function (result, key) {
938
+ var value = formatObj[key];
939
+ if (key === 'a') {
940
+ return ['日', '一', '二', '三', '四', '五', '六'][value];
941
+ }
942
+ if (result.length > 0 && value < 10) {
943
+ value = '0' + value;
944
+ }
945
+ return value || 0;
946
+ });
947
+ return timeStr;
948
+ }
949
+
907
950
  var jax$1 = {exports: {}};
908
951
 
909
952
  var dayjs_min$1 = {exports: {}};
@@ -8872,12 +8915,27 @@
8872
8915
  var Jax = /*@__PURE__*/getDefaultExportFromCjs(jaxExports);
8873
8916
 
8874
8917
  var getStandardOrigin = Jax.urlUtil.getStandardOrigin;
8918
+ var _Jax$parseUaString = Jax.parseUaString();
8919
+ _Jax$parseUaString.isApp;
8920
+ _Jax$parseUaString.appType;
8921
+ _Jax$parseUaString.appVersion;
8922
+ _Jax$parseUaString.isAndroid;
8923
+ _Jax$parseUaString.isIos;
8924
+ _Jax$parseUaString.isBxsApp;
8925
+ _Jax$parseUaString.isBaoXiaoZhuApp;
8926
+ _Jax$parseUaString.isBrokerApp;
8927
+ _Jax$parseUaString.isYjjApp;
8928
+ _Jax$parseUaString.isToBApp;
8929
+ _Jax$parseUaString.isRongYiBaoApp;
8930
+ _Jax$parseUaString.isWeChat;
8931
+ _Jax$parseUaString.appScheme;
8875
8932
  var hostname = window && window.location && window.location.hostname || '';
8876
8933
  /** 当前页 host 为 cppoc- 前缀时,请求 loading 使用 Vant Toast,否则走 appBridge */
8877
8934
  var IS_CPPOC_HOST = hostname.startsWith('cppoc-');
8878
8935
  var IS_PRODUCT_ENV = hostname.search(/(winbaoxian|ai-baoxiaozhu)\.com/) !== -1;
8879
8936
  hostname.search(/(winbaoxian|ai-baoxiaozhu)\.cn/) !== -1;
8880
8937
  hostname.search(/localhost|192\.168|127\.0\.0\.1|dev\.winbaoxian\.cn/) !== -1;
8938
+ var IS_LOCALHOST_IP_ENV = hostname.search(/192\.168/) !== -1;
8881
8939
  var IS_UAT_ENV = hostname.includes("pbf-uat.");
8882
8940
  var IS_ENABLE_DEBUG = !IS_PRODUCT_ENV;
8883
8941
  if (IS_ENABLE_DEBUG) {
@@ -8885,6 +8943,9 @@
8885
8943
  }
8886
8944
  hostname.includes('ai-baoxiaozhu') ? 'ai-baoxiaozhu' : 'winbaoxian';
8887
8945
  function getFullOrigin(data) {
8946
+ if (IS_LOCALHOST_IP_ENV) {
8947
+ return "https://".concat(data, ".winbaoxian.cn");
8948
+ }
8888
8949
  var _prefixDomain = IS_CPPOC_HOST ? 'cppoc-' : '';
8889
8950
  if (typeof data === 'string') {
8890
8951
  return getStandardOrigin("".concat(_prefixDomain).concat(data));
@@ -8900,6 +8961,8 @@
8900
8961
  var APP_HOSTNAME = getFullOrigin('app');
8901
8962
  getFullOrigin('pbf');
8902
8963
  var PLANBOOK_API_HOSTNAME = getFullOrigin("bxs-planbook-api".concat(IS_UAT_ENV ? '-uat' : ''));
8964
+ /** 险种试算等 trade 接口(insurance2a-api) */
8965
+ var INSURANCE2A_API_HOSTNAME = "https://insurance2a-api.wyins.net".concat(IS_PRODUCT_ENV ? '' : '.cn');
8903
8966
  getUrlParams();
8904
8967
  function getUrlParams(url) {
8905
8968
  var _url = location.search || '';
@@ -8907,47 +8970,328 @@
8907
8970
  return _searchStr ? QS.parse(_searchStr) : {};
8908
8971
  }
8909
8972
 
8910
- /**转换时间字符串
8911
- * @Author Lizh
8912
- * @DateTime 2020-04-16
8913
- * @param {[type]} time [description]
8914
- * @param {[type]} cFormat [description]
8915
- * @return {[type]} [description]
8916
- */
8917
- function parseTime(time, cFormat) {
8918
- if (arguments.length === 0) {
8919
- return null;
8973
+ function showLoading() {
8974
+ if (IS_CPPOC_HOST) {
8975
+ _Toast.loading({
8976
+ message: '加载中...',
8977
+ forbidClick: true
8978
+ });
8979
+ } else if (window.appBridge && window.appBridge.showLoading) {
8980
+ window.appBridge.showLoading();
8920
8981
  }
8921
- var format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}';
8922
- var date;
8923
- if (time === null) {
8924
- return;
8925
- } else if (_typeof$2(time) === 'object') {
8926
- date = time;
8927
- } else {
8928
- if (('' + time).length === 10) time = parseInt(time) * 1000;
8929
- date = new Date(time);
8982
+ }
8983
+ function hideLoading() {
8984
+ if (IS_CPPOC_HOST) {
8985
+ _Toast.clear();
8986
+ } else if (window.appBridge && window.appBridge.hideLoading) {
8987
+ window.appBridge.hideLoading();
8930
8988
  }
8931
- var formatObj = {
8932
- y: date.getFullYear(),
8933
- m: date.getMonth() + 1,
8934
- d: date.getDate(),
8935
- h: date.getHours(),
8936
- i: date.getMinutes(),
8937
- s: date.getSeconds(),
8938
- a: date.getDay()
8989
+ }
8990
+
8991
+ 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; }
8992
+ 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; }
8993
+ var options$1 = {
8994
+ baseURL: PLANBOOK_API_HOSTNAME,
8995
+ withCredentials: true,
8996
+ timeout: 10000,
8997
+ headers: {
8998
+ 'X-Requested-With': 'XMLHttpRequest'
8999
+ }
9000
+ };
9001
+ var loadingTimer = null;
9002
+ var showRequestLoading = function showRequestLoading() {
9003
+ if (loadingTimer) {
9004
+ clearTimeout(loadingTimer);
9005
+ }
9006
+ loadingTimer = setTimeout(function () {
9007
+ showLoading();
9008
+ }, 300);
9009
+ };
9010
+ var hideRequestLoading = function hideRequestLoading() {
9011
+ if (loadingTimer) {
9012
+ hideLoading();
9013
+ }
9014
+ if (loadingTimer) {
9015
+ clearTimeout(loadingTimer);
9016
+ }
9017
+ };
9018
+ var normalizeMethod = function normalizeMethod(method) {
9019
+ return (method || 'get').toUpperCase();
9020
+ };
9021
+ var serializeParams = function serializeParams(params) {
9022
+ if (!params) {
9023
+ return '';
9024
+ }
9025
+ var queryParts = [];
9026
+ Object.keys(params).forEach(function (key) {
9027
+ var value = params[key];
9028
+ if (value === undefined || value === null) {
9029
+ return;
9030
+ }
9031
+ if (Array.isArray(value)) {
9032
+ value.forEach(function (item) {
9033
+ queryParts.push("".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(item)));
9034
+ });
9035
+ return;
9036
+ }
9037
+ queryParts.push("".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(value)));
9038
+ });
9039
+ return queryParts.join('&');
9040
+ };
9041
+ var isAbsoluteUrl = function isAbsoluteUrl(url) {
9042
+ return /^https?:\/\//.test(url);
9043
+ };
9044
+ var buildUrl = function buildUrl(baseURL, url, params) {
9045
+ var queryString = serializeParams(params);
9046
+ var requestUrl = isAbsoluteUrl(url) ? url : "".concat(baseURL).concat(url);
9047
+ if (!queryString) {
9048
+ return requestUrl;
9049
+ }
9050
+ return "".concat(requestUrl).concat(requestUrl.includes('?') ? '&' : '?').concat(queryString);
9051
+ };
9052
+ var isPlainObject = function isPlainObject(value) {
9053
+ return Object.prototype.toString.call(value) === '[object Object]';
9054
+ };
9055
+ var buildBody = function buildBody(data, headers) {
9056
+ if (data === undefined || data === null) {
9057
+ return undefined;
9058
+ }
9059
+ if (data instanceof FormData || data instanceof Blob || typeof data === 'string') {
9060
+ return data;
9061
+ }
9062
+ if (isPlainObject(data) || Array.isArray(data)) {
9063
+ if (!headers['Content-Type']) {
9064
+ headers['Content-Type'] = 'application/json';
9065
+ }
9066
+ return JSON.stringify(data);
9067
+ }
9068
+ return data;
9069
+ };
9070
+ var parseResponse = /*#__PURE__*/function () {
9071
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(response) {
9072
+ var contentType, text;
9073
+ return _regeneratorRuntime.wrap(function (_context) {
9074
+ while (1) switch (_context.prev = _context.next) {
9075
+ case 0:
9076
+ contentType = response.headers.get('content-type') || '';
9077
+ if (!contentType.includes('application/json')) {
9078
+ _context.next = 1;
9079
+ break;
9080
+ }
9081
+ return _context.abrupt("return", response.json());
9082
+ case 1:
9083
+ _context.next = 2;
9084
+ return response.text();
9085
+ case 2:
9086
+ text = _context.sent;
9087
+ if (text) {
9088
+ _context.next = 3;
9089
+ break;
9090
+ }
9091
+ return _context.abrupt("return", {});
9092
+ case 3:
9093
+ _context.prev = 3;
9094
+ return _context.abrupt("return", JSON.parse(text));
9095
+ case 4:
9096
+ _context.prev = 4;
9097
+ _context["catch"](3);
9098
+ return _context.abrupt("return", {
9099
+ data: text
9100
+ });
9101
+ case 5:
9102
+ case "end":
9103
+ return _context.stop();
9104
+ }
9105
+ }, _callee, null, [[3, 4]]);
9106
+ }));
9107
+ return function parseResponse(_x) {
9108
+ return _ref.apply(this, arguments);
8939
9109
  };
8940
- var timeStr = format.replace(/{(y|m|d|h|i|s|a)+}/g, function (result, key) {
8941
- var value = formatObj[key];
8942
- if (key === 'a') {
8943
- return ['日', '', '二', '三', '四', '五', '六'][value];
9110
+ }();
9111
+ var createTimeoutError = function createTimeoutError(timeout) {
9112
+ var error = new Error("timeout of ".concat(timeout, "ms exceeded"));
9113
+ error.name = 'TimeoutError';
9114
+ return error;
9115
+ };
9116
+ var request = /*#__PURE__*/function () {
9117
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(config) {
9118
+ 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;
9119
+ return _regeneratorRuntime.wrap(function (_context2) {
9120
+ while (1) switch (_context2.prev = _context2.next) {
9121
+ case 0:
9122
+ 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;
9123
+ if (!isIgnoreLoading) {
9124
+ showRequestLoading();
9125
+ }
9126
+ requestHeaders = _objectSpread$1(_objectSpread$1({}, options$1.headers), headers);
9127
+ timeoutId = null;
9128
+ _context2.prev = 1;
9129
+ fetchPromise = fetch(buildUrl(baseURL, url, params), {
9130
+ method: normalizeMethod(method),
9131
+ headers: requestHeaders,
9132
+ body: normalizeMethod(method) === 'GET' ? undefined : buildBody(data, requestHeaders),
9133
+ credentials: withCredentials ? 'include' : 'same-origin'
9134
+ });
9135
+ _context2.next = 2;
9136
+ return Promise.race([fetchPromise, new Promise(function (resolve, reject) {
9137
+ timeoutId = setTimeout(function () {
9138
+ reject(createTimeoutError(timeout));
9139
+ }, timeout);
9140
+ })]);
9141
+ case 2:
9142
+ response = _context2.sent;
9143
+ _context2.next = 3;
9144
+ return parseResponse(response);
9145
+ case 3:
9146
+ res = _context2.sent;
9147
+ if (response.ok) {
9148
+ _context2.next = 4;
9149
+ break;
9150
+ }
9151
+ error = new Error("Request failed with status code ".concat(response.status));
9152
+ error.response = {
9153
+ status: response.status,
9154
+ data: res
9155
+ };
9156
+ throw error;
9157
+ case 4:
9158
+ code = res.code;
9159
+ if (!['002012', '002013', '002015'].includes(code)) {
9160
+ _context2.next = 5;
9161
+ break;
9162
+ }
9163
+ messageMap = {
9164
+ m002012: '当前账号因操作频繁被限制,请明天再试。感谢理解',
9165
+ m002013: '您的操作频率较高,已达到今日生成上限。请稍后再试或明天继续使用,感谢您的理解!',
9166
+ m002015: '您今天做了太多计划书了,休息一下,明天再来吧'
9167
+ };
9168
+ message = messageMap["m".concat(code)];
9169
+ if (message) {
9170
+ _Dialog.alert({
9171
+ message: message,
9172
+ confirmButtonText: '知道了',
9173
+ confirmButtonColor: '#0A64FE'
9174
+ });
9175
+ }
9176
+ return _context2.abrupt("return", Promise.reject({
9177
+ code: code,
9178
+ message: message
9179
+ }));
9180
+ case 5:
9181
+ if (!(code === 401 || res.status === 401)) {
9182
+ _context2.next = 6;
9183
+ break;
9184
+ }
9185
+ gotoLogin();
9186
+ return _context2.abrupt("return", Promise.reject('status: 401'));
9187
+ case 6:
9188
+ if (!(res.success && res.data === -1)) {
9189
+ _context2.next = 7;
9190
+ break;
9191
+ }
9192
+ gotoLogin();
9193
+ return _context2.abrupt("return", Promise.reject('login: -1'));
9194
+ case 7:
9195
+ return _context2.abrupt("return", returnFullResponse ? res : res.data);
9196
+ case 8:
9197
+ _context2.prev = 8;
9198
+ _t2 = _context2["catch"](1);
9199
+ if (_t2.response && _t2.response.status == 401) {
9200
+ gotoLogin();
9201
+ }
9202
+ return _context2.abrupt("return", Promise.reject(_t2));
9203
+ case 9:
9204
+ _context2.prev = 9;
9205
+ if (timeoutId) {
9206
+ clearTimeout(timeoutId);
9207
+ }
9208
+ hideRequestLoading();
9209
+ return _context2.finish(9);
9210
+ case 10:
9211
+ case "end":
9212
+ return _context2.stop();
9213
+ }
9214
+ }, _callee2, null, [[1, 8, 9, 10]]);
9215
+ }));
9216
+ return function request(_x2) {
9217
+ return _ref2.apply(this, arguments);
9218
+ };
9219
+ }();
9220
+
9221
+ function getCommonCurrentUser(params) {
9222
+ return request({
9223
+ url: '/planBook/common/currentUser',
9224
+ method: 'get',
9225
+ params: params,
9226
+ isIgnoreLoading: false
9227
+ });
9228
+ }
9229
+
9230
+ function getPlanbookInsuranceVerifyData(params) {
9231
+ return request({
9232
+ baseURL: APP_HOSTNAME,
9233
+ url: '/planBook/input/insurance/verifyData',
9234
+ method: 'post',
9235
+ data: params,
9236
+ headers: {
9237
+ Accept: 'application/json, text/plain, */*',
9238
+ 'Content-Type': 'application/json;'
8944
9239
  }
8945
- if (result.length > 0 && value < 10) {
8946
- value = '0' + value;
9240
+ });
9241
+ }
9242
+
9243
+ /**
9244
+ * C 端地区码(POST `…/api/product/data/getAreaCode`)
9245
+ * @param {object} data 如 `{ pageType, productId }`
9246
+ * @param {string} [userUuid] 有则拼到 query(与原先 `getApiUrl(getAreaCodeApi)` 行为一致)
9247
+ */
9248
+ function getAddress(data, userUuid) {
9249
+ var url = "".concat(INSURANCE2A_API_HOSTNAME, "/api/product/data/getAreaCode");
9250
+ if (userUuid && url.indexOf('userUuid') === -1) {
9251
+ if (url.indexOf('?') === -1) {
9252
+ url += "?userUuid=".concat(encodeURIComponent(userUuid));
9253
+ } else {
9254
+ url += "&userUuid=".concat(encodeURIComponent(userUuid));
8947
9255
  }
8948
- return value || 0;
9256
+ }
9257
+ return request({
9258
+ url: url,
9259
+ method: 'post',
9260
+ data: data,
9261
+ headers: {
9262
+ Accept: 'application/json, text/plain, */*',
9263
+ 'Content-Type': 'application/json'
9264
+ },
9265
+ isIgnoreLoading: false,
9266
+ returnFullResponse: true
9267
+ });
9268
+ }
9269
+
9270
+ /**
9271
+ * 险种保费试算 `/api/product/data/calculate`
9272
+ */
9273
+ function postProductDataCalculate(urlParams, postParams) {
9274
+ var path = '/api/product/data/calculate';
9275
+ if (urlParams && urlParams.uuid) {
9276
+ path += "?userUuid=".concat(encodeURIComponent(urlParams.uuid));
9277
+ } else if (urlParams && urlParams.openId) {
9278
+ path += "?userUuid=".concat(encodeURIComponent(urlParams.openId));
9279
+ }
9280
+ if (urlParams && urlParams.appid) {
9281
+ path += path.includes('?') ? "&appId=".concat(encodeURIComponent(urlParams.appid)) : "?appId=".concat(encodeURIComponent(urlParams.appid));
9282
+ }
9283
+ return request({
9284
+ baseURL: INSURANCE2A_API_HOSTNAME,
9285
+ url: path,
9286
+ method: 'post',
9287
+ data: postParams,
9288
+ headers: {
9289
+ Accept: 'application/json, text/plain, */*',
9290
+ 'Content-Type': 'application/json'
9291
+ },
9292
+ isIgnoreLoading: false,
9293
+ returnFullResponse: true
8949
9294
  });
8950
- return timeStr;
8951
9295
  }
8952
9296
 
8953
9297
  /*!
@@ -13959,7 +14303,7 @@
13959
14303
  Schema.messages = messages;
13960
14304
  Schema.validators = validators;
13961
14305
 
13962
- /*! bxs-vue-ui v4.2.1 */
14306
+ /*! bxs-vue-ui v4.2.4 */
13963
14307
 
13964
14308
  var fails = function (exec) {
13965
14309
  try {
@@ -33300,12 +33644,21 @@
33300
33644
  FAILED: '上传失败'
33301
33645
  }; // 本地开发环境上传代理
33302
33646
 
33303
- var PROXY_URL = 'http://192.168.180.194:9673/oss/upload';
33647
+ var PROXY_URL = 'http://192.168.180.194:9673/oss/upload'; // 科技侧 OSS 鉴权(含 cppoc POC 环境:在 hostname 加 cppoc- 前缀)
33648
+
33649
+ var OSS_TECH_AUTH = {
33650
+ authUrlTest: 'https://management.winbaoxian.cn/oss/getAuthInfo',
33651
+ authUrlProd: 'https://management.winbaoxian.com/oss/getAuthInfo'
33652
+ };
33653
+ var OSS_TECH_AUTH_CPPOC = {
33654
+ authUrlTest: 'https://cppoc-management.zytst.cn/oss/getAuthInfo',
33655
+ authUrlProd: 'https://cppoc-management.zytst.com/oss/getAuthInfo'
33656
+ };
33304
33657
  var OSS_INFO_LIST = [{
33305
33658
  type: 1,
33306
33659
  // 微易科技
33307
- authUrlTest: 'https://test.winbaoxian.com/management/oss/getAuthInfo',
33308
- authUrlProd: 'https://management.winbaoxian.com/oss/getAuthInfo'
33660
+ authUrlTest: OSS_TECH_AUTH.authUrlTest,
33661
+ authUrlProd: OSS_TECH_AUTH.authUrlProd
33309
33662
  }, {
33310
33663
  type: 2,
33311
33664
  // 微易保险经纪
@@ -34278,22 +34631,29 @@
34278
34631
  }) || {};
34279
34632
  },
34280
34633
  authUrl: function authUrl() {
34634
+ var _context;
34635
+
34281
34636
  var hostName = window.location.hostname;
34637
+ var isProd = /^.*\.com$/.test(hostName) && hostName !== 'test.winbaoxian.com' || /^.*\.net$/.test(hostName); // 访问域名含 cppoc 时统一走科技侧鉴权(带 cppoc- 前缀),与 ossType 无关
34282
34638
 
34283
- if (/^.*\.com$/.test(hostName) && hostName !== 'test.winbaoxian.com' || /^.*\.net$/.test(hostName)) {
34639
+ if (indexOf$4(_context = window.location.href).call(_context, 'cppoc') > -1) {
34640
+ return isProd ? OSS_TECH_AUTH_CPPOC.authUrlProd : OSS_TECH_AUTH_CPPOC.authUrlTest;
34641
+ }
34642
+
34643
+ if (isProd) {
34284
34644
  return this.ossInfo.authUrlProd;
34285
34645
  }
34286
34646
 
34287
34647
  return this.ossInfo.authUrlTest;
34288
34648
  },
34289
34649
  message: function message() {
34290
- var _context;
34650
+ var _context2;
34291
34651
 
34292
34652
  if (this.errorMessage) {
34293
34653
  return this.errorMessage;
34294
34654
  }
34295
34655
 
34296
- var failedImages = filter$2(_context = this.images).call(_context, function (item) {
34656
+ var failedImages = filter$2(_context2 = this.images).call(_context2, function (item) {
34297
34657
  return item.status === TASK_STATUS.FAILED;
34298
34658
  });
34299
34659
 
@@ -34681,9 +35041,9 @@
34681
35041
 
34682
35042
  this.addTasks(files);
34683
35043
  this.getAuthInfo().then(function (authInfo) {
34684
- var _context2;
35044
+ var _context3;
34685
35045
 
34686
- forEach$2(_context2 = _this6.tasks).call(_context2, function (task) {
35046
+ forEach$2(_context3 = _this6.tasks).call(_context3, function (task) {
34687
35047
  if (task.status === TASK_STATUS.READY) {
34688
35048
  _this6.taskStart(task);
34689
35049
 
@@ -34754,7 +35114,7 @@
34754
35114
  task.host = authInfo.host;
34755
35115
  var file = this.handleFile ? task.newFile : this.getBlobByDataURI(task);
34756
35116
  this.getSuffix(task.file.name, file).then(function (suffix) {
34757
- var _context3;
35117
+ var _context4;
34758
35118
 
34759
35119
  var key = "" + authInfo.dir + new Date().getTime() + "_" + _this8.randomString(15) + suffix;
34760
35120
  var formData = new FormData();
@@ -34763,7 +35123,7 @@
34763
35123
  formData.append('policy', authInfo.policy);
34764
35124
  formData.append('OSSAccessKeyId', authInfo.accessid);
34765
35125
  formData.append('key', key);
34766
- var protocol = indexOf$4(_context3 = authInfo.cdnMediaHost).call(_context3, '//') === 0 ? 'https:' : '';
35126
+ var protocol = indexOf$4(_context4 = authInfo.cdnMediaHost).call(_context4, '//') === 0 ? 'https:' : '';
34767
35127
  task.imageUrl = protocol + authInfo.cdnMediaHost + key;
34768
35128
  formData.append('file', file);
34769
35129
  task.formData = formData;
@@ -34930,9 +35290,9 @@
34930
35290
  image.content = null;
34931
35291
  this.$set(this.images, index, image);
34932
35292
  } else {
34933
- var _context4;
35293
+ var _context5;
34934
35294
 
34935
- splice$2(_context4 = this.images).call(_context4, index, 1);
35295
+ splice$2(_context5 = this.images).call(_context5, index, 1);
34936
35296
  }
34937
35297
 
34938
35298
  this.$emit('delete', {
@@ -37359,151 +37719,11 @@
37359
37719
  * @returns {Promise<any>} 产品下所有险种的费率
37360
37720
  */
37361
37721
  lodash.memoize(function (params) {
37362
- var url = "".concat(APP_HOSTNAME, "/planBook/input/insurance/verifyData");
37363
- return fetch(url, {
37364
- method: 'POST',
37365
- credentials: 'include',
37366
- headers: {
37367
- Accept: 'application/json, text/plain, */*',
37368
- 'Content-Type': 'application/json;'
37369
- },
37370
- body: JSON.stringify(params)
37371
- }).then(function (response) {
37372
- return response.json();
37373
- }).then(function (_ref) {
37374
- var success = _ref.success,
37375
- data = _ref.data;
37376
- if (!success || !data) {
37377
- return Promise.reject();
37378
- }
37379
- return Promise.resolve(data);
37380
- }).catch(function () {});
37722
+ return getPlanbookInsuranceVerifyData(params).catch(function () {});
37381
37723
  }, function (params) {
37382
37724
  return QS.stringify(params);
37383
37725
  });
37384
37726
 
37385
- function showLoading() {
37386
- if (IS_CPPOC_HOST) {
37387
- _Toast.loading({
37388
- message: '加载中...',
37389
- forbidClick: true
37390
- });
37391
- } else if (window.appBridge && window.appBridge.showLoading) {
37392
- window.appBridge.showLoading();
37393
- }
37394
- }
37395
- function hideLoading() {
37396
- if (IS_CPPOC_HOST) {
37397
- _Toast.clear();
37398
- } else if (window.appBridge && window.appBridge.hideLoading) {
37399
- window.appBridge.hideLoading();
37400
- }
37401
- }
37402
-
37403
- // 创建axios实例
37404
- var service = axios.create({
37405
- baseURL: APP_HOSTNAME,
37406
- withCredentials: true,
37407
- timeout: 10000,
37408
- // 请求超时时间
37409
- headers: {
37410
- 'X-Requested-With': 'XMLHttpRequest'
37411
- }
37412
- });
37413
- var loadingTimer = null;
37414
- var loading = function loading(show) {
37415
- if (show) {
37416
- showLoading();
37417
- } else {
37418
- hideLoading();
37419
- }
37420
- };
37421
-
37422
- // request拦截器
37423
- service.interceptors.request.use(function (config) {
37424
- if (loadingTimer) clearTimeout(loadingTimer);
37425
- loadingTimer = setTimeout(function () {
37426
- loading(true);
37427
- }, 300);
37428
- return config;
37429
- }, function (error) {
37430
- // Do something with request error
37431
- console.log(error); // for debug
37432
- Promise.reject(error);
37433
- });
37434
-
37435
- // respone拦截器
37436
- service.interceptors.response.use(function (response) {
37437
- if (loadingTimer) clearTimeout(loadingTimer);
37438
- loading(false);
37439
- var res = response.data;
37440
- if (res.code === 401 || res.status === 401) {
37441
- // gotoLogin()
37442
- return Promise.reject('login');
37443
- }
37444
- return res;
37445
- }, function (error) {
37446
- if (loadingTimer) clearTimeout(loadingTimer);
37447
- loading(false);
37448
- if (error.response && error.response.status == 401) {
37449
- // gotoLogin()
37450
- return Promise.reject('login');
37451
- }
37452
- console.log('err' + error); // for debug
37453
- return Promise.reject(error);
37454
- });
37455
-
37456
- var baseURL = "https://insurance2a-api.wyins.net".concat(IS_PRODUCT_ENV ? '' : '.cn');
37457
-
37458
- /**
37459
- * **获取地址信息**
37460
- * @ignore
37461
- * @author watson
37462
- * @date 2022-04-26
37463
- * @param {string} fetchUrl api url
37464
- * @param {object} data 接口传参
37465
- * @returns {object} addressData
37466
- */
37467
- function getAddress(fetchUrl, data) {
37468
- return new Promise(function (resolve, reject) {
37469
- service({
37470
- baseURL: fetchUrl,
37471
- url: undefined,
37472
- method: 'POST',
37473
- urlParams: undefined,
37474
- data: data
37475
- }).then(function (res) {
37476
- resolve(res);
37477
- }).catch(function (err) {
37478
- reject(err);
37479
- });
37480
- });
37481
- }
37482
-
37483
- /**
37484
- * **获取用户信息**
37485
- * @ignore
37486
- * @author watson
37487
- * @date 2022-04-26
37488
- * @param {string} fetchUrl api url
37489
- * @returns {promise}
37490
- */
37491
- function getUuid(fetchUrl) {
37492
- return new Promise(function (resolve, reject) {
37493
- service({
37494
- baseURL: fetchUrl,
37495
- url: undefined,
37496
- method: 'GET',
37497
- urlParams: undefined,
37498
- data: null
37499
- }).then(function (res) {
37500
- resolve(res);
37501
- }).catch(function (err) {
37502
- reject(err);
37503
- });
37504
- });
37505
- }
37506
-
37507
37727
  /**
37508
37728
  * **计划书初始化参数**
37509
37729
  * @ignore
@@ -37721,55 +37941,31 @@
37721
37941
  if (postParams && !postParams.scenario) {
37722
37942
  postParams.scenario = 'h5Widget';
37723
37943
  }
37724
- var url = '/api/product/data/calculate';
37725
- if (urlParams && urlParams.uuid) {
37726
- url += "?userUuid=".concat(urlParams.uuid);
37727
- } else if (urlParams && urlParams.openId) {
37728
- url += "?userUuid=".concat(urlParams.openId);
37729
- }
37730
- if (urlParams && urlParams.appid) {
37731
- if (url.indexOf('?') > -1) {
37732
- url += "&appId=".concat(urlParams.appid);
37733
- } else {
37734
- url += "?appId=".concat(urlParams.appid);
37735
- }
37736
- }
37737
37944
  if (hasPlanParams(planParams) && postParams.current_data) {
37738
37945
  postParams.current_data = tranlateCurrentData(postParams.current_data, planParams);
37739
37946
  }
37740
- return new Promise(function (resolve, reject) {
37741
- service({
37742
- baseURL: baseURL,
37743
- url: url,
37744
- method: 'POST',
37745
- urlParams: urlParams,
37746
- data: postParams
37747
- }).then(function (res) {
37748
- if (res.code === 200) {
37749
- var data = JSON.parse(JSON.stringify(res.data));
37750
- if (hasPlanParams(planParams)) {
37751
- var widgets = data.widgets;
37752
- var currentData = data.current_data;
37753
- translatePlanData(widgets, currentData, planParams);
37754
- }
37755
- var cData = {
37756
- widgets: data.widgets,
37757
- total_premium: data.total_premium,
37758
- terms: data.terms,
37759
- product_id: data.product_id,
37760
- current_data: data.current_data,
37761
- risk_premiums: data.risk_premiums
37762
- };
37763
- resolve({
37764
- code: 200,
37765
- data: cData
37766
- });
37767
- } else {
37768
- reject(res);
37769
- }
37770
- }).catch(function (err) {
37771
- reject(err);
37772
- });
37947
+ return postProductDataCalculate(urlParams, postParams).then(function (res) {
37948
+ if (res.code === 200) {
37949
+ var data = JSON.parse(JSON.stringify(res.data));
37950
+ if (hasPlanParams(planParams)) {
37951
+ var widgets = data.widgets;
37952
+ var currentData = data.current_data;
37953
+ translatePlanData(widgets, currentData, planParams);
37954
+ }
37955
+ var cData = {
37956
+ widgets: data.widgets,
37957
+ total_premium: data.total_premium,
37958
+ terms: data.terms,
37959
+ product_id: data.product_id,
37960
+ current_data: data.current_data,
37961
+ risk_premiums: data.risk_premiums
37962
+ };
37963
+ return {
37964
+ code: 200,
37965
+ data: cData
37966
+ };
37967
+ }
37968
+ return Promise.reject(res);
37773
37969
  });
37774
37970
  }
37775
37971
 
@@ -37856,9 +38052,6 @@
37856
38052
  args[_key] = arguments[_key];
37857
38053
  }
37858
38054
  _this = _callSuper(this, InsureCalculate, [].concat(args));
37859
- _defineProperty$1(_this, "getCalculateApi", '');
37860
- _defineProperty$1(_this, "getAreaCodeApi", '');
37861
- _defineProperty$1(_this, "getUuidApi", '');
37862
38055
  _defineProperty$1(_this, "widgets", []);
37863
38056
  _defineProperty$1(_this, "originData", {});
37864
38057
  _defineProperty$1(_this, "hasCalculateData", false);
@@ -37928,7 +38121,7 @@
37928
38121
  }
37929
38122
  _context.prev = 1;
37930
38123
  _context.next = 2;
37931
- return getUuid(vm.getUuidApi);
38124
+ return getCommonCurrentUser();
37932
38125
  case 2:
37933
38126
  userInfo = _context.sent;
37934
38127
  if (userInfo && userInfo.data && userInfo.data.uuid) {
@@ -38096,7 +38289,7 @@
38096
38289
  key: "showAddress",
38097
38290
  value: function () {
38098
38291
  var _showAddress = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(item) {
38099
- var vm, url, data, addressData, _t2;
38292
+ var vm, data, addressData, _t2;
38100
38293
  return _regeneratorRuntime.wrap(function (_context2) {
38101
38294
  while (1) switch (_context2.prev = _context2.next) {
38102
38295
  case 0:
@@ -38106,13 +38299,12 @@
38106
38299
  vm.returnClassify = item.values ? JSON.parse(item.values) : [];
38107
38300
  _context2.prev = 1;
38108
38301
  // 获取地址信息
38109
- url = vm.getApiUrl(vm.getAreaCodeApi);
38110
38302
  data = {
38111
38303
  pageType: 'detail',
38112
38304
  productId: String(vm.productId)
38113
38305
  };
38114
38306
  _context2.next = 2;
38115
- return getAddress(url, data);
38307
+ return getAddress(data, vm.getU());
38116
38308
  case 2:
38117
38309
  addressData = _context2.sent;
38118
38310
  if (addressData && addressData.code === 200) {
@@ -38670,19 +38862,6 @@
38670
38862
  value: function getU() {
38671
38863
  return this.uuid || this.uuidFromApi;
38672
38864
  }
38673
- }, {
38674
- key: "getApiUrl",
38675
- value: function getApiUrl(url) {
38676
- var u = url;
38677
- if (this.getU() && u.indexOf('userUuid') === -1) {
38678
- if (u.indexOf('?') === -1) {
38679
- u += "?userUuid=".concat(this.getU());
38680
- } else {
38681
- u += "&userUuid=".concat(this.getU());
38682
- }
38683
- }
38684
- return u;
38685
- }
38686
38865
  }, {
38687
38866
  key: "setIsDevelop",
38688
38867
  value: function setIsDevelop() {
@@ -38694,15 +38873,6 @@
38694
38873
  if (this.isDev === true || this.isDev === false) {
38695
38874
  this.isDevelop = this.isDev;
38696
38875
  }
38697
- if (this.isDevelop) {
38698
- this.getCalculateApi = 'https://insurance2a-api.wyins.net.cn/api/product/data/calculate';
38699
- this.getAreaCodeApi = 'https://insurance2a-api.wyins.net.cn/api/product/data/getAreaCode';
38700
- this.getUuidApi = "".concat(PLANBOOK_API_HOSTNAME, "/planBook/common/currentUser");
38701
- } else {
38702
- this.getCalculateApi = 'https://insurance2a-api.wyins.net/api/product/data/calculate';
38703
- this.getAreaCodeApi = 'https://insurance2a-api.wyins.net/api/product/data/getAreaCode';
38704
- this.getUuidApi = "".concat(PLANBOOK_API_HOSTNAME, "/planBook/common/currentUser");
38705
- }
38706
38876
  }
38707
38877
  }]);
38708
38878
  }(Vue), _descriptor = _applyDecoratedDescriptor(_class2.prototype, "showHeader", [_dec2], {