bxs-tools-ui 2.0.4 → 2.0.5

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bxs-tools-ui",
3
- "version": "2.0.4",
3
+ "version": "2.0.5",
4
4
  "description": "微易前端业务组件",
5
5
  "main": "lib/index.js",
6
6
  "files": [
@@ -1,7 +1,6 @@
1
- import { Toast } from 'vant'
1
+ import { PLANBOOK_API_HOSTNAME } from '@src/js/variables.js';
2
2
 
3
- export const IS_PRODUCT_ENV = location.hostname.search(/winbaoxian\.com/) !== -1
4
- const apiBaseUrl = `https://app.winbaoxian.${IS_PRODUCT_ENV ? 'com' : 'cn'}/planBook`
3
+ const apiBaseUrl = `${PLANBOOK_API_HOSTNAME}/planBook`
5
4
 
6
5
  export function initInsuranceInterest (reqParams, options : any = {}) {
7
6
  const { scene } = options
@@ -7,11 +7,7 @@
7
7
  <div v-if="tab === 0" class="bxs-ade-tab-popup">
8
8
  <bxs-button style="margin-bottom: 15px;" @click="isShowAdjustBaoe = true">添加调整保额</bxs-button>
9
9
  <div style="padding: 10px; overflow: auto;">
10
- <json-tree
11
- v-if="productData.adjustBaoeData"
12
- :data="productData.adjustBaoeData"
13
- :options="{ modifiable: false }"
14
- />
10
+ <json-tree v-if="productData.adjustBaoeData" :data="productData.adjustBaoeData" :options="{ modifiable: false }" />
15
11
  </div>
16
12
  <bxs-bottom-sheets v-model="isShowAdjustBaoe" title="调整保额" height="middle">
17
13
  <AdjustBaoe
@@ -42,14 +38,7 @@
42
38
  @confirm="onClickPopupConfirm"
43
39
  />
44
40
  <div class="bxs-ade-tab-normal-btn">
45
- <bxs-button
46
- v-if="submoduleName2 === 'Form'"
47
- type="assist"
48
- plain
49
- size="middle"
50
- @click="$refs.AdjustBaoe.goToTable()"
51
- >返回</bxs-button
52
- >
41
+ <bxs-button v-if="submoduleName2 === 'Form'" type="assist" plain size="middle" @click="$refs.AdjustBaoe.goToTable()">返回</bxs-button>
53
42
  <bxs-button size="middle" @click="onClickNormalConfirm">确定</bxs-button>
54
43
  </div>
55
44
  </div>
@@ -58,6 +47,7 @@
58
47
  <script lang="ts">
59
48
  import Vue from 'vue';
60
49
  import QS from 'qs';
50
+ import { PLANBOOK_API_HOSTNAME } from '@src/js/variables.js';
61
51
  import JsonTree from 'vue-json-tree';
62
52
  import { Button, BottomSheets, Tab, TabItem } from 'bxs-ui-vue';
63
53
  import { Component, Watch } from 'vue-property-decorator';
@@ -110,7 +100,7 @@ export default class AdjustBaoeDemo extends Vue {
110
100
  }
111
101
  getPlanbookData() {
112
102
  fetch(
113
- `https://app.winbaoxian.cn/planBook/V2/getInitData?${QS.stringify({
103
+ `${PLANBOOK_API_HOSTNAME}/planBook/V2/getInitData?${QS.stringify({
114
104
  insuranceTypeId: this.URL_PARAM.planbookId * 1 || 3933
115
105
  })}`,
116
106
  {
@@ -92,7 +92,7 @@ import cloneDeep from 'lodash/cloneDeep';
92
92
  import { Toast } from 'bxs-ui-vue';
93
93
  import 'bxs-ui-vue/lib/index.css';
94
94
  import { convertPersonData, convertProductData } from 'packages/bxs-utils/planbook/index';
95
- import { IS_PRODUCT_ENV } from '@src/js/variables.js';
95
+ import { PLANBOOK_API_HOSTNAME } from '@src/js/variables.js';
96
96
  import SelectItem from 'packages/components/form-item/select-item.vue';
97
97
 
98
98
  Vue.use(Toast);
@@ -229,18 +229,13 @@ export default class AdjustBaoe extends Vue {
229
229
  for (let k in adjustRecord) {
230
230
  const insData = insList.find(ins => ins[ins.code ? 'code' : 'key'] == k.replace(/baoe_/, ''));
231
231
  if (insData) {
232
- adjustData[k] = /(\(|\()([^\(\(]+)(\)|\))$/.exec(insData.name)
233
- ? /(\(|\()([^\(\(]+)(\)|\))$/.exec(insData.name)[2]
234
- : insData.name;
232
+ adjustData[k] = /(\(|\()([^\(\(]+)(\)|\))$/.exec(insData.name) ? /(\(|\()([^\(\(]+)(\)|\))$/.exec(insData.name)[2] : insData.name;
235
233
  }
236
234
  }
237
235
  return adjustData;
238
236
  }
239
237
  isModifyValue(adjust, key) {
240
- return (
241
- this.adjustBaoeData &&
242
- this.adjustBaoeData.some(ad => ad.age === adjust.age && ad[key] !== this.defaultAdjustRecord[key])
243
- );
238
+ return this.adjustBaoeData && this.adjustBaoeData.some(ad => ad.age === adjust.age && ad[key] !== this.defaultAdjustRecord[key]);
244
239
  }
245
240
 
246
241
  checkAdjustBaoe() {
@@ -251,36 +246,17 @@ export default class AdjustBaoe extends Vue {
251
246
  if (!this.adjustBaoeData) {
252
247
  return Promise.resolve();
253
248
  }
254
- const deleteProdKeys = [
255
- 'hadChoice',
256
- 'hide',
257
- 'totalBaof',
258
- 'insShowArr',
259
- 'autoImport',
260
- 'accountData',
261
- 'adjustBaoeData'
262
- ];
249
+ const deleteProdKeys = ['hadChoice', 'hide', 'totalBaof', 'insShowArr', 'autoImport', 'accountData', 'adjustBaoeData'];
263
250
  deleteProdKeys.forEach(ele => {
264
251
  delete cloneProductData[ele];
265
252
  });
266
253
  cloneProductData.mulInsOrderList?.forEach(ins => {
267
- const deleteInsKeys = [
268
- 'isFollowing',
269
- 'pPeriodDesc',
270
- 'baoeDesc',
271
- 'baofDesc',
272
- 'iDurationDesc',
273
- 'isCheckbox',
274
- 'groupKey',
275
- 'groupName'
276
- ];
254
+ const deleteInsKeys = ['isFollowing', 'pPeriodDesc', 'baoeDesc', 'baofDesc', 'iDurationDesc', 'isCheckbox', 'groupKey', 'groupName'];
277
255
  deleteInsKeys.forEach(ele => {
278
256
  delete ins[ele];
279
257
  });
280
258
  });
281
- const url = `https://app.winbaoxian.${IS_PRODUCT_ENV ? 'com' : 'cn'}/planBook/${
282
- params.publicPbUuid ? 'public' : 'V2'
283
- }/validateAccount/-1/low`;
259
+ const url = `${PLANBOOK_API_HOSTNAME}/planBook/${params.publicPbUuid ? 'public' : 'V2'}/validateAccount/-1/low`;
284
260
  return fetch(url, {
285
261
  method: 'POST',
286
262
  credentials: 'include',
@@ -8,17 +8,8 @@
8
8
  */
9
9
 
10
10
  import fetch from '@src/js/request.js';
11
- const baseURL = (() => {
12
- var env = null;
13
- if (location.hostname.search(/pbf\.winbaoxian\.com/) !== -1) {
14
- env = 'https://insurance2a-api.wyins.net';
15
- } else if (location.hostname.search(/pbf\.winbaoxian\.cn/) !== -1) {
16
- env = '//insurance2a-api.wyins.net.cn';
17
- } else if (location.hostname.search(/127\.0\.0\.1|192\.168|localhost|0\.0\.0\.0/) !== -1) {
18
- env = '//insurance2a-api.wyins.net.cn';
19
- }
20
- return env;
21
- })();
11
+ import { IS_PRODUCT_ENV } from '@src/js/variables.js';
12
+ const baseURL = `https://insurance2a-api.wyins.net${IS_PRODUCT_ENV ? '' : '.cn'}`;
22
13
 
23
14
  /**
24
15
  * **获取地址信息**
@@ -90,11 +81,7 @@ export function hasPlanParams(planParams) {
90
81
  let type = false;
91
82
  if (
92
83
  planParams &&
93
- (planParams.detail_age ||
94
- planParams.detail_sex ||
95
- planParams.detail_relation ||
96
- planParams.detail_applicant_age ||
97
- planParams.detail_applicant_sex)
84
+ (planParams.detail_age || planParams.detail_sex || planParams.detail_relation || planParams.detail_applicant_age || planParams.detail_applicant_sex)
98
85
  ) {
99
86
  type = true;
100
87
  }
@@ -24,7 +24,7 @@ import { insureCalculate, checkInsureCalculate } from 'packages/bxs-utils/index'
24
24
  }
25
25
  })
26
26
  export default class InsureCalculateDemo extends Vue {
27
- productId: number | string = 101768; // 101768; // 102163; // 102414;
27
+ productId: number | string = 102163; // 101768; // 102163; // 102414;
28
28
  uuid = '';
29
29
  planParams = {
30
30
  detail_age: '',
@@ -35,12 +35,7 @@
35
35
  >
36
36
  {{ it.name }}
37
37
  </span>
38
- <span
39
- v-else
40
- @click="bindSelectChange(item, it)"
41
- :key="it.value + optsIndex"
42
- class="bxt-select-content-item"
43
- >
38
+ <span v-else @click="bindSelectChange(item, it)" :key="it.value + optsIndex" class="bxt-select-content-item">
44
39
  {{ it.name }}
45
40
  </span>
46
41
  </template>
@@ -110,12 +105,7 @@
110
105
  <div class="bxt-fs13">
111
106
  <div class="bxt-input-box">
112
107
  <span class="bxt-input-content">
113
- <input
114
- type="text"
115
- class="bxt-input-text"
116
- v-model.trim="item.current.v"
117
- @blur="inputNumberRangeBlur(item)"
118
- />
108
+ <input type="text" class="bxt-input-text" v-model.trim="item.current.v" @blur="inputNumberRangeBlur(item)" />
119
109
  </span>
120
110
  <span class="bxt-input-unit">份</span>
121
111
  </div>
@@ -126,12 +116,7 @@
126
116
  </div>
127
117
  <!-- 展示责任 -->
128
118
  <template v-if="isShowDuty && terms && terms.length">
129
- <div
130
- v-for="(item, termsIndex) in terms"
131
- :key="item.contentId + termsIndex"
132
- class="bxt-bg-f"
133
- @click="toggle(item)"
134
- >
119
+ <div v-for="(item, termsIndex) in terms" :key="item.contentId + termsIndex" class="bxt-bg-f" @click="toggle(item)">
135
120
  <div class="bxt-content bxt-bb1">
136
121
  <div class="bxt-block-term">
137
122
  <span class="bxt-mr15 bxt-flex1 bxt-fs30 bxt-lh12">{{ item.name }}</span>
@@ -165,12 +150,7 @@
165
150
  </div>
166
151
 
167
152
  <!-- bxs组件:职业列表,异步 查询使用,无检验规则 -->
168
- <bxs-profession-list
169
- :async-columns-params="asyncColumnsParams"
170
- v-model="isShowProfession"
171
- readonly
172
- :prevent-scroll-through="true"
173
- />
153
+ <bxs-profession-list :async-columns-params="asyncColumnsParams" v-model="isShowProfession" readonly :prevent-scroll-through="true" />
174
154
  <!-- bxs组件:地址查询 -->
175
155
  <bxs-area v-model="isShowArea" :area-select="defaultArea" :area-data="areaData" @confirm="confirmArea"> </bxs-area>
176
156
  </div>
@@ -178,6 +158,7 @@
178
158
  <script lang="ts">
179
159
  import { Component, Prop, Vue } from 'vue-property-decorator';
180
160
  import { parseTime } from '@src/js/utils.js';
161
+ import { PLANBOOK_API_HOSTNAME } from '@src/js/variables.js';
181
162
  import { Picker, DatetimePicker, ProfessionList, Toast, Icon, Button, Area, Input } from 'bxs-ui-vue';
182
163
  import 'bxs-ui-vue/lib/index.css';
183
164
  Vue.use(Picker);
@@ -345,11 +326,7 @@ export default class InsureCalculate extends Vue {
345
326
  this.$set(this.asyncColumnsParams, 'postParams', postParamsProfess);
346
327
  this.$set(this.asyncColumnsParams, 'isDev', this.isDevelop);
347
328
  let originData;
348
- this.hasCalculateData = !!(
349
- this.calculateData &&
350
- this.calculateData.current_data &&
351
- this.calculateData.current_data.length
352
- );
329
+ this.hasCalculateData = !!(this.calculateData && this.calculateData.current_data && this.calculateData.current_data.length);
353
330
  if (this.hasCalculateData) {
354
331
  originData = JSON.parse(JSON.stringify(this.calculateData));
355
332
  }
@@ -517,9 +494,7 @@ export default class InsureCalculate extends Vue {
517
494
  const currTarget = item;
518
495
  let orginTarget;
519
496
  if (currTarget.duty) {
520
- orginTarget = self.widgets.find(
521
- item => item.riskCode === currTarget.riskCode && item.key === currTarget.key && item.duty === currTarget.duty
522
- );
497
+ orginTarget = self.widgets.find(item => item.riskCode === currTarget.riskCode && item.key === currTarget.key && item.duty === currTarget.duty);
523
498
  } else {
524
499
  orginTarget = this.widgets.find(item => item.riskCode === currTarget.riskCode && item.key === currTarget.key);
525
500
  }
@@ -609,9 +584,7 @@ export default class InsureCalculate extends Vue {
609
584
  const currClickItem = it;
610
585
  let orginTarget;
611
586
  if (currTarget.duty) {
612
- orginTarget = this.widgets.find(
613
- item => item.riskCode === currTarget.riskCode && item.key === currTarget.key && item.duty === currTarget.duty
614
- );
587
+ orginTarget = this.widgets.find(item => item.riskCode === currTarget.riskCode && item.key === currTarget.key && item.duty === currTarget.duty);
615
588
  } else {
616
589
  orginTarget = this.widgets.find(item => item.riskCode === currTarget.riskCode && item.key === currTarget.key);
617
590
  }
@@ -670,9 +643,7 @@ export default class InsureCalculate extends Vue {
670
643
  let current;
671
644
  // 增加current字段,保存current_data的数据
672
645
  if (item.duty) {
673
- item.current = current = currentData.find(
674
- it => it.k === item.key && it.risk === item.riskCode && item.duty === it.d
675
- );
646
+ item.current = current = currentData.find(it => it.k === item.key && it.risk === item.riskCode && item.duty === it.d);
676
647
  } else {
677
648
  item.current = current = currentData.find(it => it.k === item.key && it.risk === item.riskCode);
678
649
  }
@@ -971,11 +942,11 @@ export default class InsureCalculate extends Vue {
971
942
  if (this.isDevelop) {
972
943
  this.getCalculateApi = 'https://insurance2a-api.wyins.net.cn/api/product/data/calculate';
973
944
  this.getAreaCodeApi = 'https://insurance2a-api.wyins.net.cn/api/product/data/getAreaCode';
974
- this.getUuidApi = 'http://app.winbaoxian.cn/planBook/common/currentUser';
945
+ this.getUuidApi = `${PLANBOOK_API_HOSTNAME}/planBook/common/currentUser`;
975
946
  } else {
976
947
  this.getCalculateApi = 'https://insurance2a-api.wyins.net/api/product/data/calculate';
977
948
  this.getAreaCodeApi = 'https://insurance2a-api.wyins.net/api/product/data/getAreaCode';
978
- this.getUuidApi = 'https://app.winbaoxian.com/planBook/common/currentUser';
949
+ this.getUuidApi = `${PLANBOOK_API_HOSTNAME}/planBook/common/currentUser`;
979
950
  }
980
951
  }
981
952
  }
@@ -1,17 +1,13 @@
1
1
  <template>
2
2
  <div v-if="inputData">
3
- <PersonInfo
4
- :input-data="inputData"
5
- :verify-data="verifyData"
6
- :person-data="personData"
7
- @change="changePersonInfo"
8
- />
3
+ <PersonInfo :input-data="inputData" :verify-data="verifyData" :person-data="personData" @change="changePersonInfo" />
9
4
  </div>
10
5
  </template>
11
6
  <script lang="ts">
12
7
  import Vue from 'vue';
13
8
  import { Component } from 'vue-property-decorator';
14
9
  import QS from 'qs';
10
+ import { PLANBOOK_API_HOSTNAME } from '@src/js/variables.js';
15
11
  import { initPageData } from '../../planbook-input/helper';
16
12
  import PersonInfo from '../index.vue';
17
13
 
@@ -35,7 +31,7 @@ export default class PersonInfoDemo extends Vue {
35
31
  return QS.parse(`${location.href.split('?')[1]}`) || {};
36
32
  }
37
33
  getPlanbookData() {
38
- fetch(`https://app.winbaoxian.cn/planBook/public/init`, {
34
+ fetch(`${PLANBOOK_API_HOSTNAME}/planBook/public/init`, {
39
35
  method: 'POST',
40
36
  credentials: 'include',
41
37
  headers: {
@@ -1,6 +1,7 @@
1
1
  import QS from 'qs';
2
+ import { PLANBOOK_API_HOSTNAME } from '@src/js/variables.js';
2
3
 
3
- const apiBaseUrl = 'https://app.winbaoxian.cn/planBook';
4
+ const apiBaseUrl = `${PLANBOOK_API_HOSTNAME}/planBook`;
4
5
 
5
6
  export function getPlanbookData(params) {
6
7
  let apiPromise = fetch(`${apiBaseUrl}/V2/getInitData?${QS.stringify(params)}`, {
@@ -266,7 +266,6 @@ export default class BxtProductTable extends Vue {
266
266
  this.isCkConfirm = false;
267
267
  }
268
268
 
269
- IS_PRODUCT_ENV = location.hostname.search(/winbaoxian\.com/) !== -1;
270
269
  popupConf = initPopupConf();
271
270
  takePopupConfig = initAddAndTakePopupConfig();
272
271
  // 区分是否是单击确定按钮
@@ -1,5 +1,6 @@
1
1
  import { Toast } from 'vant';
2
2
  import QS from 'qs';
3
+ import { PLANBOOK_API_HOSTNAME } from '@src/js/variables.js';
3
4
  import {
4
5
  initPersonData,
5
6
  personDataHandler,
@@ -52,11 +53,7 @@ export function setPageDataBaseOnResult(data) {
52
53
  iPersonData[k].forEach((person, pi) => {
53
54
  person.eleOrderList &&
54
55
  person.eleOrderList.forEach(ele => {
55
- if (
56
- ePersonData[k][pi] &&
57
- ePersonData[k][pi][ele.key] !== undefined &&
58
- ePersonData[k][pi][ele.key] !== null
59
- ) {
56
+ if (ePersonData[k][pi] && ePersonData[k][pi][ele.key] !== undefined && ePersonData[k][pi][ele.key] !== null) {
60
57
  ele.value = ePersonData[k][pi][ele.key];
61
58
  }
62
59
  });
@@ -261,9 +258,7 @@ export function receiveProductData(inputData, rProductData, options = {}) {
261
258
  let insuranceId = groupInsData.isCheckbox ? groupInsData.insuranceId[0] : groupInsData.insuranceId;
262
259
  let checkedIns = productData.mulInsOrderList.find(i => i.key === insuranceId);
263
260
  for (let key in checkedIns) {
264
- if (
265
- !['allowSamePerson', 'code', 'eleOrderList', 'groupKey', 'groupName', 'huomian', 'key', 'name'].includes(key)
266
- ) {
261
+ if (!['allowSamePerson', 'code', 'eleOrderList', 'groupKey', 'groupName', 'huomian', 'key', 'name'].includes(key)) {
267
262
  ins[key] = checkedIns[key];
268
263
  }
269
264
  }
@@ -327,8 +322,7 @@ export function defaultProductData(eleOrderList) {
327
322
  export function createPlanbookDataToMake(planbookData = {}, options = {}) {
328
323
  let inputData = planbookData && planbookData.initData && planbookData.initData.inputData;
329
324
  let productGroup = inputData.productGroupList && inputData.productGroupList[0];
330
- let hadChoiceProducts =
331
- productGroup && productGroup.prodOrderList && productGroup.prodOrderList.some(ele => !!ele.hadChoice && !ele.hide);
325
+ let hadChoiceProducts = productGroup && productGroup.prodOrderList && productGroup.prodOrderList.some(ele => !!ele.hadChoice && !ele.hide);
332
326
  if (hadChoiceProducts) {
333
327
  let resultData = {
334
328
  ...options,
@@ -467,7 +461,7 @@ export async function calculateProductData(inputData, options = {}) {
467
461
  return Promise.reject(calcData.errorMsg);
468
462
  }
469
463
  }
470
- return fetch(`https://app.winbaoxian.cn/planBook/${planbookId ? 'V2' : 'public'}/calculate`, {
464
+ return fetch(`${PLANBOOK_API_HOSTNAME}/planBook/${publicPbUuid ? 'public' : 'V2'}/calculate`, {
471
465
  method: 'POST',
472
466
  credentials: 'include',
473
467
  headers: {
@@ -49,6 +49,7 @@ import { Component } from 'vue-property-decorator';
49
49
  import Vant, { Toast } from 'vant';
50
50
  import QS from 'qs';
51
51
  import { get as _get } from 'lodash';
52
+ import { PLANBOOK_API_HOSTNAME, PBF_HOSTNAME } from '@src/js/variables.js';
52
53
  import { calcTotalBaof } from 'packages/bxs-utils/index';
53
54
  import { getPlanbookData } from './api';
54
55
  import { initPageData, setPageDataBaseOnResult, calculateProductData, createPlanbookDataToMake } from './helper.js';
@@ -174,24 +175,21 @@ export default class BxtPlanbookInput extends Vue {
174
175
  };
175
176
  const resultData: any = createPlanbookDataToMake(planbookData, options);
176
177
  if (resultData) {
177
- return fetch(
178
- `https://app.winbaoxian.cn/planBook/${URL_PARAM.planbookId ? 'V2/uploadResult' : 'public/createPb'}`,
179
- {
180
- method: 'POST',
181
- credentials: 'include',
182
- headers: {
183
- Accept: 'application/json, text/plain, */*',
184
- 'Content-Type': 'application/x-www-form-urlencoded'
185
- },
186
- body: QS.stringify({
187
- jd: JSON.stringify(resultData),
188
- userUuid,
189
- signature: createMd5Token(resultData, {
190
- groupDataKey: resultData.productGroupList[0]?.key
191
- })
178
+ return fetch(`${PLANBOOK_API_HOSTNAME}/planBook/${URL_PARAM.publicPbUuid ? 'public/createPb' : 'V2/uploadResult'}`, {
179
+ method: 'POST',
180
+ credentials: 'include',
181
+ headers: {
182
+ Accept: 'application/json, text/plain, */*',
183
+ 'Content-Type': 'application/x-www-form-urlencoded'
184
+ },
185
+ body: QS.stringify({
186
+ jd: JSON.stringify(resultData),
187
+ userUuid,
188
+ signature: createMd5Token(resultData, {
189
+ groupDataKey: resultData.productGroupList[0]?.key
192
190
  })
193
- }
194
- )
191
+ })
192
+ })
195
193
  .then(response => response.json())
196
194
  .then(({ success, data }: any) => {
197
195
  if (success && data) {
@@ -199,9 +197,7 @@ export default class BxtPlanbookInput extends Vue {
199
197
  theme: inputData?.theme,
200
198
  uuid: data
201
199
  });
202
- location.href = `https://pbf.winbaoxian.cn/planBook/planBookResult/pages/${
203
- publicPbUuid ? 'planbkPurely' : 'planbkTemplatev2'
204
- }.html?${urlParam}`;
200
+ location.href = `${PBF_HOSTNAME}/planBook/planBookResult/pages/${publicPbUuid ? 'planbkPurely' : 'planbkTemplatev2'}.html?${urlParam}`;
205
201
  }
206
202
  });
207
203
  }
