vending-machine/mobile/pages/agreement/agreement.vue
2026-04-08 20:45:41 +08:00

64 lines
1.1 KiB
Vue

<template>
<view class="agreement-page">
<view v-if="loading" class="loading">
<text>{{ t('common.loading') }}</text>
</view>
<view v-else class="content">
<rich-text :nodes="content" />
</view>
</view>
</template>
<script setup>
import { ref, onMounted } from 'vue'
import { useI18n } from 'vue-i18n'
import { getAgreement } from '../../api/content.js'
const { t } = useI18n()
const content = ref('')
const loading = ref(true)
async function loadContent() {
loading.value = true
try {
const res = await getAgreement()
content.value = res.data?.content ?? res.data ?? ''
} catch (e) {
/* 错误已统一处理 */
} finally {
loading.value = false
}
}
onMounted(() => {
loadContent()
})
</script>
<style scoped>
.agreement-page {
min-height: 100vh;
background-color: #ffffff;
padding: 30rpx;
}
.loading {
display: flex;
align-items: center;
justify-content: center;
padding: 60rpx 0;
}
.loading text {
font-size: 28rpx;
color: #999;
}
.content {
font-size: 28rpx;
color: #333;
line-height: 1.8;
}
</style>