2024-11-19 00:13:49 +02:00
|
|
|
<template>
|
|
|
|
|
<div class="flex flex-col min-h-screen">
|
|
|
|
|
<main class="flex-grow flex items-center justify-center py-6 px-4 md:px-6">
|
2024-11-19 00:51:11 +02:00
|
|
|
<section class="max-w-lg w-full flex flex-col gap-10">
|
2024-11-19 01:17:16 +02:00
|
|
|
<template v-for="action in actions">
|
|
|
|
|
<ReadContactInfo v-if="action === 'viewContactInfo'" :contactInfo="contactInfo" />
|
|
|
|
|
<ReadMessageSender
|
|
|
|
|
v-else-if="action === 'sendMessage'"
|
|
|
|
|
:qr_code_uri="qr_code_uri"
|
|
|
|
|
:predefinedMessages="predefinedMessages"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
2024-11-19 00:13:49 +02:00
|
|
|
</section>
|
|
|
|
|
</main>
|
|
|
|
|
|
|
|
|
|
<footer class="bg-gray-100 text-center py-4 border-t text-sm text-gray-700">
|
|
|
|
|
<p>
|
|
|
|
|
Нужен такой же?
|
|
|
|
|
<a href="/create" class="underline">Создайте свой QR‑код</a>.
|
|
|
|
|
</p>
|
|
|
|
|
<p class="mt-1">
|
2024-11-19 01:17:16 +02:00
|
|
|
Сделайте НаСвязи удобнее. Будем рады вашей <a href="/donate" class="underline"
|
2024-11-19 00:13:49 +02:00
|
|
|
>поддержке</a
|
|
|
|
|
>.
|
|
|
|
|
</p>
|
|
|
|
|
</footer>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { ref, onMounted } from 'vue'
|
|
|
|
|
import { getQrCodeDocument } from '@/api/qrCode'
|
|
|
|
|
|
2024-11-19 00:51:11 +02:00
|
|
|
const { qr_code_uri } = defineProps<{ qr_code_uri: string }>()
|
2024-11-19 00:13:49 +02:00
|
|
|
|
|
|
|
|
// Локальные состояния
|
2024-11-19 00:51:11 +02:00
|
|
|
const predefinedMessages = ref<string[]>([])
|
|
|
|
|
const contactInfo = ref<{ name?: string; phone?: string; email?: string }>({})
|
|
|
|
|
const actions = ref<string[]>([])
|
2024-11-19 00:13:49 +02:00
|
|
|
|
|
|
|
|
onMounted(async () => {
|
|
|
|
|
try {
|
|
|
|
|
const qrCodeDoc = await getQrCodeDocument(qr_code_uri)
|
2024-11-19 00:51:11 +02:00
|
|
|
predefinedMessages.value = qrCodeDoc!.predefinedMessage || []
|
|
|
|
|
contactInfo.value = qrCodeDoc!.contactInfo || { name: 'waka', phone: '+123' }
|
|
|
|
|
actions.value = qrCodeDoc!.actions || []
|
2024-11-19 00:18:24 +02:00
|
|
|
} catch (err) {
|
|
|
|
|
console.error(err)
|
2024-11-19 00:13:49 +02:00
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
</script>
|