diff --git a/src/assets/js/utils/objectUtils.js b/src/assets/js/utils/objectUtils.js index 202214e70..4bc74a39e 100644 --- a/src/assets/js/utils/objectUtils.js +++ b/src/assets/js/utils/objectUtils.js @@ -1,43 +1,44 @@ export function deepClone(obj, hash = new WeakMap()) { + if (window.structuredClone) return window.structuredClone(obj) // 处理 null 或 undefined if (obj === null || typeof obj !== 'object') { - return obj; + return obj } // 处理循环引用 if (hash.has(obj)) { - return hash.get(obj); + return hash.get(obj) } // 处理 Date 对象 if (obj instanceof Date) { - return new Date(obj); + return new Date(obj) } // 处理 RegExp 对象 if (obj instanceof RegExp) { - return new RegExp(obj.source, obj.flags); + return new RegExp(obj.source, obj.flags) } // 处理数组 if (Array.isArray(obj)) { - const clonedArr = []; - hash.set(obj, clonedArr); + const clonedArr = [] + hash.set(obj, clonedArr) obj.forEach((item, index) => { - clonedArr[index] = deepClone(item, hash); - }); - return clonedArr; + clonedArr[index] = deepClone(item, hash) + }) + return clonedArr } // 处理普通对象 if (typeof obj === 'object') { - const clonedObj = {}; - hash.set(obj, clonedObj); + const clonedObj = {} + hash.set(obj, clonedObj) Object.keys(obj).forEach(key => { - clonedObj[key] = deepClone(obj[key], hash); - }); - return clonedObj; + clonedObj[key] = deepClone(obj[key], hash) + }) + return clonedObj } - return obj; + return obj } diff --git a/src/views/ebiz/saleFlowProImprove/InsuredPerson.vue b/src/views/ebiz/saleFlowProImprove/InsuredPerson.vue index a1ee6450e..8ebe69836 100644 --- a/src/views/ebiz/saleFlowProImprove/InsuredPerson.vue +++ b/src/views/ebiz/saleFlowProImprove/InsuredPerson.vue @@ -505,6 +505,7 @@ import SearchField from './components/SearchField' import riskRules from '@/views/ebiz/common/risk-rules' import { cardSide, subBusinessType, user } from '@/views/ebiz/saleFlowProImprove/js/enum' import { applicant, insured } from '@/views/ebiz/saleFlowProImprove/js/state' +import { deepClone } from '@/assets/js/utils/objectUtils' export default { name: 'insuredInfo', @@ -767,14 +768,14 @@ export default { }, async mounted() { window.cvThis = this - setTimeout(() => { - // eslint-disable-next-line no-undef - EWebBridge.webCallAppInJs('webview_left_button', { - img: this.$assetsUrl + 'images/del-close-btn@3x.png', - intercept: '1' //是否拦截原生返回事件 1是 其他否 - }) - }, 100) - window.appCallBack = this.appCallBack + // setTimeout(() => { + // // eslint-disable-next-line no-undef + // EWebBridge.webCallAppInJs('webview_left_button', { + // img: this.$assetsUrl + 'images/del-close-btn@3x.png', + // intercept: '1' //是否拦截原生返回事件 1是 其他否 + // }) + // }, 100) + // window.appCallBack = this.appCallBack // // document.body.style.backgroundColor = '#F5F5F5' //获取代理人管理机构 52贵州 45广西 let dataReturn = await riskRules.getAgentInfoFunc(this) @@ -2189,12 +2190,13 @@ export default { userInfo: { deep: true, immediate: true, - async handler(userInfo, oldUserInfo) { + async handler(userInfo) { + const oldUserInfo = this.oldUserInfo // 如果信息补全了, 开始计算试算信息 - if (!(await this.$validator.validate())) return - const includesProperties = ['sex', 'birthday', 'medical'] + // if (!(await this.$validator.validate())) return + const includesProperties = ['sex', 'birthday', 'medical', 'relationToAppnt'] if ( - includesProperties.every(property => { + includesProperties.some(property => { if (!userInfo || !oldUserInfo) return false if (!userInfo[property] || !oldUserInfo[property]) return false return userInfo[property] !== oldUserInfo[property] @@ -2202,6 +2204,7 @@ export default { ) { this.$emit('msgUpdate') } + this.oldUserInfo = deepClone(userInfo) } }, applicant: {