| 
									
										
										
										
											2025-09-27 17:41:14 +08:00
										 |  |  |  | <template> | 
					
						
							|  |  |  |  |     <div class="card"> | 
					
						
							|  |  |  |  |         <!-- 名下车辆信息展示 --> | 
					
						
							|  |  |  |  |         <div class="bg-yellow-100 text-yellow-700 p-4 rounded-lg"> | 
					
						
							|  |  |  |  |             <h3 class="text-xl font-semibold">名下车辆</h3> | 
					
						
							|  |  |  |  |             <p class="text-sm">此人名下拥有车辆:{{ data?.carNum }} 辆</p> | 
					
						
							|  |  |  |  |         </div> | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         <!-- 校验对象展示 --> | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     </div> | 
					
						
							|  |  |  |  | </template> | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | <script setup> | 
					
						
							| 
									
										
										
										
											2025-10-24 17:08:42 +08:00
										 |  |  |  | import { defineProps, watch, computed } from 'vue'; | 
					
						
							|  |  |  |  | import { useRiskNotifier } from '@/composables/useRiskNotifier'; | 
					
						
							| 
									
										
										
										
											2025-09-27 17:41:14 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | // 接收父组件传入的 props
 | 
					
						
							|  |  |  |  | const props = defineProps({ | 
					
						
							|  |  |  |  |     data: Object, | 
					
						
							|  |  |  |  |     params: Object, | 
					
						
							| 
									
										
										
										
											2025-10-24 17:08:42 +08:00
										 |  |  |  |     apiId: { | 
					
						
							|  |  |  |  |         type: String, | 
					
						
							|  |  |  |  |         default: '', | 
					
						
							|  |  |  |  |     }, | 
					
						
							|  |  |  |  |     index: { | 
					
						
							|  |  |  |  |         type: Number, | 
					
						
							|  |  |  |  |         default: 0, | 
					
						
							|  |  |  |  |     }, | 
					
						
							|  |  |  |  |     notifyRiskStatus: { | 
					
						
							|  |  |  |  |         type: Function, | 
					
						
							|  |  |  |  |         default: () => { }, | 
					
						
							|  |  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2025-09-27 17:41:14 +08:00
										 |  |  |  | }); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | // 脱敏函数:姓名脱敏(保留首位)
 | 
					
						
							|  |  |  |  | const maskName = (name) => { | 
					
						
							|  |  |  |  |     if (!name) return ''; | 
					
						
							|  |  |  |  |     return name.length > 1 ? name[0] + "*".repeat(name.length - 1) : "*"; | 
					
						
							|  |  |  |  | }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | // 脱敏函数:身份证号脱敏(保留前6位和最后4位)
 | 
					
						
							|  |  |  |  | const maskIdCard = (idCard) => { | 
					
						
							|  |  |  |  |     if (!idCard) return ''; | 
					
						
							|  |  |  |  |     return idCard.replace(/^(.{6})(?:\d+)(.{4})$/, "$1****$2"); | 
					
						
							|  |  |  |  | }; | 
					
						
							| 
									
										
										
										
											2025-10-24 17:08:42 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | // 计算风险评分(0-100分,分数越高越安全)
 | 
					
						
							|  |  |  |  | const riskScore = computed(() => { | 
					
						
							|  |  |  |  |     // 名下车辆不算风险,始终返回100分(最安全)
 | 
					
						
							|  |  |  |  |     return 100; | 
					
						
							|  |  |  |  | }); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | // 使用 composable 通知父组件风险评分
 | 
					
						
							|  |  |  |  | useRiskNotifier(props, riskScore); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | // 暴露给父组件
 | 
					
						
							|  |  |  |  | defineExpose({ | 
					
						
							|  |  |  |  |     riskScore | 
					
						
							|  |  |  |  | }); | 
					
						
							| 
									
										
										
										
											2025-09-27 17:41:14 +08:00
										 |  |  |  | </script> | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | <style scoped> | 
					
						
							|  |  |  |  | /* 自定义样式 */ | 
					
						
							|  |  |  |  | </style> |