feat(SSR): 将服务支持页面改为SSR
This commit is contained in:
@ -1,6 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="page-container">
|
<div class="page-container">
|
||||||
<div v-if="content">
|
|
||||||
<support-tabs model-value="contact-us" />
|
<support-tabs model-value="contact-us" />
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<h1 class="page-title">{{ $t('navigation.contact-info') }}</h1>
|
<h1 class="page-title">{{ $t('navigation.contact-info') }}</h1>
|
||||||
@ -23,10 +22,9 @@
|
|||||||
</el-breadcrumb>
|
</el-breadcrumb>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="page-content">
|
<div v-if="!pending" class="page-content">
|
||||||
<markdown-renderer :content="content || ''" />
|
<markdown-renderer :content="content || ''" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div v-else class="loading">
|
<div v-else class="loading">
|
||||||
<el-skeleton :rows="5" animated />
|
<el-skeleton :rows="5" animated />
|
||||||
</div>
|
</div>
|
||||||
@ -36,28 +34,20 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const { findOne } = useStrapi();
|
const { findOne } = useStrapi();
|
||||||
const { getStrapiLocale } = useLocalizations();
|
const { getStrapiLocale } = useLocalizations();
|
||||||
|
|
||||||
const strapiLocale = getStrapiLocale();
|
const strapiLocale = getStrapiLocale();
|
||||||
|
|
||||||
const content = ref<string>('');
|
const { data, pending, error } = useAsyncData('contact-info', () =>
|
||||||
|
findOne<StrapiContactInfo>('contact-info', undefined, {
|
||||||
onMounted(async () => {
|
|
||||||
try {
|
|
||||||
const response = await findOne<StrapiContactInfo>(
|
|
||||||
'contact-info',
|
|
||||||
undefined,
|
|
||||||
{
|
|
||||||
populate: '*',
|
populate: '*',
|
||||||
locale: strapiLocale,
|
locale: strapiLocale,
|
||||||
}
|
})
|
||||||
);
|
);
|
||||||
if (response.data) {
|
|
||||||
content.value = response.data.content || '';
|
const content = computed(() => data.value?.data.content ?? '');
|
||||||
} else {
|
|
||||||
console.warn('No contact info data found');
|
watch(error, (value) => {
|
||||||
}
|
if (value) {
|
||||||
} catch (error) {
|
console.error('数据获取失败: ', value);
|
||||||
console.error('Failed to fetch contact info:', error);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -37,26 +37,23 @@
|
|||||||
const { getStrapiLocale } = useLocalizations();
|
const { getStrapiLocale } = useLocalizations();
|
||||||
const strapiLocale = getStrapiLocale();
|
const strapiLocale = getStrapiLocale();
|
||||||
|
|
||||||
const pending = ref(true);
|
const { data, pending, error } = useAsyncData('documents', () =>
|
||||||
|
find<ProductionDocument>('production-documents', {
|
||||||
const documents = ref<StrapiMedia[]>([]);
|
|
||||||
|
|
||||||
onMounted(async () => {
|
|
||||||
try {
|
|
||||||
const response = await find<ProductionDocument>('production-documents', {
|
|
||||||
locale: strapiLocale,
|
|
||||||
populate: 'document',
|
populate: 'document',
|
||||||
});
|
locale: strapiLocale,
|
||||||
if (response.data) {
|
})
|
||||||
documents.value =
|
);
|
||||||
response.data.map((item) => ({
|
|
||||||
|
const documents = computed(
|
||||||
|
() =>
|
||||||
|
data.value?.data.map((item) => ({
|
||||||
...item.document,
|
...item.document,
|
||||||
})) || [];
|
})) || []
|
||||||
}
|
);
|
||||||
} catch (error) {
|
|
||||||
console.error('Error fetching documents:', error);
|
watch(error, (value) => {
|
||||||
} finally {
|
if (value) {
|
||||||
pending.value = false;
|
console.error('数据获取失败: ', value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="page-container">
|
<div class="page-container">
|
||||||
<div v-if="pending" class="flex justify-center items-center h-64">
|
<div v-if="pending" class="flex justify-center items-center h-64">
|
||||||
<el-spinner />
|
<el-skeleton :rows="6" animated />
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<support-tabs model-value="faq" />
|
<support-tabs model-value="faq" />
|
||||||
@ -37,22 +37,17 @@
|
|||||||
const { getStrapiLocale } = useLocalizations();
|
const { getStrapiLocale } = useLocalizations();
|
||||||
const strapiLocale = getStrapiLocale();
|
const strapiLocale = getStrapiLocale();
|
||||||
|
|
||||||
const questions = ref<Question[]>([]);
|
const { data, pending, error } = useAsyncData('questions', () =>
|
||||||
|
find<Question>('questions', {
|
||||||
const pending = ref(true);
|
|
||||||
|
|
||||||
onMounted(async () => {
|
|
||||||
try {
|
|
||||||
const faqData = await find<Question>('questions', {
|
|
||||||
locale: strapiLocale,
|
locale: strapiLocale,
|
||||||
});
|
})
|
||||||
if (faqData) {
|
);
|
||||||
questions.value = faqData.data || [];
|
|
||||||
}
|
const questions = computed(() => data.value?.data ?? null);
|
||||||
} catch (error) {
|
|
||||||
console.error('Failed to fetch FAQ data:', error);
|
watch(error, (value) => {
|
||||||
} finally {
|
if (value) {
|
||||||
pending.value = false;
|
console.error('数据获取失败: ', value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user