@@ -1,19 +1,13 @@
1
1
  <template>
2
2
  <div v-if="inputData">
3
- <ProductInfo
4
- ref="productInfo"
5
- :input-data="inputData"
6
- :verify-data="verifyData"
7
- group-key="allMainInsData"
8
- :product-key="productKey"
9
- @change="cgProduct"
10
- />
3
+ <ProductInfo ref="productInfo" :input-data="inputData" :verify-data="verifyData" group-key="allMainInsData" :product-key="productKey" @change="cgProduct" />
11
4
  </div>
12
5
  </template>
13
6
  <script lang="ts">
14
7
  import Vue from 'vue';
15
8
  import { Component } from 'vue-property-decorator';
16
9
  import QS from 'qs';
10
+ import { PLANBOOK_API_HOSTNAME } from '@src/js/variables.js';
17
11
  import { initPageData } from '../../planbook-input/helper';
18
12
  import ProductInfo from '../index.vue';
19
13
 
@@ -38,7 +32,7 @@ export default class ProductInfoDemo extends Vue {
38
32
  return QS.parse(`${location.href.split('?')[1]}`) || {};
39
33
  }
40
34
  getPlanbookData() {
41
- fetch(`https://app.winbaoxian.cn/planBook/public/init`, {
35
+ fetch(`${PLANBOOK_API_HOSTNAME}/planBook/public/init`, {
42
36
  method: 'POST',
43
37
  credentials: 'include',
44
38
  headers: {
@@ -73,7 +67,7 @@ export default class ProductInfoDemo extends Vue {
73
67
  });
74
68
  }
75
69
  cgProduct(product, obj, inst) {
76
- if (obj.type === 'change') {
70
+ if (obj.type === 'change' && obj.ins && obj.ele) {
77
71
  this.$toast(`${obj.ins.eleOrderList[0].labelName} -> ${obj.ele.labelName}: ${obj.ele.value}`);
78
72
  }
79
73
  }
@@ -188,6 +188,7 @@
188
188
  import Vue from 'vue';
189
189
  import { Component, Prop } from 'vue-property-decorator';
190
190
  import { get as _get } from 'lodash';
191
+ import { PLANBOOK_API_HOSTNAME } from '@src/js/variables.js';
191
192
  import {
192
193
  productDataHandler,
193
194
  verifyProductRules,
@@ -469,8 +470,7 @@ export default class BxtProductInfo extends Vue {
469
470
  if (!showRecommendValue) {
470
471
  return;
471
472
  }
472
- const IS_PRODUCT_ENV = location.hostname.search(/winbaoxian\.com/) !== -1;
473
- const url = `https://app.winbaoxian.${IS_PRODUCT_ENV ? 'com' : 'cn'}/planBook/input/calculate/recommend`;
473
+ const url = `${PLANBOOK_API_HOSTNAME}/planBook/input/calculate/recommend`;
474
474
  const calcData = await createdProductDataToCalc(inputData, {
475
475
  groupKey: groupData.key,
476
476
  productKey: productData.key
@@ -1,8 +1,34 @@
1
- export const IS_PRODUCT_ENV = location.hostname.search(/pbf\.winbaoxian\.com/) !== -1;
2
- export const IS_TEST_ENV = location.hostname.search(/pbf\.winbaoxian\.cn/) !== -1;
3
- export const IS_LOCALHOST_ENV = location.hostname.search(/localhost|192\.168|127\.0\.0\.1|0\.0\.0\.0/) !== -1;
4
-
5
- export const APP_HOSTNAME = `https://app.winbaoxian.${IS_PRODUCT_ENV ? 'com' : 'cn'}`;
6
- export const CONTENT_HOSTNAME = `https://content.winbaoxian.${IS_PRODUCT_ENV ? 'com' : 'cn'}`;
7
- export const INTERACTION_HOSTNAME = `https://interaction-api.winbaoxian.${IS_PRODUCT_ENV ? 'com' : 'cn'}`;
8
- export const PBF_HOSTNAME = `https://pbf.winbaoxian.${IS_PRODUCT_ENV ? 'com' : 'cn'}`;
1
+ import QS from 'qs';
2
+
3
+ const hostname = (window && window.location && window.location.hostname) || '';
4
+ export const IS_PRODUCT_ENV = hostname.search(/(winbaoxian|ai-baoxiaozhu)\.com/) !== -1;
5
+ export const IS_DEVELOP_ENV = hostname.search(/(winbaoxian|ai-baoxiaozhu)\.cn/) !== -1;
6
+ export const IS_LOCALHOST_ENV = hostname.search(/localhost|192\.168|127\.0\.0\.1|dev\.winbaoxian\.cn/) !== -1;
7
+ export const IS_UAT_ENV = hostname.includes(`pbf-uat.`);
8
+ export const IS_ENABLE_DEBUG = !IS_PRODUCT_ENV;
9
+ if (IS_ENABLE_DEBUG) {
10
+ console.error(`非线上环境,默认开启调试模式`);
11
+ }
12
+
13
+ const topDomain = IS_PRODUCT_ENV ? 'com' : 'cn';
14
+ const secondDomain = hostname.includes('ai-baoxiaozhu') ? 'ai-baoxiaozhu' : 'winbaoxian';
15
+ export const MAIN_DOMAIN = `${secondDomain}.${topDomain}`;
16
+
17
+ export const APP_HOSTNAME = `https://app.${MAIN_DOMAIN}`;
18
+ export const CONTENT_HOSTNAME = `https://content.${MAIN_DOMAIN}`;
19
+ export const CLIENT_HOSTNAME = `https://client.${MAIN_DOMAIN}`;
20
+ export const TOOL_API_HOSTNAME = `https://tool-api.${MAIN_DOMAIN}`;
21
+ export const INTERACTION_HOSTNAME = `https://interaction-api.${MAIN_DOMAIN}`;
22
+ export const PBF_HOSTNAME = `https://pbf.${MAIN_DOMAIN}`;
23
+ export const POLICY_INSPECTION_HOSTNAME = `https://policy-inspection.${MAIN_DOMAIN}`;
24
+ export const BROKER_HOSTNAME = `https://broker-2a.wyins.net${IS_PRODUCT_ENV ? '' : '.cn'}`;
25
+ export const PLANBOOK_API_HOSTNAME = `https://bxs-planbook-api${IS_UAT_ENV ? '-uat' : ''}.${MAIN_DOMAIN}`;
26
+ export const CRM_HOSTNAME = `https://wechat-crm.${MAIN_DOMAIN}`;
27
+ export const WX_HOSTNAME = `https://wx.${MAIN_DOMAIN}`;
28
+
29
+ export const URL_PARAM = getUrlParams();
30
+ export function getUrlParams(url) {
31
+ const _url = url || location.search || '';
32
+ const _searchStr = _url.split('?')[1];
33
+ return _searchStr ? QS.parse(_searchStr) : {};
34
+ }