Files
chuanqi-qycq-web/module/web/src/views/agree.vue
艾贤凌 6d4a72161f inint
2026-03-16 12:05:55 +08:00

114 lines
2.3 KiB
Vue

<script setup>
import { ref, onMounted } from 'vue'
import { useRouter } from 'vue-router'
const router = useRouter()
const content = ref('')
const loading = ref(true)
const error = ref('')
onMounted(async () => {
try {
const res = await fetch('/api/misc/agree')
if (!res.ok) throw new Error('请求失败')
content.value = await res.text()
} catch (e) {
error.value = '用户协议加载失败,请稍后重试'
} finally {
loading.value = false
}
})
</script>
<template>
<div class="agree-page pagebg">
<div class="agree-box">
<div class="header">
<button class="back-btn" @click="router.back()"> 返回</button>
<h2>用户协议及隐私协议</h2>
</div>
<div v-if="loading" class="state-tip">加载中</div>
<div v-else-if="error" class="state-tip error">{{ error }}</div>
<div v-else class="content" v-html="content" />
</div>
</div>
</template>
<style lang="scss" scoped>
.agree-page {
min-height: 100vh;
background: #0a0a0a;
display: flex;
justify-content: center;
padding: 20px;
box-sizing: border-box;
.agree-box {
width: 100%;
max-width: 800px;
color: #ddd;
.header {
display: flex;
align-items: center;
gap: 16px;
margin-bottom: 20px;
padding-bottom: 12px;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
h2 {
color: #f5bd10;
font-size: 18px;
margin: 0;
}
.back-btn {
background: transparent;
border: 1px solid rgba(255, 255, 255, 0.2);
color: rgba(255, 255, 255, 0.7);
padding: 6px 14px;
border-radius: 6px;
cursor: pointer;
font-size: 13px;
white-space: nowrap;
&:hover {
border-color: #f5bd10;
color: #f5bd10;
}
}
}
.state-tip {
text-align: center;
padding: 60px 0;
color: rgba(255, 255, 255, 0.4);
font-size: 15px;
&.error {
color: #ff6b6b;
}
}
.content {
line-height: 1.8;
font-size: 14px;
:deep(h1), :deep(h2), :deep(h3) {
color: #f5bd10;
margin-top: 20px;
}
:deep(p) {
margin: 8px 0;
}
:deep(a) {
color: #f5bd10;
}
}
}
}
</style>