This commit introduces a 'Contact Sales' modal on the web development page, allowing users to inquire about specific service plans. - The pricing plan buttons now trigger this modal, pre-filled with the selected plan's details. - Users can add custom remarks to their inquiry. - On submission, a pre-formatted message is generated and opened in WhatsApp using a new `useWhatsAppMsgSender` composable. - Adds `NUXT_PUBLIC_WHATSAPP_NUMBER` to the runtime configuration. - Refactors content validation by introducing Zod schemas for `PricingPlan` and `Button` props to improve type safety. - Adds new i18n keys for the modal interface and message templates.
22 lines
549 B
TypeScript
22 lines
549 B
TypeScript
import { createSharedComposable } from "@vueuse/core";
|
|
|
|
const _useWhatsAppMsgSender = () => {
|
|
const config = useRuntimeConfig();
|
|
const phone = config.public.whatsappNumber;
|
|
|
|
// --- WhatsApp 自动消息逻辑 ---
|
|
const sendMessage = (message: string) => {
|
|
const text = encodeURIComponent(message);
|
|
const url = `https://api.whatsapp.com/send?phone=${phone}&text=${text}`;
|
|
window.open(url, "_blank");
|
|
};
|
|
|
|
return {
|
|
sendMessage,
|
|
};
|
|
};
|
|
|
|
export const useWhatsAppMsgSender = createSharedComposable(
|
|
_useWhatsAppMsgSender
|
|
);
|