41 lines
904 B
JavaScript
41 lines
904 B
JavaScript
export function useConsultation() {
|
|
const isOpen = useState('consultation-open', () => false)
|
|
const context = useState('consultation-context', () => ({
|
|
title: '预约免费 GEO 诊断',
|
|
source: '全站咨询入口',
|
|
industry: ''
|
|
}))
|
|
const form = useState('consultation-form', () => ({
|
|
name: '',
|
|
company: '',
|
|
contact: '',
|
|
industry: '',
|
|
need: '',
|
|
message: '',
|
|
consent: false
|
|
}))
|
|
|
|
function openConsultation(payload = {}) {
|
|
context.value = {
|
|
title: payload.title || '预约免费 GEO 诊断',
|
|
source: payload.source || '全站咨询入口',
|
|
industry: payload.industry || ''
|
|
}
|
|
|
|
if (payload.industry) form.value.industry = payload.industry
|
|
isOpen.value = true
|
|
}
|
|
|
|
function closeConsultation() {
|
|
isOpen.value = false
|
|
}
|
|
|
|
return {
|
|
isOpen,
|
|
context,
|
|
form,
|
|
openConsultation,
|
|
closeConsultation
|
|
}
|
|
}
|